Revision 540

Date:
2016/01/19 11:04:20
Author:
ahitrov
Revision Log:
Retail/Wholesale order selector

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/webshop/comps/contenido/webshop/autohandler

     
    1 1 <%init>
    2 2
    3 $r->content_type('text/html');
    4 $m->call_next();
    3 $r->content_type('text/html');
    4 $request->{cookie_filter_company} = 'filter_company';
    5 $m->call_next();
    5 6
    6 7 </%init>
  • utf8/plugins/webshop/comps/contenido/webshop/components/block_order_company_filter.msn

     
    1 <fieldset>
    2 <legend>Выбор заказов по статусу</legend>
    3 <select id="order_company_filter" style="width:100%" autocomplete="off">
    4 % foreach my $sel ( @select ) {
    5 % my $selected = defined $value && $value eq $sel->{value} ? ' selected' : '';
    6 <option value="<% $sel->{value} %>"<% $selected %>><% $sel->{name} %></option>
    7 % }
    8 </select>
    9 </fieldset>
    10 <script type="text/javascript">
    11 <!--
    12 $(document).ready(function(){
    13 $('#order_company_filter').on('change', function(ev){
    14 document.location.href = '/contenido/webshop/?order_company_filter=' + $(this).val();
    15 });
    16 });
    17 //-->
    18 </script>
    19 <%once>
    20
    21 my @select = (
    22 { name => 'Все заказы', value => '' },
    23 { name => 'Розница', value => '0' },
    24 { name => 'Опт', value => 'positive' },
    25 );
    26
    27 </%once>
    28 <%args>
    29
    30 $value => undef
    31
    32 </%args>
  • utf8/plugins/webshop/comps/contenido/webshop/index.html

     
    13 13 <tr valign="top">
    14 14 <td width="35%">
    15 15
    16 <& /contenido/webshop/components/block_order_company_filter.msn, value => $company_filter_value &>
    16 17 <& /contenido/webshop/components/block_order_status_changer.msn, status => $ost &>
    17 18
    18 19 <& /contenido/webshop/components/block_coupons.msn &>
     
    67 68 $filter_params{ost} = $ost if $ost != 1;
    68 69 my $size = 40;
    69 70
    71 my %opts;
    72 my $company_filter_value;
    73 if ( exists $ARGS{order_company_filter} ) {
    74 $company_filter_value = $ARGS{order_company_filter};
    75 $m->comp( '/contenido/components/cookies.msn', name => $request->{cookie_filter_company}, value => $company_filter_value );
    76 if ( defined $company_filter_value && $company_filter_value ne '' ) {
    77 $opts{company_id} = $company_filter_value;
    78 }
    79 } else {
    80 $company_filter_value = $m->comp( '/contenido/components/cookies.msn', name => $request->{cookie_filter_company} );
    81 if ( defined $company_filter_value && $company_filter_value ne '' ) {
    82 $opts{company_id} = $company_filter_value;
    83 }
    84 }
    85
    70 86 @documents = $keeper->get_documents(
    71 87 class => 'webshop::Order',
    72 88 status => $ost,
    73 89 limit => $size,
    74 90 offset => ($p-1)*$size,
    91 %opts
    75 92 );
    76 93 $total = $keeper->get_documents(
    77 class => 'webshop::Order',
    94 class => 'webshop::Order',
    78 95 status => $ost,
    79 96 count => 1,
    97 %opts
    80 98 );
    81 99 my @structure = webshop::Order->new( $keeper->{webshop} )->structure;
    82 100 my @columns = sort { $a->{column} <=> $b->{column} }