12 KiB
Weldlog/Weldmap Incoming Control Popup Implementation
Overview
This document describes the file-by-file changes made to implement the Incoming Control popup functionality and file upload enhancements for Weldlog/Weldmap modules.
File Changes and Their Features
1. Database Migrations
database/migrations/2025_11_25_201715_add_fields_to_incoming_controls_for_weldlog.php
Purpose: Adds new fields to incoming_controls table for enhanced file tracking and data management.
Fields Added:
inspection_photo_file(string, nullable) - Path to inspection photo filesemail_tq_file(string, nullable) - Path to Email/TQ agreement filesemail_tq_number(string, nullable) - Email/TQ tracking numberosd_defect_akt_file(string, nullable) - Path to OSD Defect AKT filesosd_report_date(date, nullable) - OSD report datedrawing_number(string, nullable) - Drawing number for project tracking
Feature: Enables storage of additional file paths and tracking information in Incoming Control records.
database/migrations/2025_11_25_201743_add_drawing_number_to_mtos.php
Purpose: Adds drawing_number field to m_t_o_s table.
Fields Added:
drawing_number(string, nullable) - Drawing number for MTO records
Feature: Enables drawing number tracking in MTO module, which can be synced to Incoming Control.
2. AJAX Endpoints
resources/views/admin-ajax/get-incoming-for-weldlog.blade.php
Purpose: AJAX endpoint that fetches Incoming Control records for the popup based on filtering criteria.
Features:
- Filters by
component_code(required parameter) - Optional filtering by
ru_material_group(matches material in materials table) - Sorts by
id DESC(most recent first), thenrfi_date ASC - Adds
highlightflag to rows whererfi_date > welding_date(for visual warning) - Returns JSON with all relevant Incoming Control fields including new file fields
Parameters:
component_code(required) - Element code to filter byru_group(optional) - RU material group for additional filteringwelding_date(optional) - Welding date for highlight calculation
Response Format:
[
{
"id": 1,
"component_code": "...",
"rfi_date": "...",
"certificate_no": "...",
"heat_number": "...",
"highlight": true/false,
...
}
]
3. Components
resources/views/components/incoming-control-popup.blade.php
Purpose: DevExtreme Popup component with DataGrid for selecting Incoming Control records.
Features:
- Popup Window: 1250x720px, resizable, with close button
- DataGrid:
- CustomStore for dynamic data loading
- Search panel and filter row
- Pagination (15 items per page, configurable)
- Single row selection
- Row highlighting for records where RFI date > welding date
- Info Column: Shows file icons (camera, envelope, file) with links to:
- Inspection photo file
- Email/TQ file
- OSD Defect AKT file
- Column Display:
- Component Code
- Received/RFI Date (highlighted if > welding date)
- Zone (project field)
- Drawing Number
- Material Descriptions (EN/RU)
- Certificate No
- Heat No
- Received Quantity
- Certificate Date
- Constructor/Supplier
- Email/TQ Number
- OSD Report Date
- Selection: Double-click or single selection to choose record
- Callback: Passes selected data to callback function
Global Functions:
window.showIncomingControlPopup(options)- Opens popup with parameterswindow.setupIncomingControlPopupHelpers(dataGrid)- Attaches magnifier icons to target cells
resources/views/components/table/datagrid/file-link.blade.php
Purpose: New component for rendering file links in DataGrid cells (separate from link-search to avoid breaking existing functionality).
Features:
- Icon Display: Shows custom HTML icon (default: PDF icon)
- Link Generation: Creates clickable links to files
- Show Value Option: Can hide/show file path text (
show_valueparameter) - Editable Support: Can make cells editable with
allowEditingparameter - Placeholder Support: Custom placeholder text for editable cells
- Empty String Validation: Properly handles null, undefined, and empty string values
- Stop Propagation: Prevents grid editing when clicking file icon
Configuration Options:
html- Custom icon HTML (default:<i class="fa fa-file-pdf"></i>)show_value- Show/hide file path text (default: true)allowEditing- Enable cell editing (default: false)placeholder- Placeholder text for editable cells
Usage:
'pdf_engineering' => [
'type' => 'file-link',
'html' => '<i class="fa fa-pdf"></i>',
'show_value' => false
]
4. View Files - Incoming Control
resources/views/admin/type/incoming-control.blade.php
Purpose: Main Incoming Control module view with new fields and upload sections.
Changes:
-
Block Groups Updated:
- Added
inspection_photo_file,email_tq_file,osd_defect_akt_fileto 'Files' group - Added
drawing_numberto 'Project Info' group - Added 'Email / Technical Query Tracking' group with
email_tq_number - Added 'OSD Defect' group with
osd_report_date
- Added
-
Relation Data:
- Added
inspection_photo_filewithfile-linktype, editable, icon-only display - Added
email_tq_filewithfile-linktype, editable, icon-only display - Added
osd_defect_akt_filewithfile-linktype, editable, icon-only display
- Added
-
Upload Sections:
- Added 3rd upload: Inspection Photos (
10004_Incoming_inspection_Photos/) - Added 4th upload: Email/TQ Files (
10005_Material_Agreement/) - Added 5th upload: OSD Defect AKT (
10003_Defect_Akt/) - Configured accepted file types for each upload
- Added 3rd upload: Inspection Photos (
-
Editor Preparing:
- Added manual file column handling for new file fields
- Enables text box editing with placeholder for file path input
-
MTO Sync:
- Added
drawing_numberto sync from MTO to Incoming Control
- Added
Features:
- File upload for inspection photos, email/TQ files, and OSD defect files
- Editable file path columns with placeholders
- Drawing number synchronization from MTO
- Icon-only display for file columns (cleaner UI)
5. View Files - Weldmap/Weldlog
resources/views/admin/type/weldmap/main.blade.php
Purpose: Weldmap module main view with PDF columns and popup integration.
Changes:
-
PDF Columns Updated:
- Changed
pdf_engineering,pdf_spool_iso,pdf_as_buildfromlink-searchtofile-link - Added
show_value => falseto display only icons (no file path text)
- Changed
-
Popup Integration:
- Added
@include("components.incoming-control-popup")before datagrid script
- Added
Features:
- PDF columns show only icons (cleaner interface)
- Popup component available for certificate/heat number selection
resources/views/admin/type/weldmap/datagrid-script.blade.php
Purpose: Weldmap DataGrid JavaScript configuration with popup helper integration.
Changes:
- Initialized Function:
- Added call to
window.setupIncomingControlPopupHelpers(dataGrid)after WPS guard attachment
- Added call to
Features:
- Attaches magnifier icons to
certificate_number_of_1/2andheat_number_1/2cells - Icons trigger popup when clicked
- Popup filters data based on element code and RU material group
- Selected data auto-fills certificate and heat number fields
6. View Files - MTO
resources/views/admin/type/mto.blade.php
Purpose: MTO module view with drawing number field.
Changes:
- Block Groups:
- Added
drawing_numberto 'General Information' group
- Added
Features:
- Drawing number can be entered in MTO
- Synced to Incoming Control during MTO sync operation
7. Upload Components
resources/views/admin/type/document/upload.blade.php
Purpose: Document upload modal with multiple upload sections.
Changes:
-
Upload Sections:
- Added support for 4th and 5th upload sections (conditional display)
- Added
acceptedFilesconfiguration for each upload section - Added
data-upload-labelattribute to forms
-
Dropzone Configuration:
- Dynamic Dropzone initialization based on available upload sections
- Configurable accepted file types per section
- Success callback with SweetAlert showing uploaded file path
-
SweetAlert Integration:
- Shows uploaded file path in textarea (selectable)
- "Copy to clipboard" button for easy path copying
- Prevents accidental modal closure
Features:
- Up to 5 upload sections (configurable per module)
- Different accepted file types per section
- User-friendly path display and copying
- Archive previous versions when replacing files
resources/views/admin-ajax/document-upload.blade.php
Purpose: Backend endpoint for handling file uploads.
Changes:
- Path Normalization:
- Changed path construction to use
trim()for folder cleaning - Returns path in format:
storage/documents/{folder}/{filename}
- Changed path construction to use
Features:
- Consistent path format for all uploaded files
- Archive functionality for replaced files
- Document history tracking
- Normalized paths work correctly with file-link component
Feature Summary
1. Incoming Control Popup
- Trigger: Magnifier icon in certificate/heat number cells
- Filtering: By component code and RU material group
- Highlighting: Rows where RFI date > welding date
- Selection: Auto-fills certificate and heat number fields
- Files Display: Shows icons for inspection photos, email/TQ, and OSD files
2. File Upload Enhancements
- Multiple Sections: Up to 5 upload sections per module
- File Types: Configurable accepted file types per section
- Path Display: SweetAlert with copy-to-clipboard functionality
- Path Format: Normalized
storage/documents/...format
3. New File Fields
- Inspection Photos: Photo upload with dedicated folder
- Email/TQ Tracking: File and number tracking
- OSD Defect: File upload and report date
- Drawing Number: Added to both MTO and Incoming Control
4. File Display Component
- file-link Component: New component for file columns
- Icon-Only Mode: Can hide file path text
- Editable Support: Can make file paths editable
- Backward Compatible: Doesn't affect existing link-search usage
5. Data Synchronization
- MTO to Incoming Control: Drawing number syncs automatically
- File Paths: Normalized format ensures consistency
Testing Checklist
- Incoming Control popup opens from weldmap/weldlog certificate/heat number cells
- Popup filters correctly by component code
- Highlighting works for RFI date > welding date
- Selected data fills certificate and heat number fields
- File upload sections work (3rd, 4th, 5th)
- Uploaded file paths display in SweetAlert
- Copy-to-clipboard button works
- PDF icons display in weldmap (no file path text)
- File icons display in incoming control (no file path text)
- Drawing number syncs from MTO to Incoming Control
- File paths are normalized correctly
- Editable file columns work with placeholders
Technical Notes
-
Component Separation:
file-linkwas created as a new component to avoid breaking existinglink-searchfunctionality used in other modules. -
Path Normalization: All file paths are normalized to
storage/documents/{folder}/{file}format to ensure consistent access. -
Popup State Management: Uses global
popupStateobject to manage popup instance, data source, and callback functions. -
Highlighting Logic: RFI date comparison is done server-side to reduce client-side processing.
-
Backward Compatibility: All changes are additive - existing functionality remains unchanged.