Последние заказы (<% scalar @orders %>) % if ( @orders ) { % foreach my $order ( @orders ) { % my ($href, $action, $user_id); % my $status = $order->status; % if ( ($status == 1 || $status == 6 || $status == 7 || $status == 8) && (!$active_rights || $active_rights == 1) ) { % $href = 'take_care.html'; % $action = { href => $href, name => 'обработать' }; % $user_id = 'manager_id'; % } elsif ( $status == 2 && (!$active_rights || $active_rights == 2) ) { % $href = 'facility.html'; % $action = { href => $href, name => 'собрать' }; % $user_id = 'vault_id'; % } elsif ( $status == 3 && (!$active_rights || $active_rights == 3) ) { % $href = 'delivery.html'; % $action = { href => $href, name => 'доставить' }; % $user_id = 'postman_id'; % } elsif ( $status == 4 && !$active_rights ) { % $href = 'delivery.html'; % $action = { href => $href, name => 'просмотр' }; % } elsif ( $status == 5 && !$active_rights ) { % $href = 'delivery.html'; % $action = { href => $href, name => 'просмотр' }; % } % my $url = $href.'?id='.$order->id; % my $status_name = exists $status_options{$order->status} ? $status_options{$order->status} : 'unknown'; % }
<% $order->id %> <% $order->name %> <% $status_name %> <% $action->{name} %>
Все заказы (<% $total %>) % }
<%args> $object => undef <%init> return unless ref $object && $object->id; my $total = $keeper->get_documents( class => 'webshop::OrderCouponLink', dest_id => $object->id, source_id => 'positive', count => 1, ); my (@links, @orders); if ( $total ) { @links = $keeper->get_documents( class => 'webshop::OrderCouponLink', dest_id => $object->id, source_id => 'positive', order_by => 'ctime desc', limit => 10, ); my @ids = map { $_->source_id } @links; @orders = $keeper->get_documents( id => \@ids, class => 'webshop::Order', order_by => 'ctime desc', ); } my %props = map { $_->{attr} => $_ } webshop::Order->new( $keeper )->structure; my $prop = $props{status}; my %status_options = map { $_->[0] => $_->[1] } @{$prop->{cases}}; my $active_rights = $m->comp('/contenido/webshop/subs/user_rights.msn');