shop.balmet.com

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

amazonus_bulk_linking.twig (6675B)


      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           {% if marketplace_processing %}
     21           <div class="pull-right">
     22             <a class="btn btn-warning" href="{{ cancel_report_link }}"><i class="fa fa-times fa-lg"></i> {{ button_cancel }}</a>
     23             <a class="btn btn-primary" disabled="disabled"><i class="fa fa-cog fa-lg fa-spin"></i> {{ text_loading }}</a>
     24           </div>
     25           {% else %}
     26           <div class="pull-right"> <a id="button-load-listings" class="btn btn-primary" href="{{ link_load_listings }}">{{ button_load }}</a> </div>
     27           {% endif %}
     28         </div>
     29       </div>
     30     </div>
     31     <form id="bulk-link-form" class="form-horizontal">
     32       <div id="text-market">
     33         {% if not marketplace_processing %}
     34         {% if unlinked_products %}
     35         <table class="table table-bordered table-hover">
     36           <thead>
     37           <tr>
     38             <th></th>
     39             <th class="text-center" colspan="4">{{ text_amazon }}</th>
     40             <th class="text-center" colspan="3">{{ text_local }}</th>
     41           </tr>
     42           <tr>
     43             <th class="text-center"><input type="checkbox" id="master-checkbox" value="1"/></th>
     44             <th class="text-left">{{ column_asin }}</th>
     45             <th class="text-left">{{ column_sku }}</th>
     46             <th class="text-center">{{ column_quantity }}</th>
     47             <th class="text-right">{{ column_price }}</th>
     48             <th class="text-left">{{ column_name }}</th>
     49             <th class="text-left">{{ column_sku }}</th>
     50             <th class="text-center">{{ column_quantity }}</th>
     51           </tr>
     52           </thead>
     53           <tbody>
     54           {% set row = 0 %}
     55           {% for product in unlinked_products %}
     56           {% set row = row + 1 %}
     57           {% if product.sku or product.quantity < 1 %}
     58           <tr class="warning">
     59             <td class="text-center"> - </td>
     60             {% else %}
     61           <tr class="success">
     62             <td class="text-center"><input type="checkbox" class="link-checkbox link-checkbox-market"/></td>
     63             {% endif %}
     64 
     65             <td class="text-left"><a href="{{ product.href_amazon }}" target="_blank">{{ product.asin }}</a></td>
     66             <td class="text-left">{{ product.amazon_sku }}</td>
     67             <td class="text-center">{{ product.amazon_quantity }}</td>
     68             <td class="text-right">{{ product.amazon_price }}</td>
     69             <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>
     70             <td class="text-left">{{ product.sku }}</td>
     71             <td class="text-center">{{ product.quantity }}</td>
     72             <input type="hidden" name="link[{{ row }}][amazon_sku]" value="{{ product.amazon_sku }}"/>
     73             <input type="hidden" name="link[{{ row }}][product_id]" value="{{ product.product_id }}"/>
     74             <input type="hidden" name="link[{{ row }}][sku]" value="{{ product.var }}"/>
     75           </tr>
     76           {% endfor %}
     77           </tbody>
     78         </table>
     79         <div class="well">
     80           <div class="row">
     81             <div class="col-sm-12 text-right">
     82               <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>
     83             </div>
     84           </div>
     85         </div>
     86         <div class="row">
     87           <div class="col-sm-6 text-left">{{ pagination }}</div>
     88           <div class="col-sm-6 text-right">{{ results }}</div>
     89         </div>
     90         {% endif %}
     91         {% endif %}
     92       </div>
     93     </form>
     94     {% else %}
     95     <div class="warning">{{ error_bulk_link_permission }}</div>
     96     {% endif %}
     97   </div>
     98   <script type="text/javascript"><!--
     99   $('#button-load-listings').bind('click', function (e) {
    100     e.preventDefault();
    101 
    102     $.ajax({
    103       url: $(this).attr('href'),
    104       dataType: 'json',
    105       beforeSend: function () {
    106         $('#button-load-listings').empty().html('<i class="fa fa-cog fa-lg fa-spin"></i> {{ text_loading }}').attr('disabled','disabled');
    107         $('.alert-danger, .alert-success').remove();
    108       },
    109       success: function (json) {
    110         if (json['status'] == 1) {
    111           $('.alert-info').after('<div class="alert alert-success alert-dismissible">' + json['message'] + '</div>');
    112         } else {
    113           $('.alert-info').after('<div class="alert alert-danger alert-dismissible">' + json['message'] + '</div>');
    114         }
    115       },
    116       error: function(xhr, ajaxOptions, thrownError) {
    117         if (xhr.status != 0) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); }
    118       },
    119       complete: function() {
    120         $('#button-load-listings').empty().removeAttr('disabled').html('{{ button_load }}');
    121       }
    122     });
    123 
    124     return false;
    125   });
    126 
    127   $('#master-checkbox').click(function () {
    128     if ($(this).is(':checked')) {
    129       $('.link-checkbox-market').attr('checked', 'checked');
    130     } else {
    131       $('.link-checkbox-market').removeAttr('checked');
    132     }
    133   });
    134 
    135   $('#link-button').click(function (e) {
    136     e.preventDefault();
    137 
    138     $.ajax({
    139       url: '{{ link_do_listings }}',
    140       dataType: 'json',
    141       type: 'POST',
    142       data: $('.link-checkbox:checked').parent().siblings('input[type="hidden"]').serialize(),
    143       beforeSend: function() {
    144         $('#link-button').empty().attr('disabled', 'disabled').html('<i class="fa fa-cog fa-lg fa-spin"></i>');
    145       },
    146       success: function () {
    147         document.location.reload(true);
    148       },
    149       error: function(xhr, ajaxOptions, thrownError) {
    150         $('#link-button').empty().removeAttr('disabled').html('<i class="fa fa-save"></i>');
    151         if (xhr.status != 0) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); }
    152       }
    153     });
    154   });
    155   //--></script></div>
    156 {{ footer }}