Forráskód Böngészése

comentarios para cancelacion en updateVisistStatus

EmilianoOrtiz 4 napja
szülő
commit
5a1d555e70

+ 16 - 0
sistema-mantenimiento-back/app/Http/Controllers/PreventiveMaintenanceController.php

@@ -2753,6 +2753,22 @@ class PreventiveMaintenanceController extends Controller
         } elseif ($newStatus == 'CA') {
             $updateArr['RVTN_USCA'] = $idUser;
             $updateArr['RVTN_FECA'] = $nowStr;
+
+            // Registrar comentario de cancelación
+            if (!empty($form['comments'])) {
+                $commentsArr = json_decode($visit->RVTN_COME, true);
+                if (!is_array($commentsArr)) {
+                    $commentsArr = [];
+                }
+
+                $commentsArr['COMENTARIO_CANCELACION'] = [
+                    'ID' => $idUser,
+                    'COMENTARIO' => $form['comments'],
+                    'FECHA' => $nowStr
+                ];
+
+                $updateArr['RVTN_COME'] = json_encode($commentsArr);
+            }
         } elseif ($newStatus == 'RE') {
             $updateArr['RVTN_UARE'] = $idUser;
             $updateArr['RVTN_FARE'] = $nowStr;