Kaynağa Gözat

added color for users

Alexander Musikhin 2 ay önce
ebeveyn
işleme
6541bd2671

+ 1 - 0
app/Http/Requests/User/StoreUser.php

@@ -29,6 +29,7 @@ class StoreUser extends FormRequest
             'phone'     => 'nullable|string',
             'password'  => 'required_without:id|nullable|string|min:4',
             'role'      => 'nullable|string|in:' . implode(',', Role::VALID_ROLES),
+            'color'     => 'nullable|string',
         ];
     }
 

+ 1 - 0
app/Models/User.php

@@ -24,6 +24,7 @@ class User extends Authenticatable implements MustVerifyEmail
         'phone',
         'password',
         'role',
+        'color',
     ];
 
     /**

+ 28 - 0
database/migrations/2025_09_22_154457_add_field_to_users_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('users', function (Blueprint $table) {
+            $table->string('color')->nullable()->after('role');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::table('users', function (Blueprint $table) {
+            $table->dropColumn('color');
+        });
+    }
+};

+ 1 - 1
resources/sass/app.scss

@@ -59,7 +59,7 @@
   font-size: 0.8rem;
 }
 
-.maf:hover, tr:hover td {
+.maf:hover {
   background-color: #fff8ca;
 }
 

+ 10 - 10
resources/views/schedule/index.blade.php

@@ -41,7 +41,7 @@
     </div>
 
     <div class="schedule">
-        <table class="table">
+        <table class="table schedules">
             <thead>
                 <tr>
                     <th class="text-center vertical">День недели</th>
@@ -65,15 +65,15 @@
                     @if($orders)
                         @foreach($orders as $order)
                             {!! (!$loop->first) ? '<tr>':'' !!}
-                            <td>{{ $order->id }}</td>
-                            <td>{{ $order->district->shortname }}</td>
-                            <td>{{ $order->area->name }}</td>
-                            <td>{{ $order->object_address }}</td>
-                            <td>{{ $order->objectType->name }}</td>
-                            <td>{!! $order->productsWithCount !!}</td>
-                            <td>{{ $order->products_sku()->count() }}</td>
-                            <td>{{ $order->brigadier->name }}</td>
-                            <td></td>
+                            <td style="background: {{ $order->brigadier->color }}" class="align-middle">{{ $order->id }}</td>
+                            <td style="background: {{ $order->brigadier->color }}" class="align-middle">{{ $order->district->shortname }}</td>
+                            <td style="background: {{ $order->brigadier->color }}" class="align-middle">{{ $order->area->name }}</td>
+                            <td style="background: {{ $order->brigadier->color }}" class="align-middle">{{ $order->object_address }}</td>
+                            <td style="background: {{ $order->brigadier->color }}" class="align-middle">{{ $order->objectType->name }}</td>
+                            <td style="background: {{ $order->brigadier->color }}" class="align-middle">{!! $order->productsWithCount !!}</td>
+                            <td style="background: {{ $order->brigadier->color }}" class="align-middle">{{ $order->products_sku()->count() }}</td>
+                            <td style="background: {{ $order->brigadier->color }}" class="align-middle">{{ $order->brigadier->name }}</td>
+                            <td style="background: {{ $order->brigadier->color }}" class="align-middle"></td>
                             </tr>
                         @endforeach
                     @endif

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

@@ -25,6 +25,8 @@
 
                 @include('partials.select', ['name' => 'role', 'title' => 'Роль', 'options' => getRoles(), 'value' => $user->role ?? \App\Models\Role::MANAGER])
 
+                @include('partials.input', ['name' => 'color', 'title' => 'Цвет', 'value' => $user->color ?? '#FFFFFF', 'type' => 'color'])
+
                 @include('partials.submit')
             </form>
         </div>