瀏覽代碼

allow manager remove files, fix input.blade.php

Alexander Musikhin 1 周之前
父節點
當前提交
dcddbae93f

+ 2 - 2
app/Http/Controllers/ReclamationController.php

@@ -284,7 +284,7 @@ class ReclamationController extends Controller
 
     public function deleteDocument(Request $request, Reclamation $reclamation, File $file)
     {
-        $this->ensureHasRole([Role::ADMIN]);
+        $this->ensureHasRole([Role::ADMIN, Role::MANAGER]);
         $this->ensureCanViewReclamation($reclamation);
 
         $reclamation->documents()->detach($file);
@@ -322,7 +322,7 @@ class ReclamationController extends Controller
 
     public function deleteAct(Request $request, Reclamation $reclamation, File $file)
     {
-        $this->ensureHasRole([Role::ADMIN]);
+        $this->ensureHasRole([Role::ADMIN, Role::MANAGER]);
         $this->ensureCanViewReclamation($reclamation);
 
         $reclamation->acts()->detach($file);

+ 2 - 2
resources/views/orders/show.blade.php

@@ -112,7 +112,7 @@
                                     <a href="{{ $document->link }}" target="_blank">
                                         {{ $document->original_name }}
                                     </a>
-                                    @if(hasRole('admin'))
+                                    @if(hasRole('admin,manager'))
                                         <i class="bi bi-x-circle-fill fs-6 text-danger cursor-pointer ms-2"
                                            onclick="customConfirm('Удалить?', function () { $('#document-{{ $document->id }}').submit(); }, 'Подтверждение удаления')"
                                            title="Удалить"></i>
@@ -154,7 +154,7 @@
                                     <a href="{{ $statement->link }}" target="_blank">
                                         {{ $statement->original_name }}
                                     </a>
-                                    @if(hasRole('admin'))
+                                    @if(hasRole('admin,manager'))
                                         <i class="bi bi-x-circle-fill fs-6 text-danger cursor-pointer ms-2"
                                            onclick="customConfirm('Удалить?', function () { $('#statement-{{ $statement->id }}').submit(); }, 'Подтверждение удаления')"
                                            title="Удалить"></i>

+ 1 - 1
resources/views/partials/input.blade.php

@@ -8,7 +8,7 @@
     <div class="@if(!($right ?? null)) col-md-8 @endif">
         <div class="input-group">
             <input type="{{ $type ?? 'text' }}" name="{{ $name }}" id="{{ $name }}"
-                   class="@if(($type ?? 'text') === 'range') form-range @else form-control form-control-sm @endif @error($name) is-invalid @enderror @isset($classes) {{ implode(' ', $classes) }} @endisset }}"
+                   class="@if(($type ?? 'text') === 'range') form-range @else form-control form-control-sm @endif @error($name) is-invalid @enderror @isset($classes) {{ implode(' ', $classes) }} @endisset"
                    @disabled($disabled ?? null) @required($required ?? null)
                    @isset($min) min="{{ $min }}" @endisset
                    @isset($max) max="{{ $max }}" @endisset

+ 8 - 8
resources/views/reclamations/edit.blade.php

@@ -462,7 +462,7 @@
                                 <a href="{{ $document->link }}" target="_blank">
                                     {{ $document->original_name }}
                                 </a>
-                                @if(hasRole('admin'))
+                                @if(hasRole('admin,manager'))
                                     <i class="bi bi-x-circle-fill fs-6 text-danger cursor-pointer ms-2"
                                        onclick="customConfirm('Удалить?', function () { $('#document-{{ $document->id }}').submit(); }, 'Подтверждение удаления')"
                                        title="Удалить"></i>
@@ -496,17 +496,17 @@
                                 <a href="{{ $act->link }}" target="_blank">
                                     {{ $act->original_name }}
                                 </a>
-                                @if(hasRole('admin'))
+                                @if(hasRole('admin,manager'))
                                     <i class="bi bi-x-circle-fill fs-6 text-danger cursor-pointer ms-2"
                                        onclick="customConfirm('Удалить?', function () { $('#act-{{ $act->id }}').submit(); }, 'Подтверждение удаления')"
                                        title="Удалить"></i>
-                                    <form action="{{ route('reclamations.delete-act', [$reclamation, $act]) }}"
-                                          method="POST"
-                                          id="act-{{ $act->id }}" class="visually-hidden">
-                                        @csrf
-                                        @method('DELETE')
-                                    </form>
                                 @endif
+                                <form action="{{ route('reclamations.delete-act', [$reclamation, $act]) }}"
+                                      method="POST"
+                                      id="act-{{ $act->id }}" class="visually-hidden">
+                                    @csrf
+                                    @method('DELETE')
+                                </form>
                             </div>
                         @endforeach
                     </div>

+ 1 - 1
routes/web.php

@@ -275,7 +275,7 @@ Route::middleware('auth:web')->group(function () {
         ->middleware('role:admin,manager,brigadier,' . Role::WAREHOUSE_HEAD);
     Route::delete('reclamations/delete-act/{reclamation}/{file}', [ReclamationController::class, 'deleteAct'])
         ->name('reclamations.delete-act')
-        ->middleware('role:' . Role::ADMIN);
+        ->middleware('role:admin,manager');
 
     Route::get('schedule', [ScheduleController::class, 'index'])->name('schedule.index');
     Route::post('order/export', [OrderController::class, 'export'])