Changes Done

This commit is contained in:
Devansh 2022-04-01 21:02:37 +05:30
parent 44d53baa89
commit 55826b0bfb
4 changed files with 54 additions and 3 deletions

View File

@ -76,6 +76,15 @@ class OrderDataGrid extends DataGrid
'index' => 'status',
'label' => trans('shop::app.customer.account.order.index.status'),
'type' => 'string',
'options' => [
'processing' => 'Processing',
'completed' => 'Completed',
'canceled' => 'Cancelled',
'closed' => 'Closed',
'pending' => 'Pending',
'pending_payment' => 'Pending Payment',
'fraud' => 'Fraud',
],
'searchable' => false,
'sortable' => true,
'closure' => function ($value) {

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=e136e7c7f62341fd089a",
"/js/ui.js": "/js/ui.js?id=2d5e481fb67990d5d925",
"/css/ui.css": "/css/ui.css?id=c8a7ade09358a1d61a4a"
}

View File

@ -258,7 +258,27 @@
</li>
<li v-if="stringCondition != null">
<div class="control-group">
<div
class="control-group"
v-if="
isCurrentFilterColumnHasOptions()
"
>
<select
class="control"
v-model="stringValue"
>
<option
:key="key"
v-text="option"
v-value="key"
v-for="(option,
key) in this.getCurrentFilterOptions()"
></option>
</select>
</div>
<div class="control-group" v-else>
<input
type="text"
class="control response-string"
@ -1701,6 +1721,28 @@ export default {
'CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'
);
}
},
getCurrentFilterColumn: function() {
return this.columns.find(
column => column.index === this.filterColumn
);
},
isCurrentFilterColumnHasOptions: function() {
let currentFilterColumn = this.getCurrentFilterColumn();
return (
currentFilterColumn && currentFilterColumn.options !== undefined
);
},
getCurrentFilterOptions: function() {
if (this.isCurrentFilterColumnHasOptions()) {
return this.getCurrentFilterColumn().options ?? [];
}
throw "Options are not defined. Don't use this method if options are not available.";
}
}
};