|
|
@@ -36,7 +36,7 @@ class OrderController extends Controller
|
|
|
'order_status_id' => 'Статус',
|
|
|
'tg_group_name' => 'Имя группы в ТГ',
|
|
|
'tg_group_link' => 'Ссылка на группу в ТГ',
|
|
|
- 'products-common_name' => 'МАФы',
|
|
|
+ 'products_with_count' => 'МАФы',
|
|
|
'ready_to_mount' => 'Все МАФы на складе',
|
|
|
],
|
|
|
'searchFields' => [
|
|
|
@@ -77,7 +77,7 @@ class OrderController extends Controller
|
|
|
$this->setSortAndOrderBy($model, $request);
|
|
|
|
|
|
$q->orderBy($this->data['sortBy'], $this->data['orderBy']);
|
|
|
- $this->data['orders'] = $q->paginate()->withQueryString();
|
|
|
+ $this->data['orders'] = $q->paginate(session('per_page', config('pagination.per_page')))->withQueryString();
|
|
|
|
|
|
foreach ($this->data['orders'] as $order) {
|
|
|
$order->recalculateReadyToMount();
|
|
|
@@ -172,4 +172,15 @@ class OrderController extends Controller
|
|
|
$order->update(['order_status_id' => Order::STATUS_READY_TO_MOUNT]);
|
|
|
return redirect()->route('order.show', $order);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param Order $order
|
|
|
+ * @return RedirectResponse
|
|
|
+ */
|
|
|
+ public function destroy(Order $order)
|
|
|
+ {
|
|
|
+ Order::query()->where('id', $order->id)->delete();
|
|
|
+ ProductSKU::query()->where('order_id', $order->id)->delete();
|
|
|
+ return redirect()->route('order.index');
|
|
|
+ }
|
|
|
}
|