# Repair Log User Guide ## What is the Repair Log Module? The Repair Log module tracks and manages repair activities and maintenance records. This module helps monitor repair work, track repair history, and ensure proper repair documentation and management. ## Getting Started To access Repair Log: 1. Login to the system 2. Click on **QC** in the main menu 3. Select **Repair Log** from the submenu ## Key Features ### Primary Functions - **Repair Tracking**: Track repair activities and progress - **History Management**: Manage repair history and records - **Documentation**: Maintain repair documentation - **Status Monitoring**: Monitor repair status and completion ### Secondary Functions - **Report Generation**: Generate repair reports and analytics - **Cost Tracking**: Track repair costs and expenses - **Resource Management**: Manage repair resources and materials - **Quality Control**: Monitor repair quality and standards ## How to Use ### Managing Repair Logs 1. Click **"Add Repair"** button 2. Select item for repair 3. Enter repair details and requirements 4. Assign repair personnel 5. Set repair schedule and timeline 6. Track repair progress 7. Document repair completion ### Repair Management 1. Review repair requirements and scope 2. Assign repair personnel and resources 3. Monitor repair progress and status 4. Track repair costs and materials 5. Document repair completion ### Repair Categories - **Equipment Repairs**: Equipment maintenance and repair - **Component Repairs**: Component repair and replacement - **System Repairs**: System maintenance and repair - **Emergency Repairs**: Emergency repair activities ## Best Practices ### Usage Guidelines - ✅ Document repair activities promptly - ✅ Track repair progress accurately - ✅ Monitor repair quality and standards - ✅ Maintain comprehensive repair records ### Quality Assurance - ✅ Verify repair documentation accuracy - ✅ Ensure proper repair procedures - ✅ Monitor repair effectiveness - ✅ Regular review of repair processes ## Troubleshooting ### Common Issues 1. **Log not saving**: Check all required fields are completed 2. **Progress tracking errors**: Verify repair status and updates 3. **Documentation issues**: Check document upload and format ### Getting Help - Contact the QC department for technical support - Consult repair log procedures and guidelines - Check repair data and documentation ## Repair Log Data Sync (@guide) The `resources/views/admin-ajax/repair-log.blade.php` view keeps the `repair_logs` table aligned with real-time weld information and exposes the data as JSON: - **Source scan**: Loads all records from `weld_logs` and iterates every registered log type (`log_test_types()`). - **Filtering logic**: Keeps only joints whose `{type}_result` value is neither `null`, blank, nor `"Accept / Годен"`, ensuring problem joints stay on the follow-up list. The unique key is `iso_number + no_of_the_joint_as_per_as_built_survey`. - **Record preparation**: Clones the weld row, refreshes `created_at` / `updated_at`, drops the original `id`, and marks `repair_status` as `Done` when all log results equal `"Accept / Годен"`. - **Upsert behaviour**: Uses `updateOrInsert` on `repair_logs` with the joint identity (ISO + joint number) to maintain a single row per joint. - **Cleanup and caching**: After syncing, filters out stale rows, serialises the active set via `json_encode_tr`, stores it in `setting('repairLogs')`, and prints the same JSON for consumers. When extending the module: - Add new log types by updating `log_test_types()`. - Keep field names consistent with `weld_logs` schema so the upsert patch stays valid. - Leverage the cached `repairLogs` setting instead of querying the table when you only need the filtered dataset. ## Repair Log Veri Senkronizasyonu (Türkçe Özet) `resources/views/admin-ajax/repair-log.blade.php` görünümü `repair_logs` tablosunu kaynak kayıtlardaki kaynak (weld) verileriyle eşleştirip JSON olarak dışa aktarır: - **Kaynak taraması**: `weld_logs` tablosundaki tüm kayıtları ve `log_test_types()` çıktısındaki türleri dolaşır. - **Filtreleme mantığı**: `{type}_result` alanı boş, `null` ya da `"Accept / Годен"` olmayan eklemleri listede tutar; benzersiz anahtar ISO numarası ile birleştirilen eklem numarasıdır. - **Kayıt hazırlığı**: Kaynağın bir kopyasını oluşturur, `created_at` / `updated_at` değerlerini günceller, `id` alanını kaldırır; tüm sonuçlar `"Accept / Годен"` ise `repair_status = "Done"` olarak işaretler. - **Upsert davranışı**: Her eklem için (ISO + eklem numarası) `updateOrInsert` çağırarak `repair_logs` tablosunda tekil kaydı korur. - **Temizlik ve önbellek**: Senkron sonrası geçersiz kayıtları ayıklar, `json_encode_tr` ile serileştirir, `setting('repairLogs')` anahtarına yazar ve aynı JSON çıktısını döndürür. Modülü genişletirken: - Yeni test türleri için `log_test_types()` fonksiyonunu güncelleyin. - `weld_logs` şemasıyla alan uyumuna dikkat edin ki upsert işlemi sorunsuz çalışsın. - Sadece filtrelenmiş veri gerekiyorsa tabloyu tekrar sorgulamak yerine `repairLogs` ayarını kullanın.