shop.balmet.com

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

amazon_saved_listings.twig (4179B)


      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="{{ link_overview }}" 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     <div class="alert alert-info">{{ text_description }}</div>
     16     <div class="well">
     17       <div class="row">
     18         <div class="col-sm-12">
     19           <div class="pull-right">
     20             {% if saved_products %}
     21             <a id="button-upload" class="btn btn-primary"><i class="fa fa-cloud-upload fa-lg"></i> {{ button_upload }}</a>
     22             {% endif %}
     23           </div>
     24         </div>
     25       </div>
     26     </div>
     27     <table class="table table-bordered table-hover">
     28       <thead>
     29         <tr>
     30           <th>{{ column_name }}</th>
     31           <th>{{ column_model }}</th>
     32           <th class="text-center">{{ column_sku }}</th>
     33           <th class="text-center">{{ column_amazon_sku }}</th>
     34           <th class="text-right">{{ column_action }}</th>
     35         </tr>
     36       </thead>
     37       <tbody>
     38         {% if saved_products %}
     39         {% for saved_product in saved_products %}
     40         <tr>
     41           <td class="text-left">{{ saved_product.product_name }}</td>
     42           <td class="text-left">{{ saved_product.product_model }}</td>
     43           <td class="text-center">{{ saved_product.var }}</td>
     44           <td class="text-center">{{ saved_product.amazon_sku }}</td>
     45           <td class="text-right">
     46             <a class="btn btn-primary" href="{{ saved_product.edit_link }}" data-toggle="tooltip" data-original-title="{{ button_edit }}"><i class="fa fa-pencil"></i></a>
     47             <a class="btn btn-danger" onclick="removeSaved('{{ saved_product.product_id }}', '{{ saved_product.var }}', this)" data-toggle="tooltip" data-original-title="{{ button_remove }}"><i class="fa fa-times-circle"></i></a>
     48           </td>
     49         </tr>
     50         {% endfor %}
     51         {% else %}
     52         <tr>
     53           <td colspan="5" class="text-center">{{ text_no_results }}</td>
     54         </tr>
     55         {% endif %}
     56       </tbody>
     57     </table>
     58   </div>
     59 </div>
     60 <script type="text/javascript">
     61   function removeSaved(id, option_var, button) {
     62     if (!confirm("{{ text_delete_confirm }}")) {
     63       return;
     64     }
     65     $.ajax({
     66       url: '{{ delete_saved }}',
     67       type: 'get',
     68       data: 'product_id=' + id + '&var=' + option_var,
     69       beforeSend: function () {
     70         $(button).empty().html('<i class="fa fa-cog fa-lg fa-spin"></i>').attr('disabled','disabled');
     71       },
     72       success: function () {
     73         window.location.href = window.location.href;
     74       },
     75       error: function (xhr, ajaxOptions, thrownError) {
     76         if (xhr.status != 0) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); }
     77       }
     78     });
     79   }
     80 
     81   $('#button-upload').bind('click', function(e) {
     82     e.preventDefault();
     83 
     84     $.ajax({
     85       url: '{{ upload_saved }}',
     86       dataType: 'json',
     87       beforeSend: function () {
     88         $('#button-upload').empty().html('<i class="fa fa-cog fa-lg fa-spin"></i>').attr('disabled','disabled');
     89       },
     90       complete: function () {
     91         $('#button-upload').empty().html('<i class="fa fa-cloud-upload fa-lg"></i> {{ button_upload }}').removeAttr('disabled');
     92       },
     93       success: function (data) {
     94         if (data['status'] == 'ok') {
     95           alert('{{ text_uploaded_alert }}');
     96         } else if (data['error_message'] !== undefined) {
     97           alert(data['error_message']);
     98           return;
     99         } else {
    100           alert('Unknown error.');
    101           return;
    102         }
    103       },
    104       error: function (xhr, ajaxOptions, thrownError) {
    105         if (xhr.status != 0) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); }
    106       }
    107     });
    108   });
    109 </script>
    110 {{ footer }}