/
order_filtering.blade.php
254 lines (200 loc) · 10.6 KB
/
order_filtering.blade.php
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<script>
function orderRedirection(val) {
alert(val);
}
$(document).ready(function () {
});
</script>
<form method="get" class="js-form-order-filtering">
<div class="manage-toobar d-flex justify-content-between align-items-center">
<div id="cartsnav">
<a href="{{route('admin.order.index')}}"
class="btn btn-link btn-sm px-0 <?php if (!isset($abandoned)): ?>font-weight-bold text-dark active<?php else: ?>text-muted<?php endif; ?>">
<?php _e("Completed orders"); ?> (<?php echo $orders_count; ?>)
</a>
<a href="{{route('admin.order.abandoned')}}"
class="btn btn-link btn-sm <?php if (isset($abandoned)): ?>font-weight-bold text-dark active<?php else: ?>text-muted<?php endif; ?>">
<?php _e("Abandoned carts"); ?> (<?php echo $abandoned_count; ?>)
</a>
</div>
</div>
<?php if ($orders->count() > 0 || $filteringResults) { ?>
<div class="js-filtering-orders-box bg-primary-opacity-1 rounded p-4 mb-4" <?php if (!$filteringResults): ?>style="display: none"<?php endif;?>>
<div class="row d-flex justify-content-between align-content-end">
<div class="col-md-6">
<div class="form-group">
<label for="" class="form-label"><?php _e("Order ID"); ?></label>
<div class="input-group mb-0">
<input type="text" class="form-control" value="{{$id}}" name="id" placeholder="<?php _e("Order ID");?>">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="" class="form-label"><?php _e("Order Status"); ?></label>
<div class="input-group mb-0">
<select name="orderStatus" class="selectpicker" data-width="100%">
<option value="" @if($orderStatus == '') selected="selected" @endif>
<?php _e('All'); ?>
</option>
<option value="new" @if($orderStatus == 'new') selected="selected" @endif>
<?php _e('New'); ?>
</option>
<option value="pending" @if($orderStatus == 'pending') selected="selected" @endif>
<?php _e('Pending'); ?>
</option>
<option value="completed" @if($orderStatus == 'completed') selected="selected" @endif>
<?php _e('Completed'); ?>
</option>
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="" class="form-label"><?php _e("Date from"); ?></label>
<div class="input-group mb-0">
<div class="input-group-prepend">
<span class="input-group-text"><i class="mdi mdi-calendar"></i> </span>
</div>
<input type="text" class="form-control" value="{{$minDate}}" name="minDate" id="js-order-filter-date-from" placeholder="<?php _e("Set the orders from date");?>">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="" class="form-label"><?php _e("Date to"); ?></label>
<div class="input-group mb-0">
<div class="input-group-prepend">
<span class="input-group-text"><i class="mdi mdi-calendar"></i> </span>
</div>
<input type="text" class="form-control" value="{{$maxDate}}" name="maxDate" id="js-order-filter-date-to" placeholder="<?php _e("Set the orders to date");?>">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="" class="form-label"><?php _e("Order amount from"); ?></label>
<div class="input-group mb-0">
<div class="input-group-prepend">
<span class="input-group-text">{{get_currency_symbol()}}</span>
</div>
<input type="number" class="form-control" value="{{$minPrice}}" name="minPrice" placeholder="<?php _e("Show the order with minimum amount");?>">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="" class="form-label"><?php _e("Order amount to"); ?></label>
<div class="input-group mb-0">
<div class="input-group-prepend">
<span class="input-group-text">{{get_currency_symbol()}} </span>
</div>
<input type="number" class="form-control" value="{{$maxPrice}}" name="maxPrice" placeholder="<?php _e("Show the order with maximum amount");?>">
</div>
</div>
</div>
<script>
mw.lib.require("air_datepicker");
if ($.fn.datepicker) {
$.fn.datepicker.language['en'] = {
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
daysMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
daysShort: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
today: 'Today',
clear: 'Clear',
dateFormat: 'yyyy-mm-dd',
firstDay: 0
};
var datePickerBaseSetup = {
language:'en',
timepicker: false,
onSelect: function (fd, d, picker) {
// Do nothing if selection was cleared
if (!d[0]) return;
if (!d[1]) return;
var dateFromRange = d[0].getFullYear() + "-" + numericMonth(d[0]) + "-" + numericDate(d[0]);
var dateToRange = d[1].getFullYear() + "-" + numericMonth(d[1]) + "-" + numericDate(d[1]);
}
};
$('#js-order-filter-date-from').datepicker(datePickerBaseSetup);
$('#js-order-filter-date-to').datepicker(datePickerBaseSetup);
}
$(document).ready(function () {
var searchOrdersByProduct = new mw.autoComplete({
element: "#js-orders-search-by-products",
placeholder: "<?php if ($productKeyword) { echo xss_clean($productKeyword); } else { _e("Search by products..."); }?>",
autoComplete:true,
ajaxConfig: {
method: 'get',
url: mw.settings.api_url + 'get_content_admin?get_extra_data=1&content_type=product&keyword=${val}'
},
map: {
value: 'id',
title: 'title',
image: 'picture'
}
});
$(searchOrdersByProduct).on("change", function (e, val) {
$(".js-orders-search-product").val(val[0].id).trigger('change')
$(".js-orders-search-product-keyword").val(val[0].title).trigger('change')
});
});
</script>
<div class="col-md-6">
<div class="form-group">
<label for="" class="form-label"><?php _e("Search by products"); ?></label>
<div class="input-group">
<input type="hidden" class="js-orders-search-product-keyword" name="productKeyword" value="{{$productKeyword}}" />
<input type="hidden" class="js-orders-search-product" name="productId" value="{{$productId}}" />
<div id="js-orders-search-by-products"></div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="" class="form-label"><?php _e("Payment Status"); ?></label>
<div class="input-group mb-0">
<select name="isPaid" class="selectpicker" data-width="100%">
<option value="" @if($isPaid == '') selected="selected" @endif>
<?php _e('All'); ?>
</option>
<option value="1" @if($isPaid == '1') selected="selected" @endif>
<?php _e('Paid'); ?>
</option>
<option value="0" @if($isPaid == '0') selected="selected" @endif>
<?php _e('Unpaid'); ?>
</option>
</select>
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="" class="form-label"><?php _e("Search"); ?></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="mdi mdi-magnify"></i></span>
</div>
<input type="text" class="form-control" value="{{$keyword}}" name="keyword" placeholder="<?php _e("Free search by phone, name, email etc...");?>">
</div>
</div>
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
<button type="submit" name="filteringResults" value="true" class="js-submit-order-filtering btn btn-primary mr-2">
<?php _e("Submit this criteria"); ?>
</button>
<a href="{{route('admin.order.index')}}" class="btn btn-outline-primary">
<?php _e("Reset filter"); ?>
</a>
</div>
</div>
</div>
</div>
<?php } ?>
</form>