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