Jelajahi Sumber

notifications

Alexander Musikhin 1 bulan lalu
induk
melakukan
149dafd84f

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

@@ -121,7 +121,7 @@ class ScheduleController extends Controller
                     'brigadier_id' => $order->brigadier_id,
                     'comment'   => $validated['comment'],
                 ]);
-            if($first) {
+            if($first && isset($validated['send_notifications'])) {
                 $first = false;
                 NotifyOrderInScheduleJob::dispatch($schedule);
             }
@@ -186,7 +186,7 @@ class ScheduleController extends Controller
                     'brigadier_id' => $reclamation->brigadier_id,
                     'comment'   => $reclamation->guarantee,
                 ]);
-            if($first) {
+            if($first && isset($validated['send_notifications'])) {
                 $first = false;
                 NotifyOrderInScheduleJob::dispatch($schedule);
             }

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

@@ -26,6 +26,7 @@ class CreateScheduleFromOrderRequest extends FormRequest
             'comment'               => 'nullable|string',
             'skus'                  => 'nullable|array',
             'delete_old_records'    => 'nullable|string',
+            'send_notifications'    => 'nullable|string',
         ];
     }
 }

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

@@ -24,6 +24,7 @@ class CreateScheduleFromReclamationRequest extends FormRequest
         return [
             'reclamation_id'        => 'required|exists:reclamations,id',
             'delete_old_records'    => 'nullable|string',
+            'send_notifications'    => 'nullable|boolean',
         ];
     }
 }

+ 5 - 67
resources/views/orders/show.blade.php

@@ -312,8 +312,13 @@
                         <div>
                             <input type="hidden" name="order_id" value="{{ $order->id }}">
                             <textarea name="comment" placeholder="Комментарий для графика" class="form-control mb-3"></textarea>
+
+                            <input type="checkbox" checked="checked" id="sendNotifications" name="send_notifications" class="form-check-inline">
+                            <label for="sendNotifications" class="form-check-label mb-2">Уведомить менеджера и бригадира</label><br>
+
                             <input type="checkbox" id="deleteOldRecords" name="delete_old_records" class="form-check-inline">
                             <label for="deleteOldRecords" class="form-check-label mb-2">Удалить старые записи в графике для этой площадки?</label><br>
+
                             <button type="submit" class="btn btn-primary btn-sm">Обновить график</button>
                         </div>
                     </form>
@@ -494,72 +499,5 @@
             );
         });
 
-
-        {{--$('#installation_date').on('change', function () {--}}
-        {{--    let installationDate = $(this).val();--}}
-        {{--    $.post(--}}
-        {{--        '{{ route('order.update', $order->id) }}',--}}
-        {{--        {--}}
-        {{--            '_token': '{{ csrf_token() }}',--}}
-        {{--            id: '{{ $order->id }}',--}}
-        {{--            installation_date: installationDate--}}
-        {{--        },--}}
-        {{--        function () {--}}
-        {{--            $('.alerts').append(--}}
-        {{--                '<div class="main-alert alert alert-success" role="alert">Обновлена дата выхода на монтаж!</div>'--}}
-        {{--            );--}}
-        {{--            setTimeout(function () {--}}
-        {{--                $('.main-alert').fadeTo(2000, 500).slideUp(500, function () {--}}
-        {{--                    $(".main-alert").slideUp(500);--}}
-        {{--                })--}}
-        {{--            }, 3000);--}}
-        {{--        }--}}
-        {{--    );--}}
-        {{--});--}}
-
-        {{--$('#install_days').on('change', function () {--}}
-        {{--    let installDays = $(this).val();--}}
-        {{--    $.post(--}}
-        {{--        '{{ route('order.update', $order->id) }}',--}}
-        {{--        {--}}
-        {{--            '_token' : '{{ csrf_token() }}',--}}
-        {{--            id: '{{ $order->id }}',--}}
-        {{--            install_days: installDays--}}
-        {{--        },--}}
-        {{--        function () {--}}
-        {{--            $('.alerts').append(--}}
-        {{--                '<div class="main-alert alert alert-success" role="alert">Обновлено количество дней на монтаж!</div>'--}}
-        {{--            );--}}
-        {{--            setTimeout(function () {--}}
-        {{--                $('.main-alert').fadeTo(2000, 500).slideUp(500, function () {--}}
-        {{--                    $(".main-alert").slideUp(500);--}}
-        {{--                })--}}
-        {{--            }, 3000);--}}
-        {{--        }--}}
-        {{--    );--}}
-        {{--});--}}
-
-        {{--$('#name').on('change', function () {--}}
-        {{--    let name = $(this).val();--}}
-        {{--    $.post(--}}
-        {{--        '{{ route('order.update', $order->id) }}',--}}
-        {{--        {--}}
-        {{--            '_token' : '{{ csrf_token() }}',--}}
-        {{--            id: '{{ $order->id }}',--}}
-        {{--            name: name--}}
-        {{--        },--}}
-        {{--        function () {--}}
-        {{--            $('.alerts').append(--}}
-        {{--                '<div class="main-alert alert alert-success" role="alert">Обновлено название!</div>'--}}
-        {{--            );--}}
-        {{--            setTimeout(function () {--}}
-        {{--                $('.main-alert').fadeTo(2000, 500).slideUp(500, function () {--}}
-        {{--                    $(".main-alert").slideUp(500);--}}
-        {{--                })--}}
-        {{--            }, 3000);--}}
-        {{--        }--}}
-        {{--    );--}}
-        {{--});--}}
-
     </script>
 @endpush

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

@@ -305,6 +305,10 @@
                         <div>
                             <input type="hidden" name="reclamation_id" value="{{ $reclamation->id }}">
 {{--                            <textarea name="comment" placeholder="Комментарий для графика" class="form-control mb-3"></textarea>--}}
+
+                            <input type="checkbox" checked="checked" id="sendNotifications" name="send_notifications" class="form-check-inline">
+                            <label for="sendNotifications" class="form-check-label mb-2">Уведомить менеджера и бригадира</label><br>
+
                             <input type="checkbox" id="deleteOldRecords" name="delete_old_records" class="form-check-inline">
                             <label for="deleteOldRecords" class="form-check-label mb-2">Удалить старые записи в графике для этой рекламации?</label><br>
                             <button type="submit" class="btn btn-primary btn-sm">Обновить график</button>