94 Commits

Author SHA1 Message Date
5f9c1d4c16 Update dependency phpunit/phpunit to v12
Some checks failed
renovate/artifacts Artifact file update failure
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 9s
Gemini PR Review / review (pull_request) Successful in 32s
Laravel Pint / pint (pull_request) Failing after 1m41s
Laravel Larastan / larastan (pull_request) Failing after 1m49s
2025-12-07 00:00:57 +00:00
79e3427cdb Merge pull request 'removed extra attribute in invoice validation' (#80) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #80
2025-12-06 11:15:16 +00:00
dhanabalan
cdd746d5da removed extra attribute in invoice validation
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 Pint / pint (pull_request) Successful in 3m8s
Laravel Larastan / larastan (pull_request) Failing after 4m45s
2025-12-06 16:44:52 +05:30
81a5fa16c4 Merge pull request 'solved quick scanning issue in invoice validation' (#79) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #79
2025-12-06 09:38:37 +00:00
dhanabalan
385103323a solved quick scanning issue in invoice validation
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 30s
Laravel Pint / pint (pull_request) Successful in 2m16s
Laravel Larastan / larastan (pull_request) Failing after 3m19s
2025-12-06 15:08:22 +05:30
6520c3ca87 Merge pull request 'ranjith-dev' (#78) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #78
2025-12-06 07:26:07 +00:00
dhanabalan
6ead4bce3d Commented drop unique constraint for plant and operation number on work_group_masters
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 31s
Laravel Larastan / larastan (pull_request) Failing after 4m33s
Laravel Pint / pint (pull_request) Successful in 41m32s
2025-12-06 12:54:18 +05:30
dhanabalan
5917ae4717 Add migration to drop unique constraint for plant and operation number on work_group_masters
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
2025-12-06 12:51:29 +05:30
2e167c75b0 Merge pull request 'Alter data type for order quantity for process orders table' (#77) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #77
2025-12-06 06:54:18 +00:00
dhanabalan
dbdb11b9cf Alter data type for order quantity for process orders table
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 Larastan / larastan (pull_request) Failing after 3m39s
Laravel Pint / pint (pull_request) Successful in 12m22s
2025-12-06 12:24:06 +05:30
aca5d6c957 Merge pull request 'Added proper mail trigger for serial invoice' (#76) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #76
2025-12-06 06:39:07 +00:00
dhanabalan
764a14990b Added proper mail trigger for serial invoice
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 9s
Gemini PR Review / review (pull_request) Failing after 25s
Laravel Pint / pint (pull_request) Successful in 2m48s
Laravel Larastan / larastan (pull_request) Failing after 3m24s
2025-12-06 12:08:54 +05:30
9edbaf3d43 Merge pull request 'removed unwanted mail trigger for invoice validation error mail' (#75) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #75
2025-12-06 04:41:26 +00:00
dhanabalan
1905359179 removed unwanted mail trigger for invoice validation error mail
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 30s
Laravel Pint / pint (pull_request) Successful in 2m0s
Laravel Larastan / larastan (pull_request) Failing after 13m13s
2025-12-06 10:08:18 +05:30
a46aaa72a2 Merge pull request 'Added product characteristics master policy file' (#74) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #74
2025-12-05 09:05:58 +00:00
dhanabalan
67961ff0f9 Added product characteristics master policy file
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 9s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m41s
Laravel Larastan / larastan (pull_request) Failing after 3m9s
2025-12-05 14:35:48 +05:30
d917aa530d Merge pull request 'Added product characteristics master importer and exporter' (#73) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #73
2025-12-05 09:04:44 +00:00
dhanabalan
34412da102 Added product characteristics master importer and exporter
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 1m21s
Laravel Larastan / larastan (pull_request) Failing after 2m53s
Laravel Pint / pint (pull_request) Successful in 2m5s
2025-12-05 14:34:31 +05:30
45944c5c25 Merge pull request 'Added product characteristics master resource pages' (#72) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #72
2025-12-05 09:03:20 +00:00
dhanabalan
ad55d30d78 Added product characteristics master resource pages
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 1m21s
Laravel Larastan / larastan (pull_request) Failing after 3m8s
Laravel Pint / pint (pull_request) Successful in 2m32s
2025-12-05 14:33:06 +05:30
fda672948b Merge pull request 'Added product characteristics model file' (#71) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #71
2025-12-05 09:01:39 +00:00
dhanabalan
04eb933997 Added product characteristics model file
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 1m22s
Laravel Larastan / larastan (pull_request) Failing after 3m14s
Laravel Pint / pint (pull_request) Successful in 2m22s
2025-12-05 14:31:08 +05:30
f15e6451ca Merge pull request 'removed two migartion file for product characteristics' (#70) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #70
2025-12-05 08:58:25 +00:00
dhanabalan
95ed717020 removed two migartion file for product characteristics
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 1m20s
Laravel Larastan / larastan (pull_request) Failing after 3m22s
Laravel Pint / pint (pull_request) Successful in 2m23s
2025-12-05 14:28:12 +05:30
c8aac9116d Merge pull request 'Added production characteristics migration file' (#69) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #69
2025-12-05 08:45:49 +00:00
dhanabalan
e2b58a496c Added production characteristics migration file
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 26s
Laravel Pint / pint (pull_request) Successful in 2m14s
Laravel Larastan / larastan (pull_request) Failing after 3m14s
2025-12-05 14:15:24 +05:30
bcd107a8bc Merge pull request 'Added rout api fopr get char master for product charcteristics' (#68) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #68
2025-12-05 08:34:19 +00:00
dhanabalan
d9d0930e70 Added rout api fopr get char master for product charcteristics
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 9s
Gemini PR Review / review (pull_request) Failing after 24s
Laravel Pint / pint (pull_request) Successful in 2m9s
Laravel Larastan / larastan (pull_request) Failing after 3m4s
2025-12-05 14:04:05 +05:30
458e143b9a Merge pull request 'Added chracteristics master for product characterstics' (#67) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #67
2025-12-05 08:31:12 +00:00
dhanabalan
1f9bfdd6fe Added chracteristics master for product characterstics
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 22s
Laravel Pint / pint (pull_request) Successful in 2m13s
Laravel Larastan / larastan (pull_request) Failing after 3m10s
2025-12-05 14:00:52 +05:30
de2dda0dc5 Merge pull request 'removed notification sound in capacitor input box' (#66) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #66
2025-12-04 11:00:49 +00:00
dhanabalan
2b2b0d8803 removed notification sound in capacitor input box
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 24s
Laravel Pint / pint (pull_request) Successful in 2m16s
Laravel Larastan / larastan (pull_request) Failing after 3m5s
2025-12-04 16:30:31 +05:30
7543f8a416 Merge pull request 'removed required for part validation type in quality validation' (#65) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #65
2025-12-04 06:32:43 +00:00
dhanabalan
91d8a3441b removed required for part validation type in quality validation
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) Successful in 2m9s
Laravel Larastan / larastan (pull_request) Failing after 3m16s
2025-12-04 12:02:31 +05:30
f76316ec91 Merge pull request 'Added validation for process order with item code' (#64) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #64
2025-12-04 05:04:03 +00:00
dhanabalan
d719769fdd Added validation for process order with item 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 10s
Gemini PR Review / review (pull_request) Failing after 23s
Laravel Pint / pint (pull_request) Successful in 2m34s
Laravel Larastan / larastan (pull_request) Failing after 3m9s
2025-12-04 10:33:50 +05:30
acea7b14a6 Merge pull request 'Added line name and employee code for quality validation mail' (#63) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #63
2025-12-03 05:05:30 +00:00
dhanabalan
154b689daf Added line name and employee code for quality validation 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 10s
Gemini PR Review / review (pull_request) Failing after 24s
Laravel Pint / pint (pull_request) Successful in 2m25s
Laravel Larastan / larastan (pull_request) Failing after 3m6s
2025-12-03 10:35:18 +05:30
87f49e8491 Merge pull request 'Added filter logic in process order screen' (#62) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #62
2025-12-03 04:34:48 +00:00
dhanabalan
eb7910c119 Added filter logic in process order screen
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) Failing after 6s
Gemini PR Review / review (pull_request) Failing after 23s
Laravel Pint / pint (pull_request) Successful in 2m29s
Laravel Larastan / larastan (pull_request) Failing after 3m17s
2025-12-03 10:04:19 +05:30
f612551288 Merge pull request 'removed required option in alert mail for schedule type' (#61) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #61
2025-12-03 03:17:05 +00:00
dhanabalan
8d1e616777 removed required option in alert mail for schedule type
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 2m22s
Laravel Larastan / larastan (pull_request) Failing after 3m1s
2025-12-03 08:46:49 +05:30
4f84735eaf Merge pull request 'correction of alert mail rule logic for invoice data report' (#60) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #60
2025-12-03 03:05:35 +00:00
dhanabalan
534ac222fa correction of alert mail rule logic for invoice data report
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 11s
Gemini PR Review / review (pull_request) Failing after 51s
Laravel Larastan / larastan (pull_request) Failing after 3m1s
Laravel Pint / pint (pull_request) Successful in 2m47s
2025-12-03 08:35:03 +05:30
45b8c1fbb4 Merge pull request 'corrected logic for mail triggering' (#59) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #59
2025-12-02 11:13:56 +00:00
dhanabalan
005ea2cf87 corrected logic for mail triggering
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 Pint / pint (pull_request) Failing after 13m36s
Laravel Larastan / larastan (pull_request) Failing after 3m16s
Gemini PR Review / review (pull_request) Failing after 23s
2025-12-02 16:42:37 +05:30
6015968043 Merge pull request 'Update .github/workflows/gemini-pr-review.yaml' (#58) from actions/gemini-pr-review-patch into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #58
2025-12-02 10:57:48 +00:00
2bc8584e7a Update .github/workflows/gemini-pr-review.yaml
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) Successful in 29s
Laravel Pint / pint (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
2025-12-02 10:55:46 +00:00
d126e931c8 Merge pull request 'decreased font size of the sticker printing table' (#56) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #56
2025-12-02 03:05:34 +00:00
62bf68ad2e Merge pull request 'corrected logic in sticker printing page' (#55) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #55
2025-12-02 02:54:47 +00:00
c6c63dcb35 Merge pull request 'Added ref no above the qr code in sticker printing' (#54) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #54
2025-12-01 12:20:43 +00:00
d1663ae58a Merge pull request 'Added serial qr code validation in create page of sticker printing' (#53) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #53
2025-12-01 12:11:15 +00:00
deb46cdda2 Merge pull request 'chnaged indentation in item resource page' (#52) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #52
2025-12-01 12:10:12 +00:00
002bdc597d Merge pull request 'Added crt logic policy for sticker printing' (#51) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #51
2025-12-01 10:50:34 +00:00
a406d1b58a Merge pull request 'commented logic for sticker prinitng policy' (#50) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #50
2025-12-01 10:26:58 +00:00
58d0b9f0ae Merge pull request 'Added sticker printing policy' (#49) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #49
2025-12-01 10:12:17 +00:00
c0d8ca7b1e Merge pull request 'commented all line sof cod ein sticker printing policy' (#48) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #48
2025-12-01 10:10:03 +00:00
f31ab62ec0 Merge pull request 'commented user model class in spatie page' (#47) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #47
2025-12-01 09:55:11 +00:00
4285a31f94 Merge pull request 'Added permissions for import and export for sticker printing' (#46) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #46
2025-12-01 09:30:07 +00:00
0c9228bfec Merge pull request 'Updated item selection logic in StickerMasterResource to return an empty array when no plant is selected' (#45) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #45
2025-12-01 09:23:49 +00:00
58b45c849d Merge pull request 'Added print button for sticker printing page' (#44) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #44
2025-12-01 09:20:43 +00:00
61a2e7ffad Merge pull request 'Added sticker printing create resource file' (#43) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #43
2025-12-01 09:18:30 +00:00
3779cf3e3b Merge pull request 'Added sticker printing livewire page for table' (#42) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #42
2025-12-01 09:15:31 +00:00
acf955dd94 Merge pull request 'Added pdf qr code for sticker print page' (#41) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #41
2025-12-01 09:14:11 +00:00
0de49f14ce Merge pull request 'Added sticker printing policy page' (#40) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #40
2025-12-01 09:13:27 +00:00
0473ca33cf Merge pull request 'Added sticker prinitng import and export file' (#39) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #39
2025-12-01 09:12:15 +00:00
8a01033459 Merge pull request 'Added sticker printing resource file' (#38) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #38
2025-12-01 09:11:15 +00:00
0555f9faff Merge pull request 'Added sticker printing model file' (#37) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #37
2025-12-01 09:09:39 +00:00
8cbbaa4845 Merge pull request 'Added sticker printing migration file' (#36) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #36
2025-12-01 09:08:26 +00:00
cb6b201648 Merge pull request 'Added user model class in spatie' (#35) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #35
2025-12-01 09:06:52 +00:00
c3089a147c Merge pull request 'Refactor processSerialNumber method to improve package validation logic' (#34) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #34
2025-12-01 08:28:43 +00:00
45f0e39f73 Merge pull request 'Refactor plant selection logic in ItemResource and StickerMasterResource to order by code' (#33) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #33
2025-12-01 04:40:07 +00:00
fe1e1b9918 Merge pull request 'Added Quality mail alert in alert mail page' (#32) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #32
2025-12-01 04:30:07 +00:00
e20915ca82 Merge pull request 'Refactor content method in InvoiceDataMail to use null-safe operator for document_date check' (#29) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #29
2025-11-29 12:58:25 +00:00
58e6cbfac0 Merge pull request 'Added proper imports for mail' (#28) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #28
2025-11-29 12:57:53 +00:00
1ace049687 Merge pull request 'Uncommented the mail schedule logic' (#27) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #27
2025-11-29 12:33:52 +00:00
e5e85a8eea Merge pull request 'ranjith-dev' (#26) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #26
2025-11-29 12:28:01 +00:00
555802ab35 Merge pull request 'Updated warning message against tube_sticker and pack_slip master data' (#25) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #25
2025-11-29 11:53:18 +00:00
587b743f12 Merge pull request 'Clear process_order if plant not selected' (#24) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #24
2025-11-29 10:47:24 +00:00
42555d4a81 Merge pull request 'Added reactive validation for plant selection and duplicate checks for coil and SFG numbers in ProcessOrder form' (#23) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #23
2025-11-29 10:43:17 +00:00
fd1e554076 Merge pull request 'commented out machine ID validation logic in storeProcessOrderData method' (#22) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #22
2025-11-29 10:07:18 +00:00
022654f192 Merge pull request 'Updated get hasPumpQr status from pack_slip_pump if it does not exist in tube_sticker_pump' (#21) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #21
2025-11-29 09:00:31 +00:00
55f1088fda Merge pull request 'Updated sfg_number validations as optional and check duplcate only if it exist' (#20) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #20
2025-11-29 06:52:08 +00:00
f9233f44d8 Merge pull request 'commented alert mail rules logic from boot method' (#19) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #19
2025-11-29 06:19:01 +00:00
e0fec6b07c Merge pull request 'Added schedule method logic in app service provider' (#18) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #18
2025-11-29 05:35:04 +00:00
6bda9c1459 Merge pull request 'Added LogClear command and Updated log message' (#17) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #17
2025-11-27 06:34:58 +00:00
39bdd3df57 Merge pull request 'Updated report view logic' (#16) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #16
2025-11-27 05:41:34 +00:00
5bcf0703d9 Merge pull request 'Refactor: Clean up imports and enhance form/table structure in InvoiceDataValidation and InvoiceOutValidation resources' (#15) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #15
2025-11-27 05:29:19 +00:00
80e522b7e6 Merge pull request 'feat: Add validation rules for Machine and Work Center names; enhance ProcessOrder table sorting; refactor StickerMasterResource for improved readability and functionality' (#14) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #14
2025-11-27 04:50:10 +00:00
ee101f80ea Merge pull request 'Updated error response codes in updateGR and related methods to return 404 for various validation errors and Added sfg_number duplicate warning' (#13) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #13
2025-11-27 03:08:14 +00:00
37a99d03c1 Merge pull request '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' (#12) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #12
2025-11-26 14:21:05 +00:00
5fdced003a Merge pull request 'ranjith-dev' (#11) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #11
2025-11-26 14:17:41 +00:00
0b0bb90efb Merge pull request 'Added POST API logs to view the structure in command prompt' (#10) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #10
2025-11-26 11:43:09 +00:00
32ce6da2c1 Merge pull request 'Add Larastan configuration and dependencies for static analysis' (#9) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #9
2025-11-26 09:11:36 +00:00
27 changed files with 4103 additions and 721 deletions

View File

@@ -36,8 +36,8 @@ jobs:
restore-keys: |
${{ runner.os }}-npm-global-
- name: Install Gemini CLI globally
run: npm install -g --loglevel=http @google/gemini-cli
# - name: Install Gemini CLI globally
# run: npm install -g --loglevel=http @google/gemini-cli
- name: Generate git diff and review with Gemini
id: review

View File

@@ -0,0 +1,202 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\Scheduling\Schedule;
use App\Models\AlertMailRule;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;
class Scheduler extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
// protected $signature = 'app:scheduler';
protected $signature = 'custom:scheduler';
/**
* The console command description.
*
* @var string
*/
// protected $description = 'Command description';
protected $description = 'Manually trigger scheduler logic';
/**
* Execute the console command.
*/
// public function handle()
// {
// //
// }
public function handle()
{
// --- Production Rules ---
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
->where('rule_name', 'ProductionMail')
->select('plant', 'schedule_type')
->distinct()
->get();
foreach ($productionRules as $rule) {
switch ($rule->schedule_type) {
case 'Live':
// Run every minute
\Artisan::call('send:production-report', [
'schedule_type' => $rule->schedule_type,
'plant' => $rule->plant,
]);
break;
case 'Hourly':
if (now()->minute == 0) {
\Artisan::call('send:production-report', [
'schedule_type' => $rule->schedule_type,
'plant' => $rule->plant,
]);
}
break;
case 'Daily':
if (now()->format('H:i') == '07:59') {
\Artisan::call('send:production-report', [
'schedule_type' => $rule->schedule_type,
'plant' => $rule->plant,
]);
}
break;
}
}
// --- Invoice Validation Rules ---
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
->where('rule_name', 'InvoiceMail')
->select('plant', 'schedule_type')
->distinct()
->get();
foreach ($invoiceRules as $rule) {
switch ($rule->schedule_type) {
case 'Live':
// Run every minute
\Artisan::call('send:invoice-report', [
'schedule_type' => $rule->schedule_type,
'plant' => $rule->plant,
]);
break;
case 'Hourly':
if (now()->minute == 0) {
\Artisan::call('send:invoice-report', [
'schedule_type' => $rule->schedule_type,
'plant' => $rule->plant,
]);
}
break;
case 'Daily':
if (now()->format('H:i') == '07:59') {
\Artisan::call('send:invoice-report', [
'schedule_type' => $rule->schedule_type,
'plant' => $rule->plant,
]);
}
break;
}
}
// foreach ($invoiceRules as $rule) {
// switch ($rule->schedule_type) {
// case 'Live':
// try {
// Artisan::call('send:invoice-report', [
// 'schedule_type' => $rule->schedule_type,
// 'plant' => $rule->plant,
// ]);
// Log::info('Invoice report sent | Plant: '.$rule->plant);
// } catch (\Throwable $e) {
// Log::error("Invoice Live Failed ({$rule->plant}): ".$e->getMessage());
// }
// break;
// case 'Hourly':
// if (now()->minute == 0) {
// Artisan::call('send:invoice-report', [
// 'schedule_type' => $rule->schedule_type,
// 'plant' => $rule->plant,
// ]);
// }
// break;
// case 'Daily':
// if (now()->format('H:i') == '07:59') {
// Artisan::call('send:invoice-report', [
// 'schedule_type' => $rule->schedule_type,
// 'plant' => $rule->plant,
// ]);
// }
// break;
// }
// }
// --- Invoice Data Report Rules ---
$invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
->where('rule_name', 'InvoiceDataMail')
->select('plant', 'schedule_type')
->distinct()
->get();
foreach ($invoiceDataRules as $rule) {
switch ($rule->schedule_type) {
case 'Live':
// Run every minute
\Artisan::call('send:invoice-data-report', [
'schedule_type' => $rule->schedule_type,
'plant' => $rule->plant,
]);
break;
case 'Hourly':
if (now()->minute == 0) {
\Artisan::call('send:invoice-data-report', [
'schedule_type' => $rule->schedule_type,
'plant' => $rule->plant,
]);
}
break;
case 'Daily':
if (now()->format('H:i') == '10:00') {
\Artisan::call('send:invoice-data-report', [
'schedule_type' => $rule->schedule_type,
'plant' => $rule->plant,
]);
}
break;
}
}
}
/**
* Helper to call Artisan commands with parameters.
*/
protected function callArtisanCommand($commandName, $rule)
{
\Artisan::call($commandName, [
'schedule_type' => $rule->schedule_type,
'plant' => $rule->plant,
]);
$this->info("Executed {$commandName} for plant: {$rule->plant}");
\Log::info("Executed {$commandName} for plant: {$rule->plant}");
}
}

View File

@@ -2,11 +2,11 @@
namespace App\Console\Commands;
use App\Mail\test;
use App\Models\InvoiceValidation;
use App\Models\Plant;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use App\Mail\test;
class SendInvoiceReport extends Command
{
@@ -15,9 +15,8 @@ class SendInvoiceReport extends Command
*
* @var string
*/
// protected $signature = 'app:send-invoice-report';
protected $signature = 'send:invoice-report{schedule_type} {plant}';
// protected $signature = 'app:send-invoice-report';
protected $signature = 'send:invoice-report {schedule_type} {plant}';
/**
* The console command description.
@@ -29,12 +28,10 @@ class SendInvoiceReport extends Command
/**
* Execute the console command.
*/
public function handle()
{
$schedule = $this->argument('schedule_type');
//$scheduleType = $this->argument('scheduleType');
// $scheduleType = $this->argument('scheduleType');
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
@@ -52,18 +49,14 @@ class SendInvoiceReport extends Command
: [$plantIdArg];
$no = 1;
if (strtolower($schedule) == 'daily')
{
if (strtolower($schedule) == 'daily') {
$startDate = now()->subDay()->setTime(8, 0, 0);
$endDate = now()->setTime(8, 0, 0);
}
else
{
} else {
$startDate = now()->setTime(8, 0, 0);
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
}
foreach ($plantIds as $plantId)
{
foreach ($plantIds as $plantId) {
$plant = Plant::find($plantId);
$plantName = $plant ? $plant->name : $plantId;
@@ -89,7 +82,7 @@ class SendInvoiceReport extends Command
$scannedInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
->where('scanned_status', 'Scanned')
->where(function($query) {
->where(function ($query) {
$query->whereNull('quantity')
->orWhere('quantity', 0);
})
@@ -128,7 +121,7 @@ class SendInvoiceReport extends Command
$scannedMatInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
->where('quantity', 1)
->whereNotNull('serial_number')
->where('serial_number','!=', '')
->where('serial_number', '!=', '')
->whereBetween('updated_at', [$startDate, $endDate])
->count();
@@ -164,7 +157,7 @@ class SendInvoiceReport extends Command
$scannedBundleInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
->where('quantity', '>', 1)
->whereNotNull('serial_number')
->where('serial_number','!=', '')
->where('serial_number', '!=', '')
->whereBetween('updated_at', [$startDate, $endDate])
->count();
@@ -193,7 +186,6 @@ class SendInvoiceReport extends Command
}
}
// Send to MaterialInvoiceMail recipients (material + bundle table)
if ($mailRules->has('MaterialInvoiceMail')) {
$emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
@@ -212,16 +204,14 @@ class SendInvoiceReport extends Command
// Show preview in console
$this->info('--- Serial Invoice Table ---');
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $serialTableData);
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice', 'TotalInvoice Quantity', 'ScannedInvoice Quantity'], $serialTableData);
$this->info('--- Material Invoice Table ---');
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $materialTableData);
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice', 'TotalInvoice Quantity', 'ScannedInvoice Quantity'], $materialTableData);
$this->info('--- Bundle Invoice Table ---');
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $bundleTableData);
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice', 'TotalInvoice Quantity', 'ScannedInvoice Quantity'], $bundleTableData);
$this->info($contentVars['wishes'] ?? '');
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Filament\Exports;
use App\Models\ProductCharacteristicsMaster;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;
class ProductCharacteristicsMasterExporter extends Exporter
{
protected static ?string $model = ProductCharacteristicsMaster::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.name')
->label('PLANT'),
ExportColumn::make('item.code')
->label('ITEM CODE'),
ExportColumn::make('line.name')
->label('LINE NAME'), //machine.workGroupMaster.name
ExportColumn::make('machine.workGroupMaster.name')
->label('WORK GROUP MASTER'),
ExportColumn::make('machine.work_center')
->label('WORK CENTER'),
ExportColumn::make('characteristics_type')
->label('CHARACTERISTICS TYPE'),
ExportColumn::make('name')
->label('NAME'),
ExportColumn::make('inspection_type')
->label('INSPECTION TYPE'),
ExportColumn::make('upper')
->label('UPPER'),
ExportColumn::make('lower')
->label('LOWER'),
ExportColumn::make('middle')
->label('MIDDLE'),
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 product characteristics master 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

@@ -0,0 +1,282 @@
<?php
namespace App\Filament\Imports;
use App\Models\Item;
use App\Models\Line;
use App\Models\Machine;
use App\Models\Plant;
use App\Models\ProductCharacteristicsMaster;
use App\Models\User;
use App\Models\WorkGroupMaster;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
use Str;
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
use Illuminate\Support\Facades\Auth;
class ProductCharacteristicsMasterImporter extends Importer
{
protected static ?string $model = ProductCharacteristicsMaster::class;
public static function getColumns(): array
{
return [
ImportColumn::make('plant')
->requiredMapping()
->exampleHeader('Plant Name')
->example('Ransar Industries-I')
->label('Plant Name')
->relationship(resolveUsing:'name')
->rules(['required']),
ImportColumn::make('item')
->requiredMapping()
->exampleHeader('Item Code')
->example('630214')
->label('Item Code')
->relationship(resolveUsing:'code')
->rules(['required']),
ImportColumn::make('line')
->requiredMapping()
->exampleHeader('Line')
->example('4 inch pump line')
->label('Line')
->relationship(resolveUsing:'name')
->rules(['required']),
ImportColumn::make('work_group_master_id')
->label('Group Work Center')
->requiredMapping()
->exampleHeader('Group Work Center')
->example('RMGCGABC')
->relationship(resolveUsing:'name')
->rules(['required']),
ImportColumn::make('machine')
->requiredMapping()
->exampleHeader('Work Center')
->example('RMGCE001')
->label('Work Center')
->relationship(resolveUsing:'work_center')
->rules(['required']),
ImportColumn::make('characteristics_type')
->exampleHeader('Characteristics Type')
->example('Process or Product')
->label('Characteristics Type')
->rules(['required']),
ImportColumn::make('name')
->exampleHeader('Name')
->example('Body')
->label('Name')
->rules(['required']),
ImportColumn::make('inspection_type')
->exampleHeader('Inspection Type')
->example('Visual or Value')
->label('Inspection Type')
->rules(['required']),
ImportColumn::make('lower')
->exampleHeader('Lower')
->example('-0.2')
->label('Lower')
->rules(['numeric']),
ImportColumn::make('middle')
->exampleHeader('Middle')
->example('1')
->label('Middle')
->numeric()
->rules(['numeric']),
ImportColumn::make('upper')
->exampleHeader('Upper')
->example('0.2')
->label('Upper')
->rules(['numeric']),
ImportColumn::make('created_by')
->exampleHeader('Created By')
->example('Admin')
->label('Created By'),
//ImportColumn::make('updated_by'),
];
}
public function resolveRecord(): ?ProductCharacteristicsMaster
{
$warnMsg = [];
$plant = Plant::where('name', $this->data['plant'])->first();
if (!$plant) {
$warnMsg[] = "Plant not found";
}
$itemExists = Item::where('code', $this->data['item'])->first();
if (!$itemExists) {
$warnMsg[] = "Item not found";
}
$itemAgainstPlant = Item::where('code', $this->data['item'])
->where('plant_id', $plant->id)
->first();
if (!$itemAgainstPlant) {
$warnMsg[] = "Item code not found for the given plant";
}
else {
$itemId = $itemAgainstPlant->id;
}
$lineExists = Line::where('name', $this->data['line'])->first();
if (!$lineExists) {
$warnMsg[] = "Line not found";
}
$lineAgainstPlant = Line::where('name', $this->data['line'])
->where('plant_id', $plant->id)
->first();
if (!$lineAgainstPlant) {
$warnMsg[] = "Line not found for the given plant";
}
else
{
$LineId = $lineAgainstPlant->id;
}
$WorkgroupMaster = WorkGroupMaster::where('name', $this->data['work_group_master_id'])->where('plant_id', $plant->id)->first();
if (!$WorkgroupMaster) {
$warnMsg[] = "Work Group Master value not found";
}
else {
$workGroupMasterId = $WorkgroupMaster->id;
// 2. Now check if this WorkGroupMaster id exists in ANY of the 10 columns
$existsInLine = Line::where('plant_id', $plant->id)
->where(function ($q) use ($workGroupMasterId) {
for ($i = 1; $i <= 10; $i++) {
$q->orWhere("work_group{$i}_id", $workGroupMasterId);
}
})
->exists();
if (!$existsInLine) {
$warnMsg[] = "Work Group Master '{$WorkgroupMaster->name}' is not mapped to any line in this plant";
}
else {
$workGroupMasterId = $WorkgroupMaster->id;
}
}
$machine = Machine::where('work_center', $this->data['machine'])->first();
if (!$machine) {
$warnMsg[] = "Work Center not found";
}
else {
$machineId = $machine->id;
}
$machineAgainstPlant = Machine::where('work_center', $this->data['machine'])
->where('plant_id', $plant->id)
->first();
if (!$machineAgainstPlant) {
$warnMsg[] = "Work Center not found for the given plant";
}
else
{
$machineId = $machineAgainstPlant->id;
}
$user = User::where('name', $this->data['created_by'])->first();
if (!$user) {
$warnMsg[] = "Operator ID not found";
}
if (($this->data['inspection_type'] ?? null) == 'Value') {
$upper = $this->data['upper'] ?? null;
$lower = $this->data['lower'] ?? null;
$middle = $this->data['middle'] ?? null;
if (is_null($upper) || is_null($lower) || is_null($middle)) {
$warnMsg[] = "For 'Value' inspection type, Upper, Lower, and Middle values are required.";
} elseif (!is_numeric($upper) || !is_numeric($lower) || !is_numeric($middle)) {
$warnMsg[] = "Upper, Lower, and Middle values must be numeric.";
} elseif (!($lower <= $middle && $middle <= $upper)) {
$warnMsg[] = "For 'Value' inspection type, values must satisfy: Lower ≤ Middle ≤ Upper.";
}
}
if (!empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg));
}
else
{
$record = ProductCharacteristicsMaster::firstOrNew([
'plant_id' => $plant->id,
'item_id' => $itemId,
'line_id' => $LineId,
'work_group_master_id' => $workGroupMasterId,
'machine_id' => $machineId,
]);
$currentUser = Auth::check() ? Auth::user()->name : ($this->data['created_by'] ?? 'System');
// If record is new, fill all fields
if (!$record->exists) {
$record->name = $this->data['name'];
$record->characteristics_type = $this->data['characteristics_type'];
$record->inspection_type = $this->data['inspection_type'];
$record->upper = $this->data['upper'] ?? null;
$record->lower = $this->data['lower'] ?? null;
$record->middle = $this->data['middle'] ?? null;
$record->created_by = $currentUser;
} else {
// Record exists → update only updated_by and updated_at
$record->updated_by = $currentUser;
$record->touch();
}
$record->save();
return null;
}
// else
// {
// ProductCharacteristicsMaster::updateOrCreate(
// [
// 'plant_id' => $plant->id,
// 'item_id' => $itemId,
// 'line_id' => $LineId,
// 'work_group_master_id' => $workGroupMasterId,
// 'machine_id'=> $machineId,
// ],
// [
// 'name' => $this->data['name'],
// 'characteristics_type' => $this->data['characteristics_type'],
// 'inspection_type' => $this->data['inspection_type'],
// 'upper' => $this->data['upper'] ?? null,
// 'lower' => $this->data['lower'] ?? null,
// 'middle' => $this->data['middle'] ?? null,
// //'created_by' => user ?? $this->data['created_by'],
// 'created_by' => Auth::check() ? Auth::user()->name :($this->data['created_by'] ?? null)
// ]
// );
// return null;
// }
//return new WorkGroupMaster();
// return new ProductCharacteristicsMaster();
}
public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your product characteristics master 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

@@ -70,7 +70,6 @@ class AlertMailRuleResource extends Resource
->label('CC Emails'),
Forms\Components\Select::make('schedule_type')
->label('Schedule Type')
->required()
->options([
'Live' => 'Live',
'Hourly' => 'Hourly',

View File

@@ -5,6 +5,7 @@ namespace App\Filament\Resources;
use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction;
use App\Filament\Exports\InvoiceValidationExporter;
use App\Filament\Resources\InvoiceValidationResource\Pages;
use App\Mail\InvoiceNotification;
use App\Models\InvoiceValidation;
use App\Models\Item;
use App\Models\Plant;
@@ -29,7 +30,6 @@ use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Forms\Components\View;
use Filament\Notifications\Notification;
use Filament\Tables\Actions\Action;
use Filament\Tables\Actions\ExportAction;
@@ -38,6 +38,10 @@ use Illuminate\Support\Facades\Storage;
use Maatwebsite\Excel\Facades\Excel;
use Livewire\Livewire;
use Str;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Mail;
use Filament\Forms\Components\View;
class InvoiceValidationResource extends Resource
{
@@ -49,6 +53,8 @@ class InvoiceValidationResource extends Resource
public $invoiceNumber;
public static function form(Form $form): Form
{
return $form
@@ -119,6 +125,9 @@ class InvoiceValidationResource extends Resource
$invNo = $get('invoice_number');
$set('serial_number', null);
$set('update_invoice', null);
//Session::put('invoice_number', $state);
session(['invoice_number' => $state]);
// if (!$invNo) { return; } else { }
}),
@@ -126,17 +135,32 @@ class InvoiceValidationResource extends Resource
->label('Serial Number')
->reactive()
->readOnly(fn (callable $get) => empty($get('invoice_number')))
//->disabled(fn (Get $get) => empty($get('invoice_number')))
->disabled(fn (Get $get) => empty($get('invoice_number')))
->extraAttributes([
'id' => 'serial_number_input',
'x-data' => '{ value: "" }',
'x-model' => 'value',
'wire:keydown.enter.prevent' => 'processSerialNumber(value)', // Using wire:keydown
'wire:keydown.enter.prevent' => 'processSerial(value)', // Using wire:keydown
])
->afterStateUpdated(function ($state, callable $set, callable $get) {
// ->dehydrated(false) // Do not trigger Livewire syncing
// ->extraAttributes([
// 'id' => 'serial_number_input',
// 'x-on:keydown.enter.prevent' => "
// let serial = \$event.target.value;
// if (serial.trim() != '') {
// \$wire.dispatch('process-scan', serial);
// \$event.target.value = '';
// }
// ",
// ])
->afterStateUpdated(function ($state, callable $set, callable $get, callable $livewire) {
$set('update_invoice', 0);
// $this->dispatch('focus-serial-number');
// if (!$invNo) { return; } else { }
// if ($state) {
// $livewire('process-scan', $state);
// $set('serial_number', null);
// }
})
->columnSpan(1),
Forms\Components\TextInput::make('total_quantity')
@@ -1256,6 +1280,24 @@ class InvoiceValidationResource extends Resource
];
}
// public static function render(): View
// {
// if (session()->has('invoice_number')) {
// $invoiceNumber = session('invoice_number');
// // Debug: show the invoice number
// dd($invoiceNumber); // This will stop execution and show the value
// // Trigger email
// \Mail::to('jothikumar.padmanaban@cripumps.com')
// ->send(new InvoiceNotification($invoiceNumber));
// // Clear session so it doesn't resend on next refresh
// //session()->forget('invoice_number');
// }
// // return view('filament.resources.invoice-validation-resource.pages.list-invoice-validation');
// }
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()

View File

@@ -19,6 +19,7 @@ use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use Maatwebsite\Excel\Facades\Excel;
use Str;
use Livewire\Attributes\On;
class CreateInvoiceValidation extends CreateRecord
{
@@ -69,7 +70,7 @@ class CreateInvoiceValidation extends CreateRecord
$totQuan = InvoiceValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $this->plantId)->count();
$scanSQuan = InvoiceValidation::where('invoice_number', $this->invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $this->plantId)->count();
$this->dispatch('playNotificationSound');
// $this->dispatch('playNotificationSound');
if ($totQuan == $scanSQuan) {
$this->form->fill([
'plant_id' => $this->plantId,
@@ -2260,7 +2261,7 @@ class CreateInvoiceValidation extends CreateRecord
];
}
public function processSerialNumber($serNo)
public function processSerial($serNo)
{
$serNo = trim($serNo);
$mSerNo = $serNo;
@@ -2370,18 +2371,18 @@ class CreateInvoiceValidation extends CreateRecord
// .Mail
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2404,19 +2405,19 @@ class CreateInvoiceValidation extends CreateRecord
// .Mail
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2439,19 +2440,19 @@ class CreateInvoiceValidation extends CreateRecord
// .Mail
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2481,18 +2482,18 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
// .Mail
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2513,18 +2514,18 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('playWarnSound');
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2555,18 +2556,18 @@ class CreateInvoiceValidation extends CreateRecord
// .Mail
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2588,18 +2589,18 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
// .Mail
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2630,18 +2631,18 @@ class CreateInvoiceValidation extends CreateRecord
// .Mail
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2668,18 +2669,18 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('playWarnSound');
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotFound')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotFound')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2705,18 +2706,18 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('playWarnSound');
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotFoundDB')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotFoundDB')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2741,18 +2742,18 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('playWarnSound');
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotValidMaterialType')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotValidMaterialType')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2783,18 +2784,18 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('playWarnSound');
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotInvoice')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotInvoice')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -2824,18 +2825,18 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('playWarnSound');
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mInvoiceType = 'Material';
// $mailData = $this->getMail();
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
// $mInvoiceType = 'Material';
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'Item')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// if (! empty($emails)) {
// Mail::to($emails)->send(
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'Item')
// );
// } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([
'plant_id' => $plantId,
@@ -3098,22 +3099,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
// ..Mail
$mInvoiceType = 'Serial';
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
if (! empty($emails)) {
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, 'InvalidFormat')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3155,23 +3140,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('play-warn-sound');
// ..Mail
$mInvoiceType = 'Serial';
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'NotFound')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
// ..
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3240,19 +3208,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
$mInvoiceType = 'Serial';
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'NotFoundItemS')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3305,19 +3260,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
$mInvoiceType = 'Serial';
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'NotValidPackage')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3356,18 +3298,6 @@ class CreateInvoiceValidation extends CreateRecord
->seconds(3)
->send();
$this->dispatch('playWarnSound');
$mInvoiceType = 'Serial';
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'NotMotorQR')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
$this->form->fill([
'plant_id' => $plantId,
@@ -3389,21 +3319,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
// ..Mail
$mInvoiceType = 'Serial';
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
if (! empty($emails)) {
Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'DuplicateMotorQR')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3514,20 +3429,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
$mInvoiceType = 'Serial';
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
if (! empty($emails)) {
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'NotPumpQR')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3547,20 +3448,6 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('playWarnSound');
$mInvoiceType = 'Serial';
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
if (! empty($emails)) {
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'DuplicatePumpQR')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3675,20 +3562,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
$mInvoiceType = 'Serial';
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
if (! empty($emails)) {
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'MissingPanelBox')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3765,20 +3638,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
$mInvoiceType = 'Serial';
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
if (! empty($emails)) {
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'UnknownPumpsetQR')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3799,20 +3658,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
$mInvoiceType = 'Serial';
$mailData = $this->getMail();
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
if (! empty($emails)) {
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'DuplicatePumpsetQR')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3920,6 +3765,12 @@ class CreateInvoiceValidation extends CreateRecord
}
}
// #[On('process-scan')]
// public function processSerial($serial)
// {
// $this->processSer($serial); // Your duplicate check + mail logic
// }
public function getHeading(): string
{
return 'Scan Invoice Validation';

View File

@@ -24,6 +24,12 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
use Smalot\PdfParser\Parser;
use Storage;
use Filament\Forms\Components\DateTimePicker;
use Filament\Tables\Filters\Filter;
use Filament\Forms\Components\Select;
use App\Models\Line;
use Filament\Forms\Components\TextInput;
use App\Models\Item;
class ProcessOrderResource extends Resource
{
@@ -122,6 +128,7 @@ class ProcessOrderResource extends Resource
->hidden()
->readOnly(),
// ->readOnly(true),
Forms\Components\TextInput::make('process_order')
->label('Process Order')
->reactive()
@@ -137,6 +144,34 @@ class ProcessOrderResource extends Resource
$set('sfgNumberError', null);
}
})
->rule(function (callable $get) {
return function (string $attribute, $value, \Closure $fail) use ($get) {
$plantId = $get('plant_id');
$itemId = $get('item_id');
$processOrder = $value;
//$currentId = $get('id'); // current editing record id
if (! $plantId || ! $processOrder) {
return;
}
$existing = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('item_id', '!=', $itemId)
->first();
if ($existing) {
Notification::make()
->title('Duplicate Process Order!')
->body("Process Order '{$value}' is already exist with item code '{$existing->item->code}'.")
->danger()
->send();
$fail("process order already exists for this plant and item code '{$existing->item->code}'.");
}
};
})
->required(),
Forms\Components\TextInput::make('coil_number')
->label('Coil Number')
@@ -490,9 +525,131 @@ class ProcessOrderResource extends Resource
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
Tables\Filters\TrashedFilter::make(),
// ->filters([
// Tables\Filters\TrashedFilter::make(),
// ])
->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)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('Item', null);
}),
Select::make('Item')
->label('Item Code')
->nullable()
->options(function (callable $get) {
$plantId = $get('Plant');
return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('process_order', null);
}),
TextInput::make('process_order')
->label('Process Order')
->placeholder('Enter Process Order'),
TextInput::make('sfg_number')
->label('Sfg Number')
->placeholder(placeholder: 'Enter Sfg Number'),
TextInput::make('machine_name')
->label('Machine Name')
->placeholder(placeholder: 'Enter Machine Name'),
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['Item']) && empty($data['process_order']) && empty($data['sfg_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['machine_name'])) {
return $query->whereRaw('1 = 0');
}
if (!empty($data['Plant'])) {
$query->where('plant_id', $data['Plant']);
}
if (!empty($data['Item'])) {
$query->where('item_id', $data['Item']);
}
if (!empty($data['process_order'])) {
$query->where('process_order', $data['process_order']);
}
if (!empty($data['sfg_number'])) {
$query->where('sfg_number', $data['sfg_number']);
}
if (!empty($data['machine_name'])) {
// $query->where('machine_name', $data['machine_name']);
$query->where('machine_name', 'like', '%' . $data['machine_name'] . '%');
}
if (!empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
if (!empty($data['created_to'])) {
$query->where('created_at', '<=', $data['created_to']);
}
//$query->orderBy('created_at', 'asc');
})
->indicateUsing(function (array $data) {
$indicators = [];
if (!empty($data['Plant'])) {
$indicators[] = 'Plant: ' . Plant::where('id', $data['Plant'])->value('name');
}
if (!empty($data['Item'])) {
$indicators[] = 'Item: ' . Item::where('id', $data['Item'])->value('code');
}
if (!empty($data['process_order'])) {
$indicators[] = 'Process Order: ' . $data['process_order'];
}
if (!empty($data['sfg_number'])) {
$indicators[] = 'Sfg Number: ' . $data['sfg_number'];
}
if (!empty($data['machine_name'])) {
$indicators[] = 'Machine Name: ' . $data['machine_name'];
}
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(),

View File

@@ -0,0 +1,364 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Exports\ProductCharacteristicsMasterExporter;
use App\Filament\Imports\ProductCharacteristicsMasterImporter;
use App\Filament\Resources\ProductCharacteristicsMasterResource\Pages;
use App\Filament\Resources\ProductCharacteristicsMasterResource\RelationManagers;
use App\Models\Line;
use App\Models\Machine;
use App\Models\Plant;
use App\Models\ProductCharacteristicsMaster;
use App\Models\WorkGroupMaster;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Forms\Get;
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\ImportAction;
use Filament\Tables\Actions\ExportAction;
class ProductCharacteristicsMasterResource extends Resource
{
protected static ?string $model = ProductCharacteristicsMaster::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->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();
})
->reactive()
->required(),
Forms\Components\Select::make('item_id')
->label('Item Code')
//->relationship('item', 'code')
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('plant_id');
if (empty($plantId)) {
return [];
}
return \App\Models\Item::where('plant_id', $plantId)->pluck('code', 'id');
})
->required(),
Forms\Components\Select::make('line_id')
->label('Line')
->reactive()
->options(function (callable $get) {
$plantId = $get('plant_id');
if (empty($plantId)) {
return [];
}
return Line::where('plant_id', $plantId)->pluck('name', 'id');
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('machine_id', null);
if (!$get('work_group_master_id')) {
$set('machine_id', null);
}
})
->required(),
// ->relationship('line', 'name'),
Forms\Components\Select::make('work_group_master_id')
->label('Group Work Center')
->required()
->reactive()
->options(function (callable $get) {
if (!$get('plant_id') || !$get('line_id')) {
return [];
}
$line = Line::find($get('line_id'));
$workGroupIds = [];
for ($i = 1; $i <= $line->no_of_operation; $i++) {
$column = "work_group{$i}_id";
if (!empty($line->$column)) {
$workGroupIds[] = $line->$column;
}
}
return WorkGroupMaster::where('plant_id', $get('plant_id'))->whereIn('id', $workGroupIds)->pluck('name', 'id')->toArray();
})
->disabled(fn (Get $get) => !empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
$lineId = $get('line_id');
if (!$lineId) {
$set('mGroupWorkError', 'Please select a line first.');
$set('machine_id', null);
return;
}
else
{
// $grpWrkCnr = Line::find($lineId)->group_work_center;
// if (!$grpWrkCnr || Str::length($grpWrkCnr) < 1)
// {
// $set('mGroupWorkError', 'Please select a group work center line.');
// $set('line_id', null);
// return;
// }
$set('mGroupWorkError', null);
$set('machine_id', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('mGroupWorkError') ? 'border-red-500' : '',
])
// ->dehydrateStateUsing(fn ($state) => null)
->hint(fn ($get) => $get('mGroupWorkError') ? $get('mGroupWorkError') : null)
->hintColor('danger'),
Forms\Components\Select::make('machine_id')
->label('Work Center')
//->relationship('machine', 'name'),
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('plant_id');
$lineId = $get('line_id');
$workGroupId = $get('work_group_master_id');
if (empty($plantId) || empty($lineId) || empty($workGroupId)) {
return [];
}
return Machine::where('plant_id', $plantId)
->where('line_id', $lineId)
->where('work_group_master_id', $workGroupId)
->pluck('work_center', 'id');
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
if (!$get('plant_id') || !$get('line_id') || !$get('work_group_master_id')) {
$set('machine_id', null);
}
})
->required(),
Forms\Components\Select::make('characteristics_type')
->label('Characteristics Type')
->options([
'Product' => 'Product',
'Process' => 'Process',
])
->reactive()
->required(),
Forms\Components\TextInput::make('name')
->label('Name'),
Forms\Components\Select::make('inspection_type')
->label('Inspection Type')
->options([
'Visual' => 'Visual',
'Value' => 'Value',
])
->reactive()
->required(),
// Forms\Components\Select::make('result')
// ->label('Visual Type')
// ->reactive()
// ->options(function (callable $get) {
// if ($get('inspection_type') == 'Visual') {
// return [
// 'Ok' => 'OK',
// 'NotOk' => 'Not Ok',
// ];
// }
// return []; //empty options if type ≠ Visual
// })
// ->afterStateUpdated(function ($state, $set) {
// $set('result', $state); // store in form state only
// session()->put('temp_result', $state);
// })
// ->hidden(fn (callable $get) => $get('inspection_type') != 'Visual'),
Forms\Components\TextInput::make('upper')
->label('Upper')
->numeric()
->default(0.0)
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
Forms\Components\TextInput::make('lower')
->label('Lower')
->numeric()
->default(0.0)
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
Forms\Components\TextInput::make('middle')
->label('Middle')
->numeric()
->visible(fn (callable $get) => $get('inspection_type') == 'Value')
->rule(function (callable $get) {
return function (string $attribute, $value, \Closure $fail) use ($get) {
$lower = $get('lower');
$upper = $get('upper');
$middle = $value;
if (!is_null($lower) && !is_null($upper) && !is_null($middle)) {
if (!($lower <= $middle && $middle <= $upper)) {
$fail("Middle must be between Lower and Upper (Lower ≤ Middle ≤ Upper).");
}
}
};
}),
Forms\Components\Hidden::make('created_by')
->label('Created By')
->default(Filament::auth()->user()?->name),
Forms\Components\Hidden::make('updated_by')
->label('Updated By'),
]);
}
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')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('item.code')
->label('Item Code')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('line.name')
->label('Line')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('characteristics_type')
->label('Characteristics Type')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('workGroupMaster.name')
->label('Group Work Center')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('machine.work_center')
->label('Work Center')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('machine.work_center')
->label('Work Center')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('inspection_type')
->label('Inspection Type')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('upper')
->label('Upper')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('lower')
->label('Lower')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('middle')
->label('Middle')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->label('Created At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('created_by')
->label('Created By')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_by')
->label('Updated By')
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->label('Deleted At')
->alignCenter()
->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()
->label('Import Product Characteristics Masters')
->color('warning')
->importer(ProductCharacteristicsMasterImporter::class)
->visible(function() {
return Filament::auth()->user()->can('view import product characteristics master');
}),
ExportAction::make()
->label('Export Product Characteristics Masters')
->color('warning')
->exporter(ProductCharacteristicsMasterExporter::class)
->visible(function() {
return Filament::auth()->user()->can('view export product characteristics master');
}),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListProductCharacteristicsMasters::route('/'),
'create' => Pages\CreateProductCharacteristicsMaster::route('/create'),
'view' => Pages\ViewProductCharacteristicsMaster::route('/{record}'),
'edit' => Pages\EditProductCharacteristicsMaster::route('/{record}/edit'),
];
}
public static function getNavigationLabel(): string
{
return 'Characteristics';
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Filament\Resources\ProductCharacteristicsMasterResource\Pages;
use App\Filament\Resources\ProductCharacteristicsMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateProductCharacteristicsMaster extends CreateRecord
{
protected static string $resource = ProductCharacteristicsMasterResource::class;
public function getTitle(): string
{
return 'Create Characteristics'; // This will replace the "New product characteristics master"
}
// public function getHeading(): string
// {
// return 'Characteristics';
// }
}

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Filament\Resources\ProductCharacteristicsMasterResource\Pages;
use App\Filament\Resources\ProductCharacteristicsMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditProductCharacteristicsMaster extends EditRecord
{
protected static string $resource = ProductCharacteristicsMasterResource::class;
public function getTitle(): string
{
return 'Edit Characteristics'; // This will replace the "New product characteristics master"
}
public function mount(int|string $record): void
{
parent::mount($record);
$model = $this->getRecord(); // actual model instance
// Step 1: Fill the actual saved fields first
$this->form->fill([
'plant_id' => $model->plant_id,
'line_id' => $model->line_id,
'item_id' => $model->item_id,
'machine_id' => $model->machine_id,
'name' => $model->name,
'type' => $model->type,
'upper' => $model->upper,
'lower' => $model->lower,
'middle' => $model->middle,
'work_group_master_id' => optional($model->machine)->work_group_master_id,
]);
}
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Filament\Resources\ProductCharacteristicsMasterResource\Pages;
use App\Filament\Resources\ProductCharacteristicsMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListProductCharacteristicsMasters extends ListRecords
{
protected static string $resource = ProductCharacteristicsMasterResource::class;
public function getTitle(): string
{
return 'Characteristics'; // This will replace the "New product characteristics master"
}
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Filament\Resources\ProductCharacteristicsMasterResource\Pages;
use App\Filament\Resources\ProductCharacteristicsMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewProductCharacteristicsMaster extends ViewRecord
{
protected static string $resource = ProductCharacteristicsMasterResource::class;
public function getTitle(): string
{
return 'View Characteristics';
}
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@@ -654,7 +654,6 @@ class QualityValidationResource extends Resource
->label('Select Validation')
->reactive()
->options(fn (callable $get) => $get('part_validation_type_options') ?? [])
->required()
->afterStateUpdated(function ($state, callable $set) {
// when user selects something new, hide the image
$set('show_validation_image', false);
@@ -2250,9 +2249,15 @@ class QualityValidationResource extends Resource
$mPlantId = $get('plant_id');
$mlineId = $get('line_id');
$plant = Plant::find($mPlantId);
$plantCodePart1 = $plant?->code;
$mLine = Line::find($mlineId);
$mLinePart = $mLine?->name;
$stickerMasterId = $get('sticker_master_id');
if (!$stickerMasterId) {
return;
@@ -2284,12 +2289,13 @@ class QualityValidationResource extends Resource
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mUserName = Filament::auth()->user()->name;
if (!empty($emails))
{
//Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber')
new InvalidQualityMail($state, $mPorder, $mPlantName, $mLinePart, $mUserName, 'InvalidPartNumber')
);
}
else
@@ -2348,6 +2354,11 @@ class QualityValidationResource extends Resource
$plant = Plant::find($mPlantId);
$plantCodePart2 = $plant?->code;
$mlineId = $get('line_id');
$mLine = Line::find($mlineId);
$mLinePart = $mLine?->name;
$stickerMasterId = $get('sticker_master_id');
if (!$stickerMasterId) {
return;
@@ -2376,12 +2387,13 @@ class QualityValidationResource extends Resource
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mUserName = Filament::auth()->user()->name;
if (!empty($emails))
{
//Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber2')
new InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidPartNumber2')
);
}
else
@@ -2441,6 +2453,12 @@ class QualityValidationResource extends Resource
$plant = Plant::find($mPlantId);
$plantCodePart3 = $plant?->code;
$mlineId = $get('line_id');
$mLine = Line::find($mlineId);
$mLinePart = $mLine?->name;
if (!$stickerMasterId) {
return;
}
@@ -2469,12 +2487,13 @@ class QualityValidationResource extends Resource
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mUserName = Filament::auth()->user()->name;
if (!empty($emails))
{
//Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber3')
new InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidPartNumber3')
);
}
else
@@ -2532,6 +2551,11 @@ class QualityValidationResource extends Resource
$plant = Plant::find($mPlantId);
$plantCodePart4 = $plant?->code;
$mlineId = $get('line_id');
$mLine = Line::find($mlineId);
$mLinePart = $mLine?->name;
if (!$stickerMasterId) {
return;
}
@@ -2560,12 +2584,13 @@ class QualityValidationResource extends Resource
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$mUserName = Filament::auth()->user()->name;
if (!empty($emails))
{
//Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber4')
new InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidPartNumber4')
);
}
else
@@ -2679,22 +2704,22 @@ class QualityValidationResource extends Resource
else
{
$set('part_validation5_error', "Invalid input for part validation 5.");
$mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
// $mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
// $mPlantName = $mailData['plant_name'];
// $emails = $mailData['emails'];
if (!empty($emails))
{
//Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber5')
);
}
else
{
\Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
}
// if (!empty($emails))
// {
// //Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
// Mail::to($emails)->send(
// new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber5')
// );
// }
// else
// {
// \Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
// }
$set('part_validation5', null);
return;
}
@@ -2715,6 +2740,21 @@ class QualityValidationResource extends Resource
public static function getMailData($plantId)
{
$globalEmails = AlertMailRule::where('plant', 0)
->where('module', 'QualityValidation')
->where('rule_name', 'QualityMail')
->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
->pluck('email')
->toArray();
if (!empty($globalEmails)) {
return [
'plant_id' => 0,
'plant_name' => 'All Plants',
'emails' => $globalEmails,
];
}
$mPlantName = Plant::where('id', $plantId)->value('name');
$emails = AlertMailRule::where('plant', $plantId)

View File

@@ -5,21 +5,19 @@ namespace App\Filament\Resources;
use App\Filament\Exports\WorkGroupMasterExporter;
use App\Filament\Imports\WorkGroupMasterImporter;
use App\Filament\Resources\WorkGroupMasterResource\Pages;
use App\Filament\Resources\WorkGroupMasterResource\RelationManagers;
use App\Models\Line;
use App\Models\Plant;
use App\Models\WorkGroupMaster;
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\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Forms\Components\Section;
use Filament\Facades\Filament;
use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Actions\ExportAction;
use Illuminate\Validation\Rule;
class WorkGroupMasterResource extends Resource
@@ -37,68 +35,70 @@ class WorkGroupMasterResource extends Resource
return $form
->schema([
Section::make('')
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->relationship('plant', 'name')
->reactive()
->columnSpan(1)
->required()
->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) {
$plantId = $get('plant_id');
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->relationship('plant', 'name')
->reactive()
->columnSpan(1)
->required()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
if (!$plantId) {
$set('pqPlantError', 'Please select a plant first.');
$set('name', null);
$set('description', null);
$set('operation_number', null);
return;
}
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->afterStateUpdated(function ($state, $set, callable $get) {
$plantId = $get('plant_id');
$set('validationError', null);
$set('pqPlantError', null);
$set('name', null);
$set('description', null);
$set('operation_number', null);
})
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
->hintColor('danger'),
Forms\Components\TextInput::make('name')
->label('Name')
->required()
->minLength(6)
->columnSpan(1)
->reactive()
->rule(function (callable $get) {
return Rule::unique('work_group_masters', 'name')
->where('plant_id', $get('plant_id'))
->ignore($get('id'));
}),
Forms\Components\TextInput::make('operation_number')
->label('Operation Number')
->numeric()
->columnSpan(1)
->reactive()
->required()
->rule(function (callable $get) {
return Rule::unique('work_group_masters', 'operation_number')
->where('plant_id', $get('plant_id'))
->ignore($get('id'));
}),
Forms\Components\TextInput::make('description')
->label('Description')
->required()
->minLength(5)
->reactive()
->columnSpan(['default' => 1, 'sm' => 3]),
Forms\Components\Hidden::make('created_by')
->default(Filament::auth()->user()?->name),
])
->columns(['default' => 1, 'sm' => 3]),
if (! $plantId) {
$set('pqPlantError', 'Please select a plant first.');
$set('name', null);
$set('description', null);
$set('operation_number', null);
return;
}
$set('validationError', null);
$set('pqPlantError', null);
$set('name', null);
$set('description', null);
$set('operation_number', null);
})
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
->hintColor('danger'),
Forms\Components\TextInput::make('name')
->label('Name')
->required()
->minLength(6)
->columnSpan(1)
->reactive()
->rule(function (callable $get) {
return Rule::unique('work_group_masters', 'name')
->where('plant_id', $get('plant_id'))
->ignore($get('id'));
}),
Forms\Components\TextInput::make('operation_number')
->label('Operation Number')
->numeric()
->columnSpan(1)
->reactive()
->required(),
// ->rule(function (callable $get) {
// return Rule::unique('work_group_masters', 'operation_number')
// ->where('plant_id', $get('plant_id'))
// ->ignore($get('id'));
// }),
Forms\Components\TextInput::make('description')
->label('Description')
->required()
->minLength(5)
->reactive()
->columnSpan(['default' => 1, 'sm' => 3]),
Forms\Components\Hidden::make('created_by')
->default(Filament::auth()->user()?->name),
])
->columns(['default' => 1, 'sm' => 3]),
]);
}
@@ -112,6 +112,7 @@ class WorkGroupMasterResource 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')
@@ -177,14 +178,14 @@ class WorkGroupMasterResource extends Resource
->label('Import Work Group Masters')
->color('warning')
->importer(WorkGroupMasterImporter::class)
->visible(function() {
->visible(function () {
return Filament::auth()->user()->can('view import work group master');
}),
ExportAction::make()
->label('Export Work Group Masters')
->color('warning')
->exporter(WorkGroupMasterExporter::class)
->visible(function() {
->visible(function () {
return Filament::auth()->user()->can('view export work group master');
}),
]);

File diff suppressed because it is too large Load Diff

View File

@@ -20,17 +20,24 @@ class InvalidQualityMail extends Mailable
public $invoiceNumber;
public $mplantName;
public $mProdOrder;
public $mUserName;
public $mPartNo;
public $mailType;
public $greeting;
public $subjectLine;
public $mLinePart;
public $itemCode;
public function __construct($parNo, $mProdOrder, $mplantName, $mailType = 'InvalidPartNumber')
public function __construct($parNo, $mProdOrder, $mplantName, $mLinePart, $mUserName, $mailType = 'InvalidPartNumber')
{
$this->mPartNo = $parNo;
$this->mProdOrder = $mProdOrder;
$this->mplantName = $mplantName;
$this->mLinePart = $mLinePart;
$this->mUserName = $mUserName;
$this->mailType = $mailType;
}
@@ -70,8 +77,10 @@ class InvalidQualityMail extends Mailable
Dear Sir/Madam,<br><br>
Please note that the scanned part number appears to be incorrect.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Line Name:</b> {$this->mLinePart}<br>
<b>Production Order:</b> {$this->mProdOrder}<br>
<b>Scanned Part Number 2:</b> {$this->mPartNo}<br>
<b>Employee Code:</b> {$this->mUserName}<br>
";
break;
case 'InvalidPartNumber3':
@@ -79,8 +88,10 @@ class InvalidQualityMail extends Mailable
Dear Sir/Madam,<br><br>
Please note that the scanned part number appears to be incorrect.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Line Name:</b> {$this->mLinePart}<br>
<b>Production Order:</b> {$this->mProdOrder}<br>
<b>Scanned Part Number 3:</b> {$this->mPartNo}<br>
<b>Employee Code:</b> {$this->mUserName}<br>
";
break;
case 'InvalidPartNumber4':
@@ -88,8 +99,10 @@ class InvalidQualityMail extends Mailable
Dear Sir/Madam,<br><br>
Please note that the scanned part number appears to be incorrect.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Line Name:</b> {$this->mLinePart}<br>
<b>Production Order:</b> {$this->mProdOrder}<br>
<b>Scanned Part Number 4:</b> {$this->mPartNo}<br>
<b>Employee Code:</b> {$this->mUserName}<br>
";
break;
case 'InvalidPartNumber5':
@@ -97,8 +110,10 @@ class InvalidQualityMail extends Mailable
Dear Sir/Madam,<br><br>
Please note that the scanned part number appears to be incorrect.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Line Name:</b> {$this->mLinePart}<br>
<b>Production Order:</b> {$this->mProdOrder}<br>
<b>Scanned Part Number 5:</b> {$this->mPartNo}<br>
<b>Employee Code:</b> {$this->mUserName}<br>
";
break;
case 'InvalidPartNumber':
@@ -107,8 +122,10 @@ class InvalidQualityMail extends Mailable
Dear Sir/Madam,<br><br>
Please note that the scanned part number appears to be incorrect.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Line Name:</b> {$this->mLinePart}<br>
<b>Production Order:</b> {$this->mProdOrder}<br>
<b>Scanned Part Number 1:</b> {$this->mPartNo}<br>
<b>Employee Code:</b> {$this->mUserName}<br>
";
break;
}

View File

@@ -104,57 +104,20 @@ class InvalidSerialMail extends Mailable
{
// dynamic subject based on mail type
switch ($this->mailType) {
case 'NotFound':
$this->subjectLine = "Serial Number Not Found ({$this->mplantName})";
break;
case 'NotFoundInvoice':
$this->subjectLine = "Serial Number Not Found in Invoice ({$this->mplantName})";
break;
case 'NotFoundItemS':
$this->subjectLine = "Item Code Not Found ({$this->mplantName})";
break;
case 'NotValidPackage':
$this->subjectLine = "Not Valid Package ({$this->mplantName})";
break;
case 'InvalidMaterialFormat':
$this->subjectLine = "Invalid Qr code format Found material ({$this->mplantName})";
break;
case 'DuplicateMotorQR':
$this->subjectLine = "Duplicate Serial Number ({$this->mplantName})";
break;
case 'NotMotorQR':
$this->subjectLine = "Item Code doesn't have Motor QR ({$this->mplantName})";
break;
case 'CompletedSerialInvoice':
$this->subjectLine = "Completed Serial Invoice ({$this->mplantName})";
break;
case 'NotPumpQR':
$this->subjectLine = "Item Code doesn't have Pump QR ({$this->mplantName})";
break;
case 'DuplicatePumpQR':
$this->subjectLine = "Duplicate Serial Number ({$this->mplantName})";
break;
case 'CSerialInvoice':
$this->subjectLine = "Completed Serial Invoice ({$this->mplantName})";
break;
case 'MissingPanelBox':
$this->subjectLine = "Missing Panel Box ({$this->mplantName})";
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
break;
case 'DuplicateCapacitorQR':
$this->subjectLine = "Duplicate Capacitor QR ({$this->mplantName})";
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
break;
case 'UnknownPumpsetQR':
$this->subjectLine = "Unknown PumpSet QR ({$this->mplantName})";
case 'CompletedSerialInvoice':
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
break;
case 'DuplicatePumpsetQR':
$this->subjectLine = "Duplicate PumpSet QR ({$this->mplantName})";
case 'CSerialInvoice':
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
break;
case 'ComSerInv':
$this->subjectLine = "Completed Serial Invoice ({$this->mplantName})";
break;
case 'InvalidFormat':
default:
$this->subjectLine = "Invalid Serial Format Found ({$this->mplantName})";
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
break;
}
@@ -170,69 +133,20 @@ class InvalidSerialMail extends Mailable
{
// dynamic greeting/message body
switch ($this->mailType) {
case 'NotFound':
$this->greeting = "
Dear Sir/Madam,<br><br>
The scanned Serial Number <b>{$this->serial}</b> was not found in the database
for the plant <b>{$this->mplantName}</b>.<br><br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br><br>
Please verify the serial number.
";
break;
case 'NotFoundInvoice':
$this->greeting = "
Dear Sir/Madam,<br><br>
The scanned Serial Number <b>'{$this->serial}'</b> was not found in the Invoice Number <b>'{$this->invoiceNumber}'</b>
for the plant <b>{$this->mplantName}</b>.<br><br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br><br>
Please verify the serial number.
";
break;
case 'NotFoundItemS':
$this->greeting = "
Dear Sir/Madam,<br><br>
Item Code <b>'{$this->itemCode}'</b> with Serial Number<b>'{$this->serial}'</b> not found in sticker master
for the plant <b>{$this->mplantName}</b>.<br><br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br><br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br><br>
Please verify the Item Code.
";
break;
case 'NotValidPackage':
$this->greeting = "
Dear Sir/Madam,<br><br>
Scanned Item Code<b>'{$this->itemCode}'</b> doesn't have valid package type to proceed!
for the plant <b>{$this->mplantName}</b>.<br><br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br><br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br><br>
Please verify the Item Code.
";
break;
case 'InvalidMaterialFormat':
$this->greeting = "
Dear Sir/Madam,<br><br>
Please note that the scanned serial number format appears to be incorrect.<br>
The scanned serial number could not be found in the given invoice.<br><br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'DuplicateMotorQR':
$this->greeting = "
case 'DuplicateCapacitorQR':
$this->greeting = "
Dear Sir/Madam,<br><br>
Scanned 'Motor' serial number <b>{$this->serial}</b> already completed the scanning process.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'NotMotorQR':
$this->greeting = "
Dear Sir/Madam,<br><br>
Scanned Item Code <b>{$this->itemCode}</b> doesn't have 'Motor' QR to proceed!<br>
The scanned <b>Capacitor</b> serial number has already completed the scanning process.<br><br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
@@ -245,25 +159,6 @@ class InvalidSerialMail extends Mailable
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'NotPumpQR':
$this->greeting = "
Dear Sir/Madam,<br><br>
Scanned Item Code <b>'{$this->itemCode}'</b> doesn't have 'Pump' QR to proceed!<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'DuplicatePumpQR':
$this->greeting = "
Dear Sir/Madam,<br><br>
Scanned 'Pump' serial number already completed the scanning process.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
@@ -274,45 +169,6 @@ class InvalidSerialMail extends Mailable
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'MissingPanelBox':
$this->greeting = "
Dear Sir/Madam,<br><br>
Scanned Item Code <b>'{$this->itemCode}'</b> doesn't have 'Panel Box Code' to proceed!<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'DuplicateCapacitorQR':
$this->greeting = "
Dear Sir/Madam,<br><br>
Scanned 'Capacitor' serial number already completed the scanning process.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'UnknownPumpsetQR':
$this->greeting = "
Dear Sir/Madam,<br><br>
Scanned Item Code <b>'{$this->itemCode}'</b> doesn't have 'Pump Set' QR to proceed!<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'DuplicatePumpsetQR':
$this->greeting = "
Dear Sir/Madam,<br><br>
Scanned 'Pump Set' serial number already completed the scanning process.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
@@ -327,67 +183,6 @@ class InvalidSerialMail extends Mailable
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'ItemNotFound':
$this->greeting = "
Dear Sir/Madam,<br><br>
Item code <b>'{$this->itemCode}'</b> not found in database.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'ItemNotFoundDB':
$this->greeting = "
Dear Sir/Madam,<br><br>
Item code <b>'{$this->itemCode}'</b> not found in database for choosed plant.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'ItemNotValidMaterialType':
$this->greeting = "
Dear Sir/Madam,<br><br>
Item code <b>'{$this->itemCode}'</b> doesn't have a valid material type.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'ItemNotInvoice':
$this->greeting = "
Dear Sir/Madam,<br><br>
Item code <b>'{$this->itemCode}'</b> doesn't exist in invoice.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'ItemNotInvoice':
$this->greeting = "
Dear Sir/Madam,<br><br>
Item code <b>'{$this->itemCode}'</b> doesn't exist in invoice.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'InvalidFormat':
default:
$this->greeting = "
Dear Sir/Madam,<br><br>
Please note that the scanned serial number format appears to be incorrect.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
}
return new Content(

View File

@@ -0,0 +1,60 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class ProductCharacteristicsMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'line_id',
'item_id',
'work_group_master_id',
'machine_id',
'name',
'inspection_type',
'characteristics_type',
'upper',
'lower',
'middle',
'created_at',
'updated_at',
'created_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
public function workGroupMaster(): BelongsTo
{
return $this->belongsTo(WorkGroupMaster::class);
}
public function machine(): BelongsTo
{
return $this->belongsTo(Machine::class);
}
// public function machine()
// {
// return $this->belongsTo(\App\Models\Machine::class, 'machine_id');
// }
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
}

View File

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

View File

@@ -42,7 +42,7 @@
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^11.0.1"
"phpunit/phpunit": "^12.0.0"
},
"autoload": {
"psr-4": {

View File

@@ -0,0 +1,53 @@
<?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
{
$sql = <<<'SQL'
CREATE TABLE product_characteristics_masters(
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,
item_id BIGINT NOT NULL,
line_id BIGINT DEFAULT NULL,
work_group_master_id BIGINT DEFAULT NULL,
machine_id BIGINT DEFAULT NULL,
name TEXT DEFAULT NULL,
inspection_type TEXT DEFAULT NULL,
characteristics_type TEXT DEFAULT NULL
upper DOUBLE PRECISION DEFAULT 0.0,
lower DOUBLE PRECISION DEFAULT 0.0,
middle DOUBLE PRECISION 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),
FOREIGN KEY (line_id) REFERENCES lines (id),
FOREIGN KEY (item_id) REFERENCES items(id),
FOREIGN KEY (work_group_master_id) REFERENCES work_group_masters(id),
FOREIGN KEY (machine_id) REFERENCES machines(id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('product_characteristics_masters');
}
};

View File

@@ -0,0 +1,32 @@
<?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
{
$sql = <<<'SQL'
ALTER TABLE process_orders
ALTER COLUMN order_quantity TYPE NUMERIC
USING order_quantity::NUMERIC;
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('process_orders', function (Blueprint $table) {
// //
// });
}
};

View File

@@ -0,0 +1,35 @@
<?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
{
Schema::table('work_group_masters', function (Blueprint $table) {
$table->dropUnique('work_group_masters_plant_id_operation_number_key');
});
// $sql = <<<'SQL'
// ALTER TABLE work_group_masters
// DROP INDEX work_group_masters_plant_id_operation_number_key;
// SQL;
// DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('work_group_masters', function (Blueprint $table) {
//
});
}
};

View File

@@ -1,8 +1,6 @@
<?php
//use App\Http\Controllers\CharacteristicsController;
// use App\Http\Controllers\CharacteristicsController;
use App\Http\Controllers\CharacteristicsController;
use App\Http\Controllers\EquipmentMasterController;
use App\Http\Controllers\InvoiceValidationController;
use App\Http\Controllers\MachineController;
@@ -80,6 +78,8 @@ Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadQrP
Route::get('/download-reprint-qr-pdf/{palletNo}', [PalletController::class, 'downloadReprintQrPdf'])->name('download-reprint-qr-pdf');
//Route::get('/download-reprint-process-pdf/{plant}/{item}/{process_order}/{coil_number}', [PalletController::class, 'downloadReprintProcess'])->name('download-reprint-process-pdf');
Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->name('download-qr1-pdf');
//Production Dashboard Controller
@@ -154,26 +154,25 @@ Route::get('process-order/details', [PdfController::class, 'getProcessOrderData'
Route::post('process-order', [PdfController::class, 'storeProcessOrderData']);
Route::get('sap/files', [SapFileController::class, 'readFiles']);
//..Laser Marking - Characteristics
Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']);
// Route::post('laser/route/data', [CharacteristicsController::class, 'test']);//->withoutMiddleware(VerifyCsrfToken::class)
Route::post('laser/route/data', [CharacteristicsController::class, 'test']);//->withoutMiddleware(VerifyCsrfToken::class)
// Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
// //..
// Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);
// Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);
// Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
// Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
// Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);
// Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);
Route::get('characteristics/get/master', [CharacteristicsController::class, 'getCharMaster']);
//GR Master PDF and Serial Number
@@ -183,7 +182,7 @@ Route::get('grmaster-sno', [PdfController::class, 'getGRSerial']);
Route::post('grmaster-sno-update', [PdfController::class, 'updateGR']);
// Route::post('file/store', [SapFileController::class, 'store'])->name('file.store');
Route::post('file/store', [SapFileController::class, 'store'])->name('file.store');
// Route::post('send-telegram', [TelegramController::class, 'sendMessage']);

View File

@@ -2,8 +2,6 @@
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use App\Models\AlertMailRule;
use Illuminate\Console\Scheduling\Schedule;
@@ -11,87 +9,93 @@ Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
Artisan::command('auto:scheduler', function () {
$this->call('custom:scheduler');
})->everyMinute();
// Schedule::command('send:invoice-report');
// Schedule::command('send:production-report');
app()->booted(function () {
$schedule = app(Schedule::class);
// 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')
->select('plant', 'schedule_type')
->distinct()
->get();
// // $schedule->command('report:send-daily-production')->dailyAt('07:59');
// // Production report scheduling
// $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;
// 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'));
// $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;
}
}
// 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();
// // 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;
// foreach ($invoiceRules as $rule) {
// $type = $rule->schedule_type;
// $plantId = $rule->plant;
$command = $schedule->command('send:invoice-report', [$type, $plantId]);
// $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;
}
}
// 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();
// // 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;
// foreach ($invoiceDataRules as $rule) {
// $type = $rule->schedule_type;
// $plantId = $rule->plant;
$command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
// $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;
}
}
});
// switch ($type) {
// case 'Live':
// $command->everyMinute();
// break;
// case 'Hourly':
// $command->hourly();
// break;
// case 'Daily':
// $command->dailyAt('10:00');
// break;
// }
// }
// });