63 Commits

Author SHA1 Message Date
dhanabalan
d7d27a9dc0 added unwanted enters in between code for testing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Laravel Pint / pint (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Gemini PR Review / review (pull_request) Has been cancelled
2025-12-02 12:16:34 +05:30
dhanabalan
e525e3c526 decreased font size of the sticker printing table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 38s
Laravel Larastan / larastan (pull_request) Failing after 2m18s
Laravel Pint / pint (pull_request) Has been cancelled
2025-12-02 08:35:17 +05:30
dhanabalan
caf2f3c1e7 corrected logic in sticker printing page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 38s
Laravel Larastan / larastan (pull_request) Failing after 2m24s
Laravel Pint / pint (pull_request) Failing after 2m7s
2025-12-02 08:24:22 +05:30
dhanabalan
2ceb76f008 Added ref no above the qr code in sticker printing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 27s
Laravel Larastan / larastan (pull_request) Failing after 2m15s
Laravel Pint / pint (pull_request) Failing after 7m11s
2025-12-01 17:50:30 +05:30
dhanabalan
988d109acc Added serial qr code validation in create page of sticker printing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 22s
Laravel Larastan / larastan (pull_request) Failing after 2m15s
Laravel Pint / pint (pull_request) Failing after 2m13s
2025-12-01 17:41:00 +05:30
dhanabalan
bc8163a535 chnaged indentation in item resource page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Failing after 2m22s
Laravel Larastan / larastan (pull_request) Failing after 2m29s
2025-12-01 17:39:58 +05:30
dhanabalan
6834e37429 Added crt logic policy for sticker printing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 24s
Laravel Larastan / larastan (pull_request) Failing after 2m20s
Laravel Pint / pint (pull_request) Failing after 2m25s
2025-12-01 16:20:19 +05:30
dhanabalan
a9012ffc05 commented logic for sticker prinitng policy
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 22s
Laravel Larastan / larastan (pull_request) Failing after 2m23s
Laravel Pint / pint (pull_request) Failing after 2m15s
2025-12-01 15:56:46 +05:30
dhanabalan
c67bbc02b6 Added sticker printing policy
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 23s
Laravel Pint / pint (pull_request) Failing after 2m30s
Laravel Larastan / larastan (pull_request) Failing after 3m4s
2025-12-01 15:41:56 +05:30
dhanabalan
d71837f314 commented all line sof cod ein sticker printing policy
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Failing after 1m55s
Laravel Larastan / larastan (pull_request) Failing after 2m5s
2025-12-01 15:39:39 +05:30
dhanabalan
36a50815f9 commented user model class in spatie page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Failing after 2m3s
Laravel Larastan / larastan (pull_request) Failing after 2m13s
2025-12-01 15:24:58 +05:30
dhanabalan
11678dd846 Added permissions for import and export for sticker printing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 23s
Laravel Larastan / larastan (pull_request) Failing after 2m4s
Laravel Pint / pint (pull_request) Failing after 2m5s
2025-12-01 14:59:54 +05:30
dhanabalan
035e6cd560 Updated item selection logic in StickerMasterResource to return an empty array when no plant is selected
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / review (pull_request) Failing after 27s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Laravel Larastan / larastan (pull_request) Failing after 2m6s
Laravel Pint / pint (pull_request) Failing after 2m7s
2025-12-01 14:53:15 +05:30
dhanabalan
91deb448ef Added print button for sticker printing page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 25s
Laravel Larastan / larastan (pull_request) Failing after 2m9s
Laravel Pint / pint (pull_request) Failing after 2m25s
2025-12-01 14:50:31 +05:30
dhanabalan
c05b536253 Added sticker printing create resource file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Gemini PR Review / review (pull_request) Failing after 24s
Laravel Pint / pint (pull_request) Failing after 2m4s
Laravel Larastan / larastan (pull_request) Failing after 2m19s
2025-12-01 14:48:17 +05:30
dhanabalan
10071413a1 Added sticker printing livewire page for table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / review (pull_request) Failing after 23s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Laravel Pint / pint (pull_request) Failing after 2m19s
Laravel Larastan / larastan (pull_request) Failing after 2m24s
2025-12-01 14:45:17 +05:30
dhanabalan
624e18e18d Added pdf qr code for sticker print page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Larastan / larastan (pull_request) Failing after 2m9s
Laravel Pint / pint (pull_request) Failing after 2m18s
2025-12-01 14:43:59 +05:30
dhanabalan
11bbad0cf8 Added sticker printing policy page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / review (pull_request) Failing after 24s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Laravel Larastan / larastan (pull_request) Failing after 2m21s
Laravel Pint / pint (pull_request) Failing after 2m20s
2025-12-01 14:43:02 +05:30
dhanabalan
6ac3c664dd Added sticker prinitng import and export file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 27s
Laravel Larastan / larastan (pull_request) Failing after 2m3s
Laravel Pint / pint (pull_request) Failing after 2m16s
2025-12-01 14:42:01 +05:30
dhanabalan
10f2909b0e Added sticker printing resource file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / review (pull_request) Failing after 26s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Larastan / larastan (pull_request) Failing after 2m2s
Laravel Pint / pint (pull_request) Failing after 2m7s
2025-12-01 14:40:58 +05:30
dhanabalan
e8ed47a110 Added sticker printing model file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / review (pull_request) Failing after 22s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Larastan / larastan (pull_request) Failing after 1m55s
Laravel Pint / pint (pull_request) Failing after 2m17s
2025-12-01 14:39:17 +05:30
dhanabalan
055d7707f4 Added sticker printing migration file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / review (pull_request) Failing after 24s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Larastan / larastan (pull_request) Failing after 2m4s
Laravel Pint / pint (pull_request) Failing after 2m16s
2025-12-01 14:38:06 +05:30
dhanabalan
55cf2f6924 Added user model class in spatie
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 27s
Laravel Pint / pint (pull_request) Failing after 2m0s
Laravel Larastan / larastan (pull_request) Failing after 2m14s
2025-12-01 14:36:13 +05:30
dhanabalan
d389136223 Refactor processSerialNumber method to improve package validation logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 22s
Laravel Larastan / larastan (pull_request) Failing after 2m3s
Laravel Pint / pint (pull_request) Failing after 2m18s
2025-12-01 13:58:15 +05:30
dhanabalan
173638cd19 Refactor plant selection logic in ItemResource and StickerMasterResource to order by code
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 22s
Laravel Larastan / larastan (pull_request) Failing after 2m19s
Laravel Pint / pint (pull_request) Failing after 2m50s
2025-12-01 10:09:22 +05:30
dhanabalan
c8c38a05f4 Added Quality mail alert in alert mail page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m0s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 52s
Gemini PR Review / review (pull_request) Failing after 1m10s
Laravel Pint / pint (pull_request) Failing after 2m20s
Laravel Larastan / larastan (pull_request) Failing after 2m37s
2025-12-01 09:57:34 +05:30
dhanabalan
5f4494f5aa Refactor content method in InvoiceDataMail to use null-safe operator for document_date check
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Larastan / larastan (pull_request) Failing after 2m44s
Laravel Pint / pint (pull_request) Failing after 2m34s
2025-11-29 18:27:56 +05:30
dhanabalan
9fa73b2ecc Added proper imports for mail
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Pint / pint (pull_request) Failing after 2m19s
Laravel Larastan / larastan (pull_request) Failing after 2m39s
2025-11-29 18:27:23 +05:30
dhanabalan
d75d435456 Uncommented the mail schedule logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Larastan / larastan (pull_request) Failing after 2m1s
Laravel Pint / pint (pull_request) Failing after 2m0s
Gemini PR Review / review (pull_request) Failing after 26s
2025-11-29 18:02:25 +05:30
dhanabalan
ff8aa8b536 Update startDate logic in InvoiceDataMail content method to handle null document_date
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m15s
Laravel Larastan / larastan (pull_request) Failing after 3m7s
2025-11-29 17:54:12 +05:30
dhanabalan
53f0a7bfdf Refactor InvoiceDataMail class for improved readability and consistency and __construct arg passing $tableData instead of $tableData = []
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2025-11-29 17:37:16 +05:30
dhanabalan
1aa1937b39 Updated warning message against tube_sticker and pack_slip master data
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Pint / pint (pull_request) Successful in 2m16s
Laravel Larastan / larastan (pull_request) Failing after 3m17s
2025-11-29 17:20:07 +05:30
dhanabalan
0812484926 Clear process_order if plant not selected
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Pint / pint (pull_request) Successful in 2m17s
Laravel Larastan / larastan (pull_request) Failing after 2m47s
2025-11-29 16:16:57 +05:30
dhanabalan
2d4700c9b2 Added reactive validation for plant selection and duplicate checks for coil and SFG numbers in ProcessOrder form
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Pint / pint (pull_request) Successful in 2m0s
Laravel Larastan / larastan (pull_request) Failing after 2m57s
2025-11-29 16:11:41 +05:30
dhanabalan
eb38f4ddcf commented out machine ID validation logic in storeProcessOrderData method
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 31s
Laravel Pint / pint (pull_request) Successful in 2m46s
Laravel Larastan / larastan (pull_request) Failing after 14m10s
2025-11-29 15:36:54 +05:30
dhanabalan
faaaa88e8f Updated get hasPumpQr status from pack_slip_pump if it does not exist in tube_sticker_pump
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 31s
Laravel Pint / pint (pull_request) Successful in 3m37s
Laravel Larastan / larastan (pull_request) Failing after 7m56s
2025-11-29 14:29:52 +05:30
dhanabalan
d6c7e43715 Updated sfg_number validations as optional and check duplcate only if it exist
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m48s
Laravel Larastan / larastan (pull_request) Failing after 4m30s
2025-11-29 12:21:17 +05:30
dhanabalan
f45bb7b74b commented alert mail rules logic from boot method
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 25s
Laravel Pint / pint (pull_request) Successful in 2m18s
Laravel Larastan / larastan (pull_request) Failing after 2m46s
2025-11-29 11:45:37 +05:30
dhanabalan
80806d0f17 Added schedule method logic in app service provider
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / review (pull_request) Failing after 33s
Laravel Larastan / larastan (pull_request) Failing after 2m12s
Laravel Pint / pint (pull_request) Failing after 2m14s
2025-11-29 10:42:20 +05:30
dhanabalan
2b3db1cde1 feat: Add LogClear command to clear Laravel log files
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 27s
Laravel Larastan / larastan (pull_request) Failing after 2m1s
Laravel Pint / pint (pull_request) Failing after 2m25s
2025-11-27 11:55:21 +05:30
dhanabalan
bf1ae76334 Updated POST API log message
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2025-11-27 11:53:50 +05:30
dhanabalan
01783c4fc7 Updated report view logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 20s
Laravel Larastan / larastan (pull_request) Failing after 1m59s
Laravel Pint / pint (pull_request) Failing after 2m18s
2025-11-27 11:07:04 +05:30
dhanabalan
95c909b6ac Refactor: Clean up imports and enhance form/table structure in InvoiceDataValidation and InvoiceOutValidation resources
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Laravel Larastan / larastan (pull_request) Failing after 2m1s
Laravel Pint / pint (pull_request) Failing after 2m7s
Gemini PR Review / review (pull_request) Failing after 44s
2025-11-27 10:59:00 +05:30
dhanabalan
c16c967757 feat: Add validation rules for Machine and Work Center names; enhance ProcessOrder table sorting; refactor StickerMasterResource for improved readability and functionality
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 25s
Laravel Pint / pint (pull_request) Failing after 2m2s
Laravel Larastan / larastan (pull_request) Failing after 2m37s
2025-11-27 10:18:36 +05:30
dhanabalan
27b4377e9e Updated error response codes in updateGR and related methods to return 404 for various validation errors and Added sfg_number duplicate warning
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 22s
Laravel Pint / pint (pull_request) Failing after 2m14s
Laravel Larastan / larastan (pull_request) Failing after 2m23s
2025-11-27 08:33:31 +05:30
dhanabalan
36e51ad6cb Enhanced storeProcessOrderData method with improved validation and error handling for plant code, item code, coil number, order quantity, received quantity, SFG number, machine ID, and created by
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 24s
Laravel Larastan / larastan (pull_request) Failing after 2m12s
Laravel Pint / pint (pull_request) Failing after 2m26s
2025-11-26 19:48:52 +05:30
dhanabalan
73d863b200 Refactored ProcessOrderImporter to standardize column headers and improve error messaging
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 23s
Laravel Larastan / larastan (pull_request) Failing after 2m3s
Laravel Pint / pint (pull_request) Failing after 2m14s
2025-11-26 19:42:46 +05:30
dhanabalan
c64fbf209e Added sfg_number and machine_name column into exporter file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
2025-11-26 19:39:06 +05:30
dhanabalan
a018b0d06f Added sfg_number and machine_name column into resource file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
2025-11-26 19:36:56 +05:30
dhanabalan
4c93c3cdd6 Added sfg_number and machine_name into model file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
2025-11-26 19:34:58 +05:30
dhanabalan
a7b6d72fb5 Added migration for add sfg_number and machine_name columns
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
2025-11-26 19:33:21 +05:30
dhanabalan
ded043ba16 Added POST API logs to view the structure in command prompt
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 22s
Laravel Larastan / larastan (pull_request) Failing after 2m15s
Laravel Pint / pint (pull_request) Failing after 2m9s
2025-11-26 16:57:23 +05:30
dhanabalan
ae3d8224ad Uncomment scheduling logic in console.php for production, invoice, and invoice data reports
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 25s
Laravel Pint / pint (pull_request) Failing after 2m20s
Laravel Larastan / larastan (pull_request) Failing after 2m26s
2025-11-26 14:39:11 +05:30
dhanabalan
88d8bd6c2c Refactor console.php to clean up commented-out scheduling code
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 24s
Laravel Pint / pint (pull_request) Successful in 2m40s
Laravel Larastan / larastan (pull_request) Failing after 3m25s
2025-11-26 14:29:29 +05:30
dhanabalan
b62505d064 Change database connection from SQLite to PostgreSQL in .env.example
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 24s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Laravel Larastan / larastan (pull_request) Failing after 2m3s
Laravel Pint / pint (pull_request) Failing after 2m11s
2025-11-26 14:13:22 +05:30
dhanabalan
699103b047 Refactor composer install command in workflow files for Larastan and Laravel Pint
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Laravel Pint / pint (pull_request) Failing after 2m19s
Laravel Larastan / larastan (pull_request) Failing after 2m13s
Gemini PR Review / review (pull_request) Failing after 19s
2025-11-26 14:06:52 +05:30
dhanabalan
346aaf1438 Added schema line in console.php
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Successful in 1m19s
Laravel Larastan / larastan (pull_request) Failing after 5m15s
Laravel Pint / pint (pull_request) Failing after 2m33s
2025-11-25 17:22:33 +05:30
dhanabalan
d7b6e8c111 Enhance get_testing_data response with additional fields as requested_date and null safety
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 9s
Gemini PR Review / review (pull_request) Successful in 1m4s
Laravel Pint / pint (pull_request) Failing after 2m51s
Laravel Larastan / larastan (pull_request) Failing after 6m19s
2025-11-25 16:11:19 +05:30
dhanabalan
ecac9fe0e9 Update PHP version to 8.4 in Larastan and Laravel Pint workflows
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Laravel Larastan / larastan (pull_request) Failing after 3m21s
Laravel Pint / pint (pull_request) Failing after 3m29s
Gemini PR Review / review (pull_request) Successful in 1m0s
2025-11-25 14:45:48 +05:30
dhanabalan
bfb4dd3643 Add Larastan configuration and dependencies for static analysis
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Successful in 54s
Laravel Pint / pint (pull_request) Failing after 1m47s
Laravel Larastan / larastan (pull_request) Failing after 1m52s
2025-11-25 14:39:14 +05:30
ee02c24fbc Merge pull request 'Add .github/workflows/laravel-pint.yaml' (#3) from runner/pint into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #3
2025-11-25 08:59:54 +00:00
caa9538198 Update .github/workflows/laravel-pint.yaml
Some checks failed
Laravel Pint / pint (pull_request) Failing after 1m46s
2025-11-25 08:05:04 +00:00
3febb24d1d Add .github/workflows/laravel-pint.yaml
Some checks failed
Laravel Pint / pint (pull_request) Failing after 2m22s
2025-11-25 07:44:18 +00:00
42 changed files with 4063 additions and 2442 deletions

View File

@@ -21,7 +21,7 @@ LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
DB_CONNECTION=pgsql
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel

32
.github/workflows/larastan.yaml vendored Normal file
View File

@@ -0,0 +1,32 @@
# Filenme: .github/workflows/larastan.yaml
name: Laravel Larastan
on:
pull_request:
workflow_dispatch:
jobs:
larastan:
runs-on: ubuntu-latest
steps:
# Reinstall system libraries to ensure compatibility
- name: Ensure system libraries are up-to-date
run: |
sudo apt-get update
sudo apt-get install --reinstall --yes git libc6
- uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
- name: Install dependencies
run: composer install
# Run larastan code quality checks
- name: Run Larastan
run: vendor/bin/phpstan analyse --no-progress --memory-limit=2G

32
.github/workflows/laravel-pint.yaml vendored Normal file
View File

@@ -0,0 +1,32 @@
# Filename: .github/workflows/laravel-pint.yaml
name: Laravel Pint
on:
pull_request:
workflow_dispatch:
jobs:
pint:
runs-on: ubuntu-latest
steps:
# Reinstall system libraries to ensure compatibility
- name: Ensure system libraries are up-to-date
run: |
sudo apt-get update
sudo apt-get install --reinstall --yes git libc6
- uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
- name: Install dependencies
run: composer install --prefer-dist --no-interaction
# Run pint in test mode, check only files different from master branch
- name: Run Laravel Pint in test mode
run: vendor/bin/pint --test --diff=master

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class LogClear extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:log-clear';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
file_put_contents(storage_path('logs/laravel.log'), '');
$this->info('Laravel log cleared!');
}
}

View File

@@ -14,6 +14,7 @@ class ProcessOrderExporter extends Exporter
public static function getColumns(): array
{
static $rowNumber = 0;
return [
ExportColumn::make('no')
->label('NO')
@@ -21,8 +22,8 @@ class ProcessOrderExporter extends Exporter
// Increment and return the row number
return ++$rowNumber;
}),
ExportColumn::make('plant.name')
->label('PLANT NAME'),
ExportColumn::make('plant.code')
->label('PLANT CODE'),
ExportColumn::make('item.code')
->label('ITEM CODE'),
ExportColumn::make('process_order')
@@ -33,6 +34,10 @@ class ProcessOrderExporter extends Exporter
->label('ORDER QUANTITY'),
ExportColumn::make('received_quantity')
->label('RECEIVED QUANTITY'),
ExportColumn::make('sfg_number')
->label('SFG NUMBER'),
ExportColumn::make('machine_name')
->label('MACHINE ID'),
ExportColumn::make('created_at')
->label('CREATED AT'),
ExportColumn::make('updated_at')

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Filament\Exports;
use App\Models\StickerPrinting;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;
class StickerPrintingExporter extends Exporter
{
protected static ?string $model = StickerPrinting::class;
public static function getColumns(): array
{
static $rowNumber = 0;
return [
ExportColumn::make('no')
->label('NO')
->state(function ($record) use (&$rowNumber) {
// Increment and return the row number
return ++$rowNumber;
}),
ExportColumn::make('plant.code')
->label('PLANT CODE'),
ExportColumn::make('reference_number')
->label('REFERENCE NUMBER'),
ExportColumn::make('serial_number')
->label('SERIAL NUMBER'),
ExportColumn::make('created_at')
->label('CREATED AT'),
ExportColumn::make('updated_at')
->label('UPDATED AT'),
ExportColumn::make('created_by')
->label('CREATED BY'),
ExportColumn::make('updated_by')
->label('UPDATED BY'),
ExportColumn::make('deleted_at')
->label('DELETED AT')
->enabledByDefault(false),
];
}
public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your sticker printing export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
}
return $body;
}
}

View File

@@ -6,11 +6,11 @@ use App\Models\Item;
use App\Models\Plant;
use App\Models\ProcessOrder;
use App\Models\User;
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
use Str;
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
class ProcessOrderImporter extends Importer
{
@@ -21,27 +21,28 @@ class ProcessOrderImporter extends Importer
return [
ImportColumn::make('plant')
->requiredMapping()
->exampleHeader('Plant Code')
->exampleHeader('PLANT CODE')
->example('1000')
->label('Plant Code')
->label('PLANT CODE')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('item')
->requiredMapping()
->exampleHeader('Item Code')
->exampleHeader('ITEM CODE')
->example('123456')
->label('Item Code')
->label('ITEM CODE')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('process_order')
->exampleHeader('Process Order')
->example('200000166843')
->label('Process Order')
->exampleHeader('PROCESS ORDER')
->example('202500123456')
->label('PROCESS ORDER')
->rules(['required']),
ImportColumn::make('created_by')
->exampleHeader('Created By')
->exampleHeader('CREATED BY')
->example('RAW01234')
->label('Created By'),
->label('CREATED BY')
->rules(['required']),
];
}
@@ -53,25 +54,22 @@ class ProcessOrderImporter extends Importer
$iCode = trim($this->data['item']);
if (! $plant) {
$warnMsg[] = "Plant not found";
}
else if (Str::length($iCode) < 6 || !ctype_alnum($iCode)) {
$warnMsg[] = "Invalid item code found";
}
else if(!$itemCode)
{
$warnMsg[] = "Item Code not found";
$warnMsg[] = 'Plant not found';
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
$warnMsg[] = 'Invalid item code found';
} elseif (! $itemCode) {
$warnMsg[] = 'Item Code not found';
}
$processOrder = trim($this->data['process_order'] ?? '');
if ($processOrder == '') {
$warnMsg[] = "Process Order cannot be empty";
$warnMsg[] = 'Process Order cannot be empty';
}
$user = User::where('name', $this->data['created_by'])->first();
if (! $user) {
$warnMsg[] = "User not found";
$warnMsg[] = 'User not found';
}
if ($plant && $processOrder != '') {
@@ -81,7 +79,7 @@ class ProcessOrderImporter extends Importer
->first();
if ($existingOrder && $existingOrder->item_id !== ($itemCode->id ?? null)) {
$warnMsg[] = "Same Process Order already exists for this Plant with a different Item Code";
$warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code';
}
}
@@ -93,7 +91,7 @@ class ProcessOrderImporter extends Importer
'plant_id' => $plant->id,
'item_id' => $itemCode->id,
'process_order' => trim($this->data['process_order']),
'coil_number' => "0",
'coil_number' => '0',
'order_quantity' => 0,
'received_quantity' => 0,
'created_by' => $user->name,

View File

@@ -0,0 +1,106 @@
<?php
namespace App\Filament\Imports;
use App\Models\StickerPrinting;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
use App\Models\Plant;
use App\Models\User;
use Str;
use Filament\Facades\Filament;
class StickerPrintingImporter extends Importer
{
protected static ?string $model = StickerPrinting::class;
public static function getColumns(): array
{
return [
ImportColumn::make('plant')
->requiredMapping()
->exampleHeader('PLANT CODE')
->example('1000')
->label('PLANT CODE')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('reference_number')
->exampleHeader('REFERENCE NUMBER')
->example('REF123456')
->label('REFERENCE NUMBER'),
ImportColumn::make('serial_number')
->exampleHeader('SERIAL NUMBER')
->example('135245325212')
->label('SERIAL NUMBER'),
// ImportColumn::make('created_by')
// ->exampleHeader('CREATED BY')
// ->example('RAW01234')
// ->label('CREATED BY'),
];
}
public function resolveRecord(): ?StickerPrinting
{
// return StickerPrinting::firstOrNew([
// // Update existing records, matching them by `$this->data['column_name']`
// 'email' => $this->data['email'],
// ]);
$warnMsg = [];
$plant = Plant::where('code', $this->data['plant'])->first();
if (Str::length($this->data['serial_number']) < 9 || !ctype_alnum($this->data['serial_number'])) {
$warnMsg[] = "Invalid serial number found";
}
$existing = StickerPrinting::where('plant_id', $plant->id)
->where('serial_number', $this->data['serial_number'])
->first();
if ($existing) {
$warnMsg[] = "Serial number already exists for this plant!";//throw new RowImportFailedException("Serial number already exists for this plant!");
}
$serial = $this->data['serial_number'];
// --- Check duplicate in DB ---
$existsInDB = StickerPrinting::where('plant_id', $plant->id)
->where('serial_number', $serial)
->first();
if ($existsInDB) {
//throw new RowImportFailedException("Serial number '{$serial}' already exists in DB for this plant!");
$warnMsg[] = "Serial number '{$serial}' already exists in DB for this plant!";
}
if (!empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg));
}
StickerPrinting::Create([
'plant_id' => $plant->id,
'reference_number' => $this->data['reference_number'],
'serial_number' => $this->data['serial_number'],
'created_at' => now(),
'updated_at' =>now(),
'created_by' => Filament::auth()->user()?->name,
]);
return null;
//return new StickerPrinting();
}
public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your sticker printing import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
}
return $body;
}
}

View File

@@ -50,7 +50,7 @@ class AlertMailRuleResource extends Resource
'InvoiceValidation' => 'InvoiceValidation',
'InvoiceDataReport' => 'InvoiceDataReport',
'ProductionQuantities' => 'ProductionQuantities',
//'Calibration' => 'Calibration',
'QualityValidation' => 'QualityValidation',
]),
Forms\Components\Select::make('rule_name')
->label('Rule Name')
@@ -60,7 +60,7 @@ class AlertMailRuleResource extends Resource
'MaterialInvoiceMail' => 'Material Invoice Mail',
'ProductionMail' => 'Production Mail',
'InvoiceDataMail' => 'Invoice Data Mail',
//'CalibrationMail' => 'Calibration Mail',
'QualityMail' => 'Quality Mail',
])
->required(),
Forms\Components\TextInput::make('email')

View File

@@ -4,27 +4,23 @@ namespace App\Filament\Resources;
use App\Filament\Exports\InvoiceDataValidationExporter;
use App\Filament\Resources\InvoiceDataValidationResource\Pages;
use App\Filament\Resources\InvoiceDataValidationResource\RelationManagers;
use App\Models\InvoiceDataValidation;
use App\Models\Plant;
use DB;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Notifications\Notification;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Facades\Filament;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Notifications\Notification;
use App\Models\Plant;
use Filament\Forms\Get;
use Illuminate\Support\Facades\Storage;
use Maatwebsite\Excel\Facades\Excel;
use App\Models\StickerMaster;
use App\Models\User;
use DB;
use Filament\Tables\Actions\ExportAction;
class InvoiceDataValidationResource extends Resource
{
@@ -67,6 +63,7 @@ class InvoiceDataValidationResource extends Resource
->label('Created By')
->default(Filament::auth()->user()?->name),
Forms\Components\Hidden::make('updated_by')
->label('Updated By')
->default(Filament::auth()->user()?->name),
]);
}
@@ -77,10 +74,12 @@ class InvoiceDataValidationResource extends Resource
->columns([
Tables\Columns\TextColumn::make('No.')
->label('No.')
->alignCenter()
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
$paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.code')
@@ -100,8 +99,8 @@ class InvoiceDataValidationResource extends Resource
->sortable(),
Tables\Columns\TextColumn::make('document_number')
->label('Document Number')
->searchable()
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('document_date')
->label('Document Date')
@@ -127,15 +126,28 @@ class InvoiceDataValidationResource extends Resource
Tables\Columns\TextColumn::make('created_at')
->label('Created At')
->alignCenter()
->searchable()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
->sortable(),
// ->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('created_by')
->label('Created By')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated At')
->alignCenter()
->searchable()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_by')
->label('Updated By')
->alignCenter()
->searchable()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->label('Deleted At')
->alignCenter()
@@ -191,12 +203,10 @@ class InvoiceDataValidationResource extends Resource
$fullPath = Storage::disk('local')->path($path);
if ($fullPath && file_exists($fullPath))
{
if ($fullPath && file_exists($fullPath)) {
$rows = Excel::toArray(null, $fullPath)[0];
if ((count($rows) - 1) <= 0)
{
if ((count($rows) - 1) <= 0) {
Notification::make()
->title('Records Not Found')
->body("Import the valid 'Invoice Data' file to proceed..!")
@@ -206,6 +216,7 @@ class InvoiceDataValidationResource extends Resource
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
@@ -226,9 +237,10 @@ class InvoiceDataValidationResource extends Resource
// $duplicateEntries = [];
$duplicateEntriesExcel = [];
foreach ($rows as $index => $row)
{
if ($index == 0) continue; // Skip header
foreach ($rows as $index => $row) {
if ($index == 0) {
continue;
} // Skip header
$DisChaDesc = trim($row[3]);
$plantCode = trim($row[4]);
@@ -246,20 +258,16 @@ class InvoiceDataValidationResource extends Resource
if (empty($CustomerCode)) {
$invalidCustomerCode[] = "Row {$index}";
}
if (empty($DocNo))
{
if (empty($DocNo)) {
$invalidDocNo[] = "Row {$index}";
}
if (empty($CusTradeName))
{
if (empty($CusTradeName)) {
$invalidCusTradeName[] = "Row {$index}";
}
if (empty($CusLocation))
{
if (empty($CusLocation)) {
$invalidCusLocation[] = "Row {$index}";
}
if (empty($Location))
{
if (empty($Location)) {
$invalidLocation[] = "Row {$index}";
}
// if (empty($createdBy)) $invalidUser[] = "Row {$index}";
@@ -269,9 +277,7 @@ class InvoiceDataValidationResource extends Resource
}
if (! is_numeric($plantCode)) {
$invalidPlantType[] = $plantCode;
}
else if (!Plant::where('code', $plantCode)->first())
{
} elseif (! Plant::where('code', $plantCode)->first()) {
$invalidPlaCoFound[] = $plantCode;
}
@@ -296,17 +302,28 @@ class InvoiceDataValidationResource extends Resource
$seenPlantDoc[] = $uniqueKey;
}
if (!empty($invalidCustomerCode) || !empty($invalidDocNo) || !empty($invalidDocDate) || !empty($invalidCusTradeName) || !empty($invalidCusLocation))
{
if (! empty($invalidCustomerCode) || ! empty($invalidDocNo) || ! empty($invalidDocDate) || ! empty($invalidCusTradeName) || ! empty($invalidCusLocation)) {
$errorMsg = '';
// if (!empty($invalidDisChaDesc)) $errorMsg .= 'Missing Distribution Channel Description in rows: ' . implode(', ', $invalidDisChaDesc) . '<br>';
if (!empty($invalidCustomerCode)) $errorMsg .= 'Missing Customer Code in rows: ' . implode(', ', $invalidCustomerCode) . '<br>';
if (!empty($invalidDocNo)) $errorMsg .= 'Missing Document Number in rows: ' . implode(', ', $invalidDocNo) . '<br>';
if (!empty($invalidDocDate)) $errorMsg .= 'Missing Document Date in rows: ' . implode(', ', $invalidDocDate) . '<br>';
if (!empty($invalidCusTradeName)) $errorMsg .= 'Missing Customer Trade Name in rows: ' . implode(', ', $invalidCusTradeName) . '<br>';
if (!empty($invalidCusLocation)) $errorMsg .= 'Missing Customer Location in rows: ' . implode(', ', $invalidCusLocation) . '<br>';
if (!empty($invalidLocation)) $errorMsg .= 'Missing Location in rows: ' . implode(', ', $invalidLocation) . '<br>';
if (! empty($invalidCustomerCode)) {
$errorMsg .= 'Missing Customer Code in rows: '.implode(', ', $invalidCustomerCode).'<br>';
}
if (! empty($invalidDocNo)) {
$errorMsg .= 'Missing Document Number in rows: '.implode(', ', $invalidDocNo).'<br>';
}
if (! empty($invalidDocDate)) {
$errorMsg .= 'Missing Document Date in rows: '.implode(', ', $invalidDocDate).'<br>';
}
if (! empty($invalidCusTradeName)) {
$errorMsg .= 'Missing Customer Trade Name in rows: '.implode(', ', $invalidCusTradeName).'<br>';
}
if (! empty($invalidCusLocation)) {
$errorMsg .= 'Missing Customer Location in rows: '.implode(', ', $invalidCusLocation).'<br>';
}
if (! empty($invalidLocation)) {
$errorMsg .= 'Missing Location in rows: '.implode(', ', $invalidLocation).'<br>';
}
Notification::make()
->title('Missing Mandatory Fields')
@@ -317,10 +334,9 @@ class InvoiceDataValidationResource extends Resource
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
else if (!empty($invalidPlantCode))
{
} elseif (! empty($invalidPlantCode)) {
$invalidPlantCode = array_unique($invalidPlantCode);
Notification::make()
->title('Invalid Plant Codes')
@@ -330,10 +346,9 @@ class InvoiceDataValidationResource extends Resource
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
else if (!empty($invalidPlantType))
{
} elseif (! empty($invalidPlantType)) {
$invalidPlantType = array_unique($invalidPlantType);
Notification::make()
->title('Invalid Plant Codes')
@@ -343,10 +358,9 @@ class InvoiceDataValidationResource extends Resource
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
else if (!empty($invalidPlaCoFound))
{
} elseif (! empty($invalidPlaCoFound)) {
$invalidPlaCoFound = array_unique($invalidPlaCoFound);
Notification::make()
->title('Invalid Plant Codes')
@@ -356,6 +370,7 @@ class InvoiceDataValidationResource extends Resource
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
@@ -401,8 +416,7 @@ class InvoiceDataValidationResource extends Resource
// return;
// }
if (!empty($duplicateEntriesExcel))
{
if (! empty($duplicateEntriesExcel)) {
$duplicateGroupedByPlantExcel = [];
foreach ($duplicateEntriesExcel as $message) {// "/Document Number '([^']+)' already exist(?:s)?(?: for Plant (.+))?/"
@@ -415,8 +429,7 @@ class InvoiceDataValidationResource extends Resource
$errorMsg = 'Duplicate Document Number found in Uploaded File :<br>';
foreach ($duplicateGroupedByPlantExcel as $plant => $docNumbers)
{
foreach ($duplicateGroupedByPlantExcel as $plant => $docNumbers) {
// Remove duplicate document numbers for each plant
$uniqueDocNumbers = array_unique($docNumbers);
$count = count($uniqueDocNumbers);
@@ -439,6 +452,7 @@ class InvoiceDataValidationResource extends Resource
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
@@ -455,10 +469,11 @@ class InvoiceDataValidationResource extends Resource
DB::beginTransaction();
try
{
try {
foreach ($rows as $index => $row) {
if ($index == 0) continue;
if ($index == 0) {
continue;
}
$rowNumber = $index + 1;
@@ -508,7 +523,7 @@ class InvoiceDataValidationResource extends Resource
'customer_trade_name' => $CusTradeName,
'customer_location' => $CusLocation,
'location' => $Location,
'updated_by' => $operatorName
'updated_by' => $operatorName,
]);
$inserted = $record;
} else {
@@ -522,7 +537,7 @@ class InvoiceDataValidationResource extends Resource
'customer_trade_name' => $CusTradeName,
'customer_location' => $CusLocation,
'location' => $Location,
'created_by' => $operatorName
'created_by' => $operatorName,
]);
}
// $inserted = InvoiceDataValidation::create([
@@ -545,7 +560,7 @@ class InvoiceDataValidationResource extends Resource
$failedRecords[] = [
'row' => $rowNumber,
'document_number' => $DocNo ?? null,
'error' => $e->getMessage()
'error' => $e->getMessage(),
];
}
}
@@ -570,9 +585,7 @@ class InvoiceDataValidationResource extends Resource
->success()
->send();
}
}
catch (\Exception $e)
{
} catch (\Exception $e) {
DB::rollBack();
Notification::make()
->title('Import Failed')

View File

@@ -4,27 +4,25 @@ namespace App\Filament\Resources;
use App\Filament\Exports\InvoiceOutValidationExporter;
use App\Filament\Resources\InvoiceOutValidationResource\Pages;
use App\Filament\Resources\InvoiceOutValidationResource\RelationManagers;
use App\Models\InvoiceOutValidation;
use App\Models\Plant;
use App\Models\User;
use Carbon\Carbon;
use DB;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Section;
use Filament\Forms\Form;
use Filament\Notifications\Notification;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Facades\Filament;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Section;
use Filament\Notifications\Notification;
use Maatwebsite\Excel\Facades\Excel;
use Storage;
use Filament\Tables\Actions\ExportAction;
use PhpOffice\PhpSpreadsheet\Shared\Date as ExcelDate;
use Storage;
class InvoiceOutValidationResource extends Resource
{
@@ -54,6 +52,7 @@ class InvoiceOutValidationResource extends Resource
->label('Created By')
->default(Filament::auth()->user()?->name),
Forms\Components\Hidden::make('updated_by')
->label('Updated By')
->default(Filament::auth()->user()?->name),
])
->columns(4),
@@ -66,15 +65,18 @@ class InvoiceOutValidationResource extends Resource
->columns([
Tables\Columns\TextColumn::make('No.')
->label('No.')
->alignCenter()
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
$paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.code')
->label('Plant')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('qr_code')
->label('QR Code')
@@ -93,8 +95,10 @@ class InvoiceOutValidationResource extends Resource
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->searchable()
->label('Created At')
->dateTime()
->searchable()
->alignCenter()
->sortable(),
// ->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('created_by')
@@ -103,17 +107,21 @@ class InvoiceOutValidationResource extends Resource
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated At')
->dateTime()
->searchable()
->sortable(),
// ->toggleable(isToggledHiddenByDefault: true),
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_by')
->label('Updated By')
->searchable()
->alignCenter()
->sortable(),
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->dateTime()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
@@ -165,12 +173,10 @@ class InvoiceOutValidationResource extends Resource
$fullPath = Storage::disk('local')->path($path);
if ($fullPath && file_exists($fullPath))
{
if ($fullPath && file_exists($fullPath)) {
$rows = Excel::toArray(null, $fullPath)[0];
if ((count($rows) - 1) <= 0)
{
if ((count($rows) - 1) <= 0) {
Notification::make()
->title('Records Not Found')
->body("Import the valid 'Invoice Data' file to proceed..!")
@@ -180,6 +186,7 @@ class InvoiceOutValidationResource extends Resource
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
@@ -194,25 +201,32 @@ class InvoiceOutValidationResource extends Resource
$duplicateQrExcel = [];
// $duplicateQrDb = [];
foreach ($rows as $index => $row)
{
if ($index == 0) continue;
foreach ($rows as $index => $row) {
if ($index == 0) {
continue;
}
$qrCode = trim($row[1]);
$plantCode = trim($row[2]);
$scannedAt = trim($row[3]);
$scannedby = trim($row[4]);
if (empty($plantCode)) $invalidPlantCode[] = "Row {$index}";
if (empty($qrCode)) $invalidqrCode[] = "Row {$index}";
if (empty($scannedAt)) $invalidScannedAt[] = "Row {$index}";
if (empty($scannedby)) $invalidScannedBy[] = "Row {$index}";
if (empty($plantCode)) {
$invalidPlantCode[] = "Row {$index}";
}
if (empty($qrCode)) {
$invalidqrCode[] = "Row {$index}";
}
if (empty($scannedAt)) {
$invalidScannedAt[] = "Row {$index}";
}
if (empty($scannedby)) {
$invalidScannedBy[] = "Row {$index}";
}
if (strlen($plantCode) < 4) {
$invalidPlantCode[] = $plantCode;
}
else if(!Plant::where('code', $plantCode)->first())
{
} elseif (! Plant::where('code', $plantCode)->first()) {
$invalidPlaCoFound[] = $plantCode;
}
@@ -237,13 +251,18 @@ class InvoiceOutValidationResource extends Resource
// }
}
if (!empty($invalidqrCode) || !empty($invalidScannedAt) || !empty($invalidScannedBy) || !empty($invalidUser))
{
if (! empty($invalidqrCode) || ! empty($invalidScannedAt) || ! empty($invalidScannedBy) || ! empty($invalidUser)) {
$errorMsg = '';
if (!empty($invalidqrCode)) $errorMsg .= 'Missing Qr code in rows: '.implode(', ', $invalidqrCode) . '<br>';
if (!empty($invalidScannedAt)) $errorMsg .= 'Missing Scanned At in rows: '.implode(', ', $invalidScannedAt) . '<br>';
if (!empty($invalidScannedBy)) $errorMsg .= 'Missing Scanned By in rows: '.implode(', ', $invalidScannedBy) . '<br>';
if (! empty($invalidqrCode)) {
$errorMsg .= 'Missing Qr code in rows: '.implode(', ', $invalidqrCode).'<br>';
}
if (! empty($invalidScannedAt)) {
$errorMsg .= 'Missing Scanned At in rows: '.implode(', ', $invalidScannedAt).'<br>';
}
if (! empty($invalidScannedBy)) {
$errorMsg .= 'Missing Scanned By in rows: '.implode(', ', $invalidScannedBy).'<br>';
}
Notification::make()
->title('Missing Mandatory Fields')
@@ -254,6 +273,7 @@ class InvoiceOutValidationResource extends Resource
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
@@ -267,6 +287,7 @@ class InvoiceOutValidationResource extends Resource
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
@@ -280,6 +301,7 @@ class InvoiceOutValidationResource extends Resource
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
@@ -293,11 +315,11 @@ class InvoiceOutValidationResource extends Resource
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
if (!empty($duplicateQrExcel))
{
if (! empty($duplicateQrExcel)) {
$duplicateGroupedByPlantQr = [];
foreach ($duplicateQrExcel as $message) {// "/Document Numbers '([^']+)' already exists for Plant Code (\S+)/"
@@ -380,10 +402,11 @@ class InvoiceOutValidationResource extends Resource
DB::beginTransaction();
try
{
try {
foreach ($rows as $index => $row) {
if ($index == 0) continue;
if ($index == 0) {
continue;
}
$rowNumber = $index + 1;
@@ -430,7 +453,7 @@ class InvoiceOutValidationResource extends Resource
$record->update([
'scanned_at' => $formattedDate,
'scanned_by' => $scannedBy,
'updated_by' => $operatorName
'updated_by' => $operatorName,
]);
$inserted = $record;
} else {
@@ -440,7 +463,7 @@ class InvoiceOutValidationResource extends Resource
'qr_code' => $qrcode,
'scanned_at' => $formattedDate,
'scanned_by' => $scannedBy,
'created_by' => $operatorName
'created_by' => $operatorName,
]);
}
// $inserted = InvoiceOutValidation::create([
@@ -460,7 +483,7 @@ class InvoiceOutValidationResource extends Resource
$failedRecords[] = [
'row' => $rowNumber,
'qrcode' => $qrcode ?? null,
'error' => $e->getMessage()
'error' => $e->getMessage(),
];
}
}
@@ -485,9 +508,7 @@ class InvoiceOutValidationResource extends Resource
->success()
->send();
}
}
catch (\Exception $e)
{
} catch (\Exception $e) {
DB::rollBack();
Notification::make()
->title('Import Failed')

View File

@@ -12,24 +12,24 @@ use App\Models\StickerMaster;
use Filament\Actions\Exports\Enums\ExportFormat;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Notifications\Notification;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Notifications\Notification;
use Illuminate\Validation\Rule;
use Maatwebsite\Excel\Facades\Excel;
use Storage;
use Str;
class ItemResource extends Resource
{
@@ -55,6 +55,7 @@ class ItemResource extends Resource
->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->default(function () {
@@ -67,10 +68,9 @@ class ItemResource extends Resource
// Ensure `linestop_id` is not cleared
if (! $plantId) {
$set('iPlantError', 'Please select a plant first.');
return;
}
else
{
} else {
$set('iPlantError', null);
}
})
@@ -97,17 +97,17 @@ class ItemResource extends Resource
// Ensure `linestop_id` is not cleared
if (! $code) {
$set('iCodeError', 'Scan the valid code.');
return;
}
else
{
} else {
if (strlen($code) < 6) {
$set('iCodeError', 'Item code must be at least 6 digits.');
return;
}
else if (!preg_match('/^[a-zA-Z0-9]{6,}$/', $code)) {
} elseif (! preg_match('/^[a-zA-Z0-9]{6,}$/', $code)) {
$set('code', null);
$set('iCodeError', 'Item code must contain only alpha-numeric characters.');
return;
}
$set('iCodeError', null);
@@ -136,13 +136,13 @@ class ItemResource extends Resource
// Ensure `linestop_id` is not cleared
if (! $hourQuan) {
$set('iHourQuanError', 'Scan the valid hourly quantity.');
return;
}
else
{
} else {
if (! preg_match('/^[0-9]{1,}$/', $hourQuan)) {
$set('hourly_quantity', null);
$set('iHourQuanError', 'Quantity must be integer value.');
return;
}
$set('iHourQuanError', null);
@@ -187,6 +187,7 @@ class ItemResource extends Resource
$paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
@@ -238,7 +239,135 @@ class ItemResource extends Resource
])
->filters([
Tables\Filters\TrashedFilter::make(),
Filter::make('advanced_filters')
->label('Advanced Filters')
->form([
Select::make('Plant')
->label('Select Plant')
->nullable()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->orderBy('code')->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get): void {
$set('code', null);
$set('operator_id', null);
}),
Select::make('code')
->label('Search by Item Code')
->nullable()
// ->options(function (callable $get) {
// $plantId = $get('Plant');
// return $plantId
// ? Item::where('plant_id', $plantId)->pluck('code', 'id')
// : Item::pluck('code', 'id');
// })
->options(function (callable $get) {
$plantId = $get('Plant');
return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
})
->searchable()
->reactive(),
TextInput::make('description')
->label('Search by Description')
->placeholder(placeholder: 'Enter Description'),
TextInput::make('category')
->label('Search by Category')
->placeholder(placeholder: 'Enter Category'),
TextInput::make('uom')
->label('Search by UOM')
->placeholder(placeholder: 'Enter UOM'),
DateTimePicker::make(name: 'created_from')
->label('Created From')
->placeholder(placeholder: 'Select From DateTime')
->reactive()
->native(false),
DateTimePicker::make('created_to')
->label('Created To')
->placeholder(placeholder: 'Select To DateTime')
->reactive()
->native(false),
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (
empty($data['Plant']) &&
empty($data['code']) &&
empty($data['description']) &&
empty($data['uom']) &&
empty($data['category']) &&
empty($data['created_from']) &&
empty($data['created_to'])
) {
return $query->whereRaw('1 = 0');
}
if (! empty($data['Plant'])) { // $plant = $data['Plant'] ?? null
$query->where('plant_id', $data['Plant']);
}
if (! empty($data['code'])) {
$query->where('id', $data['code']);
}
if (! empty($data['description'])) {
$query->where('description', '%'.$data['description'].'%');
}
if (! empty($data['uom'])) {
$query->where('uom', 'like', '%'.$data['uom'].'%');
}
if (! empty($data['category'])) {
$query->where('category', '%'.$data['category'].'%');
}
if (! empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
if (! empty($data['created_to'])) {
$query->where('created_at', '<=', $data['created_to']);
}
})
->indicateUsing(function (array $data) {
$indicators = [];
if (! empty($data['Plant'])) {
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
}
if (! empty($data['code'])) {
$indicators[] = 'Item Code: '.Item::where('id', $data['code'])->value('code');
}
if (! empty($data['description'])) {
$indicators[] = 'Description: '.$data['description'];
}
if (! empty($data['uom'])) {
$indicators[] = 'UOM: '.$data['uom'];
}
if (! empty($data['category'])) {
$indicators[] = 'Category: '.$data['category'];
}
if (! empty($data['created_from'])) {
$indicators[] = 'From: '.$data['created_from'];
}
if (! empty($data['created_to'])) {
$indicators[] = 'To: '.$data['created_to'];
}
return $indicators;
}),
])
->filtersFormMaxHeight('280px')
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
@@ -251,7 +380,6 @@ class ItemResource extends Resource
]),
])
->headerActions([
// Tables\Actions\Action::make('Import Items')
// ->label('Import Items')
// ->form([
@@ -402,7 +530,6 @@ class ItemResource extends Resource
// return;
// }
// $uniqueCodes = array_unique($materialCodes);
// $matchedItems = StickerMaster::with('item')

View File

@@ -159,6 +159,7 @@ class MachineResource extends Resource
->hintColor('danger'),
Forms\Components\TextInput::make('name')
->label('Name')
->minLength(5)
->placeholder('Scan the valid Machine Name')
->required()
->rule(function (callable $get) {
@@ -169,6 +170,7 @@ class MachineResource extends Resource
}),
Forms\Components\TextInput::make('work_center')
->label('Work Center')
->minLength(6)
->placeholder('Scan the valid Work Center')
->required()
->rule(function (callable $get) {

View File

@@ -2,29 +2,28 @@
namespace App\Filament\Resources;
use App\Filament\Exports\ProcessOrderExporter;
use App\Filament\Imports\ProcessOrderImporter;
use App\Filament\Resources\ProcessOrderResource\Pages;
use App\Filament\Resources\ProcessOrderResource\RelationManagers;
use App\Models\Plant;
use App\Models\ProcessOrder;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\Actions\Action;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Forms\Set;
use Filament\Notifications\Notification;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Storage;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
use Filament\Notifications\Notification;
use Filament\Forms\Components\Actions\Action;
use Filament\Facades\Filament;
use Smalot\PdfParser\Parser;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use App\Filament\Exports\ProcessOrderExporter;
use App\Filament\Imports\ProcessOrderImporter;
use Filament\Forms\Get;
use Filament\Forms\Set;
use Storage;
class ProcessOrderResource extends Resource
{
@@ -44,8 +43,25 @@ class ProcessOrderResource extends Resource
->relationship('plant', 'name')
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
$plantId = $get('plant_id');
$set('coil_number', null);
$set('sfg_number', null);
$set('machine_name', null);
if (! $plantId) {
$set('poPlantError', 'Please select a plant first.');
$set('coilNumberError', null);
$set('sfgNumberError', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('poPlantError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('poPlantError') ? $get('poPlantError') : null)
->hintColor('danger')
->required(),
Forms\Components\Select::make('item_id')
->label('Item Code')
@@ -58,6 +74,7 @@ class ProcessOrderResource extends Resource
if (empty($plantId)) {
return [];
}
return \App\Models\Item::where('plant_id', $plantId)->pluck('code', 'id');
})
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
@@ -92,6 +109,7 @@ class ProcessOrderResource extends Resource
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
$itemId = $get('item_id');
if ($get('id')) {
$item = \App\Models\Item::where('id', $itemId)->first()?->description;
if ($item) {
$set('item_description', $item);
@@ -105,12 +123,66 @@ class ProcessOrderResource extends Resource
->hidden()
->readOnly(),
// ->readOnly(true),
Forms\Components\TextInput::make('process_order')
->label('Process Order')
->reactive()
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
$plantId = $get('plant_id');
$set('coil_number', null);
$set('sfg_number', null);
$set('machine_name', null);
if (! $plantId) {
$set('poPlantError', 'Please select a plant first.');
$set('process_order', null);
$set('coilNumberError', null);
$set('sfgNumberError', null);
}
})
->required(),
Forms\Components\TextInput::make('coil_number')
->label('Coil Number')
->default('0')
->reactive()
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
$plantId = $get('plant_id');
$processOrder = $get('process_order');
$coilNo = $get('coil_number');
if (! $plantId) {
$set('poPlantError', 'Please select a plant first.');
$set('coil_number', null);
$set('sfg_number', null);
$set('machine_name', null);
$set('coilNumberError', null);
$set('sfgNumberError', null);
} elseif (! $processOrder) {
$set('coil_number', null);
$set('sfg_number', null);
$set('machine_name', null);
$set('poPlantError', null);
$set('coilNumberError', null);
$set('sfgNumberError', null);
} elseif ($coilNo || $coilNo == '0') {
$existing = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('coil_number', $coilNo)
->first();
if ($existing) {
$set('poPlantError', null);
$set('coil_number', null);
$set('coilNumberError', "Duplicate Coil : '{$coilNo}' found!");
} else {
$set('poPlantError', null);
$set('coilNumberError', null);
}
}
})
->extraAttributes(fn ($get) => [
'class' => $get('coilNumberError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('coilNumberError') ? $get('coilNumberError') : null)
->hintColor('danger')
->required(),
Forms\Components\TextInput::make('order_quantity')
->label('Order Quantity')
@@ -119,6 +191,40 @@ class ProcessOrderResource extends Resource
->label('Received Quantity')
->default('0')
->required(),
Forms\Components\TextInput::make('sfg_number')
->label('SFG Number')
->reactive()
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
$plantId = $get('plant_id');
$sfgNo = $get('sfg_number');
if (! $plantId) {
$set('poPlantError', 'Please select a plant first.');
$set('sfg_number', null);
$set('machine_name', null);
$set('sfgNumberError', null); // 'Please select a plant first.'
} elseif ($sfgNo) {
$existing = ProcessOrder::where('plant_id', $plantId)
->where('sfg_number', $sfgNo)
->first();
if ($existing) {
$set('poPlantError', null);
$set('sfg_number', null);
$set('machine_name', null);
$set('sfgNumberError', "Duplicate SFG : '{$sfgNo}' found!");
} else {
$set('poPlantError', null);
$set('sfgNumberError', null);
}
}
})
->extraAttributes(fn ($get) => [
'class' => $get('sfgNumberError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('sfgNumberError') ? $get('sfgNumberError') : null)
->hintColor('danger'),
Forms\Components\TextInput::make('machine_name')
->label('Machine ID'),
Forms\Components\FileUpload::make('attachment')
->label('PDF Upload')
->acceptedFileTypes(['application/pdf'])
@@ -133,8 +239,7 @@ class ProcessOrderResource extends Resource
->action(function ($get, callable $set) {
$uploadedFiles = $get('attachment');
if (is_array($uploadedFiles) && count($uploadedFiles) > 0)
{
if (is_array($uploadedFiles) && count($uploadedFiles) > 0) {
$uploaded = reset($uploadedFiles);
if ($uploaded instanceof TemporaryUploadedFile) {
@@ -148,6 +253,7 @@ class ProcessOrderResource extends Resource
->body("The file '{$originalName}' already exists in uploads/ProcessOrder.")
->warning()
->send();
return; // Stop here
}
@@ -161,20 +267,17 @@ class ProcessOrderResource extends Resource
$fullPath = storage_path('app/'.$storedPath);
// Parse PDF using smalot/pdfparser
$parser = new Parser();
$parser = new Parser;
$pdf = $parser->parseContent(file_get_contents($uploaded->getRealPath()));
$text = $pdf->getText();
// if (preg_match('/Batch ID:\s*(\d+)\s*--/i', $text, $matches))
// {
// $batchId = $matches[1];
// }
if (preg_match('/Batch ID:\s*(\d+)(?:\s*--)?/i', $text, $matches)) {
$batchId = $matches[1];
}
else
{
} else {
$batchId = null;
}
@@ -187,11 +290,11 @@ class ProcessOrderResource extends Resource
->body("Batch ID ($batchId) does not match Process Order ($processOrder)")
->danger()
->send();
return;
}
if ($batchId == $processOrder)
{
if ($batchId == $processOrder) {
// If batch matches, store the PDF permanently
$storedPath = $uploaded->storeAs(
'uploads/ProcessOrder',
@@ -204,16 +307,16 @@ class ProcessOrderResource extends Resource
->body("Batch ID matches Process Order: $batchId. PDF uploaded successfully.")
->success()
->send();
return;
}
}
}
else
{
} else {
Notification::make()
->title('No file selected to upload')
->warning()
->send();
return;
}
}),
@@ -228,6 +331,7 @@ class ProcessOrderResource extends Resource
->title('No process order entered')
->danger()
->send();
return;
}
@@ -246,6 +350,7 @@ class ProcessOrderResource extends Resource
->title('PDF not found for this process order')
->danger()
->send();
return;
}
@@ -312,6 +417,7 @@ class ProcessOrderResource extends Resource
$paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
@@ -349,12 +455,21 @@ class ProcessOrderResource extends Resource
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('sfg_number')
->label('SFG Number')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('machine_name')
->label('Machine ID')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->label('Created At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
->sortable(),
Tables\Columns\TextColumn::make('created_by')
->label('Created By')
->alignCenter()

View File

@@ -13,25 +13,23 @@ use App\Models\StickerMaster;
// use Closure;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Forms\Set;
use Filament\Notifications\Notification;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Forms\Get;
use Filament\Forms\Set;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use Illuminate\Support\Facades\Storage;
use Filament\Forms\Components\FileUpload;
use Filament\Notifications\Notification;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\TextInput;
use Filament\Tables\Filters\Filter;
use App\Models\InvoiceValidation;
// use Illuminate\Validation\Rule;
@@ -55,14 +53,14 @@ class StickerMasterResource extends Resource
->nullable()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->default(function () {
return optional(StickerMaster::latest()->first())->plant_id;
})
->disabled(fn (Get $get) => ! empty($get('id'))) // disable in edit if user try to change
->afterStateUpdated(fn (callable $set) =>
$set('item_id', null) & //when plant changed remove all the data which is in text input box
->afterStateUpdated(fn (callable $set) => $set('item_id', null) & // when plant changed remove all the data which is in text input box
$set('item_description', null) &
$set('item_error', null) &
$set('panel_box_code', null) &
@@ -123,24 +121,28 @@ class StickerMasterResource extends Resource
$set('item_id', null);
$set('item_error', null);
$set('item_description', null);
return;
}
if (blank($itemId)) {
$set('item_error', null);
$set('item_description', null);
return;
}
$availableItems = \App\Models\Item::where('plant_id', $plantId)->exists();
if (! $availableItems) {
$set('item_error', null);
return;
}
// Ensure `item_id` is not cleared
if (! $plantId || ! $itemId) {
$set('item_description', null);
return;
}
@@ -158,8 +160,7 @@ class StickerMasterResource extends Resource
$duplicateSticker = StickerMaster::where('plant_id', $plantId)
->where('item_id', $itemId)
->exists();
if(!$get('id'))
{
if (! $get('id')) {
$set('item_error', $duplicateSticker ? 'Item Code already exists for the selected plant.' : null);
}
})
@@ -242,18 +243,14 @@ class StickerMasterResource extends Resource
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($state)
{
if ($state) {
$set('panel_box_code', null);
$set('load_rate', 0);
}
if ($state !== "2")
{
if ($state !== '2') {
$set('bundle_quantity', null);
}
else
{
} else {
$set('bundle_quantity', 2);
}
// $plantId = $get('plant_id');
@@ -263,17 +260,14 @@ class StickerMasterResource extends Resource
Forms\Components\TextInput::make('bundle_quantity')
->label('Bundle Quantity')
->integer()
->readOnly(fn (callable $get) => $get('material_type') !== "2")
->readOnly(fn (callable $get) => $get('material_type') !== '2')
->nullable()
->minValue(2)
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
if($get('material_type') !== "2")
{
if ($get('material_type') !== '2') {
$set('bundle_quantity', null);
}
else if ($get('bundle_quantity') < 2)
{
} elseif ($get('bundle_quantity') < 2) {
$set('bundle_quantity', 2);
}
}),
@@ -284,8 +278,7 @@ class StickerMasterResource extends Resource
// return $get('serial_number_pumpset');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('serial_number_motor'))
{
if ($get('serial_number_motor')) {
$set('serial_number_pumpset', false);
}
})
@@ -297,8 +290,7 @@ class StickerMasterResource extends Resource
// return $get('serial_number_pumpset');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('serial_number_pump'))
{
if ($get('serial_number_pump')) {
$set('serial_number_pumpset', false);
}
})
@@ -310,8 +302,7 @@ class StickerMasterResource extends Resource
// return $get('serial_number_motor') || $get('serial_number_pump');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('serial_number_pumpset'))
{
if ($get('serial_number_pumpset')) {
$set('serial_number_motor', false);
$set('serial_number_pump', false);
}
@@ -324,8 +315,7 @@ class StickerMasterResource extends Resource
// return $get('pack_slip_pumpset');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('pack_slip_motor'))
{
if ($get('pack_slip_motor')) {
$set('pack_slip_pumpset', false);
}
})
@@ -337,8 +327,7 @@ class StickerMasterResource extends Resource
// return $get('pack_slip_pumpset');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('pack_slip_pump'))
{
if ($get('pack_slip_pump')) {
$set('pack_slip_pumpset', false);
}
})
@@ -350,8 +339,7 @@ class StickerMasterResource extends Resource
// return $get('pack_slip_motor') || $get('pack_slip_pump');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('pack_slip_pumpset'))
{
if ($get('pack_slip_pumpset')) {
$set('pack_slip_motor', false);
$set('pack_slip_pump', false);
}
@@ -364,8 +352,7 @@ class StickerMasterResource extends Resource
// return $get('name_plate_pumpset');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('name_plate_motor'))
{
if ($get('name_plate_motor')) {
$set('name_plate_pumpset', false);
}
})
@@ -377,8 +364,7 @@ class StickerMasterResource extends Resource
// return $get('name_plate_pumpset');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('name_plate_pump'))
{
if ($get('name_plate_pump')) {
$set('name_plate_pumpset', false);
}
})
@@ -390,8 +376,7 @@ class StickerMasterResource extends Resource
// return $get('name_plate_motor') || $get('name_plate_pump');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('name_plate_pumpset'))
{
if ($get('name_plate_pumpset')) {
$set('name_plate_motor', false);
$set('name_plate_pump', false);
}
@@ -404,8 +389,7 @@ class StickerMasterResource extends Resource
// return $get('tube_sticker_pumpset');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('tube_sticker_motor'))
{
if ($get('tube_sticker_motor')) {
$set('tube_sticker_pumpset', false);
}
})
@@ -417,8 +401,7 @@ class StickerMasterResource extends Resource
// return $get('tube_sticker_pumpset');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('tube_sticker_pump'))
{
if ($get('tube_sticker_pump')) {
$set('tube_sticker_pumpset', false);
}
})
@@ -431,8 +414,7 @@ class StickerMasterResource extends Resource
// return $get('tube_sticker_motor') || $get('tube_sticker_pump');
// })
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($get('tube_sticker_pumpset'))
{
if ($get('tube_sticker_pumpset')) {
$set('tube_sticker_motor', false);
$set('tube_sticker_pump', false);
}
@@ -452,7 +434,6 @@ class StickerMasterResource extends Resource
public static function table(Table $table): Table
{
return $table
->columns([
// Tables\Columns\TextColumn::make('id')
// ->label('ID')
@@ -464,6 +445,7 @@ class StickerMasterResource extends Resource
$paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
@@ -579,6 +561,7 @@ class StickerMasterResource extends Resource
if (is_null($state) || $state === '') {
return '';
}
return match ($state) {
1 => 'Individual',
2 => 'Bundle',
@@ -617,7 +600,8 @@ class StickerMasterResource extends Resource
->nullable()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->orderBy('code')->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get): void {
@@ -635,9 +619,8 @@ class StickerMasterResource extends Resource
// })
->options(function (callable $get) {
$plantId = $get('Plant');
return $plantId
? Item::where('plant_id', $plantId)->pluck('code', 'id')
: [];
return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
})
->searchable()
->reactive(),
@@ -667,9 +650,9 @@ class StickerMasterResource extends Resource
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (
empty($data['material_type']) &&
empty($data['Plant']) &&
empty($data['item_id']) &&
empty($data['material_type']) &&
empty($data['panel_box_code']) &&
empty($data['created_from']) &&
empty($data['created_to'])
@@ -710,7 +693,18 @@ class StickerMasterResource extends Resource
}
if (! empty($data['item_id'])) {
$indicators[] = 'Item Code: ' . $data['item_id'];
$indicators[] = 'Item Code: '.Item::where('id', $data['item_id'])->value('code');
}
if (! empty($data['material_type'])) {
if ($data['material_type'] == 1) {
$indicators[] = 'Material Type: Individual';
} elseif ($data['material_type'] == 2) {
$indicators[] = 'Material Type: Bundle';
} elseif ($data['material_type'] == 3) {
$indicators[] = 'Material Type: Quantity';
}
// $indicators[] = 'Material Type: '.$data['material_type'];
}
if (! empty($data['panel_box_code'])) {
@@ -726,7 +720,7 @@ class StickerMasterResource extends Resource
}
return $indicators;
})
}),
])
->filtersFormMaxHeight('280px')
->actions([
@@ -747,6 +741,7 @@ class StickerMasterResource extends Resource
Select::make('plant_id')
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->label('Select Plant')
@@ -856,7 +851,7 @@ class StickerMasterResource extends Resource
if (! $sticker) {
Notification::make()
->title('Unknown Sticker Master')
->body("Sticker Master data not found.")
->body('Sticker Master data not found.')
->danger()
->seconds(2)
->send();
@@ -887,21 +882,20 @@ class StickerMasterResource extends Resource
// $newFileName,
// 'local'
// );
try
{
try {
$path = $uploadedFile->storeAs(
$directory,
$newFileName,
'local'
);
}
catch (\Exception $e) {
} catch (\Exception $e) {
Notification::make()
->title('Upload Failed')
->body("Failed to upload image: " . $e->getMessage())
->body('Failed to upload image: '.$e->getMessage())
->danger()
->seconds(3)
->send();
return;
}
@@ -909,7 +903,7 @@ class StickerMasterResource extends Resource
Notification::make()
->title('Success')
->body("Uploaded part validation image successfully")
->body('Uploaded part validation image successfully')
->success()
->seconds(2)
->send();

View File

@@ -0,0 +1,199 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\StickerPrintingResource\Pages;
use App\Models\Plant;
use App\Models\StickerPrinting;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\Section;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use App\Filament\Exports\StickerPrintingExporter;
use App\Filament\Imports\StickerPrintingImporter;
use Filament\Forms\Components\Actions\Action;
class StickerPrintingResource extends Resource
{
protected static ?string $model = StickerPrinting::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Section::make('')
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->reactive()
->relationship('plant', 'name')
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->required()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$plantId = $get('plant_id');
if (!$plantId) {
$set('reference_number', null);
$set('serial_number', null);
$set('ivPlantError', 'Please select a plant first.');
} else {
$set('ivPlantError', null);
$set('reference_number', null);
$set('serial_number', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('ivPlantError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('ivPlantError') ? $get('ivPlantError') : null)
->hintColor('danger'),
Forms\Components\TextInput::make('reference_number')
->label('Reference Number')
->reactive()
->readOnly(fn (callable $get) => !empty($get('serial_number')))
->extraAttributes([
'id' => 'invoice_number_input',
'x-data' => '{ value: "" }',
'x-model' => 'value',
'wire:keydown.enter.prevent' => 'processRef(value)',
])
->required(),
Forms\Components\TextInput::make('serial_number')
->label('Serial Number')
->reactive()
// ->required()
->readOnly(fn (callable $get) => empty($get('reference_number')))
->extraAttributes([
'id' => 'serial_number_input',
'x-data' => '{ value: "" }',
'x-model' => 'value',
'wire:keydown.enter.prevent' => 'processSno(value)',
//'x-on:keydown.enter.prevent' => '$wire.processInvoice(value)',
]),
//->required(),
Forms\Components\View::make('forms.components.print-button'),
Forms\Components\Hidden::make('created_by')
->label('Created By')
->default(Filament::auth()->user()?->name),
Forms\Components\Hidden::make('updated_by')
->label('Updated By')
->default(Filament::auth()->user()?->name),
])
->columns(4),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('No.')
->label('No.')
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
$paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('reference_number')
->label('Reference Number')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('serial_number')
->label('Serial Number')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('created_by')
->label('Created By')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
Tables\Filters\TrashedFilter::make(),
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
])
->headerActions([
ImportAction::make()
->importer(StickerPrintingImporter::class)
->label('Import Sticker Printing')
->color('warning')
->visible(function () {
return Filament::auth()->user()->can('view import sticker printing');
}),
ExportAction::make()
->exporter(StickerPrintingExporter::class)
->label('Export Sticker Printing')
->color('warning')
->visible(function () {
return Filament::auth()->user()->can('view export sticker printing');
}),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListStickerPrintings::route('/'),
'create' => Pages\CreateStickerPrinting::route('/create'),
'view' => Pages\ViewStickerPrinting::route('/{record}'),
'edit' => Pages\EditStickerPrinting::route('/{record}/edit'),
];
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}

View File

@@ -0,0 +1,244 @@
<?php
namespace App\Filament\Resources\StickerPrintingResource\Pages;
use App\Filament\Resources\StickerPrintingResource;
use Filament\Resources\Pages\CreateRecord;
use PDF;
use SimpleSoftwareIO\QrCode\Facades\QrCode;
use Filament\Facades\Filament;
use App\Models\StickerPrinting;
use Filament\Notifications\Notification;
use Str;
class CreateStickerPrinting extends CreateRecord
{
protected static string $resource = StickerPrintingResource::class;
protected static string $view = 'filament.resources.sticker-printing-resource.pages.create-sticker-printing';
public $plantId;
public $ref_number;
public $ref;
public $serial_number;
public function getFormActions(): array
{
return [
$this->getCancelFormAction(),
];
}
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
public function loadRecords()
{
$this->records = StickerPrinting::where('reference_number', $this->refNumber)
->where('plant_id', $this->plantId)
->latest()
->get();
}
public function processRef($value)
{
//$this->ref_number = $value;
$ref = $this->form->getState()['reference_number'] ?? null;
$user = Filament::auth()->user();
$operatorName = $user->name;
$plantId = $this->form->getState()['plant_id'];
$this->plantId = $plantId;
$this->dispatch('refreshEmptySticker', $plantId, $ref);
$this->dispatch('focus-serial-number');
}
public function processSno($value)
{
$this->serial_number = $value;
$plant = $this->form->getState()['plant_id'] ?? null;
$ref = $this->form->getState()['reference_number'] ?? null;
$sNumber = $this->form->getState()['serial_number'] ?? null;
$pattern1 = '/^(?<item_code>[^|]+)\|(?<serial_number>[^|]+)\|?$/i';
$pattern2 = '/^(?<item_code>[^|]+)\|(?<serial_number>[^|]+)\|(?<batch_number>.+)$/i';
$pattern3 = '/^(?<serial_number>[^|]+)$/i';
if (preg_match($pattern1, $sNumber, $matches) || preg_match($pattern2, $sNumber, $matches) || preg_match($pattern3, $sNumber, $matches)) {
$serial = $matches['serial_number'];
if (Str::length($serial) < 9) {
Notification::make()
->title('Invalid Serial Number')
->body("Serial number should conatin minimum 9 digits '$serial'.")
->warning()
->send();
$this->form->fill([
'plant_id' => $plant,
'reference_number' => $ref,
'serial_number' => '',
]);
return;
}
else if(!ctype_alnum($serial)) {
Notification::make()
->title('Invalid Serial Number')
->body("Serial number should be alphanumeric '$serial'.")
->warning()
->send();
$this->form->fill([
'plant_id' => $plant,
'reference_number' => $ref,
'serial_number' => '',
]);
return;
}
$extractedSerialNumber = $matches['serial_number'];
$sNumber = $extractedSerialNumber;
}
else
{
Notification::make()
->title('Invalid Format')
->body("Serial number must be in the format 'itemcode|serialnumber' or 'itemcode|serialnumber|batchnumber'. or just 'serialnumber'.")
->warning()
->send();
// Reset only serial number field
$this->form->fill([
'plant_id' => $plant,
'reference_number' => $ref,
'serial_number' => '',
]);
return;
}
if ($plant == null || trim($plant) == '' || $ref == null || trim($ref) == '' || $sNumber == null || trim($sNumber) == '')
{
Notification::make()
->title('Unknown: Incomplete Data!')
->body("Please ensure Plant, Reference Number, and Serial Number are provided.")
->danger()
->seconds(3)
->send();
return;
}
$exists = StickerPrinting::where('plant_id', $plant)
->where('serial_number', $sNumber)
->first();
if ($exists) {
Notification::make()
->title('Duplicate Serial Number!')
->body("Serial Number {$sNumber} already exists for this plant.")
->danger()
->seconds(3)
->send();
// Reset only serial number field
$this->form->fill([
'plant_id' => $plant,
'reference_number' => $ref,
'serial_number' => '',
]);
return;
}
StickerPrinting::create([
'plant_id' => $plant,
'reference_number' => $ref,
'serial_number' => $sNumber,
'created_by' => Filament::auth()->user()->name,
]);
$this->dispatch('addStickerToList', $plant, $ref, $sNumber);
$this->form->fill([
'plant_id' => $plant,
'reference_number' => $ref,
'serial_number' => '',
]);
}
public function printSticker() {
$plantId = $this->form->getState()['plant_id'];
$plantId = trim($plantId) ?? null;
$refNumber = trim($this->form->getState()['reference_number'])?? null;
$refNumber = trim($refNumber) ?? null;
$serialNumber = trim($this->form->getState()['serial_number'])?? null;
$serialNumber = trim($serialNumber) ?? null;
// dd($plantId, $refNumber, $serialNumber);
$serialNumbers = StickerPrinting::where('plant_id', $plantId)
->where('reference_number', $refNumber)
->pluck('serial_number')
->toArray();
if (empty($serialNumbers))
{
Notification::make()
->title('No Serial Numbers found!')
->body('Please check the selected Plant & Reference Number.')
->danger()
->send();
return;
}
// Encode as JSON string in QR Code
// $qrData = json_encode([
// 'serial_numbers' => $serialNumbers,
// ]);
//$qrData = implode(',', $serialNumbers);
$qrData = implode("\n", $serialNumbers);
$qrCode = base64_encode(
QrCode::format('png')
->size(1200) // smaller, still high res
->margin(6) // white border
->errorCorrection('Q')// medium-high correction
->generate($qrData)
);
// Send data to Pdf view
$pdf = PDF::loadView('pdf.qrcode', [
'qrCode' => $qrCode,
'referenceNumber' => $refNumber,
]);
return response()->streamDownload(function () use ($pdf) {
echo $pdf->output();
}, "qr-sticker.pdf");
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\StickerPrintingResource\Pages;
use App\Filament\Resources\StickerPrintingResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditStickerPrinting extends EditRecord
{
protected static string $resource = StickerPrintingResource::class;
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\StickerPrintingResource\Pages;
use App\Filament\Resources\StickerPrintingResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListStickerPrintings extends ListRecords
{
protected static string $resource = StickerPrintingResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\StickerPrintingResource\Pages;
use App\Filament\Resources\StickerPrintingResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewStickerPrinting extends ViewRecord
{
protected static string $resource = StickerPrintingResource::class;
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@@ -8,6 +8,7 @@ use App\Models\Plant;
use App\Models\ProcessOrder;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage;
use Str;
@@ -21,6 +22,7 @@ class PdfController extends Controller
{
//
}
public function updateGR(Request $request)
{
$expectedUser = env('API_AUTH_USER');
@@ -29,48 +31,43 @@ class PdfController extends Controller
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser.':'.$expectedPw;
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
], 403);
'status_description' => 'Invalid authorization token!',
], 404);
}
$data = $request->all();
if ($data['plant_code'] == null || $data['plant_code'] == '')
{
if ($data['plant_code'] == null || $data['plant_code'] == '') {
// return response("ERROR: Please provide a valid plant code.", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant code can't be empty!"
], 400);
}
else if (Str::length($data['plant_code']) < 4 || !is_numeric($data['plant_code']) || !preg_match('/^[1-9]\d{3,}$/', $data['plant_code']))//!ctype_digit($data['plant_code'])
{
'status_description' => "Plant code can't be empty!",
], 404);
} elseif (Str::length($data['plant_code']) < 4 || ! is_numeric($data['plant_code']) || ! preg_match('/^[1-9]\d{3,}$/', $data['plant_code'])) {// !ctype_digit($data['plant_code'])
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Invalid plant code found!"
], 400);
'status_description' => 'Invalid plant code found!',
], 404);
}
$plant = Plant::where('code', $data['plant_code'])->first();
if (! $plant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Plant not found!'
], 400);
'status_description' => 'Plant not found!',
], 404);
}
$plantId = $plant->id;
if ($data['gr_number'] == null || $data['gr_number'] == '')
{
if ($data['gr_number'] == null || $data['gr_number'] == '') {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "GR Number can't be empty!"
], 400);
'status_description' => "GR Number can't be empty!",
], 404);
}
$grExists = GRMaster::where('plant_id', $plantId)
@@ -80,7 +77,7 @@ class PdfController extends Controller
if (! $grExists) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "GR Number {$data['gr_number']} not found for plant {$data['plant_code']}!"
'status_description' => "GR Number {$data['gr_number']} not found for plant {$data['plant_code']}!",
], 404);
}
@@ -89,8 +86,8 @@ class PdfController extends Controller
if ($scannedBy == '' || $scannedBy == null) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Scanned by can't be empty!"
], 400);
'status_description' => "Scanned by can't be empty!",
], 404);
}
$user = User::where('name', $data['scanned_by'])
@@ -99,7 +96,7 @@ class PdfController extends Controller
if (! $user) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "'{$data['scanned_by']}' user not found!"
'status_description' => "'{$data['scanned_by']}' user not found!",
], 404);
}
@@ -111,8 +108,8 @@ class PdfController extends Controller
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Duplicate item codes found in request!',
'duplicate_item_codes' => array_values($duplicateItemCodes)
], 400);
'duplicate_item_codes' => array_values($duplicateItemCodes),
], 404);
}
$allSerials = [];
@@ -131,8 +128,8 @@ class PdfController extends Controller
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Duplicate serial numbers found in request!',
'duplicate_serial_numbers' => array_values($duplicateSerials)
], 400);
'duplicate_serial_numbers' => array_values($duplicateSerials),
], 404);
}
$invalidLengthItemCodes = [];
@@ -154,26 +151,26 @@ class PdfController extends Controller
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Some item codes are invalid: must be at least 6 digits!',
'invalid_item_codes' => array_values($invalidLengthItemCodes)
], 400);
'invalid_item_codes' => array_values($invalidLengthItemCodes),
], 404);
}
$invalidItemCodes = [];
$invalidPlantItems = [];
foreach ($data['item_codes'] as $item)
{
foreach ($data['item_codes'] as $item) {
$itemCode = $item['item_code'] ?? null;
if (! $itemCode) {
$invalidItemCodes[] = "(missing)";
$invalidItemCodes[] = '(missing)';
continue;
}
$itemObj = Item::where('code', $itemCode)->first();
if (! $itemObj) {
$invalidItemCodes[] = $itemCode;
continue;
}
@@ -189,8 +186,8 @@ class PdfController extends Controller
'status_code' => 'ERROR',
'status_description' => 'Some item codes are invalid!',
'not_found_items' => array_values($invalidItemCodes),
'not_in_plant' => array_values($invalidPlantItems)
], 400);
'not_in_plant' => array_values($invalidPlantItems),
], 404);
}
$missingSerialsByItem = [];
@@ -228,14 +225,13 @@ class PdfController extends Controller
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Some serial numbers not found in DB for given plant, GR number, and item!',
'missing_serials' => $missingSerialsByItem
], 400);
'missing_serials' => $missingSerialsByItem,
], 404);
}
$alreadyCompleted = [];
foreach ($data['item_codes'] as $item)
{
foreach ($data['item_codes'] as $item) {
$itemCode = $item['item_code'];
$serialNumbers = $item['serial_numbers'];
@@ -262,8 +258,8 @@ class PdfController extends Controller
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Below serial numbers are already completed',
'serial_numbers' => $alreadyCompleted
], 400);
'serial_numbers' => $alreadyCompleted,
], 404);
}
// {
// $itemCode = $item['item_code'];
@@ -274,7 +270,7 @@ class PdfController extends Controller
// return response()->json([
// 'status_code' => 'ERROR',
// 'status_description' => "Item code: $itemCode not found"
// ], 400);
// ], 404);
// }
// $itemPlant = Item::where('plant_id', $plantId)
@@ -283,10 +279,9 @@ class PdfController extends Controller
// return response()->json([
// 'status_code' => 'ERROR',
// 'status_description' => "Item code: $itemCode not found for the plant: $data[plant_code]"
// ], 400);
// ], 404);
// }
// $itemId = $itemObj->id;
// // Update all serial numbers for this item
@@ -297,9 +292,7 @@ class PdfController extends Controller
// ->update(['created_by' => $scannedBy]);
// }
foreach ($data['item_codes'] as $item)
{
foreach ($data['item_codes'] as $item) {
$itemCode = $item['item_code'];
$serialNumbers = $item['serial_numbers'];
@@ -309,12 +302,12 @@ class PdfController extends Controller
->where('item_id', $itemId)
->where('gr_number', $data['gr_number'])
->whereIn('serial_number', $serialNumbers)
->update(['created_by' => $scannedBy, 'status' => 'Completed',]);
->update(['created_by' => $scannedBy, 'status' => 'Completed']);
}
return response()->json([
'status_code' => 'SUCCESS',
'status_description' => 'Serial numbers updated successfully!'
'status_description' => 'Serial numbers updated successfully!',
], 200);
}
@@ -333,19 +326,17 @@ class PdfController extends Controller
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser.':'.$expectedPw;
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
], 403);
'status_description' => 'Invalid authorization token!',
], 404);
}
$filename = $request->header('process-order');
if (!$filename)
{
return response()->json(['error' => 'Missing file-name header'], 400);
if (! $filename) {
return response()->json(['error' => 'Missing file-name header'], 404);
}
$filename = basename($filename);
@@ -355,7 +346,7 @@ class PdfController extends Controller
$filename .= '.pdf';
}
$filePath = "uploads/ProcessOrder/" . $filename;
$filePath = 'uploads/ProcessOrder/'.$filename;
if (! Storage::disk('local')->exists($filePath)) {
return response()->json(['error' => 'File not found'], 404);
@@ -382,23 +373,21 @@ class PdfController extends Controller
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser.':'.$expectedPw;
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
], 403);
'status_description' => 'Invalid authorization token!',
], 404);
}
$filename = $request->header('gr-number');
if (!$filename)
{
if (! $filename) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Gr Number cannot be empty!'
], 403);
//return response()->json(['error' => 'Missing file-name header'], 400);
'status_description' => 'Gr Number cannot be empty!',
], 404);
// return response()->json(['error' => 'Missing file-name header'], 404);
}
$filename = basename($filename);
@@ -408,14 +397,14 @@ class PdfController extends Controller
$filename .= '.pdf';
}
$filePath = "uploads/GRNumber/" . $filename;
$filePath = 'uploads/GRNumber/'.$filename;
if (! Storage::disk('local')->exists($filePath)) {
// return response()->json(['error' => 'File not found'], 404);
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Pdf File not found for the provided GrNumber!'
], 403);
'status_description' => 'Pdf File not found for the provided GrNumber!',
], 404);
}
$file = Storage::disk('local')->get($filePath);
@@ -435,31 +424,27 @@ class PdfController extends Controller
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser.':'.$expectedPw;
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
], 403);
'status_description' => 'Invalid authorization token!',
], 404);
}
$plantCode = $request->header('plant-code');
$grNumber = $request->header('gr-number');
if (! $plantCode) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant Code value can't be empty"
'status_description' => "Plant Code value can't be empty",
], 404);
}
else if (!$grNumber)
{
} elseif (! $grNumber) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'GR Number cannot be empty!'
], 403);
'status_description' => 'GR Number cannot be empty!',
], 404);
}
$plant = Plant::where('code', $plantCode)->first();
@@ -468,7 +453,7 @@ class PdfController extends Controller
if (! $plant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant Code '{$plantCode}' not found!"
'status_description' => "Plant Code '{$plantCode}' not found!",
], 404);
}
@@ -477,7 +462,7 @@ class PdfController extends Controller
if (! $grExist) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'GR Number not found'
'status_description' => 'GR Number not found',
], 404);
}
@@ -488,7 +473,7 @@ class PdfController extends Controller
if (! $grExists) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'GR Number not found for this plant!'
'status_description' => 'GR Number not found for this plant!',
], 404);
}
@@ -499,7 +484,7 @@ class PdfController extends Controller
if (empty($grRecords)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'No serial numbers found for the given GR number!'
'status_description' => 'No serial numbers found for the given GR number!',
], 404);
}
@@ -523,7 +508,7 @@ class PdfController extends Controller
$result = $grRecords->groupBy('item_id')->map(function ($group, $itemId) use ($items) {
return [
'item_code' => $items[$itemId] ?? null,
'serial_numbers' => $group->pluck('serial_number')->toArray()
'serial_numbers' => $group->pluck('serial_number')->toArray(),
];
})->values(); // remove keys
@@ -537,31 +522,27 @@ class PdfController extends Controller
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser.':'.$expectedPw;
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
], 403);
'status_description' => 'Invalid authorization token!',
], 404);
}
$plantCode = $request->header('plant-code');
$processOrder = $request->header('process-order');
if (! $plantCode) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant Code value can't be empty"
'status_description' => "Plant Code value can't be empty",
], 404);
}
else if (!$processOrder)
{
} elseif (! $processOrder) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Process Order cannot be empty!'
], 403);
'status_description' => 'Process Order cannot be empty!',
], 404);
}
$plant = Plant::where('code', $plantCode)->first();
@@ -570,7 +551,7 @@ class PdfController extends Controller
if (! $plant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant Code '{$plantCode}' not found!"
'status_description' => "Plant Code '{$plantCode}' not found!",
], 404);
}
@@ -579,7 +560,7 @@ class PdfController extends Controller
if (! $processOrderExist) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Process order not found'
'status_description' => 'Process order not found',
], 404);
}
@@ -590,11 +571,10 @@ class PdfController extends Controller
if (! $proOrdAgPlant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Process order not found for this plant!'
'status_description' => 'Process order not found for this plant!',
], 404);
}
$item = $proOrdAgPlant->item;
$processOrderRecords = ProcessOrder::with('item')
@@ -615,25 +595,25 @@ class PdfController extends Controller
if ($totalReceivedQty == $proOrdAgPlant->order_quantity) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Process order '{$processOrder}' for plant '{$plantCode}' has already reached its order quantity."
], 400);
'status_description' => "Process order '{$processOrder}' for plant '{$plantCode}' has already reached its order quantity.",
], 404);
}
// if ($totalReceivedQty > $proOrdAgPlant->order_quantity) {
// return response()->json([
// 'status_code' => 'ERROR',
// 'status_description' => "Process order '{$processOrder}' for plant '{$plantCode}' received quantity is more than its order quantity."
// ], 400);
// ], 404);
// }
return response()->json([
'item_code' => $item?->code ?? "",
'description' => $item?->description ?? "",
'item_code' => $item?->code ?? '',
'description' => $item?->description ?? '',
// 'coil_number' => $proOrdAgPlant->coil_number ?? "",
// 'order_quantity' => (string)$proOrdAgPlant->order_quantity ?? "",
'coil_number' => $lastRecord->coil_number ?? "",
'order_quantity' => (string)$lastRecord->order_quantity ?? "",
'received_quantity' => (string)$totalReceivedQty ?? "",
'coil_number' => $lastRecord->coil_number ?? '',
'order_quantity' => (string) $lastRecord->order_quantity ?? '',
'received_quantity' => (string) $totalReceivedQty ?? '',
]);
}
@@ -642,131 +622,250 @@ class PdfController extends Controller
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$headerAuth = $request->header('Authorization');
$expectedToken = "Bearer " . $expectedUser . ':' . $expectedPw;
$expectedToken = 'Bearer '.$expectedUser.':'.$expectedPw;
if ($headerAuth !== $expectedToken) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
], 403);
'status_description' => 'Invalid authorization token!',
], 404);
}
$plantCode = $request->header('plant-code');
$processOrder = $request->header('process-order');
$data = $request->all();
if (!$plantCode || !$processOrder) {
Log::info('Process Order POST API >>', ['plant-code' => $plantCode, 'process-order' => $processOrder, 'post-data' => $data]);
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'plant-code and process-order are required'
], 400);
'status_description' => "Plant code can't be empty!",
], 404);
} elseif (! is_numeric($plantCode) || Str::length($plantCode) < 4 || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) { // !ctype_digit($data['plant_code'])
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid plant code found!',
], 404);
}
if (! $processOrder) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Process-order are required!',
], 404);
}
$plant = Plant::where('code', $plantCode)->first();
if (! $plant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid plant code'
'status_description' => "Plant code '{$plantCode}' not found!",
], 404);
}
$plantId = $plant->id;
$validated = $request->validate([
'item_code' => 'nullable|integer',
'coil_number' => 'nullable|string',
'order_quantity' => 'nullable|integer',
'received_quantity' => 'nullable|numeric',
'created_by' => 'nullable|string',
]);
$itemCode = $data['item_code'] ?? '';
$coilNo = $data['coil_number'] ?? '';
$orderQty = $data['order_quantity'] ?? 0;
$receivedQty = $data['received_quantity'] ?? 0;
$sfgNo = $data['sfg_number'] ?? '';
$machineId = $data['machine_id'] ?? '';
$createdBy = $data['created_by'] ?? '';
$item = Item::where('code', $validated['item_code'])
->where('plant_id', $plantId)
->first();
// $validated = $request->validate([
// 'item_code' => 'nullable|integer',
// 'coil_number' => 'nullable|string',
// 'order_quantity' => 'nullable|integer',
// 'received_quantity' => 'nullable|numeric',
// 'sfg_number' => 'nullable|string',
// 'machine_id' => 'nullable|string',
// 'created_by' => 'nullable|string',
// ]);
if (!$item)
{
if ($itemCode == null || $itemCode == '' || ! $itemCode) {
return response()->json([
'message' => 'Invalid item_code for this plant'
'status_code' => 'ERROR',
'status_description' => "Item code can't be empty!",
], 404);
} elseif (Str::length($itemCode) < 6) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Item code should contain minimum 6 digits!',
], 404);
} elseif (! ctype_alnum($itemCode)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Item code should contain only alpha-numeric values!',
], 404);
}
$createdBy = $validated['created_by'] ?? null;
if ($coilNo == null || $coilNo == '') {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Coil number can't be empty!",
], 404);
} elseif (! is_numeric($coilNo) || Str::length($coilNo) <= 0 || ! preg_match('/^\d{1,}$/', $coilNo)) { // !ctype_digit($data['plant_code'])
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid coil number found!',
], 404);
}
// if ($sfgNo == null || $sfgNo == '' || ! $sfgNo) {
// return response()->json([
// 'status_code' => 'ERROR',
// 'status_description' => "SFG number can't be empty!",
// ], 404);
// }
// if ($machineId == null || $machineId == '' || ! $machineId) {
// return response()->json([
// 'status_code' => 'ERROR',
// 'status_description' => "Machine ID can't be empty!",
// ], 404);
// }
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "User name can't be empty!",
], 404);
} elseif ($createdBy == 'jothi') {
$createdBy = 'Admin';
}
$user = User::where('name', $createdBy)->first();
$userPlant = User::where('name', $createdBy)->where('plant_id', $plantId)->first();
if (! $user) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "User '{$createdBy}' not found"
'status_description' => "User name '{$createdBy}' not found!",
], 404);
} elseif (! $userPlant && ! $user->hasRole('Super Admin')) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "User name '{$createdBy}' not found for the plant code '{$plantCode}'!",
], 404);
} elseif (! $user->hasRole('Super Admin') && ! $user->hasRole('Process Employee') && ! $user->hasRole('Process Supervisor')) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'User does not have rights!',
], 404);
}
$existing = ProcessOrder::where('plant_id', $plant->id)
->where('process_order', $processOrder)
->where('item_id', '!=', $item->id)
$item = Item::where('code', $itemCode)->first();
if (! $item) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code '{$itemCode}' not found!",
], 404);
}
$itemPlant = Item::where('code', $itemCode)
->where('plant_id', $plantId)
->first();
if (! $itemPlant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code '{$itemCode}' not found for the plant code '{$plantCode}'!",
], 404);
}
$itemId = $itemPlant->id;
if ($sfgNo != null && $sfgNo != '' && Str::length($sfgNo) > 0 && $sfgNo) {
$existing = ProcessOrder::where('plant_id', $plantId)
->where('sfg_number', $sfgNo)
->first();
if ($existing) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Process order '{$processOrder}' for plant '{$plantCode}' already has item_code '{$existing->item->code}'"
], 409);
'status_description' => "SFG number '{$sfgNo}' already exist for the plant code '{$plantCode}'!",
], 404);
}
} else {
$sfgNo = null;
}
$alreadyReceived = ProcessOrder::where('plant_id', $plant->id)
$existing = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('item_id', $item->id)
->where('item_id', '!=', $itemId)
->first();
if ($existing) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Process order '{$processOrder}' already has item_code '{$existing->item->code}' for the plant code '{$plantCode}'!",
], 404);
}
$existing = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('coil_number', $coilNo)
->first();
if ($existing) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Process order '{$processOrder}' with coil number '{$coilNo}' already exist for the plant code '{$plantCode}'!",
], 404);
}
$alreadyReceived = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('item_id', $itemId)
->sum('received_quantity');
$newReceived = $validated['received_quantity'] ?? 0;
$orderQty = $validated['order_quantity'] ?? 0;
if ($orderQty == 0) {
$orderQty = ProcessOrder::where('plant_id', $plant->id)
$orderQty = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('item_id', $item->id)
->where('item_id', $itemId)
->value('order_quantity') ?? 0;
}
$total = $alreadyReceived + $newReceived;
$total = $alreadyReceived + $receivedQty;
if ($total > $orderQty) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Received quantity cannot exceed order quantity.
Order Qty = {$orderQty}, Already Received = {$alreadyReceived},
Trying to Insert = {$newReceived}"
'status_description' => "Received quantity should not exceed order quantity! Order Qty = {$orderQty}, Already Received Qty = {$alreadyReceived}, Trying to Insert Qty = {$receivedQty}",
], 404);
}
try
{
try {
ProcessOrder::Create(
[
'plant_id' => $plant->id,
'plant_id' => $plantId,
'process_order' => $processOrder,
'item_id' => $item->id,
'coil_number' => $validated['coil_number'] ?? "",
'order_quantity' => $validated['order_quantity'] ?? 0,
'received_quantity' => $validated['received_quantity'] ?? 0,
'created_by' => $validated['created_by'] ?? "",
'item_id' => $itemId,
'coil_number' => $coilNo,
'order_quantity' => $orderQty,
'received_quantity' => $receivedQty,
'sfg_number' => $sfgNo,
'machine_name' => $machineId,
'created_by' => $createdBy,
]
);
return response()->json([
'status_code' => 'SUCCESS',
'status_description' => 'Record Inserted Successfully'
'status_description' => 'Record Inserted Successfully',
]);
} catch (\Exception $e) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => $e->getMessage()
'status_description' => $e->getMessage(),
], 500);
}
}
/**
* Display the specified resource.
*/

View File

@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Models\Plant;
use App\Models\User;
//use Carbon\Carbon;
use Hash;
use Illuminate\Http\Request;
@@ -83,10 +84,11 @@ class UserController extends Controller
//$user = User::where('email', $email)->first();
if (Hash::check($header_pass, $existUser->password)) {
return response()->json([
'created_at' => $existUser->created_at->format('Y-m-d H:i:s'),
'updated_at' => $existUser->updated_at->format('Y-m-d H:i:s'),
'plant' => (String)$existPlant,
'email' => $existUser->email,
'created_at' => $existUser->created_at->format('Y-m-d H:i:s') ?? "",
'updated_at' => $existUser->updated_at->format('Y-m-d H:i:s') ?? "",
'requested_at' => now()->format('Y-m-d H:i:s') ?? "", //Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s') ?? "",
'plant' => (String)$existPlant ?? "",
'email' => $existUser->email ?? "",
'roles' => $existUser->roles()->pluck('name')->toArray()
], 200);
} else {

View File

@@ -2,7 +2,6 @@
namespace App\Livewire;
use App\Filament\Resources\InvoiceValidationResource\Pages\CreateInvoiceValidation;
use App\Models\InvoiceValidation;
use App\Models\StickerMaster;
use Filament\Facades\Filament;
@@ -41,7 +40,7 @@ class InvoiceDataTable extends Component
'refreshEmptyInvoice' => 'loadEmptyData',
'refreshInvoiceData' => 'loadData',
'refreshMaterialInvoiceData' => 'loadMaterialData',
'openCapacitorModal' => 'showCapacitorInputBox'
'openCapacitorModal' => 'showCapacitorInputBox',
];
public $capacitorInput = '';
@@ -127,70 +126,52 @@ class InvoiceDataTable extends Component
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
$curStick = StickerMaster::where('id', $row['sticker_master_id'])->first();
if ($curStick)
{
if ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1 || Str::length($curStick->panel_box_code) > 0)
{
if ($curStick->tube_sticker_motor == 1)
{
if ($curStick) {
if (Str::length($curStick->panel_box_code) > 0) {
$stickCount++;
}
if ($curStick->tube_sticker_pump == 1)
{
if ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1) {
if ($curStick->tube_sticker_motor == 1) {
$stickCount++;
}
if ($curStick->tube_sticker_pumpset == 1)
{
if ($curStick->tube_sticker_pump == 1 || ($curStick->tube_sticker_pumpset != 1 && $curStick->tube_sticker_pump != 1 && $curStick->pack_slip_pump == 1)) {
$stickCount++;
}
if (Str::length($curStick->panel_box_code) > 0)
{
if ($curStick->tube_sticker_pumpset == 1) {
$stickCount++;
}
}
else if ($curStick->pack_slip_motor == 1 || $curStick->pack_slip_pump == 1 || $curStick->pack_slip_pumpset == 1)
{
if ($curStick->pack_slip_motor == 1)
{
} elseif ($curStick->pack_slip_motor == 1 || $curStick->pack_slip_pump == 1 || $curStick->pack_slip_pumpset == 1) {
if ($curStick->pack_slip_motor == 1) {
$stickCount++;
}
if ($curStick->pack_slip_pump == 1)
{
if ($curStick->pack_slip_pump == 1) {
$stickCount++;
}
if ($curStick->pack_slip_pumpset == 1)
{
if ($curStick->pack_slip_pumpset == 1) {
$stickCount++;
}
}
}
if ($row['motor_scanned_status'] == 1)
{
if ($row['motor_scanned_status'] == 1) {
$scannedCount++;
}
if ($row['pump_scanned_status'] == 1)
{
if ($row['pump_scanned_status'] == 1) {
$scannedCount++;
}
if ($row['capacitor_scanned_status'] == 1)
{
if ($row['capacitor_scanned_status'] == 1) {
$scannedCount++;
}
if ($row['scanned_status_set'] == 1)
{
if ($row['scanned_status_set'] == 1) {
$scannedCount++;
}
$this->packageCount += $stickCount - $scannedCount;
}
if ($onCapFocus)
{
if ($onCapFocus) {
$this->dispatch('focus-capacitor-input');
}
else
{
} else {
$this->dispatch('focus-serial-number');
}
}
@@ -228,20 +209,13 @@ class InvoiceDataTable extends Component
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
if ($matType === 1)
{
if ($matType === 1) {
$row['material_type'] = 'Individual';
}
else if ($matType === 2)
{
} elseif ($matType === 2) {
$row['material_type'] = 'Bundle';
}
else if ($matType === 3)
{
} elseif ($matType === 3) {
$row['material_type'] = 'Quantity';
}
else
{
} else {
$row['material_type'] = 'N/A';
}
}
@@ -287,6 +261,7 @@ class InvoiceDataTable extends Component
// ->duration(3000)
->seconds(2)
->send();
return;
}
@@ -309,12 +284,12 @@ class InvoiceDataTable extends Component
->seconds(2)
->send();
$this->capacitorInput = '';
return;
}
foreach ($this->invoiceData as &$row) {
if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber)
{
if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
$row['panel_box_supplier'] = $supplier;
$row['panel_box_item_code'] = $itemCode;
$row['panel_box_serial_number'] = $serialNumber;
@@ -343,8 +318,7 @@ class InvoiceDataTable extends Component
$packCnt = 1;
$scanCnt = 1;
// if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr)
{
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
@@ -353,8 +327,7 @@ class InvoiceDataTable extends Component
$scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
$scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
if ($packCnt === $scanCnt)
{
if ($packCnt === $scanCnt) {
$matchingValidation->update([
'panel_box_supplier' => $supplier,
'panel_box_item_code' => $itemCode,
@@ -363,9 +336,7 @@ class InvoiceDataTable extends Component
'scanned_status' => 'Scanned',
'operator_id' => $operatorName,
]);
}
else
{
} else {
$matchingValidation->update([
'panel_box_supplier' => $supplier,
'panel_box_item_code' => $itemCode,
@@ -374,9 +345,7 @@ class InvoiceDataTable extends Component
'operator_id' => $operatorName,
]);
}
}
else
{
} else {
$matchingValidation->update([
'panel_box_supplier' => $supplier,
'panel_box_item_code' => $itemCode,
@@ -405,8 +374,7 @@ class InvoiceDataTable extends Component
// 'scanned_quantity'=> $scannedQuantity,
// ]);
if ($totalQuantity === $scannedQuantity)
{
if ($totalQuantity === $scannedQuantity) {
Notification::make()
->title('Completed: Serial Invoice')
->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
@@ -414,9 +382,7 @@ class InvoiceDataTable extends Component
->seconds(2)
->send();
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
}
else
{
} else {
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id, false);
}
}
@@ -435,5 +401,4 @@ class InvoiceDataTable extends Component
{
return view('livewire.invoice-data-table');
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Livewire;
use Livewire\Component;
use App\Models\StickerPrinting;
class StickerPrintData extends Component
{
public $plantId;
public $refNumber;
public $serialNumber;
public bool $materialInvoice = false;
public $records = [];
protected $listeners = [
'refreshEmptySticker' => 'loadStickerData',
'addStickerToList' => 'loadSticker'
];
public function loadStickerData($plantId, $refNumber)
{
$this->plantId = $plantId;
$this->refNumber = $refNumber;
$this->materialInvoice = true;
$this->records = StickerPrinting::where('plant_id', $plantId)
->where('reference_number', $refNumber)
->orderBy('created_at', 'asc')
->get(['serial_number', 'created_by']);
}
public function loadSticker($plantId, $refNumber, $serialNumber)
{
$this->plantId = $plantId;
$this->refNumber = $refNumber;
$this->materialInvoice = true;
$this->records = StickerPrinting::where('plant_id', $plantId)
->where('reference_number', $refNumber)
->orderBy('created_at', 'asc')
->get(['serial_number', 'created_by']);
}
public function render()
{
return view('livewire.sticker-print-data');
}
}

View File

@@ -2,13 +2,13 @@
namespace App\Mail;
use App\Models\InvoiceDataValidation;
use DateTime;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
use DateTime;
class InvoiceDataMail extends Mailable
{
@@ -23,7 +23,7 @@ class InvoiceDataMail extends Mailable
/**
* Create a new message instance.
*/
public function __construct($scheduleType, $tableData = [], $mailSubject)
public function __construct($scheduleType, $tableData, $mailSubject)
{
$this->scheduleType = $scheduleType;
$this->tableData = $tableData ?? [];
@@ -48,12 +48,14 @@ class InvoiceDataMail extends Mailable
$greeting = 'Dear Sir/Madam,<br><br>We are sending here with list of "Despatch pending sale invoice & STO invoice as on date"';
if ($this->scheduleType == 'Daily') {
$firstRecord = \App\Models\InvoiceDataValidation::orderBy('document_date', 'asc')->first();
//$lastRecord = \App\Models\InvoiceDataValidation::orderBy('document_date', 'desc')->first();
$firstRecord = InvoiceDataValidation::orderBy('document_date', 'asc')->first(); // 'desc'
if ($firstRecord) {
$startDate = null;
if ($firstRecord && $firstRecord?->document_date != null && $firstRecord?->document_date != '') {
$startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay();
// $endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay();
} else {
$startDate = now()->subDay()->setTime(10, 0, 0);
}
$endDate = now()->setTime(10, 0, 0);
@@ -81,10 +83,10 @@ class InvoiceDataMail extends Mailable
return new Content(
view: 'mail.invoice_data_report',
with: [
'company' => "CRI Digital Manufacturing Solutions",
'company' => 'CRI Digital Manufacturing Solutions',
'greeting' => $greeting,
'tableData' => $this->tableData,
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
],
);
}

View File

@@ -11,16 +11,18 @@ class ProcessOrder extends Model
use SoftDeletes;
protected $fillable = [
"plant_id",
"item_id",
"process_order",
"coil_number",
"order_quantity",
"received_quantity",
"created_at",
"created_by",
"updated_by",
"updated_at"
'plant_id',
'item_id',
'process_order',
'coil_number',
'order_quantity',
'received_quantity',
'sfg_number',
'machine_name',
'created_at',
'created_by',
'updated_by',
'updated_at',
];
public function plant(): BelongsTo
@@ -32,5 +34,4 @@ class ProcessOrder extends Model
{
return $this->belongsTo(Item::class, 'item_id');
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class StickerPrinting extends Model
{
//
use SoftDeletes;
protected $fillable = [
'plant_id',
'reference_number',
'serial_number',
'created_at',
'updated_at',
'created_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -0,0 +1,107 @@
<?php
namespace App\Policies;
use Illuminate\Auth\Access\Response;
use App\Models\StickerPrinting;
use App\Models\User;
class StickerPrintingPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->checkPermissionTo('view-any StickerPrinting');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, StickerPrinting $stickerprinting): bool
{
return $user->checkPermissionTo('view StickerPrinting');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->checkPermissionTo('create StickerPrinting');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, StickerPrinting $stickerprinting): bool
{
return $user->checkPermissionTo('update StickerPrinting');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, StickerPrinting $stickerprinting): bool
{
return $user->checkPermissionTo('delete StickerPrinting');
}
/**
* Determine whether the user can delete any models.
*/
public function deleteAny(User $user): bool
{
return $user->checkPermissionTo('delete-any StickerPrinting');
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, StickerPrinting $stickerprinting): bool
{
return $user->checkPermissionTo('restore StickerPrinting');
}
/**
* Determine whether the user can restore any models.
*/
public function restoreAny(User $user): bool
{
return $user->checkPermissionTo('restore-any StickerPrinting');
}
/**
* Determine whether the user can replicate the model.
*/
public function replicate(User $user, StickerPrinting $stickerprinting): bool
{
return $user->checkPermissionTo('replicate StickerPrinting');
}
/**
* Determine whether the user can reorder the models.
*/
public function reorder(User $user): bool
{
return $user->checkPermissionTo('reorder StickerPrinting');
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, StickerPrinting $stickerprinting): bool
{
return $user->checkPermissionTo('force-delete StickerPrinting');
}
/**
* Determine whether the user can permanently delete any models.
*/
public function forceDeleteAny(User $user): bool
{
return $user->checkPermissionTo('force-delete-any StickerPrinting');
}
}

View File

@@ -2,19 +2,19 @@
namespace App\Providers;
use App\Models\AlertMailRule;
use App\Models\User;
use Filament\Facades\FilamentView;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
use App\Policies\RolePolicy;
use App\Policies\PermissionPolicy;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
use Filament\Support\Facades\FilamentAsset;
use App\Policies\RolePolicy;
use Filament\Support\Assets\Js;
use Filament\Support\Facades\FilamentAsset;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Vite;
use Illuminate\Support\ServiceProvider;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
// use Doctrine\DBAL\Types\Type;
@@ -28,7 +28,6 @@ class AppServiceProvider extends ServiceProvider
//
}
/**
* Bootstrap any application services.
*/
@@ -51,13 +50,13 @@ class AppServiceProvider extends ServiceProvider
FilamentAsset::register([
Js::make('chart-js-plugins', Vite::asset('resources/js/filament-chart-js-plugins.js'))->module(),
]);
// if (env('APP_MODE') === 'admin') {
// FilamentAsset::register([
// Js::make('chart-js-plugins', Vite::asset('resources/js/filament-chart-js-plugins.js'))->module(),
// ]);
// }
// URL::forceScheme('https');
// if (!Type::hasType('citext')) {
@@ -70,5 +69,82 @@ class AppServiceProvider extends ServiceProvider
ini_set('max_execution_time', 300); // 300 seconds = 5 minutes
ini_set('memory_limit', '512M'); // 512MB
// $schedule = app(Schedule::class);
// $productionRules = AlertMailRule::where('module', 'ProductionQuantities')
// ->where('rule_name', 'ProductionMail')
// ->select('plant', 'schedule_type')
// ->distinct()
// ->get();
// foreach ($productionRules as $rule) {
// $type = $rule->schedule_type;
// $plantId = $rule->plant;
// $command = $schedule->command('send:production-report', [$type, $plantId]);
// // ->appendOutputTo(storage_path('logs/scheduler.log'));
// switch ($type) {
// case 'Live':
// $command->everyMinute();
// break;
// case 'Hourly':
// $command->hourly();
// break;
// case 'Daily':
// $command->dailyAt('07:59');
// break;
// }
// }
// // Invoice report scheduling
// $invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
// ->select('plant', 'schedule_type')
// ->distinct()
// ->get();
// foreach ($invoiceRules as $rule) {
// $type = $rule->schedule_type;
// $plantId = $rule->plant;
// $command = $schedule->command('send:invoice-report', [$type, $plantId]);
// switch ($type) {
// case 'Live':
// $command->everyMinute();
// break;
// case 'Hourly':
// $command->hourly();
// break;
// case 'Daily':
// $command->dailyAt('07:59');
// break;
// }
// }
// // Invoice Data Report Scheduling
// $invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
// ->select('plant', 'schedule_type')
// ->distinct()
// ->get();
// foreach ($invoiceDataRules as $rule) {
// $type = $rule->schedule_type;
// $plantId = $rule->plant;
// $command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
// switch ($type) {
// case 'Live':
// $command->everyMinute();
// break;
// case 'Hourly':
// $command->hourly();
// break;
// case 'Daily':
// $command->dailyAt('10:00');
// break;
// }
// }
}
}

View File

@@ -36,6 +36,7 @@
"barryvdh/laravel-ide-helper": "^3.5",
"beyondcode/laravel-dump-server": "^2.1",
"fakerphp/faker": "^1.23",
"larastan/larastan": "^3.0",
"laravel/pail": "^1.1",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",

186
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "2c6681f17532120adc216f4e70b8d18d",
"content-hash": "70aec54c03a23cfc92e7f22d912a2e21",
"packages": [
{
"name": "alperenersoy/filament-export",
@@ -10981,6 +10981,137 @@
},
"time": "2025-04-30T06:54:44+00:00"
},
{
"name": "iamcal/sql-parser",
"version": "v0.6",
"source": {
"type": "git",
"url": "https://github.com/iamcal/SQLParser.git",
"reference": "947083e2dca211a6f12fb1beb67a01e387de9b62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/iamcal/SQLParser/zipball/947083e2dca211a6f12fb1beb67a01e387de9b62",
"reference": "947083e2dca211a6f12fb1beb67a01e387de9b62",
"shasum": ""
},
"require-dev": {
"php-coveralls/php-coveralls": "^1.0",
"phpunit/phpunit": "^5|^6|^7|^8|^9"
},
"type": "library",
"autoload": {
"psr-4": {
"iamcal\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Cal Henderson",
"email": "cal@iamcal.com"
}
],
"description": "MySQL schema parser",
"support": {
"issues": "https://github.com/iamcal/SQLParser/issues",
"source": "https://github.com/iamcal/SQLParser/tree/v0.6"
},
"time": "2025-03-17T16:59:46+00:00"
},
{
"name": "larastan/larastan",
"version": "v3.8.0",
"source": {
"type": "git",
"url": "https://github.com/larastan/larastan.git",
"reference": "d13ef96d652d1b2a8f34f1760ba6bf5b9c98112e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/larastan/larastan/zipball/d13ef96d652d1b2a8f34f1760ba6bf5b9c98112e",
"reference": "d13ef96d652d1b2a8f34f1760ba6bf5b9c98112e",
"shasum": ""
},
"require": {
"ext-json": "*",
"iamcal/sql-parser": "^0.6.0",
"illuminate/console": "^11.44.2 || ^12.4.1",
"illuminate/container": "^11.44.2 || ^12.4.1",
"illuminate/contracts": "^11.44.2 || ^12.4.1",
"illuminate/database": "^11.44.2 || ^12.4.1",
"illuminate/http": "^11.44.2 || ^12.4.1",
"illuminate/pipeline": "^11.44.2 || ^12.4.1",
"illuminate/support": "^11.44.2 || ^12.4.1",
"php": "^8.2",
"phpstan/phpstan": "^2.1.29"
},
"require-dev": {
"doctrine/coding-standard": "^13",
"laravel/framework": "^11.44.2 || ^12.7.2",
"mockery/mockery": "^1.6.12",
"nikic/php-parser": "^5.4",
"orchestra/canvas": "^v9.2.2 || ^10.0.1",
"orchestra/testbench-core": "^9.12.0 || ^10.1",
"phpstan/phpstan-deprecation-rules": "^2.0.1",
"phpunit/phpunit": "^10.5.35 || ^11.5.15"
},
"suggest": {
"orchestra/testbench": "Using Larastan for analysing a package needs Testbench",
"phpmyadmin/sql-parser": "Install to enable Larastan's optional phpMyAdmin-based SQL parser automatically"
},
"type": "phpstan-extension",
"extra": {
"phpstan": {
"includes": [
"extension.neon"
]
},
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Larastan\\Larastan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Can Vural",
"email": "can9119@gmail.com"
}
],
"description": "Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel",
"keywords": [
"PHPStan",
"code analyse",
"code analysis",
"larastan",
"laravel",
"package",
"php",
"static analysis"
],
"support": {
"issues": "https://github.com/larastan/larastan/issues",
"source": "https://github.com/larastan/larastan/tree/v3.8.0"
},
"funding": [
{
"url": "https://github.com/canvural",
"type": "github"
}
],
"time": "2025-10-27T23:09:14+00:00"
},
{
"name": "laravel/pail",
"version": "v1.2.3",
@@ -11496,6 +11627,59 @@
},
"time": "2025-07-22T14:01:30+00:00"
},
{
"name": "phpstan/phpstan",
"version": "2.1.32",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e126cad1e30a99b137b8ed75a85a676450ebb227",
"reference": "e126cad1e30a99b137b8ed75a85a676450ebb227",
"shasum": ""
},
"require": {
"php": "^7.4|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
"static analysis"
],
"support": {
"docs": "https://phpstan.org/user-guide/getting-started",
"forum": "https://github.com/phpstan/phpstan/discussions",
"issues": "https://github.com/phpstan/phpstan/issues",
"security": "https://github.com/phpstan/phpstan/security/policy",
"source": "https://github.com/phpstan/phpstan-src"
},
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://github.com/phpstan",
"type": "github"
}
],
"time": "2025-11-11T15:18:17+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "11.0.11",

View File

@@ -213,6 +213,8 @@ return [
'user_model' => \App\Models\User::class,
// 'user_model_class' => \App\Models\User::class,
'policies_namespace' => 'App\Policies',
],
];

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql1 = <<<'SQL'
ALTER TABLE process_orders
ADD COLUMN sfg_number TEXT DEFAULT NULL
SQL;
DB::statement($sql1);
$sql2 = <<<'SQL'
ALTER TABLE process_orders
ADD COLUMN machine_name TEXT DEFAULT NULL
SQL;
DB::statement($sql2);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('process_orders', function (Blueprint $table) {
// //
// });
}
};

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql = <<<'SQL'
CREATE TABLE sticker_printings (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,
reference_number TEXT DEFAULT NULL,
serial_number TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
created_by TEXT DEFAULT NULL,
updated_by TEXT DEFAULT NULL,
deleted_at TIMESTAMP,
FOREIGN KEY (plant_id) REFERENCES plants (id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sticker_printings');
}
};

View File

@@ -169,6 +169,7 @@ class PermissionSeeder extends Seeder
Permission::updateOrCreate(['name' => 'view import process order']);
Permission::updateOrCreate(['name' => 'view export process order']);
Permission::updateOrCreate(['name' => 'view import sticker printing']);
Permission::updateOrCreate(['name' => 'view export sticker printing']);
}
}

17
phpstan.neon Normal file
View File

@@ -0,0 +1,17 @@
includes:
- vendor/larastan/larastan/extension.neon
- vendor/nesbot/carbon/extension.neon
parameters:
paths:
- app/
# Level 10 is the highest level
level: 3
# ignoreErrors:
# - '#PHPDoc tag @var#'
#
# excludePaths:
# - ./*/*/FileToBeExcluded.php

View File

@@ -0,0 +1,24 @@
<x-filament::page>
<form wire:submit.prevent="create" class="space-y-6">
{{-- Form Section --}}
<div class="filament-form space-y-6">
{{ $this->form }}
</div>
{{-- <livewire:notification-sound /> --}}
{{-- Livewire Component (Invoice Table) --}}
<div class="bg-white shadow rounded-xl p-4">
<livewire:sticker-print-data :ref-data="$ref_number" />
</div>
{{-- Actions --}}
<div class="filament-actions mt-6">
<x-filament::actions>
@foreach ($this->getFormActions() as $action)
{{ $action }}
@endforeach
</x-filament::actions>
</div>
</form>
</x-filament::page>

View File

@@ -0,0 +1,23 @@
{{-- <div class="flex flex-col items-start space-y-2">
<button
type="button"
wire:click="printSticker"
class="mt-15 px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
>
Print
</button>
</div> --}}
<div class="flex flex-col items-start space-y-2">
<button
type="button"
wire:click="printSticker"
class="px-2 py-1 border border-primary-500 text-primary-600 bg-white rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
style="margin-top: 10mm;"
>
Print
</button>
</div>

View File

@@ -0,0 +1,81 @@
{{-- <div class="overflow-x-auto overflow-y-visible" style="height: 385px;">
<table class="table-auto w-full border-collapse border">
<thead class="bg-gray-100">
<tr>
<th class="border p-2">No</th>
<th class="border p-2">Reference No</th>
<th class="border p-2">Serial Number</th>
<th class="border p-2">Created By</th>
</tr>
</thead>
<tbody>
@forelse($records as $index => $record)
<tr>
<td class="border p-2 text-center">{{ $index + 1 }}</td>
<td class="border p-2 text-center">{{ $refNumber }}</td>
<td class="border p-2 text-center">{{ $record['serial_number'] }}</td>
<td class="border p-2 text-center">{{ $record->created_by }}</td>
</tr>
@empty
<tr>
<td class="border p-2 text-center" colspan="4">No serial numbers found.</td>
</tr>
@endforelse
</tbody>
</table>
</div> --}}
<div>
<h3 class="text-lg font-semibold mb-2">Sticker Printing Table</h3>
<div
wire:loading.remove
@if(!$materialInvoice) style="display:none" @endif
class="overflow-x-auto overflow-y-visible"
style="height: 385px;"
>
<table class="table-auto w-full border-collapse border">
{{-- <thead class="bg-gray-100"> --}}
<thead class="bg-gray-100 text-xs">
<tr>
<th class="border p-2">No</th>
<th class="border p-2">Reference No</th>
<th class="border p-2">Serial Number</th>
<th class="border p-2">Created By</th>
</tr>
</thead>
{{-- <tbody> --}}
<tbody class="text-xs">
@forelse($records as $index => $record)
<tr>
<td class="border p-2 text-center">{{ $index + 1 }}</td>
<td class="border p-2 text-center">{{ $refNumber }}</td>
<td class="border p-2 text-center">{{ $record['serial_number'] }}</td>
<td class="border p-2 text-center">{{ $record->created_by }}</td>
</tr>
@empty
<tr>
<td class="border p-2 text-center" colspan="4">No serial numbers found.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<script>
window.addEventListener('focus-serial-number', () => {
setTimeout(() => {
const container = document.getElementById('serial_number_input');
const input = container?.querySelector('input'); // gets the actual input inside
if (input) {
input.focus();
input.select();
}
}, 50);
});
</script>

View File

@@ -0,0 +1,92 @@
{{-- <!DOCTYPE html>
<html>
<head>
<style>
body { text-align: center; font-family: Arial, sans-serif; }
.qr-container { margin-top: 30px; }
</style>
</head>
<body>
<div class="qr-container">
<img src="data:image/png;base64,{{ $qrCode }}" width="250" height="250">
</div>
</body>
</html> --}}
{{-- <!DOCTYPE html>
<html>
<head>
<style>
@page {
margin: 0;
size: 100mm 100mm;
}
body {
margin: 0;
padding: 0;
width: 100mm;
height: 100mm;
display: flex;
justify-content: center;
align-items: center;
}
img {
width: 100mm;
height: 100mm;
}
</style>
</head>
<body>
<img src="data:image/png;base64,{{ $qrCode }}" />
</body>
</html> --}}
<!DOCTYPE html>
<html>
<head>
<style>
@page {
margin: 0;
size: 100mm 100mm;
}
body {
margin: 0;
padding: 0;
width: 100mm;
height: 100mm;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
font-size: 12px;
font-family: Arial, sans-serif;
}
img {
width: 90mm; /* QR CODE REDUCED TO FIT TEXT */
height: 90mm;
}
.ref-text {
margin-top: 3mm;
font-size: 16px; /* Increased Font Size */
font-weight: bold;
}
</style>
</head>
<body>
<div class="ref-text">
{{ $referenceNumber }}
</div>
<img src="data:image/png;base64,{{ $qrCode }}" />
</body>
</html>

View File

@@ -1,10 +1,12 @@
<?php
use App\Models\AlertMailRule;
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use App\Models\AlertMailRule;
use Illuminate\Console\Scheduling\Schedule;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
@@ -12,14 +14,10 @@ Artisan::command('inspire', function () {
// Schedule::command('send:invoice-report');
// Schedule::command('send:production-report');
app()->booted(function () {
$schedule = app(Schedule::class);
// $schedule->command('report:send-daily-production')->dailyAt('07:59');
// Production report scheduling
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
->where('rule_name', 'ProductionMail')
@@ -31,8 +29,8 @@ Artisan::command('inspire', function () {
$type = $rule->schedule_type;
$plantId = $rule->plant;
$command = $schedule->command('send:production-report', [$type, $plantId])
->appendOutputTo(storage_path('logs/scheduler.log'));
$command = $schedule->command('send:production-report', [$type, $plantId]);
// ->appendOutputTo(storage_path('logs/scheduler.log'));
switch ($type) {
case 'Live':
@@ -72,7 +70,7 @@ Artisan::command('inspire', function () {
}
}
//Invoice Data report scheduling
// Invoice Data Report Scheduling
$invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
->select('plant', 'schedule_type')
->distinct()
@@ -97,5 +95,3 @@ Artisan::command('inspire', function () {
}
}
});