Revision 628

Date:
2016/11/30 22:04:11
Author:
ahitrov
Revision Log:
Find order by id

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/webshop/comps/contenido/webshop/ajax/order_id.html

     
    1 <% $json %>
    2 <%once>
    3
    4 use JSON::XS;
    5
    6 </%once>
    7 <%args>
    8
    9 $id => undef
    10
    11 </%args>
    12 <%init>
    13
    14 my %result;
    15
    16 if ( $id && $id =~ /^\d+$/ && $id > 0 ) {
    17 my $order = $keeper->get_document_by_id( $id, class => 'webshop::Order');
    18 if ( ref $order ) {
    19 $result{html} = Encode::decode('utf-8', $m->scomp('/contenido/webshop/components/order_found.msn', order => $order));
    20 $result{success} = 1;
    21 } else {
    22 $result{error} = Encode::decode('utf-8', 'Заказ с данным идентификатором не найден.');
    23 }
    24 } else {
    25 $result{error} = Encode::decode('utf-8', 'Неверный идентификатор заказа. Должно быть целое число.');
    26 }
    27
    28 my $json = encode_json \%result;
    29
    30 </%init>
  • utf8/plugins/webshop/comps/contenido/webshop/components/block_order_id_finder.msn

     
    1 1 <script type="text/javascript">
    2 2 <!--
    3 3 $(document).ready(function(){
    4
    4 $('#start-search-by-id').on('click', function( ev ){
    5 ev.preventDefault();
    6 var oForm = document.forms['search_doc_by_id'];
    7 var oField = oForm.elements['order_id'];
    8 if ( oField.value.length > 0 ) {
    9 $('#search-by-id-prompt').html('');
    10 $.ajax({
    11 'url' : '/contenido/webshop/ajax/order_id.html',
    12 'data' : { 'id' : oField.value },
    13 'dataType' : 'json',
    14 'success' : function( data ){
    15 if ( data.error ) {
    16 $('#search-by-id-prompt').html('<div class="err">' + data.error + '</div>');
    17 }
    18 if ( data.success ) {
    19 $('#search-by-id-found').html( data.html );
    20 }
    21 }
    22 });
    23 }
    24 });
    5 25 });
    6 26 //-->
    7 27 </script>
     
    10 30
    11 31 <form name="search_doc_by_id" action="" method="GET" target="_blank">
    12 32 <table width="100%" border="0" cellpadding="0" cellspacing="6" class="tform">
    13 <tr><td><b>Выберите статус:</b></td></tr>
    14 <tr><td><& "/contenido/components/string.msn", name => 'id', &></td>
    15 <tr><td><input type="submit" value="Найти" class="btn"></td></tr>
    33 <tr><td><b>Наберите номер заказа:</b></td></tr>
    34 <tr><td><input type="text" name="order_id" style="width:99%"></td>
    35 <td><input type="button" id="start-search-by-id" value="Найти" class="btn"></td></tr>
    16 36 </table>
    17 37 </form>
    38
    39 <div id="search-by-id-prompt"></div>
    18 40
    19 41 </fieldset>
  • utf8/plugins/webshop/comps/contenido/webshop/components/order_browse.msn

     
    17 17 <form name="section_browse" action="./" method="POST">
    18 18 <table width="100%" border="0" cellpadding="4" cellspacing="0" class="tlistdocs">
    19 19 <tr bgcolor="#efefef">
    20 % unless ( $no_inline ) {
    20 21 <th><a href="javascript:delete_check()" onclick="delete_check(); return false;"><img src="/contenido/i/actions/delete.gif" width="14" height="17" alt="Удаление документов" align="absmiddle" border="0" hspace="1"></a></th>
    22 % }
    21 23 <th>#</th>
    22 24 %
    23 25 % foreach (@$columns) {
     
    37 39 % my ($a1, $a2) = $href ? ('<a href="./'.$href.'?id='.$document->id.($params_unclassed ? '&'.$params_unclassed : '').'"'.$style.'>','</a>') : ('','');
    38 40 %
    39 41 <tr valign="top">
    42 % unless ( $no_inline ) {
    40 43 <td nowrap>\
    41 % if ($document_access == 2) {
    42 % $delete_status = 1;
    44 % if ($document_access == 2) {
    45 % $delete_status = 1;
    43 46 <input type="checkbox" name="<% 'delete_'.$document->id.'_id' %>">
    44 % } else {
    47 % } else {
    45 48 &nbsp;
    49 % }
    50 </td>
    46 51 % }
    47 </td>
    48 52 <td><span<% $style %> class="<% $document->status ? '':'hiddensect' %>"><% $a1.$document->id.$a2 %></span></td>
    49 53 %
    50 54 % for my $col (@$columns) {
     
    193 197 <input type="hidden" name="<% $key %>" value="<% $value |h %>">
    194 198 % }
    195 199 % }
    196 % if ( $inline_status || $delete_status ) {
    200 % if ( !$no_inline && ($inline_status || $delete_status) ) {
    197 201 <div style="text-align:right; padding:10px 0;">
    198 202 % if ( $inline_status ) {
    199 203 <input type="submit" name="update" value="Сохранить изменения" class="input_btn">
     
    212 216 $id => undef
    213 217 $filter => undef
    214 218 $status => undef
    219 $no_inline => undef
    215 220
    216 221 </%args>
    217 222 <%init>
  • utf8/plugins/webshop/comps/contenido/webshop/components/order_found.msn

     
    1 <fieldset>
    2 <legend>Найден заказ со статусом "<span style="color:yellow"><% $current_status->[1] %></span>"</legend>
    3
    4 <& /contenido/webshop/components/order_browse.msn, documents => \@documents, columns => \@columns, filter => \%filter_params, status => $order->status, no_inline => 1, %ARGS &>
    5
    6 </td>
    7 <td width="1%">&nbsp;</td>
    8 </tr>
    9 </table>
    10
    11 </body>
    12 </html>
    13 <%args>
    14
    15 $order => undef
    16
    17 </%args>
    18 <%init>
    19
    20 return unless ref $order;
    21
    22 my @documents = ($order);
    23 my %filter_params = ( ost => $order->status );
    24 my $size = 40;
    25
    26 my %opts;
    27 my $company_filter_value;
    28 if ( exists $ARGS{order_company_filter} ) {
    29 $company_filter_value = $ARGS{order_company_filter};
    30 $m->comp( '/contenido/components/cookies.msn', name => $request->{cookie_filter_company}, value => $company_filter_value );
    31 if ( defined $company_filter_value && $company_filter_value ne '' ) {
    32 $opts{company_id} = $company_filter_value;
    33 }
    34 } else {
    35 $company_filter_value = $m->comp( '/contenido/components/cookies.msn', name => $request->{cookie_filter_company} );
    36 if ( defined $company_filter_value && $company_filter_value ne '' ) {
    37 $opts{company_id} = $company_filter_value;
    38 }
    39 }
    40
    41 my @structure = webshop::Order->new( $keeper->{webshop} )->structure;
    42 my @columns = sort { $a->{column} <=> $b->{column} }
    43 grep { $_->{column} } @structure;
    44 push @columns, {attr => '_act_', rusname => 'Действия'};
    45 my ($status_map) = grep { $_->{attr} eq 'status' } @structure;
    46 my ($current_status) = grep { $_->[0] == $order->status } @{$status_map->{cases}};
    47
    48 my $active_rights = $m->comp('/contenido/webshop/subs/user_rights.msn');
    49
    50 </%init>
  • utf8/plugins/webshop/comps/contenido/webshop/index.html

     
    25 25 <td width="1%">&nbsp;</td>
    26 26 <td width="65%">
    27 27
    28 <div id="search-by-id-found"></div>
    29
    28 30 <fieldset>
    29 31 <legend>Заказы со статусом "<span style="color:yellow"><% $current_status->[1] %></span>"</legend>
    30 32