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

% use Mojo::Util qw(dumper);

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

% my $name = $c->req->param('unwanted_name');
% my $unwanted_id = $c->req->param('unwanted_id') || 0;
% my $profile = $u->unwanted_profile($unwanted_id);

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

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

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

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

<a class="float-left button tiny" href="/unwanted/list">
    <i class="fi-arrow-left"></i>
</a>

%#EOF




