Revision 563 (by ahitrov, 2016/04/12 12:53:34) |
Payment plugin contenido interface. Order finder and order actions
|
<fieldset>
<legend>Движения по заказу</legend>
% if ( @operations || @transactions ) {
% if ( @operations ) {
<h2>Операции</h2>
<table width="100%" border="0" cellpadding="4" cellspacing="0" class="tlistdocs">
<tr bgcolor="#efefef">
<th>ID заказа</th>
<th>Дата/время</th>
<th>Результат</th>
<th>Менеджер</th>
</tr>
% foreach my $op ( @operations ) {
% my $dt = Contenido::DateTime->new( postgres => $op->ctime );
% my $user = $op->uuid ? $keeper->get_user_by_id( $op->uuid ) : undef;
<tr>
<td><% $op->id %></td>
<td><% $dt->ymd('-').' '.$dt->hms %></td>
<td><% $opnames{$op->name} %></td>
<td>
% if ( ref $user ) {
% $m->out($user->name);
% } elsif ( $op->uuid ) {
Неопознанный (id=<% $op->uuid %>)
% }
</td>
</tr>
% }
</table>
<p class="rem">Операция - действие пользователя или менеджера по отношению к заказу.</p>
% }
% if ( @transactions ) {
<h2>Транзакции</h2>
% foreach my $tr ( @transactions ) {
% if ( $m->comp_exists( "/contenido/payments/components/block_transaction_".$tr->provider.".msn" ) ) {
% $m->comp( "/contenido/payments/components/block_transaction_".$tr->provider.".msn", transaction => $tr );
% } else {
% $m->comp( "/contenido/payments/components/block_transaction.msn", transaction => $tr );
% }
% }
<p class="rem">Транзакция - результат взаимодействия платежной системы и веб-магазина по отношению к заказу.</p>
% }
% } elsif ( $order_id ) {
<p class="rem">По данному номеру заказа ничего не найдено.</p>
% }
</fieldset>
<%once>
</%once>
<%args>
$order_id => undef
</%args>
<%init>
my ( @operations, @transactions );
if ( $order_id && $order_id =~ /^\d+$/ ) {
@operations = $keeper->get_documents(
class => 'payments::Operation',
order_id => $order_id,
order_by => 'ctime',
);
@transactions = $keeper->get_documents(
class => 'payments::Transaction',
order_id => $order_id,
order_by => 'ctime',
);
}
my ($prop) = grep { $_->{attr} eq 'name' } payments::Operation->new->structure;
my %opnames = map { $_->[0] => $_->[1] } @{$prop->{cases}};
</%init>