shop.balmet.com

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

amazonus_saved_listings.twig (4201B)


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