|
@@ -22,10 +22,10 @@ class SparePartOrderController extends Controller
|
|
|
'year' => 'Год',
|
|
'year' => 'Год',
|
|
|
'article' => 'Артикул',
|
|
'article' => 'Артикул',
|
|
|
'source_text' => 'Источник заказа',
|
|
'source_text' => 'Источник заказа',
|
|
|
- 'status' => 'Статус',
|
|
|
|
|
|
|
+ 'status_name' => 'Статус',
|
|
|
'ordered_quantity' => 'Заказано',
|
|
'ordered_quantity' => 'Заказано',
|
|
|
'available_qty' => 'Остаток',
|
|
'available_qty' => 'Остаток',
|
|
|
- 'with_documents' => 'С документами',
|
|
|
|
|
|
|
+ 'with_documents_text' => 'С документами',
|
|
|
'note' => 'Примечание',
|
|
'note' => 'Примечание',
|
|
|
'user_name' => 'Менеджер',
|
|
'user_name' => 'Менеджер',
|
|
|
'created_at' => 'Дата создания',
|
|
'created_at' => 'Дата создания',
|
|
@@ -49,10 +49,25 @@ class SparePartOrderController extends Controller
|
|
|
$model = new SparePartOrdersView();
|
|
$model = new SparePartOrdersView();
|
|
|
|
|
|
|
|
// Фильтры
|
|
// Фильтры
|
|
|
- $this->createFilters($model, 'year', 'article', 'status', 'with_documents');
|
|
|
|
|
|
|
+ $this->createFilters($model, 'year', 'article');
|
|
|
$this->createRangeFilters($model, 'ordered_quantity', 'available_qty');
|
|
$this->createRangeFilters($model, 'ordered_quantity', 'available_qty');
|
|
|
$this->createDateFilters($model, 'created_at');
|
|
$this->createDateFilters($model, 'created_at');
|
|
|
|
|
|
|
|
|
|
+ // Фильтр статуса с русскими названиями
|
|
|
|
|
+ $this->data['filters']['status'] = [
|
|
|
|
|
+ 'title' => 'Статус',
|
|
|
|
|
+ 'values' => SparePartOrdersView::STATUS_NAMES
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ // Фильтр "С документами"
|
|
|
|
|
+ $this->data['filters']['with_documents'] = [
|
|
|
|
|
+ 'title' => 'С документами',
|
|
|
|
|
+ 'values' => [
|
|
|
|
|
+ 1 => 'Да',
|
|
|
|
|
+ 0 => 'Нет',
|
|
|
|
|
+ ]
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
// Запрос
|
|
// Запрос
|
|
|
$q = $model::query();
|
|
$q = $model::query();
|
|
|
|
|
|
|
@@ -66,8 +81,13 @@ class SparePartOrderController extends Controller
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($request->has('with_documents')) {
|
|
if ($request->has('with_documents')) {
|
|
|
- $withDocs = filter_var($request->get('with_documents'), FILTER_VALIDATE_BOOLEAN);
|
|
|
|
|
- $q->where('with_documents', $withDocs);
|
|
|
|
|
|
|
+ $withDocsValue = $request->get('with_documents');
|
|
|
|
|
+ // Преобразуем значение в boolean
|
|
|
|
|
+ if ($withDocsValue === 'Да' || $withDocsValue === '1') {
|
|
|
|
|
+ $q->where('with_documents', true);
|
|
|
|
|
+ } elseif ($withDocsValue === 'Нет' || $withDocsValue === '0') {
|
|
|
|
|
+ $q->where('with_documents', false);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($request->has('status')) {
|
|
if ($request->has('status')) {
|