diff --git a/app/Http/Controllers/Userarea/UploadPhotosMobileController.php b/app/Http/Controllers/Userarea/UploadPhotosMobileController.php new file mode 100644 index 0000000..ecbc7d7 --- /dev/null +++ b/app/Http/Controllers/Userarea/UploadPhotosMobileController.php @@ -0,0 +1,74 @@ +query('iddatadb'); + + if (empty($iddatadb)) { + return response('ID riga non fornito', 400); + } + + // Show the upload form + return view('userarea.upload_photos_mobile', [ + 'iddatadb' => $iddatadb + ]); + } + + public function upload(Request $request) + { + // Validation + $request->validate([ + 'photo' => 'required|file|mimes:jpeg,png,gif,heic,heif|max:5120', // 5MB + 'iddatadb' => 'required|integer' + ]); + + $iddatadb = $request->input('iddatadb'); + $photo = $request->file('photo'); + $iduserlogin = auth()->id(); // assuming Laravel authentication + + // Check if user exists + $userExists = DB::table('auth_users')->where('id', $iduserlogin)->exists(); + if (!$userExists) { + return response()->json(['success' => false, 'message' => 'Utente non valido']); + } + + // Upload folder + $uploadDir = public_path('photostrf'); + if (!is_dir($uploadDir)) { + mkdir($uploadDir, 0755, true); + } + if (!is_writable($uploadDir)) { + return response()->json(['success' => false, 'message' => 'La cartella photostrf non è scrivibile']); + } + + // New filename + $timestamp = now()->format('YmdHis'); + $originalName = pathinfo($photo->getClientOriginalName(), PATHINFO_FILENAME); + $extension = strtolower($photo->getClientOriginalExtension()); + + $newFileName = "{$iddatadb}-{$timestamp}-{$originalName}.{$extension}"; + $destination = $uploadDir . '/' . $newFileName; + + // Move uploaded file + $photo->move($uploadDir, $newFileName); + + // Save DB record + DB::table('datadb_photos')->insert([ + 'iddatadb' => $iddatadb, + 'file_path' => $newFileName, + 'file_name' => $newFileName, + 'uploaded_by' => $iduserlogin + ]); + + return response()->json(['success' => true, 'message' => 'Foto caricata con successo']); + } +} diff --git a/public/photostrf/646-20250816171436-webcam_photo_1755364475466.jpg b/public/photostrf/646-20250816171436-webcam_photo_1755364475466.jpg new file mode 100644 index 0000000..b586815 Binary files /dev/null and b/public/photostrf/646-20250816171436-webcam_photo_1755364475466.jpg differ diff --git a/public/photostrf/646-20250816171449-webcam_photo_1755364488146.jpg b/public/photostrf/646-20250816171449-webcam_photo_1755364488146.jpg new file mode 100644 index 0000000..681d72b Binary files /dev/null and b/public/photostrf/646-20250816171449-webcam_photo_1755364488146.jpg differ diff --git a/public/photostrf/647-20250817135743-images.jpg b/public/photostrf/647-20250817135743-images.jpg new file mode 100644 index 0000000..78882ed Binary files /dev/null and b/public/photostrf/647-20250817135743-images.jpg differ diff --git a/public/photostrf/647-20250817135749-images (1).jpg b/public/photostrf/647-20250817135749-images (1).jpg new file mode 100644 index 0000000..f3b7e9a Binary files /dev/null and b/public/photostrf/647-20250817135749-images (1).jpg differ diff --git a/public/photostrf/648-20250817140119-images.jpg b/public/photostrf/648-20250817140119-images.jpg new file mode 100644 index 0000000..78882ed Binary files /dev/null and b/public/photostrf/648-20250817140119-images.jpg differ diff --git a/public/photostrf/648-20250817140126-images (1).jpg b/public/photostrf/648-20250817140126-images (1).jpg new file mode 100644 index 0000000..f3b7e9a Binary files /dev/null and b/public/photostrf/648-20250817140126-images (1).jpg differ diff --git a/public/photostrf/649-20250817140320-images.jpg b/public/photostrf/649-20250817140320-images.jpg new file mode 100644 index 0000000..78882ed Binary files /dev/null and b/public/photostrf/649-20250817140320-images.jpg differ diff --git a/public/photostrf/649-20250817140433-images (1).jpg b/public/photostrf/649-20250817140433-images (1).jpg new file mode 100644 index 0000000..f3b7e9a Binary files /dev/null and b/public/photostrf/649-20250817140433-images (1).jpg differ diff --git a/public/photostrf/666-20250819070024-images.jpg b/public/photostrf/666-20250819070024-images.jpg new file mode 100644 index 0000000..78882ed Binary files /dev/null and b/public/photostrf/666-20250819070024-images.jpg differ diff --git a/public/photostrf/666-20250819070034-images (1).jpg b/public/photostrf/666-20250819070034-images (1).jpg new file mode 100644 index 0000000..f3b7e9a Binary files /dev/null and b/public/photostrf/666-20250819070034-images (1).jpg differ diff --git a/public/photostrf/667-20250819070340-images.jpg b/public/photostrf/667-20250819070340-images.jpg new file mode 100644 index 0000000..78882ed Binary files /dev/null and b/public/photostrf/667-20250819070340-images.jpg differ diff --git a/public/photostrf/667-20250819070347-images (1).jpg b/public/photostrf/667-20250819070347-images (1).jpg new file mode 100644 index 0000000..f3b7e9a Binary files /dev/null and b/public/photostrf/667-20250819070347-images (1).jpg differ diff --git a/public/photostrf/669-20250819085746-images.jpg b/public/photostrf/669-20250819085746-images.jpg new file mode 100644 index 0000000..78882ed Binary files /dev/null and b/public/photostrf/669-20250819085746-images.jpg differ diff --git a/public/photostrf/669-20250819085753-images (1).jpg b/public/photostrf/669-20250819085753-images (1).jpg new file mode 100644 index 0000000..f3b7e9a Binary files /dev/null and b/public/photostrf/669-20250819085753-images (1).jpg differ diff --git a/public/photostrf/670-20250819090251-images.jpg b/public/photostrf/670-20250819090251-images.jpg new file mode 100644 index 0000000..78882ed Binary files /dev/null and b/public/photostrf/670-20250819090251-images.jpg differ diff --git a/public/photostrf/670-20250819090257-images (1).jpg b/public/photostrf/670-20250819090257-images (1).jpg new file mode 100644 index 0000000..f3b7e9a Binary files /dev/null and b/public/photostrf/670-20250819090257-images (1).jpg differ diff --git a/public/photostrf/671-20250819090924-images.jpg b/public/photostrf/671-20250819090924-images.jpg new file mode 100644 index 0000000..78882ed Binary files /dev/null and b/public/photostrf/671-20250819090924-images.jpg differ diff --git a/public/photostrf/671-20250819090931-images (1).jpg b/public/photostrf/671-20250819090931-images (1).jpg new file mode 100644 index 0000000..f3b7e9a Binary files /dev/null and b/public/photostrf/671-20250819090931-images (1).jpg differ diff --git a/public/photostrf/672-20250819091301-images.jpg b/public/photostrf/672-20250819091301-images.jpg new file mode 100644 index 0000000..78882ed Binary files /dev/null and b/public/photostrf/672-20250819091301-images.jpg differ diff --git a/public/photostrf/annotated/cla_photo_649_2025-08-17T14-13-07-096Z_2025-08-17T14-13-07-096Z.png b/public/photostrf/annotated/cla_photo_649_2025-08-17T14-13-07-096Z_2025-08-17T14-13-07-096Z.png new file mode 100644 index 0000000..71a0118 Binary files /dev/null and b/public/photostrf/annotated/cla_photo_649_2025-08-17T14-13-07-096Z_2025-08-17T14-13-07-096Z.png differ diff --git a/public/photostrf/annotated/clausphoto_2025-08-16T17-10-10-237Z.png b/public/photostrf/annotated/clausphoto_2025-08-16T17-10-10-237Z.png new file mode 100644 index 0000000..00ec3e9 Binary files /dev/null and b/public/photostrf/annotated/clausphoto_2025-08-16T17-10-10-237Z.png differ diff --git a/public/photostrf/annotated/photo_667_2025-08-19T07-04-54-561Z_2025-08-19T07-04-54-561Z.png b/public/photostrf/annotated/photo_667_2025-08-19T07-04-54-561Z_2025-08-19T07-04-54-561Z.png new file mode 100644 index 0000000..005bee0 Binary files /dev/null and b/public/photostrf/annotated/photo_667_2025-08-19T07-04-54-561Z_2025-08-19T07-04-54-561Z.png differ diff --git a/public/photostrf/annotated/photo_669_2025-08-19T08-59-12-023Z_2025-08-19T08-59-12-023Z.png b/public/photostrf/annotated/photo_669_2025-08-19T08-59-12-023Z_2025-08-19T08-59-12-023Z.png new file mode 100644 index 0000000..9d39a39 Binary files /dev/null and b/public/photostrf/annotated/photo_669_2025-08-19T08-59-12-023Z_2025-08-19T08-59-12-023Z.png differ diff --git a/public/photostrf/annotated/photo_670_2025-08-19T09-04-05-078Z_2025-08-19T09-04-05-078Z.png b/public/photostrf/annotated/photo_670_2025-08-19T09-04-05-078Z_2025-08-19T09-04-05-078Z.png new file mode 100644 index 0000000..ae43dfd Binary files /dev/null and b/public/photostrf/annotated/photo_670_2025-08-19T09-04-05-078Z_2025-08-19T09-04-05-078Z.png differ diff --git a/public/photostrf/annotated/photo_670_2025-08-19T09-07-10-383Z_2025-08-19T09-07-10-383Z.png b/public/photostrf/annotated/photo_670_2025-08-19T09-07-10-383Z_2025-08-19T09-07-10-383Z.png new file mode 100644 index 0000000..5334893 Binary files /dev/null and b/public/photostrf/annotated/photo_670_2025-08-19T09-07-10-383Z_2025-08-19T09-07-10-383Z.png differ diff --git a/public/photostrf/qrcodes/qrcode_646.png b/public/photostrf/qrcodes/qrcode_646.png new file mode 100644 index 0000000..88fd547 Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_646.png differ diff --git a/public/photostrf/qrcodes/qrcode_647.png b/public/photostrf/qrcodes/qrcode_647.png new file mode 100644 index 0000000..88c90d3 Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_647.png differ diff --git a/public/photostrf/qrcodes/qrcode_648.png b/public/photostrf/qrcodes/qrcode_648.png new file mode 100644 index 0000000..3eb5ee6 Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_648.png differ diff --git a/public/photostrf/qrcodes/qrcode_649.png b/public/photostrf/qrcodes/qrcode_649.png new file mode 100644 index 0000000..5507728 Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_649.png differ diff --git a/public/photostrf/qrcodes/qrcode_666.png b/public/photostrf/qrcodes/qrcode_666.png new file mode 100644 index 0000000..6a36585 Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_666.png differ diff --git a/public/photostrf/qrcodes/qrcode_667.png b/public/photostrf/qrcodes/qrcode_667.png new file mode 100644 index 0000000..1a69eec Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_667.png differ diff --git a/public/photostrf/qrcodes/qrcode_669.png b/public/photostrf/qrcodes/qrcode_669.png new file mode 100644 index 0000000..ec580bd Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_669.png differ diff --git a/public/photostrf/qrcodes/qrcode_670.png b/public/photostrf/qrcodes/qrcode_670.png new file mode 100644 index 0000000..a0e694d Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_670.png differ diff --git a/public/photostrf/qrcodes/qrcode_671.png b/public/photostrf/qrcodes/qrcode_671.png new file mode 100644 index 0000000..b2aab9d Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_671.png differ diff --git a/public/photostrf/qrcodes/qrcode_672.png b/public/photostrf/qrcodes/qrcode_672.png new file mode 100644 index 0000000..0c37ae8 Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_672.png differ diff --git a/public/photostrf/qrcodes/qrcode_699.png b/public/photostrf/qrcodes/qrcode_699.png new file mode 100644 index 0000000..f7b130a Binary files /dev/null and b/public/photostrf/qrcodes/qrcode_699.png differ diff --git a/public/userarea/get_customfield_values.php b/public/userarea/get_customfield_values.php index 6001e74..5770073 100644 --- a/public/userarea/get_customfield_values.php +++ b/public/userarea/get_customfield_values.php @@ -1,5 +1,5 @@ ერთი default + if (empty($fieldIds)) { + $fieldIds = [156]; + } - // Recupera i dati dal server - $data = $api->get($endpoint); + $results = []; - // Salva la risposta in un file per debug - file_put_contents(__DIR__ . '/customfield_values_response.json', json_encode($data)); + foreach ($fieldIds as $customFieldId) { + $endpoint = "CustomField($customFieldId)?\$expand=CustomFieldsValues"; + $data = $api->get($endpoint); - // Output JSON al client - echo json_encode($data); + $results[$customFieldId] = $data['CustomFieldsValues'] ?? []; + } + + // Debug ფაილი + file_put_contents(__DIR__ . '/customfield_values_response.json', json_encode($results)); + + echo json_encode($results); } catch (Exception $e) { http_response_code(500); echo json_encode([ diff --git a/public/userarea/import_edit2.php b/public/userarea/import_edit2.php index 8ac7f0c..e0bdfcc 100644 --- a/public/userarea/import_edit2.php +++ b/public/userarea/import_edit2.php @@ -19,11 +19,11 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST' || !isset($_POST['template_id']) || !i exit; } -$template_id = intval($_POST['template_id']); -$selected_rows = $_POST['selected_rows']; -$columns = json_decode($_POST['columns'], true); // Header dell'XLS -$rows = json_decode($_POST['rows'], true); // Dati dell'XLS -$newFilename = htmlspecialchars($_POST['filename']); +$template_id = intval($_POST['template_id']) ?? $_SESSION['template_id']; +$selected_rows = $_POST['selected_rows'] ?? $_SESSION['selected_rows']; +$columns = json_decode($_POST['columns'], true) ?? $_SESSION['columns']; // Header dell'XLS +$rows = json_decode($_POST['rows'], true) ?? $_SESSION['rows']; // Dati dell'XLS +$newFilename = htmlspecialchars($_POST['filename']) ?? $_SESSION['filename']; // Log dei dati ricevuti error_log("Received Data - Template ID: $template_id, Selected Rows: " . json_encode($selected_rows)); @@ -40,7 +40,7 @@ $pdo = $db->getConnection(); $importReferenceCode = date('YmdHis') . '-' . uniqid(); // Recupera tutti i mapping dal template -$stmt = $pdo->prepare("SELECT id, excel_column, data_type, is_required, manual_default, is_manual, field_label, field_id FROM template_mapping WHERE template_id = ?"); +$stmt = $pdo->prepare("SELECT id, excel_column, data_type, is_required, manual_default, is_manual, field_label, field_id, main_field FROM template_mapping WHERE template_id = ?"); $stmt->execute([$template_id]); $allMappings = $stmt->fetchAll(PDO::FETCH_ASSOC); @@ -49,71 +49,82 @@ if (empty($allMappings)) { exit; } -// Inserisci le righe selezionate in datadb (solo campi generici con templateid) -$insertedIds = []; -foreach ($selected_rows as $rowIndex) { - $row = $rows[$rowIndex]; - $values = [ - $template_id, // templateid - $importReferenceCode, // importreferencecode - $newFilename, // filename_import - 'i', // status - $user_id, // user_id - null, // limscode - date('Y-m-d') // importdate - ]; - $sql = "INSERT INTO datadb (templateid, importreferencecode, filename_import, status, user_id, limscode, importdate) VALUES (?, ?, ?, ?, ?, ?, ?)"; - $stmt = $pdo->prepare($sql); - $stmt->execute($values); - - $iddatadb = $pdo->lastInsertId(); - $insertedIds[] = $iddatadb; - - // Inserisci tutti i campi (automatici e manuali) in import_data_details - foreach ($allMappings as $mapping) { - $fieldValue = null; - if (!$mapping['is_manual']) { // Campi automatici dall'XLS - $excelColumn = trim($mapping['excel_column']); - $excelColumnIndex = array_search($excelColumn, array_map('trim', $columns)); - if ($excelColumnIndex !== false && isset($row[$excelColumnIndex]) && $row[$excelColumnIndex] !== '') { - $fieldValue = $row[$excelColumnIndex]; - error_log("Found Excel column '$excelColumn' at index $excelColumnIndex, value: " . var_export($fieldValue, true)); - } else { - $fieldValue = $mapping['manual_default'] ?? ''; - error_log("Excel column '$excelColumn' not found or empty, using default: " . var_export($fieldValue, true)); - } - switch ($mapping['data_type']) { - case 'INT': - $fieldValue = is_numeric($fieldValue) ? (int)$fieldValue : ($mapping['manual_default'] ?? 0); - break; - case 'DATE': - $fieldValue = !empty($fieldValue) ? date('Y-m-d', strtotime($fieldValue)) : ($mapping['manual_default'] === 'today' ? date('Y-m-d') : ($mapping['manual_default'] ?? '')); - break; - case 'CHAR': - $fieldValue = !empty($fieldValue) ? substr((string)$fieldValue, 0, 1) : ($mapping['manual_default'] ?? ''); - break; - case 'Testo': - case 'VARCHAR': - default: - $fieldValue = !empty($fieldValue) ? htmlspecialchars((string)$fieldValue) : ($mapping['manual_default'] ?? ''); - break; - } - } else { // Campi manuali - $fieldValue = $mapping['manual_default'] ?? ''; - if ($mapping['data_type'] === 'DATE' && $mapping['manual_default'] === 'today') { - $fieldValue = date('Y-m-d'); - } - } - if ($mapping['is_required'] && (is_null($fieldValue) || $fieldValue === '')) { - error_log("Required field missing for mapping ID: " . $mapping['id'] . ", field: " . $mapping['field_label']); - } - error_log("Inserting into import_data_details - Mapping ID: " . $mapping['id'] . ", Field Value: " . var_export($fieldValue, true) . ", Is Manual: " . $mapping['is_manual'] . ", Excel Column: " . ($mapping['excel_column'] ?? 'N/A') . ", Manual Default: " . ($mapping['manual_default'] ?? 'N/A')); - $stmt = $pdo->prepare("INSERT INTO import_data_details (id, mapping_id, field_value) VALUES (?, ?, ?)"); - $stmt->execute([$iddatadb, $mapping['id'], $fieldValue]); - error_log("Inserted into import_data_details for ID $iddatadb, Mapping ID: " . $mapping['id'] . ", Field Value: " . var_export($fieldValue, true)); +// Trova il campo main_field +$mainFieldMapping = null; +foreach ($allMappings as $mapping) { + if ($mapping['main_field'] == 1) { + $mainFieldMapping = $mapping; + break; } } +//// Inserisci le righe selezionate in datadb (solo campi generici con templateid) +//$insertedIds = []; +//foreach ($selected_rows as $rowIndex) { +// $row = $rows[$rowIndex]; +// $values = [ +// $template_id, // templateid +// $importReferenceCode, // importreferencecode +// $newFilename, // filename_import +// 'i', // status +// $user_id, // user_id +// null, // limscode +// date('Y-m-d') // importdate +// ]; +// $sql = "INSERT INTO datadb (templateid, importreferencecode, filename_import, status, user_id, limscode, importdate) VALUES (?, ?, ?, ?, ?, ?, ?)"; +// $stmt = $pdo->prepare($sql); +// $stmt->execute($values); +// +// $iddatadb = $pdo->lastInsertId(); +// $insertedIds[] = $iddatadb; +// +// // Inserisci tutti i campi (automatici e manuali) in import_data_details +// foreach ($allMappings as $mapping) { +// $fieldValue = null; +// if (!$mapping['is_manual']) { // Campi automatici dall'XLS +// $excelColumn = trim($mapping['excel_column']); +// $excelColumnIndex = array_search($excelColumn, array_map('trim', $columns)); +// if ($excelColumnIndex !== false && isset($row[$excelColumnIndex]) && $row[$excelColumnIndex] !== '') { +// $fieldValue = $row[$excelColumnIndex]; +// error_log("Found Excel column '$excelColumn' at index $excelColumnIndex, value: " . var_export($fieldValue, true)); +// } else { +// $fieldValue = $mapping['manual_default'] ?? ''; +// error_log("Excel column '$excelColumn' not found or empty, using default: " . var_export($fieldValue, true)); +// } +// switch ($mapping['data_type']) { +// case 'INT': +// $fieldValue = is_numeric($fieldValue) ? (int)$fieldValue : ($mapping['manual_default'] ?? 0); +// break; +// case 'DATE': +// $fieldValue = !empty($fieldValue) ? date('Y-m-d', strtotime($fieldValue)) : ($mapping['manual_default'] === 'today' ? date('Y-m-d') : ($mapping['manual_default'] ?? '')); +// break; +// case 'CHAR': +// $fieldValue = !empty($fieldValue) ? substr((string)$fieldValue, 0, 1) : ($mapping['manual_default'] ?? ''); +// break; +// case 'Testo': +// case 'VARCHAR': +// default: +// $fieldValue = !empty($fieldValue) ? htmlspecialchars((string)$fieldValue) : ($mapping['manual_default'] ?? ''); +// break; +// } +// } else { // Campi manuali +// $fieldValue = $mapping['manual_default'] ?? ''; +// if ($mapping['data_type'] === 'DATE' && $mapping['manual_default'] === 'today') { +// $fieldValue = date('Y-m-d'); +// } +// } +// if ($mapping['is_required'] && (is_null($fieldValue) || $fieldValue === '')) { +// error_log("Required field missing for mapping ID: " . $mapping['id'] . ", field: " . $mapping['field_label']); +// } +// error_log("Inserting into import_data_details - Mapping ID: " . $mapping['id'] . ", Field Value: " . var_export($fieldValue, true) . ", Is Manual: " . $mapping['is_manual'] . ", Excel Column: " . ($mapping['excel_column'] ?? 'N/A') . ", Manual Default: " . ($mapping['manual_default'] ?? 'N/A')); +// $stmt = $pdo->prepare("INSERT INTO import_data_details (id, mapping_id, field_value) VALUES (?, ?, ?)"); +// $stmt->execute([$iddatadb, $mapping['id'], $fieldValue]); +// error_log("Inserted into import_data_details for ID $iddatadb, Mapping ID: " . $mapping['id'] . ", Field Value: " . var_export($fieldValue, true)); +// } +//} + +$insertedIds = $_POST['inserted_ids'] ?? $_SESSION['inserted_ids']; + // Recupera i dati appena inseriti con i nomi degli utenti $stmt = $pdo->prepare(" SELECT d.*, CONCAT(u.first_name, ' ', u.last_name) AS user_name @@ -221,7 +232,8 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) { .grid-header, .grid-cell { flex: 1; - min-width: 100px; + min-width: 70px; + /* Ridotto da 100px per compatibilità con pulsanti */ padding: 12px 15px; border-right: 1px solid #dee2e6; overflow: hidden; @@ -397,6 +409,25 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) { border-color: #80bdff; box-shadow: 0 0 5px rgba(0, 123, 255, 0.5); } + + /* Sovrascrivi min-width per le celle dei pulsanti */ + .grid-cell.button-cell, + .grid-header.button-header { + min-width: 70px !important; + flex: 0 0 70px !important; + } + + /* Stile per l'header dei pulsanti */ + .button-header { + min-height: 48px; + /* Altezza minima per uniformare */ + padding: 12px 0; + /* Centra verticalmente, no padding orizzontale */ + background-color: #e9ecef !important; + /* Grigio uniforme */ + border-right: 1px solid #dee2e6 !important; + /* Bordo destro coerente */ + }