Przeglądaj źródła

added days for install field to order

Alexander Musikhin 2 miesięcy temu
rodzic
commit
08ea4f6d8b

+ 1 - 0
app/Http/Requests/Order/StoreOrderRequest.php

@@ -39,6 +39,7 @@ class StoreOrderRequest extends FormRequest
             'quantity'          => 'nullable|array',
             'products_sku'      => 'nullable|array',
             'order_status_id'   => 'nullable|exists:order_statuses,id',
+            'install_days'      => 'nullable|integer|min:1',
         ];
     }
 }

+ 1 - 0
app/Models/Order.php

@@ -98,6 +98,7 @@ class Order extends Model
         'tg_group_name',
         'tg_group_link',
         'ready_to_mount',
+        'install_days',
     ];
 
     public $appends = ['common_name', 'products_with_count'];

+ 28 - 0
database/migrations/2025_09_18_215716_add_field_to_orders_table.php

@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        Schema::table('orders', function (Blueprint $table) {
+            $table->unsignedInteger('install_days')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::table('orders', function (Blueprint $table) {
+            $table->dropColumn('install_days');
+        });
+    }
+};

+ 2 - 0
resources/views/orders/edit.blade.php

@@ -30,6 +30,8 @@
 
                 @include('partials.input', ['name' => 'installation_date', 'title' => 'Дата выхода на монтаж', 'type' => 'date', 'value' => $order->installation_date ?? old('installation_date')])
 
+                @include('partials.input', ['name' => 'install_days', 'title' => 'Дней на монтаж', 'type' => 'number', 'min' => 1, 'value' => $order->install_days ?? old('install_days')])
+
                 @include('partials.input', ['name' => 'ready_date', 'title' => 'Дата готовности площадки', 'type' => 'date', 'value' => $order->ready_date ?? old('ready_date')])
 
                 @include('partials.select', ['name' => 'brigadier_id', 'title' => 'Бригадир', 'options' => $brigadiers, 'value' => $order->brigadier_id ?? old('brigadier_id'), 'first_empty' => true])

+ 1 - 0
resources/views/orders/show.blade.php

@@ -52,6 +52,7 @@
                     объекта: {{ $order->orderStatus->name }}</div>
                 <div>Комментарий: {{ $order->comment }}</div>
                 <div>Дата выхода на монтаж: {{ $order->installation_date }}</div>
+                <div>Дней на монтаж: {{ $order->install_days }}</div>
                 <div>Дата готовности площадки: {{ $order->ready_date }}</div>
                 <div>Бригадир: {{ $order?->brigadier?->name }}, тел. {{ $order?->brigadier?->phone }}</div>
                 <div>Менеджер: {{ $order->user->name }}, тел. {{ $order->user->phone }}</div>