aboutsummaryrefslogtreecommitdiffstats
path: root/public/admin/view/template/extension/openbay/openbay_orderlist.twig
blob: d5c32113c111979c4463a6111f4bd26350a0a30f (plain)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <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>
      <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">
    {% if error_warning %}
      {% for error in error_warning %}
        <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error }} <button type="button" class="close" data-dismiss="alert">&times;</button></div>
      {% endfor %}
    {% endif %}

    {% if error_orders %}
      {% for error_order in error_orders %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_order.order_id }} - {{ error_order.error }} <button type="button" class="close" data-dismiss="alert">&times;</button></div>
      {% endfor %}
    {% endif %}

    {% if success %}
    <div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> {{ success }} <button type="button" class="close" data-dismiss="alert">&times;</button></div>
    {% endif %}

    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-list"></i> {{ text_list }}</h3>
      </div>
      <div class="panel-body">
        <div class="well">
          <div class="row">
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-order-id">{{ entry_order_id }}</label>
                <input type="text" name="filter_order_id" value="{{ filter_order_id }}" placeholder="{{ entry_order_id }}" id="input-order-id" class="form-control" />
              </div>
              <div class="form-group">
                <label class="control-label" for="input-customer">{{ entry_customer }}</label>
                <input type="text" name="filter_customer" value="{{ filter_customer }}" placeholder="{{ entry_customer }}" id="input-customer" class="form-control" />
              </div>
            </div>
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-order-status">{{ entry_order_status }}</label>
                <select name="filter_order_status_id" id="input-order-status" class="form-control">
                  <option value="*"></option>
                    {% if filter_order_status_id == '0' %}
                      <option value="0" selected="selected">{{ text_missing }}</option>
                    {% else %}
                      <option value="0">{{ text_missing }}</option>
                    {% endif %}
                    {% for order_status in order_statuses %}
                      {% if order_status.order_status_id == filter_order_status_id %}
                        <option value="{{ order_status.order_status_id }}" selected="selected">{{ order_status.name }}</option>
                      {% else %}
                        <option value="{{ order_status.order_status_id }}">{{ order_status.name }}</option>
                      {% endif %}
                    {% endfor %}
                </select>
              </div>
            </div>
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-channel">{{ entry_order_channel }}</label>
                <select name="filter_channel" id="input-channel" class="form-control">
                  <option value=""></option>
                  {% for channel in channels %}
                    {% if channel.module == filter_channel %}
                      <option value="{{ channel.module }}" selected="selected">{{ channel.title }}</option>
                    {% else %}
                      <option value="{{ channel.module }}">{{ channel.title }}</option>
                    {% endif %}
                  {% endfor %}
                </select>
              </div>
            </div>
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-date-added">{{ entry_date_added }}</label>
                <div class="input-group date">
                  <input type="text" name="filter_date_added" value="{{ filter_date_added }}" placeholder="{{ entry_date_added }}" data-date-format="YYYY-MM-DD" id="input-date-added" class="form-control" />
                  <span class="input-group-btn">
                  <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
                  </span></div>
              </div>
            </div>
            <div class="col-sm-4">
              <button type="button" id="button-filter" class="btn btn-primary pull-right"><i class="fa fa-filter"></i> {{ button_filter }}</button>
            </div>
          </div>
        </div>
        <form action="{{ link_update }}" method="post" id="order-update-form">
          <div class="well">
            <div class="row">
              <div class="col-sm-12">
                <div class="form-group">
                  <div class="input-group">
                    <select name="change_order_status_id" class="form-control">
                    {% for order_status in order_statuses %}
                      <option value="{{ order_status.order_status_id }}">{{ order_status.name }}</option>
                    {% endfor %}
                    </select>
                    <a data-toggle="tooltip" title="{{ button_filter }}" class="btn btn-primary input-group-addon" onclick="$('#order-update-form').submit();"><i class="fa fa-plus-circle"></i> {{ button_status }}</a> </div>
                </div>
              </div>
            </div>
          </div>
          <div class="table-responsive">
            <table class="table table-bordered table-hover">
              <thead>
                <tr>
                  <th width="1"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></th>
                  <th class="text-center">{% if sort == 'o.order_id' %} <a href="{{ sort_order }}" class="{{ order|lower }}">{{ column_order_id }}</a> {% else %} <a href="{{ sort_order }}">{{ column_order_id }}</a> {% endif %}</th>
                  <th class="text-center">{{ column_market_order_ref }}</th>
                  <th class="text-center">{% if sort == 'channel' %} <a href="{{ sort_channel }}" class="{{ order|lower }}">{{ column_channel }}</a> {% else %} <a href="{{ sort_channel }}">{{ column_channel }}</a> {% endif %}</th>
                  <th class="text-center">{% if sort == 'customer' %} <a href="{{ sort_customer }}" class="{{ order|lower }}">{{ column_customer }}</a> {% else %} <a href="{{ sort_customer }}">{{ column_customer }}</a> {% endif %}</th>
                  <th class="text-center">{% if sort == 'status' %} <a href="{{ sort_status }}" class="{{ order|lower }}">{{ column_status }}</a> {% else %} <a href="{{ sort_status }}">{{ column_status }}</a> {% endif %}</th>
                  <th class="text-center">{% if sort == 'o.date_added' %} <a href="{{ sort_date_added }}" class="{{ order|lower }}">{{ column_date_added }}</a> {% else %} <a href="{{ sort_date_added }}">{{ column_date_added }}</a> {% endif %}</th>
                  <th class="text-right">{{ column_action }}</th>
                </tr>
              </thead>
              <tbody>
              {% if orders %}
                {% for order in orders %}
                <tr>
                  <td style="text-align: center;">
                    {% if order.selected %}
                      <input type="checkbox" name="selected[]" value="{{ order.order_id }}" checked="checked" />
                    {% else %}
                      <input type="checkbox" name="selected[]" value="{{ order.order_id }}" />
                    {% endif %}
                  </td>
                  <td class="text-center">{{ order.order_id }}</td>
                  <td class="text-center">{{ order.market_order_ref }}</td>
                  <td class="text-center">{{ order.channel }}</td>
                  <td class="text-center">{{ order.customer }}</td>
                  <td class="text-center">{{ order.status }}</td>
                  <td class="text-center">{{ order.date_added }}</td>
                  <td class="text-right"><a href="{{ order.view }}" data-toggle="tooltip" title="{{ button_view }}" class="btn btn-info"><i class="fa fa-eye"></i></a></td>
                </tr>
                {% endfor %}
              {% else %}
                <tr>
                  <td class="text-center" colspan="7">{{ text_no_results }}</td>
                </tr>
              {% endif %}
              </tbody>
            </table>
          </div>
        </form>
        <div class="row">
          <div class="col-sm-6 text-left">{{ pagination }}</div>
          <div class="col-sm-6 text-right">{{ results }}</div>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
  $('#button-filter').on('click', function() {
  url = 'index.php?route=marketplace/openbay/orderlist&user_token={{ user_token }}';

  var filter_order_id = $('input[name=\'filter_order_id\']').val();

  if (filter_order_id) {
    url += '&filter_order_id=' + encodeURIComponent(filter_order_id);
  }

  var filter_customer = $('input[name=\'filter_customer\']').val();

  if (filter_customer) {
    url += '&filter_customer=' + encodeURIComponent(filter_customer);
  }

  var filter_order_status_id = $('select[name=\'filter_order_status_id\']').find(":selected").val();

  if (filter_order_status_id != '*') {
    url += '&filter_order_status_id=' + encodeURIComponent(filter_order_status_id);
  }

  var filter_channel = $('select[name=\'filter_channel\']').find(":selected").val();

  if (filter_channel != '') {
    url += '&filter_channel=' + encodeURIComponent(filter_channel);
  }

  var filter_date_added = $('input[name=\'filter_date_added\']').val();

  if (filter_date_added) {
    url += '&filter_date_added=' + encodeURIComponent(filter_date_added);
  }

	location = url;
});

  $('input[name=\'filter_customer\']').autocomplete({
    'source': function(request, response) {
      $.ajax({
        url: 'index.php?route=customer/customer/autocomplete&user_token={{ user_token }}&filter_name=' +  encodeURIComponent(request),
        dataType: 'json',
        success: function(json) {
          response($.map(json, function(item) {
            return {
              label: item['name'],
              value: item['customer_id']
            }
          }));
        }
      });
    },
    'select': function(item) {
      $('input[name=\'filter_customer\']').val(item['label']);
    }
  });

  $('.date').datetimepicker({
	language: '{{ datepicker }}',
    pickTime: false
  });
//--></script>
{{ footer }}