%#
%# $Id$
%#
% layout 'default';
% title 'Maacom';

% use Mojo::Util qw(dumper);

% my $u = $c->app->user;

% my $name = $c->req->param('forwarded_name');
% my $forwarded_id = $c->req->param('forwarded_id') || 0;
% my $profile = $u->forwarded_profile($forwarded_id);

% if ($profile) {
    % my $cid = $u->forwarded_exist($name);
    % if ($cid) {
        <div class="callout warning">Domain <%= $name %> already exists</div>
    % }

    % unless ($cid) {
        % my $res = $u->forwarded_update($forwarded_id, name => $name);
        % if ($res) {
            <div class="callout success">Domain <%= $name %> has been updated.</div>
        % }

        % unless ($res) {
            <div class="callout alert">Domain <%= $name %> was not updated.</div>
        % }
    % }
% }

% unless ($profile) {
        <div class="callout warning">Domain with id <%= $forwarded_id %> not exist</div>
% }

<a class="float-left button tiny" href="/forwarded/list">
    <i class="fi-arrow-left"></i>
</a>
%#EOF




