Browse Source

added factory reclamation number to reclamations

Alexander Musikhin 3 weeks ago
parent
commit
6a7244434d

+ 1 - 0
app/Http/Requests/StoreReclamationRequest.php

@@ -33,6 +33,7 @@ class StoreReclamationRequest extends FormRequest
             'work_days'     => 'nullable|integer',
             'brigadier_id'  => 'nullable|exists:users,id',
             'comment'       => 'nullable|string',
+            'factory_reclamation_number' => 'nullable|string|max:255',
         ];
     }
 }

+ 1 - 0
app/Models/Reclamation.php

@@ -52,6 +52,7 @@ class Reclamation extends Model
         'work_days',
         'brigadier_id',
         'comment',
+        'factory_reclamation_number',
     ];
 
     public function order(): BelongsTo

+ 1 - 0
database/factories/ReclamationFactory.php

@@ -29,6 +29,7 @@ class ReclamationFactory extends Factory
             'work_days' => fake()->numberBetween(1, 14),
             'brigadier_id' => null,
             'comment' => fake()->optional()->sentence(),
+            'factory_reclamation_number' => fake()->optional()->bothify('FR-#####'),
         ];
     }
 

+ 28 - 0
database/migrations/2026_02_17_120000_add_factory_reclamation_number_to_reclamations_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('reclamations', function (Blueprint $table) {
+            $table->string('factory_reclamation_number')->nullable()->after('comment');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::table('reclamations', function (Blueprint $table) {
+            $table->dropColumn('factory_reclamation_number');
+        });
+    }
+};

+ 1 - 0
resources/views/reclamations/edit.blade.php

@@ -45,6 +45,7 @@
                     @include('partials.input', ['name' => 'start_work_date', 'title' => 'Дата начала работ', 'type' => 'date', 'value' => $reclamation->start_work_date, 'disabled' => !hasRole('admin,manager')])
                     @include('partials.input', ['name' => 'work_days', 'title' => 'Срок работ, дней', 'type' => 'number', 'min' => 1, 'value' => $reclamation->work_days, 'disabled' => !hasRole('admin,manager')])
                     @include('partials.select', ['name' => 'reason', 'title' => 'Причина', 'size' => 6, 'value' => $reclamation->reason ?? '', 'options' => ['Вандализм', 'Гарантия', 'Сервисное обслуживание'], 'key_as_val' => true, 'disabled' => !hasRole('admin,manager')])
+                    @include('partials.input', ['name' => 'factory_reclamation_number', 'title' => '№ рекламации на фабрике', 'type' => 'text', 'value' => $reclamation->factory_reclamation_number ?? '', 'disabled' => !hasRole('admin,manager')])
                     @include('partials.textarea', ['name' => 'guarantee', 'title' => 'Гарантии', 'size' => 6, 'value' => $reclamation->guarantee ?? '', 'disabled' => !hasRole('admin,manager')])
                     @include('partials.textarea', ['name' => 'whats_done', 'title' => 'Что сделано', 'size' => 6, 'value' => $reclamation->whats_done ?? '', 'disabled' => !hasRole('admin,manager')])
                     @include('partials.textarea', ['name' => 'comment', 'title' => 'Комментарий', 'size' => 6, 'value' => $reclamation->comment ?? '', 'disabled' => !hasRole('admin,manager')])