shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

amazon_bulk_linking.twig (7756B)


      1 {{ header }}{{ column_left }}
      2 <div id="content">
      3   <div class="page-header">
      4     <div class="container-fluid">
      5       <div class="pull-right"> <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a> </div>
      6       <h1>{{ heading_title }}</h1>
      7       <ul class="breadcrumb">
      8         {% for breadcrumb in breadcrumbs %}
      9         <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
     10         {% endfor %}
     11       </ul>
     12     </div>
     13   </div>
     14   <div class="container-fluid">
     15     {% if bulk_linking_status %}
     16     <div class="alert alert-info">{{ text_load_listings }}</div>
     17     <div class="well">
     18       <div class="row">
     19         <div class="col-sm-12">
     20           <div class="form-group">
     21             <label class="control-label" for="marketplace-select">{{ text_choose_marketplace }}</label>
     22             <select name="marketplace_select" id="marketplace-select" class="form-control">
     23               {% for marketplace in marketplaces %}
     24               <option value="{{ marketplace.link }}" {% if marketplace.code == marketplace_code %} selected{% endif %}>{{ marketplace.name }}</option>
     25               {% endfor %}
     26             </select>
     27           </div>
     28         </div>
     29       </div>
     30       <div class="row">
     31         <div class="col-sm-12">
     32           {% if marketplace_code in marketplaces_processing %}
     33           <div class="pull-right">
     34             <a class="btn btn-warning" href="{{ cancel_report_link }}"><i class="fa fa-times fa-lg"></i> {{ button_cancel }}</a>
     35             <a class="btn btn-primary" disabled="disabled"><i class="fa fa-cog fa-lg fa-spin"></i> {{ text_loading }}</a>
     36           </div>
     37           {% else %}
     38           <div class="pull-right"> <a id="button-load-listings" class="btn btn-primary" href="{{ marketplaces[marketplace_code].href_load_listings }}">{{ button_load }}</a> </div>
     39           {% endif %}
     40         </div>
     41       </div>
     42     </div>
     43     <form id="bulk-link-form" class="form-horizontal">
     44       <div id="text-{{ marketplace_code }}">
     45         {% if marketplace_code is not marketplaces_processing|keys %}
     46           {% if unlinked_products %}
     47             <table class="table table-bordered table-hover">
     48               <thead>
     49                 <tr>
     50                   <th></th>
     51                   <th class="text-center" colspan="4">{{ text_amazon }}</th>
     52                   <th class="text-center" colspan="3">{{ text_local }}</th>
     53                 </tr>
     54                 <tr>
     55                   <th class="text-center"><input type="checkbox" id="master-checkbox" value="{{ marketplace.code }}"/></th>
     56                   <th class="text-left">{{ column_asin }}</th>
     57                   <th class="text-left">{{ column_sku }}</th>
     58                   <th class="text-center">{{ column_quantity }}</th>
     59                   <th class="text-right">{{ column_price }}</th>
     60                   <th class="text-left">{{ column_name }}</th>
     61                   <th class="text-left">{{ column_sku }}</th>
     62                   <th class="text-center">{{ column_quantity }}</th>
     63                 </tr>
     64               </thead>
     65               <tbody>
     66                 {% set row = 0 %}
     67                 {% for product in unlinked_products %}
     68                   {% set row = row + 1 %}
     69                   {% if product.sku is empty or product.quantity < 1 %}
     70                     <tr class="warning">
     71                       <td class="text-center"> - </td>
     72                   {% else %}
     73                     <tr class="success">
     74                       <td class="text-center"><input type="checkbox" class="link-checkbox link-checkbox-{{ marketplace.code }}"/></td>
     75                   {% endif %}
     76 
     77                   <td class="text-left"><a href="{{ product.href_amazon }}" target="_blank">{{ product.asin }}</a></td>
     78                   <td class="text-left">{{ product.amazon_sku }}</td>
     79                   <td class="text-center">{{ product.amazon_quantity }}</td>
     80                   <td class="text-right">{{ product.amazon_price }}</td>
     81                   <td class="text-left"><a href="{{ product.href_product }}" target="_blank">{{ product.name }}</a>{% if product.combination is not empty %}<br />{{ product.combination }}{% endif %}</td>
     82                   <td class="text-left">{{ product.sku }}</td>
     83                   <td class="text-center">{{ product.quantity }}</td>
     84                   <input type="hidden" name="link[{{ row }}][amazon_sku]" value="{{ product.amazon_sku }}"/>
     85                   <input type="hidden" name="link[{{ row }}][product_id]" value="{{ product.product_id }}"/>
     86                   <input type="hidden" name="link[{{ row }}][sku]" value="{{ product.var }}"/>
     87                 </tr>
     88                 {% endfor %}
     89               </tbody>
     90             </table>
     91             <div class="well">
     92               <div class="row">
     93                 <div class="col-sm-12 text-right">
     94                   <div class="pull-right"> <a id="link-button" class="btn btn-primary" data-toggle="tooltip" title="{{ button_link }}"><i class="fa fa-save"></i></a></div>
     95                 </div>
     96               </div>
     97             </div>
     98             <div class="row">
     99               <div class="col-sm-6 text-left">{{ pagination }}</div>
    100               <div class="col-sm-6 text-right">{{ results }}</div>
    101             </div>
    102           {% endif %}
    103         {% endif %}
    104       </div>
    105     </form>
    106     {% else %}
    107     <div class="warning">{{ error_bulk_link_permission }}</div>
    108     {% endif %}
    109   </div>
    110   <script type="text/javascript"><!--
    111   $('#button-load-listings').bind('click', function (e) {
    112     e.preventDefault();
    113 
    114     $.ajax({
    115       url: $(this).attr('href'),
    116       dataType: 'json',
    117       beforeSend: function () {
    118         $('#button-load-listings').empty().html('<i class="fa fa-cog fa-lg fa-spin"></i> {{ text_loading }}').attr('disabled','disabled');
    119         $('.alert-danger, .alert-success').remove();
    120       },
    121       success: function (json) {
    122         if (json['status'] == 1) {
    123           $('.alert-info').after('<div class="alert alert-success alert-dismissible">' + json['message'] + '</div>');
    124         } else {
    125           $('.alert-info').after('<div class="alert alert-danger alert-dismissible">' + json['message'] + '</div>');
    126         }
    127       },
    128       error: function(xhr, ajaxOptions, thrownError) {
    129         if (xhr.status != 0) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); }
    130       }
    131     });
    132 
    133     return false;
    134   });
    135 
    136   $('#master-checkbox').click(function () {
    137     var marketplace = $(this).val();
    138     if ($(this).is(':checked')) {
    139       $('.link-checkbox-' + marketplace).attr('checked', 'checked');
    140     } else {
    141       $('.link-checkbox-' + marketplace).removeAttr('checked');
    142     }
    143   });
    144 
    145   $('#link-button').click(function (e) {
    146     e.preventDefault();
    147 
    148     $.ajax({
    149       url: '{{ link_do_listings }}',
    150       dataType: 'json',
    151       type: 'POST',
    152       data: $('.link-checkbox:checked').parent().siblings('input[type="hidden"]').serialize(),
    153       beforeSend: function() {
    154         $('#link-button').empty().attr('disabled', 'disabled').html('<i class="fa fa-cog fa-lg fa-spin"></i>');
    155       },
    156       success: function () {
    157         document.location.reload(true);
    158       },
    159       error: function(xhr, ajaxOptions, thrownError) {
    160         $('#link-button').empty().removeAttr('disabled').html('<i class="fa fa-save"></i>');
    161         if (xhr.status != 0) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); }
    162       }
    163     });
    164   });
    165 
    166   $('#marketplace-select').bind('change', function() {
    167     location = $('#marketplace-select').val();
    168   });
    169 //--></script></div>
    170 {{ footer }}