@extends('layouts.app') @section('content') @php $canView = static fn (string $field): bool => (bool) ($readableFields[$field] ?? false); $canUpdate = static fn (string $field): bool => (bool) ($writableFields[$field] ?? false); $itemRows = old('items'); if ($itemRows === null) { $itemRows = $order ? $order->items->map(static fn ($item): array => [ 'id' => $item->id, 'common_catalog_item_id' => $item->common_catalog_item_id, 'order_item_number' => $item->order_item_number, 'factory_number' => $item->factory_number, 'manufacture_date' => $item->manufacture_date?->toDateString(), ])->values()->all() : []; } @endphp

{{ $order ? 'Заказ '.$order->order_number : 'Новый заказ' }}

@if($order && hasPermission('schedule-orders.delete'))
@csrf @method('DELETE')
@endif
@csrf @if($order) @method('PUT') @endif
Заказ
@if($canView('order_number')) @include('partials.input', ['name' => 'order_number', 'title' => 'Номер заказа', 'required' => true, 'value' => $order?->order_number, 'disabled' => !$canUpdate('order_number')]) @endif @if($canView('order_year')) @include('partials.input', ['name' => 'order_year', 'title' => 'Год заказа', 'type' => 'number', 'min' => 2000, 'max' => 2100, 'required' => true, 'value' => $order?->order_year ?? now()->year, 'disabled' => !$canUpdate('order_year')]) @endif @if($canView('customer_name')) @include('partials.input', ['name' => 'customer_name', 'title' => 'Заказчик', 'required' => true, 'value' => $order?->customer_name, 'disabled' => !$canUpdate('customer_name')]) @endif @if($canView('object_address'))
@error('object_address')
{{ $message }}
@enderror
@endif @if($canView('manager_id')) @include('partials.select', ['name' => 'manager_id', 'title' => 'Менеджер', 'required' => true, 'first_empty' => true, 'options' => $managers, 'value' => old('manager_id', $order?->manager_id), 'disabled' => !$canUpdate('manager_id')]) @endif @if($canView('status')) @include('partials.select', ['name' => 'status', 'title' => 'Статус', 'required' => true, 'options' => $statuses, 'value' => old('status', $order?->status?->value ?? \App\Enums\ProductionOrderStatus::Placed->value), 'disabled' => !$canUpdate('status')]) @endif @if($canView('execution_type')) @include('partials.select', ['name' => 'execution_type', 'title' => 'Тип исполнения', 'required' => true, 'first_empty' => true, 'options' => $executionTypes, 'value' => old('execution_type', $order?->execution_type?->value), 'disabled' => !$canUpdate('execution_type')]) @endif
@if($canView('invoice_number')) @include('partials.input', ['name' => 'invoice_number', 'title' => '№ счёта', 'required' => true, 'value' => $order?->invoice_number, 'disabled' => !$canUpdate('invoice_number')]) @endif @if($canView('invoice_date')) @include('partials.input', ['name' => 'invoice_date', 'title' => 'Дата счёта', 'type' => 'date', 'value' => $order?->invoice_date?->toDateString(), 'disabled' => !$canUpdate('invoice_date')]) @endif @if($canView('contract_number')) @include('partials.input', ['name' => 'contract_number', 'title' => '№ договора', 'value' => $order?->contract_number, 'disabled' => !$canUpdate('contract_number')]) @endif @if($canView('contract_date')) @include('partials.input', ['name' => 'contract_date', 'title' => 'Дата договора', 'type' => 'date', 'value' => $order?->contract_date?->toDateString(), 'disabled' => !$canUpdate('contract_date')]) @endif @if($canView('payment_date')) @include('partials.input', ['name' => 'payment_date', 'title' => 'Дата оплаты', 'type' => 'date', 'required' => true, 'value' => $order?->payment_date?->toDateString(), 'disabled' => !$canUpdate('payment_date')]) @endif @if($canView('supply_working_days')) @include('partials.input', ['name' => 'supply_working_days', 'title' => 'Срок поставки, раб. дней', 'type' => 'number', 'min' => 0, 'max' => 2000, 'required' => true, 'value' => $order?->supply_working_days, 'disabled' => !$canUpdate('supply_working_days')]) @endif @if($order && $canView('contract_shipment_date')) @include('partials.input', ['name' => 'contract_shipment_date_display', 'title' => 'Дата отгрузки по договору', 'type' => 'date', 'value' => $order->contract_shipment_date?->toDateString(), 'disabled' => true]) @endif @if($canView('application_shipment_date')) @include('partials.input', ['name' => 'application_shipment_date', 'title' => 'Дата отгрузки по заявке', 'type' => 'date', 'value' => $order?->application_shipment_date?->toDateString(), 'disabled' => !$canUpdate('application_shipment_date')]) @endif @if($canView('note'))
@error('note')
{{ $message }}
@enderror
@endif
Оборудование
@if($canManageItems)
Количество
Введите не менее двух символов и выберите позицию. Для каждой единицы будет создана отдельная строка.
@endif
@if($canManageItems)@endif @foreach($itemRows as $index => $itemRow) @include('production_orders.partials.item-row', ['index' => $index, 'itemRow' => $itemRow]) @endforeach
Позиция общего каталога Номер заказа МАФ Заводской номер Дата производства
@error('items')
{{ $message }}
@enderror
@if(($order && hasPermission('schedule-orders.update')) || (!$order && hasPermission('schedule-orders.create'))) @endif Назад
@if($order) @include('production_orders.partials.planning') @endif @if($canManageItems) @endif
@if($canManageItems) @push('scripts') @endpush @endif @endsection