Compare commits

...

395 Commits

Author SHA1 Message Date
Cleison Freitas df283e54a2 Company rename endpoint. 2023-01-10 23:03:35 -03:00
Omair Saleh 4c023aa393 export customer total yearly cbm 2023-01-05 10:41:38 +08:00
Omair Saleh 7922c10e2c export customer total yearly cbm 2023-01-05 10:39:04 +08:00
Omair Saleh 742fdf307b export customer total yearly cbm 2023-01-05 10:37:27 +08:00
Omair Saleh df993fe491 export customer total yearly cbm 2023-01-04 12:17:44 +08:00
Omair Saleh 5f5707718f show reference number for package 2023-01-04 11:29:40 +08:00
Omair Saleh d7d9a065fd show reference number for package 2023-01-04 11:23:16 +08:00
EDMOND MING 568d45808a Merge branch 'export-top-order-pdf' into 'master'
export top order pdf

See merge request CIEFWorldwideSdnBhd/shipping-portal!138
2023-01-03 05:47:39 +00:00
edmondlang 715051076c export top order pdf 2023-01-03 00:41:12 +08:00
Omair Saleh 7642f6e9d3 regenerate invoices for specific customers 2022-12-30 17:35:28 +08:00
Omair Saleh 84ad39ac11 regenerate invoices for specific customers 2022-12-30 17:35:07 +08:00
Omair Saleh 03b44cf71d regenerate invoices for specific customers 2022-12-30 17:34:33 +08:00
Omair Saleh 0b577c22f4 regenerate invoices for specific customers 2022-12-30 17:33:29 +08:00
Omair Saleh cabb7b7d63 regenerate invoices for specific customers 2022-12-30 17:32:34 +08:00
Omair Saleh 880d3fc8ce regenerate invoices for specific customers 2022-12-30 17:29:00 +08:00
Omair Saleh 8d901505fe regenerate invoices for specific customers 2022-12-30 17:28:27 +08:00
Omair Saleh 489216e7be regenerate invoices for specific customers 2022-12-30 17:23:56 +08:00
Omair Saleh e413dfa795 regenerate invoices for specific customers 2022-12-30 17:21:47 +08:00
Omair Saleh 4ff5c6df80 update gz warehouse notice 2022-12-26 21:21:00 +08:00
Omair Saleh 762add8e5c fix log data for transactional tables 2022-12-18 15:14:36 +08:00
Omair Saleh 96723461e4 log transactional data 2022-12-16 13:39:19 +08:00
Omair Saleh 2c1431a813 fix over weight minimum charge 2022-12-14 20:16:52 +08:00
Omair Saleh 90ca018e81 fix over weight minimum charge 2022-12-14 20:15:02 +08:00
Omair Saleh 60c51419bb fix over weight minimum charge 2022-12-14 20:07:31 +08:00
Omair Saleh 69f98125a0 fix over weight minimum charge 2022-12-14 20:05:50 +08:00
Omair Saleh f56bfb0309 fix over weight minimum charge 2022-12-14 20:04:02 +08:00
Omair Saleh aedd836211 fix over weight minimum charge 2022-12-14 20:03:11 +08:00
Omair Saleh abfb0ea47b fix over weight minimum charge 2022-12-14 19:57:10 +08:00
Omair Saleh 09461e5bef fix over weight minimum charge 2022-12-14 19:56:21 +08:00
Omair Saleh d5b16f288a fix over weight minimum charge 2022-12-14 19:55:55 +08:00
Omair Saleh 7c1a77089b fix over weight minimum charge 2022-12-14 19:54:19 +08:00
Omair Saleh 505d924eec fix over weight minimum charge 2022-12-14 19:48:39 +08:00
Omair Saleh d0dd802693 fix over weight minimum charge 2022-12-14 19:47:56 +08:00
Omair Saleh 3113cc9fc0 fix over weight minimum charge 2022-12-14 19:47:00 +08:00
Omair Saleh 840e1147c8 fix over weight minimum charge 2022-12-14 19:42:16 +08:00
Omair Saleh 5c89471e14 fix over weight minimum charge 2022-12-14 11:45:28 +08:00
Omair Saleh fbc73e040f fix billplz bill status 2022-12-13 11:03:48 +08:00
Omair Saleh 414f22ab05 fix billplz bill status 2022-12-13 10:56:36 +08:00
Omair Saleh d7328bafdc fix billplz bill status 2022-12-13 10:54:46 +08:00
Omair Saleh 5c5505174a fix billplz bill status 2022-12-13 10:52:51 +08:00
Omair Saleh 6b73d13c33 fix billplz bill status 2022-12-09 12:01:47 +08:00
Omair Saleh 8a62807356 fix billplz bill status 2022-12-09 11:54:16 +08:00
Omair Saleh acca5192b6 estimate container shipping cost 2022-12-07 17:30:48 +08:00
Omair Saleh dfbf22951b estimate container shipping cost 2022-12-02 11:23:40 +08:00
Omair Saleh cc26e67340 estimate container shipping cost 2022-12-02 11:22:47 +08:00
Omair Saleh 15db2715f5 estimate container shipping cost 2022-12-02 11:15:50 +08:00
Omair Saleh 2fc54f796a estimate container shipping cost 2022-12-02 11:01:33 +08:00
Omair Saleh 91b14b3820 estimate container shipping cost 2022-12-02 10:14:37 +08:00
Omair Saleh 7dc549ab2e estimate container shipping cost 2022-12-01 19:08:43 +08:00
Omair Saleh 5480a55edc estimate container shipping cost 2022-12-01 18:44:04 +08:00
Omair Saleh 0cb3bd6ce3 estimate container shipping cost 2022-12-01 18:41:17 +08:00
Omair Saleh f2cc45303c estimate container shipping cost 2022-12-01 18:40:36 +08:00
Omair Saleh e0db537931 estimate container shipping cost 2022-12-01 18:37:50 +08:00
Omair Saleh 53b4af2b5c estimate container shipping cost 2022-12-01 18:35:24 +08:00
Omair Saleh c9d2041653 estimate container shipping cost 2022-12-01 18:31:43 +08:00
Omair Saleh 53e9fcaeb8 debug minimum charge 2022-11-29 15:14:34 +08:00
Omair Saleh 7e007e7d78 debug minimum charge 2022-11-29 15:07:32 +08:00
Omair Saleh 7c879c8633 add bcc to invoice notification email for testing 2022-11-25 11:42:20 +08:00
Omair Saleh 9f255664ac show add/edit billing address to admin 2022-11-24 09:52:12 +08:00
Omair Saleh 63918b4eb0 update china on hold list 2022-11-22 12:10:24 +08:00
Omair Saleh ae36513635 round up cbm to 3 decimals 2022-11-16 16:52:01 +08:00
Omair Saleh 7ac66080ec update export invoice 2022-11-16 16:45:33 +08:00
Omair Saleh 4b699345b8 update export invoice 2022-11-16 16:32:45 +08:00
Omair Saleh 634a97f3b4 minor changes to dummy data seeder comments 2022-11-15 19:56:03 +08:00
Omair Saleh 8a4810d961 remove lockdown announcement from order form 2022-11-15 15:07:33 +08:00
Omair Saleh ab3ba64d31 show anitha debtor ui 2022-11-14 15:01:56 +08:00
Omair Saleh 7bca4be9b9 show anitha debtor ui 2022-11-14 14:54:43 +08:00
Omair Saleh 4f12c7c8ac show anitha debtor ui 2022-11-14 14:53:37 +08:00
Omair Saleh 759a9c19d7 show anitha debtor ui 2022-11-14 14:21:25 +08:00
Omair Saleh 6fa72a4195 show anitha debtor ui 2022-11-14 14:19:06 +08:00
Omair Saleh c82581dcc4 show anitha debtor ui 2022-11-14 14:13:55 +08:00
Omair Saleh d4a63c0095 disable notification for non production enviroments 2022-11-10 21:13:28 +08:00
Omair Saleh 22b03669c6 disable notification for non production enviroments 2022-11-10 21:11:45 +08:00
Omair Saleh 58e9e80fd9 dummy data seed 2022-11-10 20:32:14 +08:00
Omair Saleh 4dab73fc8e re-release yd paid orders 2022-11-09 12:00:25 +08:00
Omair Saleh 9b87f26ca3 re-release yd paid orders 2022-11-09 11:56:43 +08:00
Omair Saleh cd81683816 add container summary for billing report 2022-11-07 13:18:59 +08:00
Omair Saleh 169fac4ab0 add container summary for billing report 2022-11-07 13:17:22 +08:00
Omair Saleh 34b4482139 add container summary for billing report 2022-11-07 13:16:42 +08:00
Omair Saleh 945e8585d4 show edit billing address at invoice pending approval 2022-11-07 10:57:11 +08:00
Omair Saleh 68cb7b7df1 show edit billing address at invoice pending approval 2022-11-07 10:51:32 +08:00
Omair Saleh 84b6750bcc show edit billing address at invoice pending approval 2022-11-07 10:21:27 +08:00
Omair Saleh 7f766cde6a Invoice reminder and shipment update notification emails 2022-11-07 09:38:03 +08:00
Omair Saleh 5d1bb976f8 misc fixes 2022-11-07 08:20:24 +08:00
Omair Saleh 529eb1be93 GZ warehouse close notice 2022-11-03 20:28:30 +08:00
Omair Saleh 95fd0aa45d shipping sales report 2022-11-01 15:45:46 +08:00
Omair Saleh 64a7e4e0b7 shipping sales report 2022-11-01 15:41:28 +08:00
Omair Saleh de4577346c shipping sales report 2022-11-01 15:36:37 +08:00
Omair Saleh 0ac9ca38f2 shipping sales report 2022-11-01 15:34:15 +08:00
Omair Saleh 4b79039a18 shipping sales report 2022-11-01 15:32:39 +08:00
Omair Saleh 4b32a48e07 shipping sales report 2022-11-01 15:30:53 +08:00
Omair Saleh eb09993397 yd api to fetch 30 days 2022-11-01 12:36:29 +08:00
Omair Saleh 627d782e5d yd api to fetch 30 days 2022-11-01 12:35:17 +08:00
Omair Saleh 04771cec4f yd api to fetch 30 days 2022-11-01 12:24:48 +08:00
Omair Saleh d7630af675 fix payment due date days filter 2022-10-31 12:30:24 +08:00
Omair Saleh 37c710def6 fix payment due date days filter 2022-10-30 20:41:20 +08:00
Omair Saleh 7423588324 fix payment due date days filter 2022-10-30 20:38:36 +08:00
Omair Saleh cb76e86c75 fix payment due date days filter 2022-10-30 20:37:43 +08:00
Omair Saleh cb862123b5 fix payment due date days filter 2022-10-30 20:37:02 +08:00
Omair Saleh 032efcb96b fix payment due date days filter 2022-10-30 20:35:54 +08:00
Omair Saleh a90730d616 fix payment due date days filter 2022-10-30 20:35:01 +08:00
Omair Saleh d5026df3a5 fix payment due date days filter 2022-10-30 20:33:33 +08:00
Omair Saleh 6dd3849bff fix payment due date days filter 2022-10-30 20:31:46 +08:00
Omair Saleh 9e4bad1eee fix payment due date days filter 2022-10-30 19:02:29 +08:00
Omair Saleh e356573715 fix payment due date days filter 2022-10-30 19:01:51 +08:00
Omair Saleh de6cb6a75f fix payment due date days filter 2022-10-30 18:59:47 +08:00
Omair Saleh 524da42526 fix payment due date days filter 2022-10-30 18:56:19 +08:00
Omair Saleh 1abc99fe10 fix payment due date days filter 2022-10-30 18:46:14 +08:00
Omair Saleh e91e770bf3 fix payment due date days filter 2022-10-30 18:41:55 +08:00
omair saleh 2e5d39fe96 Merge branch '417-payment-filter' into 'master'
Payment filter

See merge request CIEFWorldwideSdnBhd/shipping-portal!137
2022-10-30 10:28:25 +00:00
omair saleh 6efa78e40d Merge branch 'master' into '417-payment-filter'
# Conflicts:
#   app/Http/Resources/PackingListResource.php
2022-10-30 10:28:19 +00:00
Fairuz df862b7107 Payment filter 2022-10-30 17:44:14 +08:00
Omair Saleh 9df97f3db5 whitelist replica 3992WHE 2022-10-28 12:26:14 +08:00
Omair Saleh aa2ce980bc fix export invoice 2022-10-27 15:57:27 +08:00
Omair Saleh a6446b88fd shorten yd fetch duration 2022-10-20 11:37:55 +08:00
Omair Saleh be283dee78 shorten yd fetch duration 2022-10-20 11:28:09 +08:00
Omair Saleh 2d58db7bd9 allow to edit company name for personal account s 2022-10-20 11:12:10 +08:00
Omair Saleh 2b44254186 add further description to export payments 2022-10-19 15:50:18 +08:00
Omair Saleh e99cec81d7 add further description to export payments 2022-10-19 15:44:45 +08:00
Omair Saleh 5e810a1c16 add further description to export payments 2022-10-19 15:40:57 +08:00
Omair Saleh b5cba80db9 add further description to export payments 2022-10-19 15:09:33 +08:00
Omair Saleh 3479aed911 add further description to export payments 2022-10-19 15:07:45 +08:00
Omair Saleh f05e96725b add further description to export payments 2022-10-19 15:06:41 +08:00
Omair Saleh becb16c674 add further description to export payments 2022-10-19 14:53:51 +08:00
Omair Saleh 7e8163166b add further description to export payments 2022-10-19 14:52:26 +08:00
Omair Saleh ad21580c3e add excel extension 2022-10-19 12:04:19 +08:00
Omair Saleh 2f15268897 add excel extension 2022-10-19 11:34:56 +08:00
Omair Saleh ff4efdcd54 add excel extension 2022-10-19 11:31:52 +08:00
Omair Saleh fe400264c7 add excel extension 2022-10-19 11:23:30 +08:00
Omair Saleh cb0189e7d8 add excel extension 2022-10-19 10:49:57 +08:00
Omair Saleh f5070b2138 add excel extension 2022-10-19 10:46:33 +08:00
Omair Saleh 6a6497cac3 add excel extension 2022-10-19 10:39:30 +08:00
Omair Saleh dbf61d3a77 add excel extension 2022-10-19 10:37:43 +08:00
Omair Saleh 2f1164d606 add excel extension 2022-10-19 10:35:54 +08:00
Omair Saleh a472ec6684 add excel extension 2022-10-19 10:27:50 +08:00
Omair Saleh 10403943d0 add excel extension 2022-10-19 10:22:30 +08:00
Omair Saleh 5d49847f1f list customer with delayed shipment 2022-10-18 13:49:29 +08:00
Omair Saleh f96321c854 list customer with delayed shipment 2022-10-18 13:48:37 +08:00
Omair Saleh 2e6432f2e5 list customer with delayed shipment 2022-10-18 13:45:24 +08:00
Omair Saleh f8c37f4dbc list customer with delayed shipment 2022-10-18 13:44:17 +08:00
Omair Saleh 9deed272ad list customer with delayed shipment 2022-10-18 13:37:16 +08:00
Omair Saleh 38e7f89293 list customer with delayed shipment 2022-10-18 13:36:41 +08:00
Omair Saleh 724861270c list customer with delayed shipment 2022-10-18 13:34:29 +08:00
Omair Saleh 88cf72eb75 fix invoice complete bug 2022-10-18 10:44:15 +08:00
Omair Saleh 5fcd11e84c allow admin to do partial payment 2022-10-18 10:32:33 +08:00
Omair Saleh 13bd343198 allow admin to do partial payment 2022-10-18 10:29:59 +08:00
Omair Saleh d6c5b45b44 show manual transfer bank in details 2022-10-17 16:59:40 +08:00
Omair Saleh db0da02e27 show manual transfer bank in details 2022-10-17 16:57:08 +08:00
Omair Saleh 6db2675e76 hide sensitive pages from customer view 2022-10-17 16:31:25 +08:00
Omair Saleh 13271f311c fix debtor upload ui 2022-10-17 16:25:18 +08:00
Omair Saleh a2ac87b659 add published announcement filter 2022-10-17 15:21:21 +08:00
Omair Saleh 0b317ae1f7 hide payment button when outstanding is less than 0.01 2022-10-17 15:18:51 +08:00
Omair Saleh 5a0ef40e44 show debtor ui to anitha 2022-10-17 15:07:31 +08:00
Omair Saleh 97273a30cb show debtor ui to anitha 2022-10-17 15:05:32 +08:00
Omair Saleh c13145ad41 hide billing address button 2022-10-17 14:01:27 +08:00
Omair Saleh 045b0b9878 show edit billing address only to super admin 2022-10-17 13:55:24 +08:00
Omair Saleh 39a9e45fc4 export payment UI 2022-10-17 13:53:53 +08:00
Omair Saleh 910fa13867 export payment debug 2022-10-17 13:49:48 +08:00
Omair Saleh 6f86702df0 export payment debug 2022-10-17 13:49:06 +08:00
Omair Saleh b79bcdbbb3 export payment debug 2022-10-17 13:48:22 +08:00
Omair Saleh 086b262fca fix edit billing address ui 2022-10-17 13:44:32 +08:00
Omair Saleh 8396e8dab3 export payments 2022-10-17 13:43:26 +08:00
Omair Saleh 96948c96b5 edit billing address 2022-10-17 13:39:03 +08:00
Omair Saleh d8386601c3 1. Import Debtor
2. export payments
2022-10-17 13:29:52 +08:00
omair saleh bf2a6e7f23 Merge branch 'import-debtor' into 'master'
Import debtor

See merge request CIEFWorldwideSdnBhd/shipping-portal!136
2022-10-17 05:00:51 +00:00
omair saleh 235b04e395 Merge branch 'master' into 'import-debtor'
# Conflicts:
#   routes/web.php
2022-10-17 05:00:42 +00:00
Omair Saleh 5ea4044e3f debug callback url for billplz 2022-10-13 15:54:56 +08:00
Omair Saleh 66bbf9934c fix payment ui & reload issue 2022-10-13 01:44:48 +08:00
Omair Saleh 94a6f0758c fix payment ui & reload issue 2022-10-13 01:42:11 +08:00
Omair Saleh 04f43d8ea8 fix payment ui & reload issue 2022-10-13 01:40:47 +08:00
Omair Saleh 0808d86af9 fix payment ui & reload issue 2022-10-13 01:34:00 +08:00
Omair Saleh 714678fdc1 fix payment ui & reload issue 2022-10-13 01:31:41 +08:00
Omair Saleh c050444cdb export yd parcel postcode 2022-10-13 01:17:55 +08:00
Omair Saleh bc6c690b54 export yd parcel postcode 2022-10-13 01:12:22 +08:00
Omair Saleh 7cfa328ec0 export yd parcel postcode 2022-10-13 01:05:54 +08:00
Omair Saleh 45685bf2a4 export yd parcel postcode 2022-10-13 01:04:26 +08:00
Omair Saleh 534e02a20f export yd parcel postcode 2022-10-13 00:55:29 +08:00
Omair Saleh 26547328cb remove delivery address postcode to yd to release goods from china 2022-10-13 00:36:18 +08:00
Omair Saleh f92ca756aa submit delivery address postcode to yd to release goods from china 2022-10-11 23:25:30 +08:00
Omair Saleh 5514f3b8e0 submit delivery address postcode to yd to release goods from china 2022-10-11 23:13:48 +08:00
Omair Saleh 14d80fd457 fix invoice date 2022-10-10 17:51:04 +08:00
Omair Saleh c8d621057b fix invoice date 2022-10-10 17:49:14 +08:00
Omair Saleh 6ecfa8e031 fix invoice date 2022-10-10 17:43:32 +08:00
Omair Saleh 975e3d49e7 hide payment button for floating amount 2022-09-30 16:20:54 +08:00
Omair Saleh 2bd30492c5 hide payment button for floating amount 2022-09-30 16:13:15 +08:00
Omair Saleh c089b5f072 hide payment button for floating amount 2022-09-30 16:12:15 +08:00
Omair Saleh fbaa1238cb hide payment button for floating amount 2022-09-30 16:10:17 +08:00
Omair Saleh d1cf06d700 hide payment button for floating amount 2022-09-30 16:09:05 +08:00
Omair Saleh ff159730e0 hide payment button for floating amount 2022-09-30 16:07:06 +08:00
Omair Saleh e59934fa7b show order reference on payment verification component 2022-09-30 15:59:25 +08:00
Omair Saleh 650d232ab0 show order reference on payment verification component 2022-09-30 15:57:26 +08:00
Omair Saleh 71ae2437a4 show order reference on payment verification component 2022-09-30 15:54:06 +08:00
Omair Saleh 17edf59b57 show order reference on payment verification component 2022-09-30 15:52:21 +08:00
Omair Saleh 6268cdd21f show order reference on payment verification component 2022-09-30 15:50:30 +08:00
Omair Saleh 2ea62bcfb9 show order reference on payment verification component 2022-09-30 15:48:46 +08:00
Omair Saleh 1debc8e2d5 show order reference on payment verification component 2022-09-30 15:46:21 +08:00
Omair Saleh fb849aa4cc show order reference on payment verification component 2022-09-30 15:44:31 +08:00
Omair Saleh 913f6f84e2 show order reference on payment verification component 2022-09-30 15:40:24 +08:00
Omair Saleh f28d0382b8 show order reference on payment verification component 2022-09-30 15:35:57 +08:00
edmondlang 97a568322c edit billing address in payment and billing 2022-09-29 20:53:00 +08:00
edmondlang b01e2022dc import debtor 2022-09-29 19:11:59 +08:00
Omair Saleh f7a1ba05f8 customer announcement in customer profile 2022-09-28 17:34:27 +08:00
Omair Saleh a05a6381df fix delete packinglist 2022-09-28 13:12:57 +08:00
Omair Saleh d7c0f7302d delete duplicated buttons from unclaimed packing list component 2022-09-28 13:07:36 +08:00
Omair Saleh 78a8451699 fix unclaimed packing list pending invoice 2022-09-27 13:31:28 +08:00
Omair Saleh 5964123c5f fix bug when dispute has no comment 2022-09-27 13:28:30 +08:00
Omair Saleh 28e5fa43a5 update delivery keywords for yd 2022-09-27 10:54:31 +08:00
Omair Saleh 4d39d7f43f update delivery keywords for yd 2022-09-27 10:53:40 +08:00
Omair Saleh ee65ceac1d update delivery keywords for yd 2022-09-27 10:46:42 +08:00
Omair Saleh ee1dfea0c8 show packing list reference 2022-09-27 10:33:13 +08:00
omair saleh a90766ba13 fix cnt quantity in the invoice 2022-09-26 12:15:45 +08:00
omair saleh 6613ca9a86 fix qr image ratio in pdf 2022-09-25 22:36:34 +08:00
omair saleh 2839f7855c fix qr image ratio in pdf 2022-09-25 22:35:56 +08:00
omair saleh 9b70fdf37f fix qr image ratio in pdf 2022-09-25 22:35:09 +08:00
omair saleh 4667d8fbc3 fix qr image ratio in pdf 2022-09-25 22:34:32 +08:00
omair saleh 8b3e60a74a fix qr image ratio in pdf 2022-09-25 22:33:59 +08:00
omair saleh 1f6c6bf87d fix qr image ratio in pdf 2022-09-25 22:33:27 +08:00
omair saleh 8100ea0329 Merge remote-tracking branch 'origin/master' 2022-09-25 22:30:49 +08:00
omair saleh 20d706caf8 fix qr image ratio in pdf 2022-09-25 22:30:24 +08:00
edmondlang 3fe46f596a delete pending approval invoice 2022-09-22 23:27:32 +08:00
omair saleh c22e13f3cb show address at invoice component 2022-09-22 15:47:34 +08:00
omair saleh e39d364782 show address at invoice component 2022-09-22 15:35:47 +08:00
omair saleh 47fdac08aa debug invoice 2022-09-22 13:40:22 +08:00
omair saleh d824075e51 debug invoice 2022-09-22 13:40:10 +08:00
omair saleh af5de245ad debug invoice 2022-09-22 13:37:11 +08:00
omair saleh a58a5bd9a6 debug invoice 2022-09-22 13:35:41 +08:00
omair saleh 0493057805 debug invoice 2022-09-22 13:34:56 +08:00
omair saleh b6fc042d07 debug invoice 2022-09-22 13:33:19 +08:00
omair saleh 6bdcc007fc debug invoice 2022-09-22 13:32:44 +08:00
omair saleh 747402a5bc debug invoice 2022-09-22 13:32:06 +08:00
omair saleh c49d43f000 debug vt container update script 2022-09-22 13:25:40 +08:00
omair saleh 1e06e4db21 debug vt container update script 2022-09-22 13:24:12 +08:00
omair saleh 3b449fc812 change transactions receiver and issuer relationship from companies to company_modules 2022-09-22 13:18:57 +08:00
omair saleh a1ea94fa73 debug billing 2022-09-22 13:14:50 +08:00
omair saleh 79f6637b7b hide payment and billing page from customer 2022-09-22 11:56:20 +08:00
omair saleh dd684531c6 fetch vt recieve last 10 days 2022-09-21 13:02:01 +08:00
omair saleh 52e95b40ab fetch vt recieve last 10 days 2022-09-21 12:43:31 +08:00
omair saleh b6269ee369 fetch vt recieve last 10 days 2022-09-21 12:35:52 +08:00
omair saleh 144b5e7e13 fetch vt recieve last 10 days 2022-09-21 12:30:42 +08:00
omair saleh a84f44e9b0 fetch vt recieve last 10 days 2022-09-21 12:19:11 +08:00
omair saleh 32b90a3387 fetch vt recieve last 10 days 2022-09-21 11:54:24 +08:00
omair saleh 7faf5331e5 billing fix up 2022-09-21 10:10:39 +08:00
omair saleh 9783c76be3 billing fix up 2022-09-21 09:02:41 +08:00
omair saleh 3658991c43 billing fix up 2022-09-21 09:01:48 +08:00
omair saleh d2d82aabac Merge branch 'development' into 'master'
if company doesn't have billing address - hide generate invoice and show...

See merge request CIEFWorldwideSdnBhd/shipping-portal!135
2022-09-21 00:54:20 +00:00
omair saleh 6fe3023abc billing fix up 2022-09-20 16:50:50 +08:00
omair saleh e0356599bb billing fix up 2022-09-20 16:46:03 +08:00
omair saleh 37c3f95eda billing fix up 2022-09-20 16:43:21 +08:00
omair saleh 843b311c77 billing fix up 2022-09-20 16:41:30 +08:00
omair saleh 3fc7ccb51e billing fix up 2022-09-20 16:31:40 +08:00
omair saleh 9216c176f3 billing fix up 2022-09-20 16:27:38 +08:00
omair saleh 021c200d07 billing fix up 2022-09-20 16:24:56 +08:00
omair saleh a795a118a5 billing fix up 2022-09-20 16:23:05 +08:00
omair saleh 9833d07b04 billing fix up 2022-09-20 16:22:29 +08:00
omair saleh 7bf865ed3e billing fix up 2022-09-20 16:21:36 +08:00
omair saleh f7c8f68520 billing fix up 2022-09-20 16:19:05 +08:00
omair saleh 756e1b9419 billing fix up 2022-09-20 15:58:14 +08:00
omair saleh dd28171011 billing fix up 2022-09-20 09:13:46 +08:00
omair saleh 9f6fe2722c billing fix up 2022-09-20 09:09:11 +08:00
omair saleh 25928305ea billing fix up 2022-09-20 09:08:15 +08:00
omair saleh 499d1f9759 billing fix up 2022-09-20 09:06:10 +08:00
omair saleh 0e8c74bec2 billing fix up 2022-09-20 09:05:08 +08:00
omair saleh f774e90d50 billing fix up 2022-09-20 09:04:29 +08:00
omair saleh 6558ce20d9 billing fix up 2022-09-20 09:01:26 +08:00
omair saleh f16a843197 billing fix up 2022-09-20 08:49:48 +08:00
omair saleh 1ea081d831 billing fix up 2022-09-20 08:47:32 +08:00
omair saleh ce4e88fcdc billing fix up 2022-09-20 08:44:59 +08:00
omair saleh 6ca4f235df billing fix up 2022-09-20 08:06:39 +08:00
omair saleh 03843d8726 billing fix up 2022-09-20 08:04:43 +08:00
omair saleh 48b4381ba5 billing fix up 2022-09-20 07:56:29 +08:00
omair saleh 71d45fa100 billing fix up 2022-09-20 07:53:59 +08:00
omair saleh ebd42cfcbe billing fix up 2022-09-20 07:52:48 +08:00
omair saleh 9541f32641 billing fix up 2022-09-20 07:50:22 +08:00
omair saleh 5077e0e8d4 billing fix up 2022-09-20 07:48:49 +08:00
omair saleh c1c2c155be billing fix up 2022-09-20 07:36:20 +08:00
omair saleh c69dcf6ba3 billing fix up 2022-09-20 07:32:05 +08:00
omair saleh 10a95f0b4d billing fix up 2022-09-20 07:28:40 +08:00
omair saleh d8b41cbe55 billing fix up 2022-09-20 06:43:54 +08:00
omair saleh ad15b2f6b8 export parcel summary 2022-09-20 03:33:10 +08:00
omair saleh 5a69a31628 export parcel summary 2022-09-20 03:32:49 +08:00
omair saleh 65e0fe668d export parcel summary 2022-09-20 03:30:43 +08:00
omair saleh 0cd2272e6c export parcel summary 2022-09-20 03:29:55 +08:00
omair saleh 2f358c659b export parcel summary 2022-09-20 03:29:18 +08:00
omair saleh 3bec5b9c86 export parcel summary 2022-09-20 03:28:09 +08:00
omair saleh f499aaa0a7 export parcel summary 2022-09-20 03:27:29 +08:00
omair saleh dfcb6064f8 export parcel summary 2022-09-20 03:26:10 +08:00
omair saleh 968ff5c02a Merge branch 'connetction-segment-integration' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php
#	app/Http/Resources/OrderResource.php
#	app/Http/Resources/PackingListResource.php
#	resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue
#	resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue
2022-09-20 02:47:47 +08:00
omair saleh 427bbb9de2 export parcel summary 2022-09-20 02:31:09 +08:00
omair saleh dc4fabbf36 export parcel summary 2022-09-20 02:30:26 +08:00
omair saleh e5e93e500e fix pending delivery export 2022-09-19 12:03:07 +08:00
omair saleh 924f686381 fix pending delivery export 2022-09-19 11:57:36 +08:00
omair saleh acb334f2c2 fix pending delivery export 2022-09-19 11:39:59 +08:00
omair saleh 35611da094 fix pending delivery export 2022-09-19 11:39:16 +08:00
omair saleh ba192563ba fix pending delivery export 2022-09-19 11:38:01 +08:00
omair saleh 42525a4d32 fix export on hold list 2022-09-15 12:57:14 +08:00
omair saleh 7af7b28408 move csw to yd 2022-09-14 13:40:58 +08:00
omair saleh b90fa86eae don't allow to release packing list with yd without person in charge info 2022-09-14 13:35:51 +08:00
omair saleh ba7f9807a7 remove csw from yd exempt list 2022-09-09 14:17:59 +08:00
edmondlang daf5c65bd7 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	routes/web.php
2022-09-07 21:50:48 +08:00
omair saleh 4280a9188c add 2 days to eta date 2022-09-07 17:30:45 +08:00
omair saleh 08398c481e break line for postcode 2022-09-07 15:35:40 +08:00
omair saleh c8399cc336 break line for postcode 2022-09-07 15:31:13 +08:00
omair saleh 84bef88f16 break line for postcode 2022-09-07 15:25:22 +08:00
omair saleh 3e45f58b3b break line for postcode 2022-09-07 15:24:33 +08:00
omair saleh 856302f480 break line for postcode 2022-09-07 15:22:36 +08:00
edmondlang 1a67fa31dc fix connection segment in customer page 2022-09-03 18:59:12 +08:00
omair saleh d045e0401d billing segment 2022-09-03 15:03:17 +08:00
omair saleh d2e3e1979a remove announcement 2022-09-03 11:33:55 +08:00
omair saleh 4dba55eb32 add customers to the exception list for auto release 2022-09-02 14:39:17 +08:00
omair saleh 29fe4cf53c csw move to yd 2022-08-30 15:21:10 +08:00
omair saleh 3b39477369 holiday announcement 2022-08-26 11:15:42 +08:00
omair saleh a79d9249af update holiday announcement 2022-08-26 11:14:14 +08:00
omair saleh 6c1a9fe992 fix vt container api 2022-08-25 16:54:12 +08:00
omair saleh 01b539bea8 fix vt container api 2022-08-25 16:52:15 +08:00
omair saleh 73ba896e7c fix vt container api 2022-08-25 16:50:20 +08:00
omair saleh 8635e5f71f fix vt container api 2022-08-25 16:49:26 +08:00
omair saleh fb3405cdbc fix vt container api 2022-08-25 16:48:12 +08:00
omair saleh 4e4e0b5d9c fix vt container api 2022-08-25 16:45:48 +08:00
omair saleh 41c76c7c09 fix vt container api 2022-08-25 16:43:43 +08:00
omair saleh 5fada5310e fix vt container api 2022-08-25 16:41:24 +08:00
omair saleh 10fc3d7f68 fix vt container api 2022-08-25 14:39:39 +08:00
omair saleh a495d5ac0a fix vt container api 2022-08-25 14:33:58 +08:00
omair saleh 49a21865b6 fix vt container api 2022-08-25 14:33:21 +08:00
omair saleh 32c03caff1 fix vt container api 2022-08-25 14:28:53 +08:00
omair saleh 42e7ee43f2 fix vt container api 2022-08-25 14:28:13 +08:00
omair saleh 18fab0e8d4 fix vt container api 2022-08-25 14:27:21 +08:00
omair saleh f8bd9c0372 fix vt container api 2022-08-25 14:26:43 +08:00
omair saleh 9845b85cf0 fix vt container api 2022-08-25 14:24:58 +08:00
omair saleh 5163728298 fix vt container api 2022-08-25 14:17:41 +08:00
omair saleh 3e19696d02 fix vt container api 2022-08-25 14:16:32 +08:00
omair saleh 41dbd80d0d fix vt container api 2022-08-25 14:10:43 +08:00
omair saleh 4e64d8cd1d fix vt api 2022-08-24 18:49:50 +08:00
omair saleh 3108d20c16 fix vt update container 2022-08-24 18:42:53 +08:00
omair saleh ea35cd0c10 fix vt container update 2022-08-24 18:41:16 +08:00
omair saleh fffd6da513 fix vt container update 2022-08-24 18:40:17 +08:00
omair saleh 4b6d288485 fix vt container update 2022-08-24 18:37:33 +08:00
omair saleh 750ebbd769 fix vt container updates 2022-08-24 18:35:35 +08:00
omair saleh e638186367 fix vt container updates 2022-08-24 18:34:38 +08:00
omair saleh 77812e625a fix vt 2022-08-24 18:28:15 +08:00
omair saleh 5acd08d8e4 debug vt 2022-08-24 18:18:52 +08:00
omair saleh 6d7a05d264 add customer to exception for auto release from china 2022-08-24 17:11:47 +08:00
omair saleh fcb16cc115 enable yiwu 2022-08-22 15:32:12 +08:00
omair saleh 4f7097772f enable yiwu 2022-08-22 15:23:51 +08:00
omair saleh 9e8ee0f405 export all cbm report 2022-08-16 12:14:04 +08:00
omair saleh 8acbc56aeb yiwu notice 2022-08-11 19:47:04 +08:00
omair saleh 460b141102 yiwu notice 2022-08-11 19:43:55 +08:00
edmondlang d00620564b update Customer order page and admin payment billing page - include remarks 2022-08-09 02:44:05 +08:00
edmondlang 68028d5cf3 add function for admin to regenerate the dispute invoice 2022-08-08 22:19:55 +08:00
edmondlang a2c7eddf7b update payment and billing 2022-08-07 17:11:26 +08:00
edmondlang 9e756132ca update annoucment css 2022-08-06 23:53:43 +08:00
edmondlang 1706e2e1a3 remove console.log 2022-08-06 23:48:23 +08:00
edmondlang e84e39b8a1 debug annoucment segment 2022-08-06 23:46:37 +08:00
edmondlang 6ed383c06c update create annoucment service to suit the date time format from datetime picker 2022-08-06 23:34:07 +08:00
edmondlang b52445f106 migrate annoucment module from exchange 2022-08-06 23:33:09 +08:00
edmondlang e7f8b62116 update seeder for segment constant 2022-08-06 01:57:34 +08:00
edmondlang cd59debee4 update CUSTOM SEGMENTS price api 2022-08-06 01:46:06 +08:00
edmondlang f7a2861072 update admin payments billing page - do extra validation checking on each data with vue conditions 2022-08-06 00:42:20 +08:00
edmondlang 845fdfd5ca debug all constant in settings 2022-08-06 00:41:28 +08:00
edmondlang b984f931e1 update admin payments and billings page - add address and postcode 2022-08-05 23:40:59 +08:00
edmondlang 2b1fca6b2e if company doesn't have billing address - hide generate invoice and show create billing address modal 2022-08-05 21:24:36 +08:00
edmondlang 433d8e63b4 hide generate invoice for un-claimed packing list 2022-08-05 20:07:55 +08:00
edmondlang 30bf744854 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	resources/assets/vue/components/settings/forms/EditSegmentPriceFormComponent.vue
2022-08-05 19:53:55 +08:00
omair saleh ea880a1a54 update eta arrival date 2022-08-05 15:35:31 +08:00
omair saleh b6a62fed2b update eta arrival date 2022-08-05 15:34:35 +08:00
omair saleh 3106750be6 update eta arrival date 2022-08-05 15:26:02 +08:00
omair saleh f1c2ff7364 update eta when arrival 2022-08-05 15:22:53 +08:00
omair saleh 0f307bda1f update eta on arrival 2022-08-05 15:15:48 +08:00
omair saleh 52e601de00 disable yiwu warehouse temp 2022-08-05 10:40:49 +08:00
omair saleh 83351f17b1 hide payment and billing page from menu 2022-08-01 03:09:49 +08:00
omair saleh be3d10e055 rename addon table 2022-08-01 03:06:52 +08:00
omair saleh d6616c0c5c rename addon table 2022-08-01 03:06:07 +08:00
omair saleh a667e23647 rename addon table 2022-08-01 03:05:20 +08:00
omair saleh c018fa9050 rename addon table 2022-08-01 02:56:15 +08:00
omair saleh 61eae220d1 rename addon table 2022-08-01 02:55:22 +08:00
omair saleh e4aa8fdd57 rename addon table 2022-08-01 02:51:59 +08:00
omair saleh 8b41056129 rename addon table 2022-08-01 02:50:11 +08:00
omair saleh df69ff6fec disable addon migration temp 2022-08-01 02:49:01 +08:00
omair saleh 894799a801 disable addon migration temp 2022-08-01 02:47:56 +08:00
omair saleh c62231fe3a hide notification temp 2022-08-01 02:15:03 +08:00
omair saleh 6335e90aab update yd new delivery api 2022-08-01 02:13:19 +08:00
omair saleh 02c83044a2 Merge remote-tracking branch 'origin/master' 2022-08-01 02:11:40 +08:00
omair saleh 86e6ef7af5 update yd new delivery api 2022-08-01 02:11:07 +08:00
edmondlang 0bad26e8ff update segment - delete props 2022-08-01 00:17:24 +08:00
edmondlang c24ddb4fa2 remove code error 2022-07-31 22:52:05 +08:00
edmondlang ff68ee76ab update base price according to packlinglist drop date 2022-07-31 22:08:48 +08:00
edmondlang 2a0501ad99 remove extra line of codes 2022-07-31 22:08:15 +08:00
edmondlang 43491223ab customer payment ui inside orders 2022-07-31 21:38:15 +08:00
edmondlang 436985db8f fix error section not showing 2022-07-31 20:17:10 +08:00
edmondlang 37887de61d add invoice in order resources 2022-07-31 20:15:38 +08:00
edmondlang 374cc7748a update billplz ui 2022-07-31 18:00:05 +08:00
edmondlang af15e462ba Merge branch 'payment-and-billing-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-07-31 16:06:52 +08:00
edmondlang afc6595715 Merge branch 'payment-and-billing-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-07-31 15:59:30 +08:00
edmondlang ce38d098fd Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-07-31 14:38:36 +08:00
glovetleong 4db4f6094d unit test bug 2022-07-30 09:56:30 +08:00
glovetleong 2a6a980fc3 unit test 2022-07-30 09:40:50 +08:00
163 changed files with 5334 additions and 578 deletions
@@ -95,4 +95,4 @@ abstract class AbstractControllerLogic
return $this->response(json_decode($collection->response()->getContent(), true));
}
}
}
@@ -39,6 +39,11 @@ abstract class AbstractListRecord extends AbstractGetRecord
$query = $query->orderBy($filters->get('order_by')->column, $filters->get('order_by')->DESC ? 'DESC': 'ASC');
}
if($filters->has('group_by')){
$query = $query->groupBy($filters->get('group_by')->column);
}
//dd($query->toSql());
return $filters->has('per_page') ? $query->paginate($filters->get('per_page')) : $query->get();
}
@@ -0,0 +1,37 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\SegmentConstants;
use App\Classes\ValueObjects\Constants\TransactionType;
use Illuminate\Database\Eloquent\Builder;
class CreditTerm implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder;
return $builder->whereHas('packingLists.owner', function($query) use($value) {
$query->whereHas('companyModule.connections', function($query) use($value){
if ($value) {
$query->whereHas('segments', function($query) {
$query->where('segments.id' , 3);
});
}else{
$query->whereDoesntHave('segments', function($query) {
$query->where('segments.id' , 3);
});
}
});
});
}
}
@@ -2,6 +2,7 @@
namespace App\Classes\General\Eloquent\Filters;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
class DoesNotHaveTransactionType implements Filter
@@ -15,6 +16,8 @@ class DoesNotHaveTransactionType implements Filter
{
return $builder->whereDoesntHave('transactions', function (Builder $query) use($value) {
$query->where('type', $value);
})->whereHas('containers', function ($query){
return $query->whereDate('loading_date', '>=', Carbon::parse('20-09-2022'));
});
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
class IsPublished implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereDate('starting_on', '<=', Carbon::now())
->whereDate('ending_on', '>=', Carbon::now());
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class OwnerIdNotIn implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereNotIn('owner_id', $value);
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\SegmentConstants;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\PackingList;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
class PackingListOrderedByInvoiceDate implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->select('packing_lists.*')->join('transactions', function($join){
$join->on('transactions.owner_id', '=', 'packing_lists.id');
$join->where('transactions.owner_type', '=', PackingList::class);
$join->where('transactions.status', '=', ApprovalStatus::APPROVED);
})->orderBy('transactions.updated_at', 'DESC');
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
class PaymentDay implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereHas('transactions', function (Builder $query) use($value) {
$query->where('transactions.type', 1)->where('status', ApprovalStatus::APPROVED)->whereDate('updated_at', '<=', Carbon::now()->subdays($value));
});
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class PaymentReference implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('payment_reference', '=', $value);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class SegmentIdIn implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereIn('segment_id', $value);
}
}
+87
View File
@@ -0,0 +1,87 @@
<?php
namespace App\Classes\General;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Cache;
class ExcelHandel
{
function __construct()
{
}
public static function generateFolder($path = '')
{
$folder = \Storage::disk('public')->makeDirectory($path);
return $folder;
}
public static function insertExcel($path = '', $base64Set = [])
{
$file_info = [];
$folder_path = ExcelHandel::generateFolder('excels/' . $path);
foreach ($base64Set as $key => $row) {
$exceldata = $row;
$filename = (string) Str::uuid();
$f = finfo_open();
$mime_type = finfo_file($f, $exceldata, FILEINFO_MIME_TYPE);
$extension = 'xls';
switch ($mime_type) {
case 'application/vnd.ms-excel':
$extension = 'xls';
break;
case 'application/zip':
$extension = 'xlsx';
break;
}
if (empty($extension)) {
return false;
}
$exceldata = explode('base64,', $exceldata);
$exceldata = base64_decode($exceldata[1]);
$filename_with_ext = $filename . '.' . $extension;
$file = ExcelHandel::generateExcel($path, $exceldata, $filename, $extension);
$file_info[] = [
'path' => $path,
'filename' => $filename_with_ext,
'mime_type' => $mime_type,
'extension' => $extension,
'file_info' => empty($file) ? [] : $file,
];
}
return $file_info;
}
public static function generateExcel($path = '', $exceldata = '', $filename = '', $extension = '')
{
$file_info = [];
$file = \Storage::disk('public')->put('excels/' . $path . '/' . $filename . '.' . $extension, $exceldata);
$file_info['original']['file'] = storage_path('app/public/excels/' . $path . '/' . $filename . '.' . $extension);
return $file_info;
}
public static function removeExcel($excel_info = [])
{
$excel_info = json_decode(json_encode($excel_info), true);
foreach ($excel_info as $key => $row) {
if (!empty($row['path'])) {
\File::delete([$row['file_info']['original']['file']]);
}
}
return true;
}
}
+47
View File
@@ -0,0 +1,47 @@
<?php
namespace App\Classes\General\Traits;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
trait LogData
{
public static function boot()
{
parent::boot();
static::updating(function($model)
{
$tableName = Str::singular($model->table).'_logs';
$relationshipColumn = Str::singular($model->table).'_id';
$originalData = $model->getRawOriginal();
$originalData[$relationshipColumn] = $originalData['id'];
unset($originalData['id']);
if (!Schema::hasTable($tableName)) {
DB::statement('CREATE TABLE '.$tableName.' LIKE '.$model->table);
$indexs = DB::select('SHOW INDEX FROM '.$tableName.';');
$removedIndexes = [];
foreach ($indexs as $index){
if($index->Column_name === 'id' || in_array($index->Key_name, $removedIndexes)) continue;
DB::statement('ALTER TABLE '.$tableName.' drop index '.$index->Key_name);
$removedIndexes[] = $index->Key_name;
}
DB::statement('ALTER TABLE '.$tableName.' ADD COLUMN `'.$relationshipColumn.'` BIGINT NOT NULL AFTER `id`');
}
DB::table($tableName)->insert($originalData);
});
}
}
@@ -67,4 +67,4 @@ class AuthenticationProcessor
}
}
}
@@ -23,4 +23,4 @@ class AuthenticatesUser
}
}
}
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\Announcements\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Announcements\DataTransferObjects\AnnouncementObject;
use App\Models\Announcement;
use DateTime;
class CreatesAnnouncement extends AbstractUpdateRecord
{
@@ -18,9 +19,17 @@ class CreatesAnnouncement extends AbstractUpdateRecord
$model = new Announcement();
$model->title = $object->getTitle();
$model->description = $object->getDescription();
$model->starting_on = $object->getStartingOn();
$model->ending_on = $object->getEndingOn();
// $model->starting_on = $object->getStartingOn();
$model->starting_on = $this->convertDateFormat($object->getStartingOn());
// $model->ending_on = $object->getEndingOn();
$model->ending_on = $this->convertDateFormat($object->getEndingOn());
return $this->handler($model);
}
public function convertDateFormat($value) {
$value = DateTime::createFromFormat('d-m-Y', $value)->format('Y-m-d H:i:s');
return $value;
}
}
@@ -2,6 +2,8 @@
namespace App\Classes\Modules\Billplzs\ControllersLogic;
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
use App\Classes\Modules\Wallets\DataTransferObjects\WalletObject;
use App\Classes\Modules\Wallets\Services\UpdatesWallet;
@@ -21,6 +23,7 @@ use App\Classes\Modules\Billplzs\DataTransferObjects\BillplzXSignatureObject;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
@@ -35,21 +38,27 @@ class CallbackBillplzLogic
/** @var UpdatesTransactionStatus */
private $updatesTransactionStatus;
/** @var UpdatesWalletBalance */
private $updatesWalletBalance;
/** @var UpdateDoFromVTPortalProcessor */
private $updateDoFromVTPortalProcessor;
/** @var UpdateDoFromYDPortalProcessor */
private $updateDoFromYDPortalProcessor ;
/**
* CallbackBillplzLogic constructor.
* @param GetBillplzBill $getBillplzBill
* @param FetchesTransaction $fetchesTransaction
* @param UpdatesTransactionStatus $updatesTransactionStatus
* @param UpdatesWalletBalance $updatesWalletBalance
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
*/
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus)
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor)
{
$this->getBillplzBill = $getBillplzBill;
$this->fetchesTransaction = $fetchesTransaction;
$this->updatesTransactionStatus = $updatesTransactionStatus;
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
}
@@ -58,6 +67,8 @@ class CallbackBillplzLogic
* @return bool|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws MalformedRequestException
* @throws ResourceNotFoundException
* @throws \App\Classes\Exceptions\InternalServerErrorException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function execute(Request $request)
{
@@ -73,6 +84,12 @@ class CallbackBillplzLogic
$transaction = $this->fetchesTransaction->execute(['payment_reference' => $billplzXSignatureObject->getBillPlzId()]);
$invoice = $transaction->owner;
$packingList = $invoice->owner;
$order = $packingList->owner;
$status = ApprovalStatus::PENDING_VERIFICATION;
if($billPlz->state === 'paid') {
$status = ApprovalStatus::APPROVED;
}
@@ -84,8 +101,23 @@ class CallbackBillplzLogic
$token = Auth::fromUser(User::find(1));
$request->headers->set('Authorization', 'Bearer '.$token);
$marking = $transaction->owner()->first()->owner()->first();
$this->updatesTransactionStatus->execute($transaction, ApprovalStatus::APPROVED);
return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $marking->reference, 'transaction' => $transaction, 'status' => $status]);
if(($invoice->amount - $transaction->amount) < 0.01) {
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
if(app()->environment('production')){
$this->updateDoFromVTPortalProcessor->execute($packingList);
$this->updateDoFromYDPortalProcessor->execute($packingList);
}
}
return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $order->reference, 'transaction' => $transaction, 'status' => $status]);
}
}
}
@@ -23,7 +23,7 @@ class CreatesBillplzBill
try{
// config('billplz.maybank')
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->post(config('billplz.base_url').'/api/v3/bills', [
'collection_id' => $wallet ? config('billplz.wallet_collection_id') : config('billplz.collection_id'),
'collection_id' => config('billplz.collection_id'),
'name' => $name,
'email' => $email,
'description' => $description,
@@ -97,15 +97,15 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
$this->updatesCompanyStatus->execute($document->owner, $status === 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
$object = new NotificationObject(
'ID Verification ' . ( $status === 'approve' ? 'Approved' : 'Rejected' ),
( $status === 'approve' ? 'Dear user, congratulations that your ' : 'Dear user, we are sorry to inform you that your ' ) . ( $document->type === 'IDENTITY_CARD' ? 'IC' : 'SSM' ) . ( $status === 'approve' ? ' has been approved. Start your first order now!' : ' has been rejected due to ' . ( $request->input('rejectRemark') ?? '' ) . ', please resubmit it for further action.' ),
$document->owner,
$document->owner->companyModules()->first()->employees()->first(),
$document,
);
$this->createNotificationProcessor->execute($object);
// $object = new NotificationObject(
// 'ID Verification ' . ( $status === 'approve' ? 'Approved' : 'Rejected' ),
// ( $status === 'approve' ? 'Dear user, congratulations that your ' : 'Dear user, we are sorry to inform you that your ' ) . ( $document->type === 'IDENTITY_CARD' ? 'IC' : 'SSM' ) . ( $status === 'approve' ? ' has been approved. Start your first order now!' : ' has been rejected due to ' . ( $request->input('rejectRemark') ?? '' ) . ', please resubmit it for further action.' ),
// $document->owner,
// $document->owner->companyModules()->first()->employees()->first(),
// $document,
// );
//
// $this->createNotificationProcessor->execute($object);
if($status === 'approve'){
$orders = $this->updatesOrdersStatus->execute($document->owner, ApprovalStatus::APPROVED);
@@ -0,0 +1,73 @@
<?php
namespace App\Classes\Modules\Companies\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Companies\Services\UpdatesCompanyModuleName;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use App\Classes\Modules\Companies\Standards\Rules\CanUpdateCompany;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Classes\Modules\Companies\Services\UpdatesCompanyName;
use App\Http\Resources\CompanyResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateCompanyNameLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Updated Company',
'message' => 'You have successfully updated the Company'
];
}
/** @var FetchesCompany */
private $fetchesCompany;
/** @var UpdatesCompanyName */
private $updatesCompanyName;
/** @var UpdatesCompanyModuleName */
private $updatesCompanyModuleName;
/**
* UpdateCompanyControllersLogic constructor.
* @param FetchesCompany $fetchesCompany
* @param UpdatesCompanyName $updatesCompany
* @param UpdatesCompanyModuleName $updatesCompanyModuleName
*/
public function __construct(FetchesCompany $fetchesCompany,UpdatesCompanyName $updatesCompanyName, UpdatesCompanyModuleName $updatesCompanyModuleName)
{
$this->fetchesCompany = $fetchesCompany;
$this->updatesCompanyName = $updatesCompanyName;
$this->updatesCompanyModuleName = $updatesCompanyModuleName;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
*/
public function logic(Request $request) : JsonResponse
{
$query = $this->fetchesCompany->execute(['id' => $request->route('id')]);
$object = new CompanyObject($request->input('name'), $query->reference, $query->type);
$this->updatesCompanyName->execute($query, $object);
$this->updatesCompanyModuleName->execute($query->companyModules()->first(), $object->getName());
return $this->resourceResponse(new CompanyResource($query));
}
}
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Companies\Services;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Models\Company;
use App\Models\Segment;
use Illuminate\Database\QueryException;
@@ -19,8 +20,9 @@ class AssignsCompanyToSegment extends AbstractUpdateRecord
public function execute(Company $company, Segment $segment)
{
try {
$company->segments()->attach($segment);
$companyModule = $company->companyModules()->where('type', BusinessType::IMPORTER)->first();
$connection = $companyModule->connections()->where('inviter_reference', 'CIEF');
$connection->segments()->attach($segment);
return $company;
@@ -0,0 +1,24 @@
<?php
namespace App\Classes\Modules\Companies\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Models\Company;
class UpdatesCompanyName extends AbstractUpdateRecord
{
/**
* @param Company $model
* @param int $status
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(Company $model, CompanyObject $object)
{
$model->name = $object->getName();
return $this->handler($model);
}
}
@@ -28,7 +28,7 @@ class FileObject implements DataTransferObject
*/
public function getData()
{
return $this->getExtension() === 'pdf' ? $this->data : (new imageManager())->make($this->data);
return in_array($this->getExtension(), ['pdf', 'excel']) ? $this->data : (new imageManager())->make($this->data);
}
/**
@@ -66,7 +66,7 @@ class FileObject implements DataTransferObject
*/
public function getDecodedData(): string
{
return $this->getExtension() === 'pdf' ?
return in_array($this->getExtension(), ['pdf', 'excel']) ?
base64_decode((explode('base64,', $this->getData()))[1]):
$this->getData()->encode('data-url')->encoded;
}
@@ -78,9 +78,4 @@ class FileObject implements DataTransferObject
{
$this->data = $data;
}
}
}
@@ -36,7 +36,7 @@ class ConvertsBase64ToFile
foreach ($files as $file) {
$object = new FileObject($file);
$object->getExtension() === 'pdf' ? $this->generatePDF($object) : $this->generateImage($object);
in_array($object->getExtension(), ['pdf', 'excel']) ? $this->generatePDF($object) : $this->generateImage($object);
}
@@ -122,4 +122,4 @@ class ConvertsBase64ToFile
]);
}
}
}
@@ -37,9 +37,7 @@ class ExportsArrivedParcel implements WithHeadings, WithHeadingRow, WithMapping,
*/
public function query()
{
return PackingList::where('type', '=', 1)->where('status', '=', 2)->where('owner_type', Order::class)->whereHas('transports', function($query){
return $query->where('drop_date', '>=',Carbon::now()->subMonth());
});
return PackingList::where('type', '=', 1)->where('status', '=', 2)->where('owner_type', Order::class);
}
/**
@@ -0,0 +1,84 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Models\CompanyModule;
use App\Models\Company;
use App\Models\PackingList;
use Carbon\Carbon;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Illuminate\Http\Request;
class ExportsCustomerTotalOrderByYear implements FromCollection, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
{
use Exportable;
private $request;
public function __construct(Request $request)
{
$this->request = $request;
}
public function headings(): array
{
return [
'CompanyId',
'CompanyName',
'CompanyReference',
'TotalCbm'
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function collection()
{
$packingLists = PackingList::where('type', PackingListType::SHIPPING_PACKING_LIST)->whereHas('containers', function($container){
return $container->where('loading_date', '>=', Carbon::parse('01-01-' . $this->request->route('year')))
->where('loading_date', '<=', Carbon::parse('31-12-' . $this->request->route('year')));
})->get();
$packingLists = $packingLists->groupBy(function ($packingList){
return $packingList->owner->company_module_id;
})->sortByDesc(function($companyModule){
return $companyModule->sum(function($packingList){
return $packingList->packages->sum(function ($package){
return (($package->width / 100) * ($package->height / 100) * ($package->length / 100)) * $package->quantity;
});
});
})->take(10);
return $packingLists;
}
/**
* @param $row
* @return array
*/
public function map($row): array
{
$companyModule = $row[0]->owner->companyModule;
$marking = $companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
$cbm = $row->sum(function($packingList){
return $packingList->packages->sum(function ($package){
return (($package->width / 100) * ($package->height / 100) * ($package->length / 100)) * $package->quantity;
});
});
return [
$companyModule->company_id,
$companyModule->name,
$marking,
$cbm
];
}
}
@@ -0,0 +1,97 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Company;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class ExportsNullDebtors implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
{
use Exportable;
public function headings(): array
{
return [
'Code',
'DebtorControlAcc',
'ControlAccount',
'CompanyName',
'Desc2',
'DebtorType',
'DisplayTerm',
'CurrencyCode',
'RegisterNo',
'Address1',
'Address2',
'Address3',
'PostCode',
'DeliverAddr1',
'DeliverAddr2',
'DeliverAddr3',
'DeliverPostCode',
'EmailAddress',
'Attention',
'Phone1',
'Phone2',
'Fax1'
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function query()
{
return Company::where(function($query){
$query->whereNull('debtor')->orWhere('debtor', '');
})->whereHas('companyModules', function($query){
$query->where('type', BusinessType::IMPORTER);
})->whereHas('parcels')->where('status', ApprovalStatus::APPROVED);
}
/**
* @param Company $company
*
* @return array
*/
public function map($company): array
{
$marking = $company->companyModules()->where('type', BusinessType::IMPORTER)->first()->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
return [
'<<New>>',
'300-0000',
'300-0000',
$company->name.' (Shipping)',
$marking,
'',
'PIA',
'MYR',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',//EmailAddress
'',
'',
'',
''
];
}
}
@@ -52,7 +52,7 @@ class ExportsOnHoldPackingList implements FromQuery, WithHeadings, WithHeadingRo
return [
$container->reference,
$ContainerTransport ? $ContainerTransport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->eta : 'n/a',
$ContainerTransport ? $ContainerTransport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first() ? $ContainerTransport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->eta : 'n/a' : 'n/a',
$ContainerTransport ? $ContainerTransport->drop_date : 'n/a',
$marking,
$order->reference,
@@ -0,0 +1,28 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\Modules\Exports\Sheets\ContainersSheet;
use App\Classes\Modules\Exports\Sheets\PackingListsSheet;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;;
class ExportsParcel implements WithMultipleSheets
{
use Exportable;
/**
* @return array
*/
public function sheets(): array
{
$sheets = [];
$sheets[] = new ContainersSheet();
$sheets[] = new PackingListsSheet();
return $sheets;
}
}
@@ -0,0 +1,52 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Models\Order;
use App\Models\PackingList;
use Carbon\Carbon;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
class ExportsParcelPostcodes implements WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, FromQuery
{
use Exportable;
public function headings(): array
{
return [
'Order Number',
'Postcode'
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function query()
{
return PackingList::where('type', PackingListType::SHIPPING_PACKING_LIST)->whereRaw('LENGTH(reference) > 8')->where('reference', 'not like', "%YW%")->where('owner_type', Order::class)->whereDate('created_at', '>=', Carbon::parse('20-09-2022'))->whereDoesntHave('containers');
}
/**
* @param $packingList
* @return array
*/
public function map($packingList): array
{
$address = $packingList->owner->addresses()->where('status', ApprovalStatus::APPROVED)->first();
return [
$packingList->reference,
$address->postcode
];
}
}
@@ -0,0 +1,135 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Transaction;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Illuminate\Http\Request;
use Carbon\Carbon;
class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
{
use Exportable;
private $request;
public function __construct(Request $request)
{
$this->request = $request;
}
public function headings(): array
{
return [
'DocNo',
'DocDate',
'DebtorCode',
'ShipInfo',
'AccNo',
'DetailDescription',
'FurtherDescription',
'ProjNo',
'DeptNo',
'Qty',
'UnitPrice'
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function query()
{
$start_date = $this->request->input('startDate', null);
if ($start_date) {
$start_date = Carbon::parse($this->request->input('startDate'))->format('Y-m-d');
}
$end_date = $this->request->input('endDate', null);
if ($end_date) {
$end_date = Carbon::parse($this->request->input('endDate'))->format('Y-m-d');
}
$query = Transaction::query();
$query->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::COMPLETED]);
if($start_date && $end_date) {
$query->whereBetween('updated_at', [
Carbon::parse($start_date)->format('Y-m-d 0:00:00'),
Carbon::parse($end_date)->format('Y-m-d 23:59:59')
]);
}
elseif($start_date && !$end_date) {
$query->whereHas('transactions', function($transaction) use ($start_date) {
$transaction->where('type', TransactionType::PAYMENT)->where('updated_at', '>=', Carbon::parse($start_date)->format('Y-m-d 0:00:00'));
});
}
elseif(!$start_date && $end_date) {
$query->whereHas('transactions', function($transaction) use ($end_date) {
$transaction->where('type', TransactionType::PAYMENT)->where('updated_at', '>=', Carbon::parse($end_date)->format('Y-m-d 0:00:00'));
});
}
return $query;
}
public function map($transaction): array
{
$container = $transaction->owner->containers()->first();
$order = $transaction->owner->owner;
$company = $order->companyModule->company;
$shippingTransactionDetails = $transaction->transactionDetails()->where('reference', 'SHIPPING_FEE')->first();
$furtherDescription = '';
foreach ($transaction->transactionDetails as $item){
if($item->reference === 'SHIPPING_FEE')
$furtherDescription .= str_replace('X1 Freight Service Charge<br>', '', $item->name)."\n";
elseif($item->reference === 'OVER_WEIGHT_CHARGES')
$furtherDescription .= $item->name.' '.$item->quantity.' CBM'."\n";
elseif($item->reference === 'MIN_CBM_CHARGES')
$furtherDescription .= $item->name.' '.$item->quantity.' CBM'."\n";
else
$furtherDescription .= $item->name.' '.$item->quantity.' X '.$item->price."\n";
}
return [
'<<New>>',
$transaction->created_at->format('m/d/Y H:m'),
$company->debtor,
$order->reference,
'500-0000',
'X1 Freight Service Charge',
$furtherDescription,
$container->reference,
'CIEF',
$shippingTransactionDetails->quantity,
$shippingTransactionDetails->price
];
return [
'<<New>>',
$transaction->updated_at->format('m/d/Y H:m'),
$company->debtor,
$container->reference,
'500-0000',
'X1 Freight Service Charge',
'FurtherDescription',
$container->reference,
'M3',
'CIEF',
$shippingTransactionDetails->quantity,
$shippingTransactionDetails->price,
];
}
}
@@ -43,7 +43,7 @@ class ExportsPendingArrangementDeliveryList implements FromQuery, WithHeadings,
public function query()
{
return PackingList::where('type', '=', 2)->whereHas('containers', function ($query){
$query->where('containers.status', ApprovalStatus::COMPLETED);
$query->where('containers.status', ApprovalStatus::COMPLETED)->where('containers.created_at', '>', Carbon::now()->subMonths(3));
});
}
@@ -64,15 +64,16 @@ class ExportsPendingArrangementDeliveryList implements FromQuery, WithHeadings,
$originalPackingList = $packingList->owner instanceof PackingList ? $packingList->owner : $packingList;
$transport = $originalPackingList->containers()->first()->transports()->first();
$deliveryTransport = $originalPackingList->transports()->first();
$schedule = $deliveryTransport ? $deliveryTransport->schedules()->first() : null;
return [
$container->reference,
$ContainerTransport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->eta,
$ContainerTransport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first() ? $ContainerTransport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->eta : '',
$ContainerTransport->drop_date,
$marking,
$order->reference,
$deliveryTransport ? (Carbon::parse($deliveryTransport->schedules()->first()->eta) < Carbon::now() ? 'Delivered' : 'Pending Delivery') : 'Pending Arrangement',
$deliveryTransport ? $deliveryTransport->schedules()->first()->eta : ($transport ? Carbon::now()->diffInDays($transport->drop_date, false) . ' Days' : ''),
$schedule ? (Carbon::parse($schedule->eta) < Carbon::now() ? 'Delivered' : 'Pending Delivery') : 'Pending Arrangement',
$schedule ? $schedule->eta : ($transport ? Carbon::now()->diffInDays($transport->drop_date, false) . ' Days' : ''),
$packingList->packages()->sum('quantity'),
$address->state->name,
$address->postcode,
@@ -0,0 +1,105 @@
<?php
/**
* Created by PhpStorm.
* User: Omair Saleh
* Date: 20/9/2022
* Time: 12:20 AM
*/
namespace App\Classes\Modules\Exports\Sheets;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Container;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithTitle;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
class ContainersSheet implements WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, FromQuery, WithTitle
{
use Exportable;
public function headings(): array
{
return [
'Container No.',
'Loaded Date',
'ETD',
'ETA',
'Delay',
'Unstuffing date',
'Status',
'CTN',
'CBM'
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function query()
{
return Container::query();
}
/**
* @param $container
* @return array
*/
public function map($container): array
{
$transport = $container->transports()->first();
$currentSchedule = $transport ? $transport->schedules()->where('status', '!=', ApprovalStatus::EXPIRED)->first() : null;
$scheduleHistory = $transport ? $transport->schedules()->where('status', ApprovalStatus::EXPIRED)->get() : null;
$status = 'Loaded';
if($currentSchedule) {
if(Carbon::parse($currentSchedule->etd) >= Carbon::today()){
$status = 'Shipping';
}
if(Carbon::parse($currentSchedule->eta) >= Carbon::today()){
$status = 'Arrived?';
}
if($transport->drop_date){
$status = 'Pending deliveries';
if(!$container->packinglists()->whereDoesntHave('transports')->get()){
$status = 'Complete';
}
}
}
return [
$container->reference,
$container->loading_date,
$currentSchedule ? $currentSchedule->etd : null,
$currentSchedule ? $currentSchedule->eta : null,
$scheduleHistory ? count($scheduleHistory) : 0,
$transport ? $transport->drop_date : null,
$status,
$container->packages()->sum('quantity'),
$container->packages()->sum(DB::raw('(width/100) * (height/100) * (length/100) * quantity')),
];
}
/**
* @return string
*/
public function title(): string
{
return 'Containers';
}
}
@@ -0,0 +1,131 @@
<?php
/**
* Created by PhpStorm.
* User: Omair Saleh
* Date: 20/9/2022
* Time: 12:20 AM
*/
namespace App\Classes\Modules\Exports\Sheets;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Models\Order;
use App\Models\PackingList;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithTitle;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
class PackingListsSheet implements WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, FromCollection, WithTitle
{
use Exportable;
public function headings(): array
{
return [
'Arrival Date',
'Marking',
'Order No.',
'Reference',
'Quantity',
'CBM',
'Overweight',
'Total CBM',
'Container No.',
'Delivery Date',
'Warehouse',
'Warehouse District',
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function collection()
{
$packingLists = PackingList::where('status', '=', 2)->whereIn('type', [PackingListType::WAREHOUSE_RECEIVE_LIST, PackingListType::SHIPPING_PACKING_LIST])->get();
return $packingLists->filter(function ($packingList) {
if($packingList->type === PackingListType::SHIPPING_PACKING_LIST){
$warehouseArrival = PackingList::where('type', PackingListType::WAREHOUSE_RECEIVE_LIST)->where('reference', $packingList->reference)->get();
return $warehouseArrival ? false : true;
}
return true;
});
}
/**
* @param $packingList
* @return array
*/
public function map($packingList): array
{
$warehouseArrivalList = $packingList;
$shippingList = PackingList::where('type', PackingListType::SHIPPING_PACKING_LIST)->where('reference', $packingList->reference)->first();
if($packingList->type === PackingListType::SHIPPING_PACKING_LIST) {
$warehouseArrivalList = null;
$shippingList = $packingList;
}
$arrivalTransport = null;
if($warehouseArrivalList){
$arrivalTransport = $warehouseArrivalList->transports()->first();
}
$order = null;
if($packingList->owner instanceof Order){
$order = $packingList->owner;
}
$cbm = $packingList->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum(function($package) {
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
});
$overWeight = $packingList->packages->where('type', PackageType::OVER_WEIGHT)->sum(function($package) {
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
});
$container = $shippingList ? $shippingList->container : null;
$delivery = $shippingList ? $shippingList->transport : null;
return [
$arrivalTransport ? $arrivalTransport->drop_date : null,
$order ? $order->reference : 'Unclaimed',
$order ? $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference : 'Unclaimed',
$packingList->reference,
$packingList->packages()->sum('quantity'),
$cbm,
$overWeight ? $overWeight : 0,
$cbm + $overWeight,
$container ? $container->reference : null,
$delivery ? $delivery->drop_date : null,
strlen($packingList->reference) > 8 ? 'YD' : 'VT',
$order ? $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->name : null,
];
}
/**
* @return string
*/
public function title(): string
{
return 'Packing Lists';
}
}
@@ -0,0 +1,56 @@
<?php
namespace App\Classes\Modules\Imports\Services;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Models\Company;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithBatchInserts;
use Maatwebsite\Excel\Concerns\WithValidation;
class ImportsDebtor implements ToModel, WithHeadingRow, WithBatchInserts, WithValidation
{
public function __construct() {
}
public function model($row = [])
{
try {
preg_match_all('/([0-9]{3,4}[a-zA-Z]{3,4})/', $row['desc2'], $matches);
foreach ($matches[0] as $match){
$reference = $match;
$debtor = $row['code'];
$company = Company::whereNull('debtor')->whereHas('companyModules', function($query) use ($reference) {
$query->whereHas('connections', function($query) use ($reference) {
$query->where('invitee_reference', $reference);
});
})->first();
if ($company) {
$company->debtor = $debtor;
$company->update();
}
}
} catch (\Exception $exception){
dd($exception);
}
}
public function batchSize(): int
{
return 100;
}
public function rules(): array
{
return [
];
}
}
@@ -3,6 +3,7 @@
namespace App\Classes\Modules\Orders\Processors;
use App\Classes\Exceptions\InternalServerErrorException;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Modules\Orders\Services\FetchesDataFromYDPortal;
use App\Classes\Modules\Addresses\Services\FetchesAddress;
@@ -54,6 +55,7 @@ class UpdateDoFromYDPortalProcessor
$reference = $contact ? $contact->reference : null;
$remark = $remark ? $remark->content : 'URGENT!!! PLEASE CALL BEFORE ONE DAY DELIVERY.';
if(!$phone || !$reference) throw new MalformedRequestException('Can\'t release this packing list because it doesn\'t have the person in charge contact information');
$this->fetchesDataFRomYDPortal->clientRequest(
'http://www.yd-wl.com/api/UpdateOrderAddress.ashx',
'POST',
@@ -8,6 +8,7 @@ use App\Classes\Modules\PackingLists\Services\DeletesPackingList;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\PackingLists\Standards\Rules\CanDeletePackingList;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Models\PackingList;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -59,11 +60,9 @@ class DeletePackingListLogic extends AbstractControllerLogic
$this->canDeletePackingList->passes();
$warehouseList = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
$packingList = $this->fetchesPackingList->execute(['reference' => $warehouseList->reference, 'type' => PackingListType::SHIPPING_PACKING_LIST]);
$packingList = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
$this->deletesPackingList->execute($warehouseList);
$this->deletesPackingList->execute($packingList);
PackingList::where('reference', $packingList->reference)->delete();
return $this->response([]);
@@ -7,9 +7,13 @@ use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
use App\Classes\Modules\Schedules\Services\UpdatesScheduleStatus;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Classes\Modules\Transports\Services\CreatesTransport;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Http\Resources\PackingListResource;
use App\Models\Transport;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -17,6 +21,8 @@ use Carbon\Carbon;
class ReschedulePackingListLogic extends AbstractControllerLogic
{
/**
* @return array
*/
@@ -33,26 +39,31 @@ class ReschedulePackingListLogic extends AbstractControllerLogic
/** @var UpdatesScheduleStatus */
private $updatesScheduleStatus;
/** @var CreatesTransport */
private $createsTransport;
/** @var CreatesSchedule */
private $createsSchedule;
/**
* DeleteContainerControllersLogic constructor.
* ReschedulePackingListLogic constructor.
* @param FetchesPackingList $fetchesPackingList
* @param UpdatesScheduleStatus $updatesScheduleStatus
* @param CreatesTransport $createsTransport
* @param CreatesSchedule $createsSchedule
*/
public function __construct(FetchesPackingList $fetchesPackingList, UpdatesScheduleStatus $updatesScheduleStatus, CreatesSchedule $createsSchedule)
public function __construct(FetchesPackingList $fetchesPackingList, UpdatesScheduleStatus $updatesScheduleStatus, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule)
{
$this->fetchesPackingList = $fetchesPackingList;
$this->updatesScheduleStatus = $updatesScheduleStatus;
$this->createsTransport = $createsTransport;
$this->createsSchedule = $createsSchedule;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function logic(Request $request) : JsonResponse
{
@@ -60,9 +71,15 @@ class ReschedulePackingListLogic extends AbstractControllerLogic
$transport = $packing_list->transports()->first();
$old_sechedule = $transport->schedules()->first();
if(!$transport) {
$object = new TransportObject(TransportType::LAND, null, '', Carbon::parse($request->input('etd')), Carbon::parse($request->input('eta')),ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($object, $packing_list);
}
$this->updatesScheduleStatus->execute($old_sechedule, ApprovalStatus::REJECTED);
$transport->schedules()->update([
'status' => ApprovalStatus::REJECTED
]);
$scheduleObject = new ScheduleObject(
Carbon::parse($request->input('eta')),
@@ -145,7 +145,6 @@ class FetchLoadedContainersFromVTPortalProcessor
$containersRequest = $this->fetchesDataFRomVTPortal->clientRequest('http://portal.vtnation.com.my/Services/DataControllerService.asmx/GetPage', 'POST', json_decode('{"controller":"VCustomercontainer","view":"grid1","request":{"PageIndex":-1,"PageSize":10000,"SortExpression":"LoadedTime asc","Filter":'.$filter.'}}'), '');
$containers = $this->fetchesDataFRomVTPortal->getResponseBody($containersRequest);
foreach ($containers->Rows as $container){
$filter = '["ContainerID:=%js%'.$container[12].'"]';
$containerDetailRequest = $this->fetchesDataFRomVTPortal->clientRequest('http://portal.vtnation.com.my/Services/DataControllerService.asmx/GetPage', 'POST', json_decode('{"controller":"ParcelInContainer","view":"grid1","request":{"PageIndex":-1,"PageSize":10000,"SortExpression":null,"Filter":'.$filter.'}}'), '');
@@ -155,7 +154,6 @@ class FetchLoadedContainersFromVTPortalProcessor
$containerObject = new ContainerObject($container[0], str_replace(' ', '', $container[24]), str_replace(' ', '', $container[16]), ContainerTypes::FORTY_FEET_DRY_CONTAINER, Carbon::parse($container[6]), ApprovalStatus::PENDING_VERIFICATION);
$containerInfo = $container;
try {
$container = $this->fetchesContainer->execute(['reference' => $containerObject->getReference()]);
} catch (ResourceNotFoundException $exception){
@@ -163,9 +161,9 @@ class FetchLoadedContainersFromVTPortalProcessor
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $warehouseId === 11 ? 3 : 4]);
$container = $this->createContainerProcessor->execute($containerObject, $originWarehouse);
}
$eta = Carbon::parse($containerInfo[4]);
$etd = Carbon::parse($eta)->subDays(5);
$eta = Carbon::parse($containerInfo[4])->addDays(2);
$etd = Carbon::parse($eta)->subDays(7);
$delayDate = $containerInfo[7];
@@ -175,7 +173,9 @@ class FetchLoadedContainersFromVTPortalProcessor
$transport = $container->transports()->first();
if(!$transport){
if(!$transport || $eta !== $transport->eta){
$container->transports()->delete();
$transportObject = new TransportObject(TransportType::SEA, null, null, $etd, null, ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($transportObject, $container);
@@ -183,8 +183,7 @@ class FetchLoadedContainersFromVTPortalProcessor
}
if($delayDate){
$delayDate = Carbon::parse($delayDate);
$delayDate = Carbon::parse($delayDate)->addDays(2);
$transport = $container->transports()->first();
if(!$transport->schedules()->where('eta', '=', $delayDate)->first()) {
@@ -2,6 +2,7 @@
namespace App\Classes\Modules\PackingLists\Processors;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\Orders\Services\FetchesDataFromYDPortal;
@@ -23,6 +24,8 @@ use App\Classes\Modules\Unity\Processors\AssignContractEntityProcessor;
use App\Classes\Modules\Unity\Processors\CreateContractEntityProcessor;
use App\Classes\Modules\Unity\Services\CreatesContract;
use App\Classes\Modules\Unity\Services\UpdatesContractObligation;
use App\Classes\Notifications\ShipmentDepartureEmail;
use App\Classes\Notifications\ShipmentRescheduleEmail;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\ContainerTypes;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
@@ -132,11 +135,12 @@ class FetchOrderListsFromYdPortalProcessor
* @param Carbon|null $start
* @param Carbon|null $end
* @return void
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function execute(?Carbon $start = null, ?Carbon $end = null)
{
try {
$start = $start ? $start : Carbon::today()->subMonths(1);
$start = $start ? $start : Carbon::today()->subDays(30);
$startLimit = Carbon::parse('01-12-2021');
@@ -170,7 +174,6 @@ class FetchOrderListsFromYdPortalProcessor
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
if(!$rows){
Log::debug($row->expressno);
continue;
}
@@ -184,7 +187,7 @@ class FetchOrderListsFromYdPortalProcessor
$containerReference = explode('预计到港时间', $tracking[1])[0];
$loadingDate = Carbon::parse($trackingRow->trackingtime);
$etd = Carbon::parse($tracking[2])->subDays(5);
$eta = Carbon::parse($tracking[2]);
$eta = Carbon::parse($tracking[2])->addDays(2);
}
$rescheduleETD = strpos($trackingRow->remark, '开') || strpos($trackingRow->remark, '到港');
@@ -203,6 +206,7 @@ class FetchOrderListsFromYdPortalProcessor
}
$rescheduleDate = $dates->sortDesc()->first();
if(!$delayDate || $rescheduleDate > $delayDate){
/** @var Carbon $delayDate */
$delayDate = $rescheduleDate;
@@ -214,20 +218,42 @@ class FetchOrderListsFromYdPortalProcessor
}
if ($trackingRow->tracking === '到港') {
$delayDate = Carbon::parse($trackingRow->trackingtime);
}
if ($trackingRow->tracking === '已开船') {
$delayDate = Carbon::parse($trackingRow->trackingtime)->addDays('5');
}
if ($trackingRow->tracking === '货物已进目的港仓库') {
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
}
if (Str::contains($trackingRow->tracking, ['派送中', '签收完成', ' 第三方提货', '货物已派送完成'])) {
if (Str::contains($trackingRow->tracking, ['派送中', '已签收', '签收完成', ' 第三方提货', '货物已派送完成', '派送', 'delivery', 'delivered'])) {
$deliveryDate = Carbon::parse($trackingRow->trackingtime);
}
}
$client = new \GuzzleHttp\Client(['cookies' => true, 'headers' => ['Cookie' => 'utc_offset=480']]);
try {
$request = $client->request('get', 'https://main.universe.com.my/Tracking/User/Paging?sEcho=1&sTrackingNo='.$row->expressno.'&sOrgId=sti');
$deliveryTracking = json_decode($request->getBody()->getContents());
foreach (array_reverse($deliveryTracking->aaData) as $trackingRow) {
$trackingDate = Carbon::createFromFormat('d/m/y H:i', $trackingRow->LocalDateTime);
if (Str::contains($trackingRow->PublicDescription, ['accepted/picked'])){
$unstuffingDate = $trackingDate;
}
if (Str::contains($trackingRow->PublicDescription, ['delivered'])) {
$deliveryDate = $trackingDate;
}
}
} catch (\Exception $exception){
Log::debug('failed to fetch delivery tracking');
}
$customerno = preg_split('(-|\(|\)|\/)', $row->customerno);
$orderNumber = $customerno[array_key_last($customerno)];
@@ -332,7 +358,7 @@ class FetchOrderListsFromYdPortalProcessor
if($order instanceof Order){
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
if(!in_array($marking, ['2192KAA', '2353GFE', '6866DTR', '153DSR', '1291NSC', '8288MIB'])){
if(!in_array($marking, ['1290CSW', '8997ITB', '3992WHE', '962LOW', '1152AAT'])){
$this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/confirmsendorder.ashx', 'GET', [
'expressno' => $row->expressno
]);
@@ -374,13 +400,20 @@ class FetchOrderListsFromYdPortalProcessor
}
if($delayDate){
$delayDate = $delayDate->addDays(2);
$transport = $container->transports()->first();
if(!$transport->schedules()->whereDate('eta', '>=', $delayDate)->first()) {
$etd = $transport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->etd;
$transport->schedules()->update(['status' => ApprovalStatus::EXPIRED]);
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $delayDate, ApprovalStatus::APPROVED));
foreach ($container->packingLists as $packingList){
if(!($packingList->owner instanceof Order)) continue;
$user = $packingList->owner->companyModule->employees()->first();
if(app()->environment(['production'])) {
$user->notify(new ShipmentRescheduleEmail($user, $packingList));
}
}
}
}
@@ -433,7 +466,6 @@ class FetchOrderListsFromYdPortalProcessor
}
} catch (\Exception $exception) {
dump($exception);
Log::debug($exception);
}
@@ -116,7 +116,7 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
try {
$start = $start ? $start : Carbon::today()->subDays(5);
$start = $start ? $start : Carbon::today()->subDays(10);
$startLimit = Carbon::parse('11-08-2021');
@@ -133,15 +133,19 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
$response = $this->fetchesDataFRomVTPortal->getResponseBody($warehouseListRequest);
foreach ($response->Rows as $parcel){
$allow_contract = true;
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $parcel[11]));
$orderNumber = $marking[array_key_last($marking)];
$quantity = $parcel[16];
if(!$quantity){
continue;
}
if(!$parcel[23] || !$parcel[22] || !$parcel[21]) continue;
try {
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
$appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
@@ -152,7 +156,7 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
}
$packingListReference = $parcel[0];
// $measurement = round(($parcel[10]/$quantity) ** (1/3) * 100, 2);
// $measurement = round(($parcel[26]/$quantity) ** (1/3) * 100, 2);
$description = $parcel[13];
$tracking = $parcel[37];
$receiveDate = $parcel[1];
@@ -112,7 +112,7 @@ class UpdateConstantLogic extends AbstractControllerLogic
$constantObject = [];
$constantObject[$request->input('id')] = $request->input('rate');
$constantObject[$request->input('id')] = $request->input('value');
$object = new ConstantObject(
$request->input('reference'),
@@ -25,8 +25,8 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic
*/
protected function notification():array {
return [
'title' => 'Updated Segment Constant',
'message' => 'You have successfully updated the Segment Constant'
'title' => 'Updated Postcode Constant',
'message' => 'You have successfully updated the Postcode Constant'
];
}
@@ -70,7 +70,8 @@ class UpdateSegmentLogic extends AbstractControllerLogic
$segment_query = $this->fetchesSegment->execute(['id' => $request->route('id')]);
$segment_object = new SegmentObject(
$request->input('name', $segment_query->name)
$request->input('name'),
$segment_query->company_module_id
);
$this->canUpdateSegment->passes($segment_object);
$segment_query = $this->updatesSegment->execute($segment_query, $segment_object);
@@ -0,0 +1,124 @@
<?php
namespace App\Classes\Modules\Segments\ControllersLogic;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
use App\Classes\Modules\Segments\Services\CreatesConstant;
use App\Classes\Modules\Segments\Services\CreatesSegment;
use App\Classes\Modules\Segments\Services\FetchesConstant;
use App\Classes\Modules\Segments\Services\FetchesSegment;
use App\Classes\Modules\Segments\Standards\Rules\CanCreateConstant;
use App\Classes\Modules\Segments\Standards\Rules\CanUpdateConstant;
use App\Classes\Modules\Segments\Services\UpdatesConstant;
use App\Http\Resources\ConstantResource;
use App\Models\SegmentConstant;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Classes\Modules\Segments\Services\UpdatesConstantValue;
class UpdateSegmentPriceLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Updated Segment Price',
'message' => 'You have successfully updated the Segment Price'
];
}
/** @var CanUpdateConstant */
private $canUpdateConstant;
/** @var UpdatesConstant */
private $updatesConstant;
/** @var FetchesSegment */
private $fetchesSegment;
/** @var FetchesConstant */
private $fetchesConstant;
/** @var CanCreateConstant */
private $canCreateConstant;
/** @var CreatesConstant */
private $createsConstant;
/** @var CreatesSegment */
private $createsSegment;
/** @var UpdatesConstantValue */
private $updatesConstantValue;
/**
* UpdateConstantLogic constructor.
* @param CanUpdateConstant $canUpdateConstant
* @param UpdatesConstant $updatesConstant
* @param FetchesSegment $fetchesSegment
* @param FetchesConstant $fetchesConstant
* @param CanCreateConstant $canCreateConstant
* @param CreatesConstant $createsConstant
* @param UpdatesConstantValueByState $updatesConstantValueByState
* @param CreatesSegment $createsSegment
*/
public function __construct(
CanUpdateConstant $canUpdateConstant,
UpdatesConstant $updatesConstant,
FetchesSegment $fetchesSegment,
FetchesConstant $fetchesConstant,
CanCreateConstant $canCreateConstant,
CreatesConstant $createsConstant,
UpdatesConstantValue $updatesConstantValue,
CreatesSegment $createsSegment
)
{
$this->canUpdateConstant = $canUpdateConstant;
$this->updatesConstant = $updatesConstant;
$this->fetchesSegment = $fetchesSegment;
$this->fetchesConstant = $fetchesConstant;
$this->canCreateConstant = $canCreateConstant;
$this->createsConstant = $createsConstant;
$this->updatesConstantValue = $updatesConstantValue;
$this->createsSegment = $createsSegment;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function logic(Request $request) : JsonResponse
{
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
try {
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]);
$object = new ConstantObject($request->input('reference'), [$request->input('value')]);
$this->canUpdateConstant->passes($object);
} catch (ResourceNotFoundException $exception){
$object = new ConstantObject(
$request->input('reference'),
[$request->input('value')]
);
$constant = $this->createsConstant->execute($segment, $object);
}
$constant = $this->updatesConstant->execute($constant, $object);
return $this->resourceResponse(new ConstantResource($constant));
}
}
@@ -7,9 +7,9 @@ class UpdatesConstantValue
/**
* @param $json
* @param int $status_id
* @param Array $rate
* @return Array
* @param int $state_id
* @param array $rate
* @return array
*/
public function execute($json, int $state_id, Array $rate) {
@@ -9,6 +9,8 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Documents\Services\ApprovesDocument;
use App\Classes\Modules\Documents\Services\FetchesDocument;
use App\Classes\Modules\Documents\Services\RejectsDocument;
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
@@ -20,20 +22,22 @@ use Illuminate\Http\Request;
class ApprovePaymentTransactionLogic extends AbstractControllerLogic
{
/**
* ApprovePaymentVerificationLogic constructor.
* ApprovePaymentTransactionLogic constructor.
* @param FetchesTransaction $fetchesTransaction
* @param UpdatesTransactionStatus $updatesTransactionStatus
* @param ApprovesDocument $approvesDocument
* @param RejectsDocument $rejectsDocument
* @param FetchesDocument $fetchesDocument
* @param CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
*/
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument)
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor)
{
$this->fetchesTransaction = $fetchesTransaction;
$this->updatesTransactionStatus = $updatesTransactionStatus;
$this->approvesDocument = $approvesDocument;
$this->rejectsDocument = $rejectsDocument;
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
}
/**
@@ -58,10 +62,18 @@ class ApprovePaymentTransactionLogic extends AbstractControllerLogic
/** @var RejectsDocument */
private $rejectsDocument;
/** @var UpdateDoFromVTPortalProcessor */
private $updateDoFromVTPortalProcessor;
/** @var UpdateDoFromYDPortalProcessor */
private $updateDoFromYDPortalProcessor ;
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\InternalServerErrorException
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function logic(Request $request) : JsonResponse
{
@@ -69,13 +81,31 @@ class ApprovePaymentTransactionLogic extends AbstractControllerLogic
$status = $request->route('status');
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('transaction_id')]);
$status === 'approve' ? $this->approvesDocument->execute($transaction->documents()->first()) : $this->rejectsDocument->execute($transaction->documents()->first());
$this->updatesTransactionStatus->execute($transaction, $status === 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
// $this->createInvoiceTransactionProcessor->execute($transaction->booking);
if($transaction->status === ApprovalStatus::APPROVED){
$invoice = $transaction->owner;
$packingList = $invoice->owner;
if(($invoice->amount - $transaction->amount) < 0.01) {
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
if(app()->environment('production')){
$this->updateDoFromVTPortalProcessor->execute($packingList);
$this->updateDoFromYDPortalProcessor->execute($packingList);
}
}
}
return $this->response([]);
}
}
}
@@ -3,6 +3,7 @@
namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Classes\Notifications\InvoiceIssuedEmail;
use Illuminate\Http\Request;
@@ -69,7 +70,7 @@ class ApproveShippingInvoiceTransactionLogic extends AbstractControllerLogic
{
$packing_list = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
$invoice_transaction = $packing_list->transactions->where('type', TransactionType::SHIPPING_INVOICE)->first();
$invoice_transaction = $packing_list->transactions()->where('transactions.type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::PENDING_SUBMISSION])->first();
$this->updatesTransactionStatus->execute($invoice_transaction, ApprovalStatus::APPROVED);
@@ -87,8 +88,11 @@ class ApproveShippingInvoiceTransactionLogic extends AbstractControllerLogic
$document = $this->createsDocument->execute($invoice_transaction, $document_object);
$this->createsFiles->execute($document, $document_object);
$user = $packing_list->owner->companyModule->employees()->first();
if(app()->environment(['production'])) {
$user->notify(new InvoiceIssuedEmail($user, $packing_list));
}
return $this->response([]);
}
}
}
@@ -18,6 +18,7 @@ use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Http\Resources\TransactionResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
@@ -83,7 +84,7 @@ class CreatePaymentTransactionLogic extends AbstractControllerLogic
$payment_method = PaymentMethodType::PAYMENT_GATEWAY;
$billPlzBill = $this->createsBillplzBill->execute(
$company_module->name,
$company_module->employees()->first()->email ?? '',
(app()->environment(['production'])) ? $company_module->employees()->first()->email : 'uldvstar@gmail.com',
'This payment is for the invoice number . ' . $invoice_transaction->bill_no,
$amount,
$billNumber,
@@ -119,6 +120,6 @@ class CreatePaymentTransactionLogic extends AbstractControllerLogic
$payment_transaction = $this->createsPaymentTransaction->execute($invoice_transaction, $object);
return $this->response([]);
return $this->resourceResponse(new TransactionResource($payment_transaction));
}
}
@@ -16,6 +16,7 @@ use App\Classes\Modules\Transactions\DataTransferObjects\TransactionDetailObject
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
@@ -24,7 +25,9 @@ use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\SegmentConstants;
use App\Classes\ValueObjects\Constants\TransactionDetailType;
use App\Models\CompanyModule;
use App\Models\Document;
use App\Models\PackingList;
use App\Models\Transaction;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
@@ -67,11 +70,11 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
/** @var CreatesFiles */
private $createsFile;
public function __construct(
FetchesPackingList $fetchesPackingList,
FetchesSegmentConstant $fetchesSegmentConstant,
GeneratesTransactionBillNumber $generatesTransactionBillNumber,
FetchesPackingList $fetchesPackingList,
FetchesSegmentConstant $fetchesSegmentConstant,
GeneratesTransactionBillNumber $generatesTransactionBillNumber,
CreatesTransaction $createsTransaction,
CreatesTransactionDetail $createsTransactionDetail,
CreatesDocument $createsDocument,
@@ -91,16 +94,23 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
public function logic(Request $request) : JsonResponse
{
$packing_list = $this->fetchesPackingList->execute(['id' => $request->input('packing_list_id')]);
$packing_list = PackingList::where('reference', $packing_list->reference)->where('type', PackingListType::SHIPPING_PACKING_LIST)->first();
$cbm = $packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum(function($package) {
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
});
$billable_packing_list = $packing_list->packingLists()->first();
$over_weight_cbm = $packing_list->packages->where('type', PackageType::OVER_WEIGHT)->sum(function($package) {
$billable_packing_list = $billable_packing_list ? $billable_packing_list : $packing_list;
$cbm = round($billable_packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum(function($package) {
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
});
}), 3);
$over_weight_cbm = round($billable_packing_list->packages->where('type', PackageType::OVER_WEIGHT)->sum(function($package) {
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
}), 3);
$order = $packing_list->owner;
$companyModule = $order->companyModule;
$connection = $companyModule->connections()->first();
$address = $order->addresses()->first();
$base_price_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::BASE_PRICE]);
@@ -109,12 +119,20 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$center_postcode_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::CENTER_POSTCODE]);
$outstation_postcode_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::OUTSTATION_POSTCODE]);
$base_price = 0;
$warehouse_rate = 0;
$state_rate = 0;
$noMinimumCharge = $connection->segments()->where('segments.id', 2)->first();
$minimum_cbm = 0.3;
$state_select = '';
$base_price = $this->getConstantByKey($base_price_constant, date('Y-m-d'));
$segment_price = $connection->segments()->whereHas('constants', function($query){
return $query->where('reference', SegmentConstants::CUSTOM_PRICE);
})->get()->map(function($segment){
return (float) $segment->constants()->first()->value[0];
})->sort()->first();
$segment_price = $segment_price ? $segment_price : 0;
$packing_list_drop_date = PackingList::where('reference', $packing_list->reference)->where('type', 1)->first()->transports->first()->drop_date->format('Y-m-d');
$base_price = $this->getConstantByKey($base_price_constant, $packing_list_drop_date);
$warehouseId = $order->orderRoles()->where('role_id', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->company_module_id;
$selected_warehouse_rate = $this->getConstantByKey($warehouse_rate_constant, $warehouseId);
@@ -130,26 +148,63 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$state_rate_constant = (array)$state_rate_constant;
$state_rate = $state_select == '' ? 0 : $state_rate_constant[$state_select];
$price_cbm = $base_price + $warehouse_rate + $state_rate;
$total_cbm = $price_cbm * ($cbm + $over_weight_cbm);
$container = $packing_list->containers()->first();
$containerPackingLists = collect();
$hasMinimumCharge = null;
foreach ($container->packingLists as $packingList){
if($packingList->owner instanceof CompanyModule) continue;
if($packingList->owner->companyModule->id !== $companyModule->id) continue;
$containerPackingLists->push($packingList);
if(!$hasMinimumCharge) {
$hasMinimumCharge = $packingList->transactions()->whereHas('transactionDetails', function ($query){
$query->where('reference', 'MIN_CBM_CHARGES');
})->first();
}
}
$totalContainerCbm = $containerPackingLists->sum(function($packingList){
$billable_packing_list = $packingList->packingLists()->first();
$billable_packing_list = $billable_packing_list ? $billable_packing_list : $packingList;
return $billable_packing_list->packages->sum(function($package) {
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
});
});
$minimum_charge = $minimum_cbm - $totalContainerCbm;
$minimum_charge = ($minimum_charge < 0) ? 0 : $minimum_charge;
$minimum_charge = $noMinimumCharge ? 0 : $minimum_charge;
$minimum_charge = $noMinimumCharge ? 0 : round($minimum_charge, 3);
if($hasMinimumCharge) {
$minimum_charge = 0;
}
$price_cbm = $base_price + $segment_price + $warehouse_rate + $state_rate;
$total_cbm = $price_cbm * ($cbm + $minimum_charge + $over_weight_cbm);
$billNumber = $this->generatesTransactionBillNumber->execute('SHIP-');
$object = new TransactionObject(
$billNumber,
TransactionType::SHIPPING_INVOICE,
1,
$billNumber,
TransactionType::SHIPPING_INVOICE,
1,
$order->company_module_id,
1,
1,
PaymentMethodType::CASH,
$total_cbm,
$total_cbm,
1,
1,
0,
0,
1,
0,
null,
0,
0,
null,
ApprovalStatus::PENDING_SUBMISSION
);
@@ -158,13 +213,13 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$object_detail = new TransactionDetailObject(
'SHIPPING_FEE',
TransactionDetailType::SHIPPING_FEE,
TransactionDetailType::SHIPPING_FEE.'<br>'.round($packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum('quantity'), 3).' CTNS - '.round($cbm, 3).' CBM',
$cbm,
$price_cbm
);
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
if ($over_weight_cbm > 0) {
$object_detail = new TransactionDetailObject(
'OVER_WEIGHT_CHARGES',
@@ -176,6 +231,17 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
}
if ($minimum_charge > 0) {
$object_detail = new TransactionDetailObject(
'MIN_CBM_CHARGES',
TransactionDetailType::MIN_CBM_CHARGES,
$minimum_charge,
$price_cbm
);
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
}
return $this->response([]);
}
@@ -183,6 +249,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
if ($segmentConstantObject) {
$base_rate = (array) $segmentConstantObject->value;
$base_rate = array_key_exists($key, $base_rate) === true ? $base_rate[$key] : 0;
return $base_rate;
}
}
@@ -50,10 +50,10 @@ class SuspendTransactionLogic extends AbstractControllerLogic
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]);
$this->updatesTransactionStatus->execute($transaction, ApprovalStatus::SUSPENDED);
return $this->response([]);
$transaction = $this->updatesTransactionStatus->execute($transaction, ApprovalStatus::SUSPENDED);
return $this->resourceResponse(new TransactionResource($transaction));
}
@@ -85,7 +85,7 @@ class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic
{
$invoice_transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]);
$old_transaction_details = $invoice_transaction->transactionDetails->whereNotIn('reference', ['SHIPPING_FEE', 'OVER_WEIGHT_CHARGES'])->pluck('id')->toArray();
$old_transaction_details = $invoice_transaction->transactionDetails->whereNotIn('reference', ['SHIPPING_FEE', 'OVER_WEIGHT_CHARGES', 'MIN_CBM_CHARGES'])->pluck('id')->toArray();
$new_transaction_details = collect($request->input('transaction_details'));
@@ -104,7 +104,7 @@ class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic
foreach($new_transaction_details as $transaction_detail){
$transaction_detail = (object) $transaction_detail;
if(!in_array($transaction_detail->reference, ['SHIPPING_FEE', 'OVER_WHEIGHT_CHARGES'])){
if(!in_array($transaction_detail->reference, ['SHIPPING_FEE', 'OVER_WEIGHT_CHARGES', 'MIN_CBM_CHARGES'])){
$object_detail = new TransactionDetailObject(
'CUSTOM_CHARGES',
isset($transaction_detail->name) ? $transaction_detail->name : TransactionDetailType::CUSTOM_CHARGES,
@@ -117,8 +117,6 @@ class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic
}else{
$new_transaction_detail = $this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
}
$total_cbm += $new_transaction_detail->amount;
}
}
@@ -129,8 +127,8 @@ class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$invoice_transaction->issuer,
1,
PaymentMethodType::CASH,
$total_cbm,
$total_cbm,
$invoice_transaction->transactionDetails()->sum('amount'),
$invoice_transaction->transactionDetails()->sum('amount'),
1,
1,
0,
@@ -0,0 +1,71 @@
<?php
namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
use App\Classes\Modules\Transactions\Services\ListsTransactions;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Http\Resources\BookingResource;
use App\Http\Resources\TransactionResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateTransactionStatusLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Update Transaction Status',
'message' => 'You have successfully updated the Transaction Status'
];
}
/** @var FetchesTransaction */
private $fetchesTransaction;
/** @var UpdatesTransactionStatus */
private $updatesTransactionStatus;
/**
* SuspendTransactionLogic constructor.
* @param FetchesTransaction $fetchesTransaction
* @param UpdatesTransactionStatus $updatesTransactionStatus
*/
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus)
{
$this->fetchesTransaction = $fetchesTransaction;
$this->updatesTransactionStatus = $updatesTransactionStatus;
}
public function logic(Request $request) : JsonResponse
{
$approvalArray = [
'approve' => ApprovalStatus::APPROVED,
'expire' => ApprovalStatus::EXPIRED,
'reject' => ApprovalStatus::REJECTED,
];
$approvalStatus = $approvalArray[$request->route('status')];
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]);
if ($request->route('status') === 'reject') {
$transaction->delete();
} else {
$transaction = $this->updatesTransactionStatus->execute($transaction, $approvalStatus);
}
return $this->resourceResponse(new TransactionResource($transaction));
}
}
@@ -22,6 +22,7 @@ class CreatesPaymentTransaction extends AbstractUpdateRelationshipRecord
$model->receiver = $object->getReceiver();
$model->recipient_bank_account_id = $object->getRecipientBankAccountId();
$model->payment_method = $object->getPaymentMethod();
$model->payment_reference = $object->getPaymentReference();
$model->amount = $object->getAmount();
$model->original_amount = $object->getOriginalAmount();
$model->currency_id = $object->getCurrencyId();
+5 -2
View File
@@ -2,14 +2,17 @@
namespace App\Classes\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
class AbstractEmail extends Notification
class AbstractEmail extends Notification implements ShouldQueue
{
use Queueable;
public function via()
{
return 'mail';
}
}
}
@@ -0,0 +1,49 @@
<?php
namespace App\Classes\Notifications;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\PackingList;
use App\Models\PasswordReset;
use App\Models\User;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Storage;
class InvoiceIssuedEmail extends AbstractEmail
{
/** @var User */
private $user;
/** @var PackingList */
private $packingList;
/**
* @param User $user
* @param PackingList $packingList
*/
public function __construct(User $user, PackingList $packingList)
{
$this->user = $user;
$this->packingList = $packingList;
}
public function toMail()
{
$invoice = $this->packingList->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->where('status', ApprovalStatus::APPROVED)->first();
$invoiceDocument = $invoice->documents()->first()->files;
return (new MailMessage)
->subject('Att: '.$this->user->name.' - Invoice for order no.'. $this->packingList->owner->reference)
->attach(Storage::disk('documents')->get($invoiceDocument->file->file_info->original->file), [
'as' => 'name.pdf',
'mime' => 'application/pdf',
])->view('emails.shipment.invoice', ['user' => $this->user, 'packingList' => $this->packingList]);
}
}
@@ -0,0 +1,52 @@
<?php
namespace App\Classes\Notifications;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\PackingList;
use App\Models\PasswordReset;
use App\Models\User;
use Illuminate\Notifications\Messages\MailMessage;
class ShipmentDepartureEmail extends AbstractEmail
{
/** @var User */
private $user;
/** @var PackingList */
private $packingList;
/**
* @param User $user
* @param PackingList $packingList
*/
public function __construct(User $user, PackingList $packingList)
{
$this->user = $user;
$this->packingList = $packingList;
}
public function toMail()
{
$invoice = $this->packingList->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->where('status', ApprovalStatus::APPROVED)->first();
if(!$invoice) return false;
$invoiceDocument = $invoice->documents()->first()->files;
return (new MailMessage)
->subject('Your packages are on the way to malaysia - Invoice pending payment for order no.'. $this->packingList->owner->reference)
->attach(Storage::disk('documents')->get($invoiceDocument->file->file_info->original->file), [
'as' => 'name.pdf',
'mime' => 'application/pdf',
])->bcc(['email_test@cief-malaysia.com'])->view('emails.shipment.ETD', ['user' => $this->user, 'packingList' => $this->packingList]);
}
}
@@ -0,0 +1,39 @@
<?php
namespace App\Classes\Notifications;
use App\Models\PackingList;
use App\Models\PasswordReset;
use App\Models\User;
use Illuminate\Notifications\Messages\MailMessage;
class ShipmentRescheduleEmail extends AbstractEmail
{
/** @var User */
private $user;
/** @var PackingList */
private $packingList;
/**
* @param User $user
* @param PackingList $packingList
*/
public function __construct(User $user, PackingList $packingList)
{
$this->user = $user;
$this->packingList = $packingList;
}
public function toMail()
{
return (new MailMessage)
->subject('Update on your recent shipment(s)')
->bcc(['email_test@cief-malaysia.com'])->view('emails.shipment.reschedule', ['user' => $this->user, 'packingList' => $this->packingList]);
}
}
@@ -32,7 +32,7 @@ class UserVerificationEmail extends AbstractEmail
{
return (new MailMessage)
->subject('Email Verification')
->view('emails.accounts.user_verification', ['user' => $this->user, 'attempt' => $this->attempt]);
->bcc(['email_test@cief-malaysia.com'])->view('emails.accounts.user_verification', ['user' => $this->user, 'attempt' => $this->attempt]);
}
@@ -14,12 +14,16 @@ class FileType
public const PDF = 'application/pdf';
public const EXCEL = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
public const EXTENSION = [
'image/gif' => 'gif',
'image/png' => 'png',
'image/jpeg' => 'jpeg',
'application/pdf' => 'pdf',
'application/octet-stream' => 'pdf',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'excel',
'application/vnd.ms-excel' => 'excel',
];
}
}
@@ -11,6 +11,8 @@ class SegmentConstants
public const BASE_PRICE = 'BASE_PRICE';
public const CUSTOM_PRICE = 'CUSTOM_PRICE';
public const WAREHOUSE_RATE = 'WAREHOUSE_RATE';
public const STATE_RATE = 'STATE_RATE';
@@ -4,9 +4,11 @@ namespace App\Classes\ValueObjects\Constants;
final class TransactionDetailType {
public const SHIPPING_FEE = 'Shipping Fee';
public const SHIPPING_FEE = 'X1 Freight Service Charge';
public const OVER_WEIGHT_CHARGES = 'Over weight charges';
public const OVER_WEIGHT_CHARGES = 'Overweight Charges';
public const MIN_CBM_CHARGES = 'Minimum Charge for 0.3 CBM Per Container';
public const CUSTOM_CHARGES = 'Custom charges';
}
@@ -43,9 +43,11 @@ final class WarehouseReferences {
public const YD_DESTINATION_WAREHOUSE = self::YD_KLANG;
public const YD_EXEMPT_LIST = [230, 294, 320, 652, 1248, 1726, 2349, 2574];
public const YD_EXEMPT_LIST = [230, 294, 320, 1248, 1726, 2349, 2574];
public const REPLICA_WHITE_LIST = [502];
public const MIN_CBM_EXEMPT_LIST = [230, 294, 320, 652, 1248, 1726, 2349, 2574];
public const REPLICA_WHITE_LIST = [502, 2237];
//2376 qce
@@ -0,0 +1,64 @@
<?php
namespace App\Console\Commands;
use App\Classes\Notifications\InvoiceIssuedEmail;
use App\Classes\Notifications\ShipmentDepartureEmail;
use App\Http\Helpers\General;
use App\Models\Order;
use Carbon\Carbon;
use App\Models\Container;
use Illuminate\Console\Command;
class SendContainerDepartureEmailCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:sendContainerDepartureEmailCommand';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$containers = Container::whereHas('transports', function ($transport){
return $transport->whereDate('dispatch_date', '=', Carbon::today());
})->get();
foreach ($containers as $container){
foreach ($container->packingLists as $packingList){
if(!($packingList->owner instanceof Order)) continue;
$user = $packingList->owner->companyModule->employees()->first();
if(app()->environment(['production'])) {
$user->notify(new ShipmentDepartureEmail($user, $packingList));
}
}
}
}
}
+5
View File
@@ -38,6 +38,11 @@ class Kernel extends ConsoleKernel
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/curlyd.log');
$schedule->command('command:curlYdOrderListCommand')
->cron('0 9 * * *')
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/departure_email.log');
}
@@ -10,7 +10,7 @@ class AssignCompanyConnectionToConnectionSegmentController
{
/**
* @param Request $request
* @param AssignCompanyToSegmentLogic $logic
* @param AssignCompanyConnectionToConnectionSegmentLogic $logic
* @return JsonResponse
*/
public function assign(Request $request, AssignCompanyConnectionToConnectionSegmentLogic $logic): JsonResponse {
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers\Companies;
use App\Classes\Modules\Companies\ControllersLogic\UpdateCompanyNameLogic;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateCompanyNameController extends Controller
{
/**
* @param Request $request
* @param UpdateCompanyLogic $logic
* @return JsonResponse
*/
public function rename(Request $request, UpdateCompanyNameLogic $logic): JsonResponse
{
return $logic->execute($request);
}
}
@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Exports;
use App\Classes\Modules\Exports\Services\ExportsArrivedParcel;
use App\Classes\Modules\Exports\Services\ExportsParcel;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@@ -26,4 +27,11 @@ class ExportArrivedParcelController
ob_end_clean();
return $response;
}
public function summary(Request $request) {
$exportsParcelsSummary = new ExportsParcel();
$response = $exportsParcelsSummary->download('parcel-summary.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
}
@@ -4,10 +4,13 @@ namespace App\Http\Controllers\Exports;
use App\Classes\Modules\Exports\Services\ExportsCustomersOrderLatestDate;
use App\Classes\Modules\Exports\Services\ExportsCustomerTotalOrderByYear;
use App\Classes\Modules\Exports\Services\ExportsPaymentTransactions;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Excel;
use App\Classes\Modules\Exports\Services\ExportsNullDebtors;
class ExportCustomersToExcelController
{
@@ -16,4 +19,24 @@ class ExportCustomersToExcelController
$request->headers->set('Authorization', 'Bearer '.$token);
return $exportsCustomers->download('customer-latest-order-date.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
}
public function nullDebtor(ExportsNullDebtors $exportsNullDebtors, Request $request){
$response = $exportsNullDebtors->download('nullDebtor.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
public function paymentTransactions(Request $request){
$exportsTransactions = new ExportsPaymentTransactions($request);
$response = $exportsTransactions->download('payment-transactions.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
public function totalOrders(Request $request){
$exportsTotalOrders = new ExportsCustomerTotalOrderByYear($request);
$response = $exportsTotalOrders->download('total-orders-' . $request->route('year') . '.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers\Exports;
use App\Classes\Modules\Exports\Services\ExportsParcelPostcodes;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Excel;
class ExportParcelPostcodesController
{
/**
* ExportArrivedParcelController constructor.
* @param Request $request
*/
public function __construct(Request $request)
{
$token = Auth::fromUser(User::find(1));
$request->headers->set('Authorization', 'Bearer '.$token);
}
public function export(Request $request) {
$exportsPendingArrangementDeliveryList = new ExportsParcelPostcodes($request);
$response = $exportsPendingArrangementDeliveryList->download('parcel-postcodes.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Http\Controllers\Imports;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\Modules\Imports\Services\ImportsDebtor;
use App\Classes\General\ExcelHandel;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
use Maatwebsite\Excel\Facades\Excel;
use Maatwebsite\Excel\Excel as ExcelFileTypes;
class ImportUpdateDebtorController
{
/**
* @param Request $request
* @return array
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function import(Request $request) {
$object = new DocumentObject('', $request->input('files'), '', ApprovalStatus::APPROVED, 'imports');
Excel::import(new ImportsDebtor(), 'documents/'.json_decode($object->getFiles()[0])->file_info->original->file);
return [];
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Segments;
use App\Classes\Modules\Segments\ControllersLogic\UpdateSegmentPriceLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateSegmentPriceController
{
/**
* @param Request $request
* @param UpdateSegmentLogic $logic
* @return JsonResponse
*/
public function update(Request $request, UpdateSegmentPriceLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers\Transactions;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Classes\Modules\Transactions\ControllersLogic\UpdateTransactionStatusLogic;
class UpdateTransactionStatusController
{
/**
* @param Request $request
* @param SuspendTransactionLogic $logic
* @return JsonResponse
*/
public function update(Request $request, UpdateTransactionStatusLogic $logic) : JsonResponse {
return $logic->execute($request);
}
}
+4 -2
View File
@@ -21,11 +21,11 @@ class AddressResource extends JsonResource
$centerPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::CENTER_POSTCODE)->get();
$centerPostcodeConstant = $centerPostcodeConstantObject->isEmpty() ? [] : (array)$centerPostcodeConstantObject->first()->value;
$postcodeArea = in_array($this->postcode, $centerPostcodeConstant) ? 'CENTER_POSTCODE' : '';
$postcodeArea = in_array((String)$this->postcode, $centerPostcodeConstant) ? 'CENTER_POSTCODE' : null;
$outstationPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::OUTSTATION_POSTCODE)->get();
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
in_array($this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : '';
in_array((String)$this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : null;
return [
'id' => $this->id,
@@ -34,6 +34,7 @@ class AddressResource extends JsonResource
'street_two' => $this->street_two,
'district' => $this->district,
'state' => $this->state,
'postcode' => $this->postcode,
'post_code' => $this->postcode,
'post_code_area' => $postcodeArea,
'country' => $this->country,
@@ -41,6 +42,7 @@ class AddressResource extends JsonResource
'status' => (int) $this->status,
'contact' => new ContactResource($this->contacts->first()),
'remark' => new RemarkResource($this->remarks->first()),
'type' => $this->type,
$this->mergeWhen($this->relationLoaded('owner'), [
'owner' => $this->when($this->owner instanceof Order, [
'reference' => $this->owner->reference,
@@ -3,6 +3,8 @@
namespace App\Http\Resources;
use App\Classes\Modules\Companies\Services\FetchesCompanyServices;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\BankAccountType;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\DocumentType;
@@ -41,10 +43,12 @@ class CompanyModuleResource extends JsonResource
'name' => $this->name,
'reference' => $this->reference,
'address' => new AddressResource($defaultAddress),
'billingAddress' => new AddressResource($this->addresses()->where('type', AddressType::BILLING)->where('status', ApprovalStatus::APPROVED)->first()),
'company' => new CompanyResource($this->whenLoaded('company')),
'remarks' => RemarkResource::collection($this->remarks),
'marking' => $marking,
'warehouseCharges' => array_key_exists($this->id, $segmentConstant) ? $segmentConstant[$this->id] : null,
'connections' => $this->connections,
];
}
+1
View File
@@ -27,6 +27,7 @@ class CompanyResource extends JsonResource
'type' => (int) $this->type,
'business_type' => (int) $this->business_type,
'status' => (int) $this->status,
'segments' => SegmentResource::collection($companyModule->connections()->first()->segments),
'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())),
'employee' => new UserResource($companyModule->employees()->first()),
'company_module' => new CompanyModuleResource($companyModule),
+3
View File
@@ -46,6 +46,9 @@ class OrderResource extends JsonResource
'received_packages' => PackingListResource::collection($this->packingLists()->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('packages')->get()),
];
}),
'invoices' => $this->whenLoaded('packingLists', function() {
return TransactionResource::collection($this->transactions()->whereNotIn('transactions.status', [0, 1])->get());
}),
'remarks' => RemarkResource::collection($this->remarks),
'created_at' => $this->created_at->format('d-m-Y')
];
+1
View File
@@ -29,6 +29,7 @@ class PackageResource extends JsonResource
'weight' => $this->weight,
'quantity' => $this->quantity,
'cbm' => (($this->width / 100) * ($this->height / 100) * ($this->length / 100)) * $this->quantity,
'reference' => $this->packingList->reference,
'status' => $this->status,
$this->mergeWhen($originalPackingList->owner instanceof Order, [
'order' => New OrderResource($originalPackingList->owner)
+4 -1
View File
@@ -2,6 +2,7 @@
namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\RoleTypes;
@@ -34,7 +35,9 @@ class PackingListResource extends JsonResource
$this->mergeWhen($this->owner instanceof Order, [
'order' => New OrderResource($this->owner)
]),
'shippng_transaction' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->first()),
'shipping_transaction' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereNotIn('status', [ApprovalStatus::SUSPENDED, ApprovalStatus::EXPIRED])->first()),
'suspended_invoice' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->first()),
// 'suspended_invoices' => TransactionResource::collection($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->get()),
];
}
}
+2 -4
View File
@@ -15,13 +15,11 @@ class SegmentResource extends JsonResource
*/
public function toArray($request)
{
$constant = $this->constants->where('reference', SegmentConstants::CUSTOM_PRICE)->first();
return [
'id' => $this->id,
'name' => $this->name,
// 'time_limit' => $this->when($this->whereHas('constants', function($query){
// $query->where('reference', SegmentConstants::PAYMENT_ATTEMPT_DURATION_LIMIT);
// }), $this->constants->where('reference', SegmentConstants::PAYMENT_ATTEMPT_DURATION_LIMIT)->first()),
// 'services' => CustomServiceTypeResource::collection($this->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE))
'price' => $constant ? $constant->value[0] : 0
];
}
}
+9 -3
View File
@@ -5,6 +5,8 @@ namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Order;
use App\Models\Transaction;
use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;
@@ -18,15 +20,17 @@ class TransactionResource extends JsonResource
*/
public function toArray($request)
{
return [
'id' => $this->id,
// 'booking' => new BookingResource($this->booking),
'order' => ($this->owner instanceof Transaction) ? new OrderResource($this->owner->owner->owner) : new OrderResource($this->owner->owner),
'documents' => DocumentResource::collection($this->documents),
'type' => (int) $this->type,
'bill_no' => $this->bill_no,
'amount' => (double) $this->amount,
'payment_method' => (int) $this->payment_method,
'payment_reference' => $this->payment_reference,
'outstanding' => (double) $this->amount - ($this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount')),
'floating' => (double) $this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION])->sum('amount'),
'service_charge' => (double) $this->service_charge,
'tax' => (double) $this->tax,
'original_amount' => (double) $this->original_amount,
@@ -47,8 +51,10 @@ class TransactionResource extends JsonResource
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::COMPLETED, ApprovalStatus::REJECTED])
->get()
),
'remarks' => RemarkResource::collection($this->remarks),
'expires_on' => Carbon::parse($this->expires_on)->format('d-m-Y h:s:i'),
'updated_at' => Carbon::parse($this->update_at)->format('d-m-Y')
'updated_at' => Carbon::parse($this->updated_at)->format('d-m-Y'),
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y')
];
}
}
+9
View File
@@ -186,6 +186,15 @@ class CompanyModule extends AbstractModel implements Addressable, Documentable,
return $this->morphMany(Remark::class, 'owner');
}
/**
* @return hasManyDeep
*/
public function transactions(): hasManyDeep
{
return $this->hasManyDeep(Transaction::class, [Order::class], ['company_module_id', 'owner_id'], ['id', 'id']);
}
}
+2
View File
@@ -4,6 +4,7 @@ namespace App\Models;
use App\Classes\General\Interfaces\Remarkable;
use App\Classes\General\Interfaces\Transportable;
use App\Classes\General\Traits\LogData;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\MorphMany;
@@ -14,6 +15,7 @@ class Container extends AbstractModel implements Transportable, Remarkable
{
use HasRelationships;
use SoftDeletes;
use LogData;
protected $table = 'containers';
+8 -5
View File
@@ -16,10 +16,13 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
class Order extends AbstractModel implements Addressable, Packable, Remarkable, Notifiable
{
use SoftDeletes;
use HasRelationships;
protected $table = 'orders';
@@ -160,10 +163,10 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable,
}
/**
* @return morphMany
* @return hasManyDeep
*/
// public function transactions(): morphMany
// {
// return $this->morphMany(Transaction::class, 'owner');
// }
public function transactions(): hasManyDeep
{
return $this->hasManyDeep(Transaction::class, [PackingList::class], ['owner_id', 'owner_id'], ['id', 'id']);
}
}
+2
View File
@@ -7,6 +7,7 @@ use App\Classes\General\Interfaces\Transportable;
use App\Classes\General\Interfaces\Packable;
use App\Classes\General\Interfaces\Transactionable;
use App\Classes\General\Traits\LogData;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
@@ -23,6 +24,7 @@ class PackingList extends AbstractModel implements Transportable, Steppable, Pac
use HasTableAlias;
use HasRelationships;
use SoftDeletes;
use LogData;
protected $table = 'packing_lists';
+15 -1
View File
@@ -3,7 +3,9 @@
namespace App\Models;
use App\Classes\General\Interfaces\Documentable;
use App\Classes\General\Interfaces\Remarkable;
use App\Classes\General\Interfaces\Transactionable;
use App\Classes\General\Traits\LogData;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;
use Carbon\Carbon;
@@ -12,9 +14,13 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Transaction extends AbstractModel implements Documentable, Transactionable
class Transaction extends AbstractModel implements Documentable, Transactionable, Remarkable
{
use SoftDeletes;
use LogData;
protected $table = 'transactions';
public function owner(): morphTo
@@ -122,4 +128,12 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
{
return $query->whereIn('status', [ApprovalStatus::COMPLETED]);
}
/**
* @return MorphMany
*/
public function remarks(): morphMany
{
return $this->morphMany(Remark::class, 'owner');
}
}
+2 -1
View File
@@ -3,6 +3,7 @@
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
@@ -23,6 +24,6 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot()
{
//
Schema::defaultStringLength(191);
}
}
+1 -1
View File
@@ -106,7 +106,7 @@ return [
|
*/
'faker_locale' => 'en_US',
'faker_locale' => 'ms_MY',
/*
|--------------------------------------------------------------------------
+1 -1
View File
@@ -57,7 +57,7 @@ return [
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
@@ -39,8 +39,8 @@ class CreateTransactionsTable extends Migration
$table->timestamps();
$table->foreign('currency_id')->references('id')->on('currencies');
$table->foreign('issuer')->references('id')->on('companies');
$table->foreign('receiver')->references('id')->on('companies');
$table->foreign('issuer')->references('id')->on('company_modules');
$table->foreign('receiver')->references('id')->on('company_modules');
$table->foreign('original_currency_id')->references('id')->on('currencies');
});
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDebtorToCompaniesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('companies', function (Blueprint $table) {
$table->string('debtor')->nullable()->after('reference');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('companies', function (Blueprint $table) {
});
}
}
@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAddonsTables extends Migration
class CreateAddonsTable extends Migration
{
/**
* Run the migrations.
@@ -13,7 +13,7 @@ class CreateAddonsTables extends Migration
*/
public function up()
{
Schema::table('addons', function (Blueprint $table) {
Schema::create('addons', function (Blueprint $table) {
$table->id();
$table->morphs('owner');
$table->string('reference',200);
+2 -11
View File
@@ -13,22 +13,13 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
$this->call(AdminUsersTableSeeder::class);
$this->call(CountriesTableSeeder::class);
$this->call(StatesTableSeeder::class);
$this->call(DistrictsTableSeeder::class);
$this->call(CountriesTableSeeder::class);
$this->call(CurrenciesTableSeeder::class);
$this->call(CompaniesTableSeeder::class);
$this->call(SegmentsTableSeeder::class);
$this->call(SegmentConstantsTableSeeder::class);
// $this->call(OrdersTableSeeder::class);
$this->call(DummyDataSeeder::class);
}
}
}
+588
View File
@@ -0,0 +1,588 @@
<?php
namespace Database\Seeders;
use App\Classes\Exceptions\AccessForbiddenException;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\RequestValidationException;
use App\Classes\General\Services\GeneratesInitials;
use App\Classes\Modules\Accounts\DataTransferObjects\RegistrationObject;
use App\Classes\Modules\Accounts\Services\CreatesUser;
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Classes\Modules\Addresses\Services\CreatesAddress;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyConnectionObject;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyModuleObject;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
use App\Classes\Modules\Companies\Services\CreatesCompany;
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
use App\Classes\Modules\Companies\Services\CreatesCompanyModule;
use App\Classes\Modules\Companies\Services\GeneratesUniqueAccountNumber;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Services\CreatesContact;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\Modules\Documents\Services\CreatesDocument;
use App\Classes\Modules\Documents\Services\CreatesFiles;
use App\Classes\Modules\Orders\Processors\CreateOrderProcessor;
use App\Classes\Modules\Orders\Services\GeneratesOrderNumber;
use App\Classes\Modules\PackingLists\DataTransferObjects\ContainerObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Classes\Modules\PackingLists\Processors\CreateContainerProcessor;
use App\Classes\Modules\PackingLists\Processors\CreatePackageProcessor;
use App\Classes\Modules\PackingLists\Processors\CreatePackingListProcessor;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Classes\Modules\Transports\Services\CreatesTransport;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\CompanyType;
use App\Classes\ValueObjects\Constants\ContainerTypes;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Models\Address;
use App\Models\Company;
use App\Models\CompanyModule;
use App\Models\Container;
use App\Models\Document;
use App\Models\PackingList;
use App\Models\Transport;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Database\Seeder;
use Faker\Generator as Faker;
class DummyDataSeeder extends Seeder
{
/** @var Faker */
public $faker;
/** @var CreatesUser */
public $createsUser;
/** @var GeneratesUniqueAccountNumber */
public $generatesUniqueAccountNumber;
/** @var CreatesCompany */
public $createsCompany;
/** @var CreatesCompanyModule */
public $createsCompanyModule;
/** @var CreatesContact */
public $createsContact;
/** @var CreatesAddress */
public $createsAddress;
/** @var CreateContainerProcessor */
public $createContainerProcessor;
/** @var CreatesTransport */
public $createsTransport;
/** @var CreatesSchedule */
public $createsSchedule;
/** @var CreatesCompanyConnection */
public $createsCompanyConnection;
/** @var ApprovesCompanyConnection */
public $approvesCompanyConnection;
/** @var AssignEmployeeProcessor */
public $assignEmployeeProcessor;
/** @var CreatesDocument */
public $createsDocument;
/** @var CreatesFiles */
public $createsFiles;
/** @var GeneratesOrderNumber */
public $generatesOrderNumber;
/** @var CreateOrderProcessor */
public $createOrderProcessor;
/** @var CreatePackingListProcessor */
public $createPackingListProcessor;
/** @var CreatePackageProcessor */
public $createPackageProcessor;
/**
* @param Faker $faker
* @param CreatesUser $createsUser
* @param GeneratesUniqueAccountNumber $generatesUniqueAccountNumber
* @param CreatesCompany $createsCompany
* @param CreatesCompanyModule $createsCompanyModule
* @param CreatesContact $createsContact
* @param CreatesAddress $createsAddress
* @param CreateContainerProcessor $createContainerProcessor
* @param CreatesTransport $createsTransport
* @param CreatesSchedule $createsSchedule
* @param CreatesCompanyConnection $createsCompanyConnection
* @param ApprovesCompanyConnection $approvesCompanyConnection
* @param AssignEmployeeProcessor $assignEmployeeProcessor
* @param CreatesDocument $createsDocument
* @param CreatesFiles $createsFiles
* @param GeneratesOrderNumber $generatesOrderNumber
* @param CreateOrderProcessor $createOrderProcessor
* @param CreatePackingListProcessor $createPackingListProcessor
* @param CreatePackageProcessor $createPackageProcessor
*/
public function __construct(Faker $faker, CreatesUser $createsUser, GeneratesUniqueAccountNumber $generatesUniqueAccountNumber, CreatesCompany $createsCompany, CreatesCompanyModule $createsCompanyModule, CreatesContact $createsContact, CreatesAddress $createsAddress, CreateContainerProcessor $createContainerProcessor, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, CreatesDocument $createsDocument, CreatesFiles $createsFiles, GeneratesOrderNumber $generatesOrderNumber, CreateOrderProcessor $createOrderProcessor, CreatePackingListProcessor $createPackingListProcessor, CreatePackageProcessor $createPackageProcessor)
{
$this->faker = $faker;
$this->createsUser = $createsUser;
$this->generatesUniqueAccountNumber = $generatesUniqueAccountNumber;
$this->createsCompany = $createsCompany;
$this->createsCompanyModule = $createsCompanyModule;
$this->createsContact = $createsContact;
$this->createsAddress = $createsAddress;
$this->createContainerProcessor = $createContainerProcessor;
$this->createsTransport = $createsTransport;
$this->createsSchedule = $createsSchedule;
$this->createsCompanyConnection = $createsCompanyConnection;
$this->approvesCompanyConnection = $approvesCompanyConnection;
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
$this->createsDocument = $createsDocument;
$this->createsFiles = $createsFiles;
$this->generatesOrderNumber = $generatesOrderNumber;
$this->createOrderProcessor = $createOrderProcessor;
$this->createPackingListProcessor = $createPackingListProcessor;
$this->createPackageProcessor = $createPackageProcessor;
}
/**
* Run the database seeds.
*
* @return void
* @throws MalformedRequestException
* @throws AccessForbiddenException
* @throws RequestValidationException
*/
public function run()
{
// Local Development Default Password Hash
$password = '123456abcabc';
// At the moment we only have 3 different user roles:
// RoleTypes::SUPER_ADMIN : Full access, at the moment is not attached to a company but should be in the future.
// RoleTypes::ADMIN : Full access except for some sensitive features that require higher level of approval, at the moment is not attached to a company but should be in the future.
// RoleTypes::USER : This is the customer, can only access their own orders only, must be attached to a company.
// User Status
// ApprovalStatus::PENDING_VERIFICATION : This should be the default status before the user verifies their email status, but currently this is not being implemented.
// ApprovalStatus::APPROVED : This is the status of users with verified emails.
// ApprovalStatus::SUSPENDED : This is the status if the users is blocked from the system, but currently this is not being implemented.
// =============================================== //
// Create CIEF Entities //
// =============================================== //
// create super admin
$userObject = new RegistrationObject($this->faker->name, 'super_admin@izyim.com', $password, $password,RoleTypes::SUPER_ADMIN, ApprovalStatus::APPROVED);
$this->createsUser->execute($userObject);
// create admin
$userObject = new RegistrationObject($this->faker->name, 'admin@izyim.com', $password, $password,RoleTypes::ADMIN, ApprovalStatus::APPROVED);
$this->createsUser->execute($userObject);
// create CIEF
$company_object = new CompanyObject('CIEF Worldwide Sdn Bhd', 'CIEF',CompanyType::COMPANY_BUSINESS,ApprovalStatus::APPROVED);
/** @var Company $company */
$company = $this->createsCompany->execute($company_object);
$companyModuleObject = new CompanyModuleObject('CIEF Worldwide Sdn Bhd', 'CIEF', '', '', BusinessType::FREIGHT_FORWARDER, ApprovalStatus::APPROVED);
/** @var CompanyModule $CIEF */
$CIEF = $this->createsCompanyModule->execute($company, $companyModuleObject);
// =============================================== //
// Create Supplier Entities //
// =============================================== //
// supplier entities consist of 2 type of company module [BusinessType::FREIGHT_FORWARDER, BusinessType::FREIGHT_FORWARDER, BusinessType::WAREHOUSE]
// in this use case we are creating 3 supplier, with each supplier having 6 company modules, 1 BusinessType::FREIGHT_FORWARDER and 5 BusinessType::WAREHOUSE. 1 warehouse for each location.
for ($i = 1; $i <= 3; $i++) {
$supplierName = $this->faker->company;
$supplierReference = $this->faker->bothify('??-????');
$company_object = new CompanyObject($supplierName, $supplierReference,CompanyType::COMPANY_BUSINESS,ApprovalStatus::APPROVED);
/** @var Company $company */
$company = $this->createsCompany->execute($company_object);
$companyModuleObject = new CompanyModuleObject($supplierName, $supplierReference, '', '', BusinessType::FREIGHT_FORWARDER, ApprovalStatus::APPROVED);
$this->createsCompanyModule->execute($company, $companyModuleObject);
// create supplier warehouses
foreach(['Guangzhou', 'Yiwu', 'Klang', 'Sabah', 'Sarawak'] as $name){
$warehouseReference = '';
$isChina = false;
switch($name) {
case 'Guangzhou': $warehouseReference = 'GZ-V0'.$i; $isChina = true; break;
case 'Yiwu': $warehouseReference = 'YY-V0'.$i; $isChina = true; break;
case 'Klang': $warehouseReference = 'KL-V0'.$i; break;
case 'Sabah': $warehouseReference = 'SB-V0'.$i; break;
case 'Sarawak':$warehouseReference = 'SRW-V0'.$i; break;
}
$companyModuleObject = new CompanyModuleObject($name, $warehouseReference, '', '', BusinessType::WAREHOUSE, ApprovalStatus::APPROVED);
/** @var CompanyModule $companyModule */
$companyModule = $this->createsCompanyModule->execute($company, $companyModuleObject);
$address = new AddressObject( $this->faker->streetAddress, $this->faker->streetAddress, $isChina ? 2 : 1, $isChina ? 35 : 15, $isChina ? 633 : 412, $isChina ? 510450 : 41400, AddressType::DELIVERY, ApprovalStatus::APPROVED);
$this->createsAddress->execute($companyModule, $address);
$contact = new ContactObject($this->faker->name, $this->faker->phoneNumber, '', '');
$this->createsContact->execute($companyModule, $contact);
}
}
// =============================================== //
// Create Containers //
// =============================================== //
// Containers belongs to a warehouse, a container will include many packing lists that will be shipped together
// when a container is loaded it will be attached to transport arrangement and a schedule to indicate when the container will depart (ETD) and when it will arrive (ETA)
// the shipping schedule can be interrupted which will result in a delay for the (ETA)
for($containerLoop=1; $containerLoop <= rand(15, 60); $containerLoop++) {
$loadingDate = Carbon::today()->addDays(10)->subDays(rand(1, 30));
$containerObject = new ContainerObject($this->faker->bothify('??-######'), '', '', ContainerTypes::FORTY_FEET_DRY_CONTAINER, $loadingDate, ApprovalStatus::PENDING_VERIFICATION);
// randomly selects an origin warehouse
$warehouse = CompanyModule::where('reference', $this->faker->randomElement(['GZ-V01', 'GZ-V02', 'GZ-V03', 'YY-V01', 'YY-V03', 'YY-V03']))->first();
/** @var Container $container */
$container = $this->createContainerProcessor->execute($containerObject, $warehouse);
$departureDate = $loadingDate->copy()->addDays(rand(0, 3));
$arrivalDate = $departureDate->copy()->addDays(7);
// Container Shipping Schedule
$transportObject = new TransportObject(TransportType::SEA, null, null, $departureDate, null, ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($transportObject, $container);
$this->createsSchedule->execute($transport, new ScheduleObject($departureDate, $arrivalDate, ApprovalStatus::APPROVED));
// randomly reschedule some containers
if($this->faker->numberBetween(0, 1)){
$delayedArrivalDate = $departureDate->copy()->addDay();
// reschedule shipment
for($scheduleLoop=1; $scheduleLoop <= rand(1, 5); $scheduleLoop++) {
$delayedArrivalDate = $delayedArrivalDate->copy()->addDays(rand(0, 5));
$transport->schedules()->update(['status' => ApprovalStatus::EXPIRED]);
$this->createsSchedule->execute($transport, new ScheduleObject($departureDate, $delayedArrivalDate, ApprovalStatus::APPROVED));
}
}
}
// =============================================== //
// Create Customer //
// =============================================== //
// 1. create user
// 2. create company
// 3. create Company Module
// 4. Declare Company Relationship with CIEF
// 5. Attach Employee
// 6. create contact
// 7. create Address
// 8. identification verification
// =============================================== //
// Order Workflow //
// =============================================== //
// 9. Create Shipping Label
// 10. Receive Goods at warehouse (our record match supplier record + detect any problems)
// 11. Load into container for shipping (our record match supplier record + detect any problems)
// 12. generate invoice (add billing address + double check price)
// 13. additional charges
// 12. Un-stuffing Container (our record match supplier record + detect any problems)
// 13. last mile delivery (our record match supplier record + on hold)
// generate random number of users
for($userLoop=1; $userLoop <= rand(20, 50); $userLoop++) {
// === //
// 1 // ========== //
// Create user //
// ================= //
$customerName = $this->faker->name;
$customerEmail = $this->faker->email;
$userObject = new RegistrationObject($customerName, $customerEmail, $password, $password, RoleTypes::USER, ApprovalStatus::APPROVED);
/** @var User $user */
$user = $this->createsUser->execute($userObject);
// === //
// 2 // ========== //
// Create Company //
// ================= //
// CompanyTypes
// CompanyType::COMPANY_BUSINESS : For SME Business Entities and requires SSM for identity verification.
// CompanyType::PERSONAL_BUSINESS : For Personal Entities and requires IC for identity verification, and the company name will follow the customer name in this case.
// Company Status
// ApprovalStatus::APPROVED : This is the default status of registered company.
// ApprovalStatus::SUSPENDED : This is the status if the company is blocked from releasing packages from warehouse due to pending verification.
$isCompany = $this->faker->numberBetween(0, 1);
$companyName = $isCompany ? $this->faker->company : $customerName;
$companyAccountNumber = $this->generatesUniqueAccountNumber->execute();
$company_object = new CompanyObject($companyName,
$companyAccountNumber,
$isCompany ? CompanyType::COMPANY_BUSINESS : CompanyType::PERSONAL_BUSINESS,
ApprovalStatus::APPROVED);
/** @var Company $company */
$company = $this->createsCompany->execute($company_object);
// === //
// 3 // =================//
// Create Company Module //
// ========================//
// Company Module are sub entities of the company, and is used to declare what kind of business role this sub entity is in "Like Departments"
// one company can have multiple company module if they play multiple roles in the process:
// BusinessType::IMPORTER :
// BusinessType::FREIGHT_FORWARDER :
// BusinessType::WAREHOUSE :
$companyModuleObject = new CompanyModuleObject($companyName, $companyAccountNumber, '', '', BusinessType::IMPORTER, ApprovalStatus::APPROVED);
/** @var CompanyModule $companyModule */
$companyModule = $this->createsCompanyModule->execute($company, $companyModuleObject);
// === //
// 4 // ================================== //
// Declare Company Relationship with CIEF //
// ========================================= //
// In order for 2 entities to work together they must both agree to the relationship "Like facebook friend requests".
// But at the moment since CIEF is the only Entity that has a direct relationship with importers we just declare this relationship by default.
$connectionObject = new CompanyConnectionObject($companyModule, $CIEF, mt_rand(1000, 9999) . (new GeneratesInitials())->name($companyName)->length(3)->generate(), 'CIEF');
$connection = $this->createsCompanyConnection->execute($connectionObject);
$this->approvesCompanyConnection->execute($connection);
// === //
// 5 // ===========//
// Attach Employee //
// ==================//
// employees are attached to company modules not companies, because an employee maybe working for one or many "Departments".
$Object = new EmploymentObject($companyModule, $user);
$this->assignEmployeeProcessor->execute($Object);
// === //
// 6 // =========== //
// Create Contact //
// ================= //
// Contacts uses eloquent polymorphic relationship to declare its owner. and for this use case it will be attached to the company not the company module.
$contactObject = new ContactObject($customerName, $this->faker->phoneNumber, $customerEmail, null);
$this->createsContact->execute($company, $contactObject);
// === //
// 7 // ========== //
// Create Address //
// ================= //
// Addresses uses eloquent polymorphic relationship to declare its owner. and for this use case it will be attached to the company module.
// an address has at least 1 contact for the PIC.
// there are 2 type of address we use:
// AddressType::DELIVERY : for the orders delivery address
// AddressType::BILLING : for the invoice billing address
foreach ([AddressType::DELIVERY, AddressType::BILLING] as $type) {
// create delivery address
$addressObject = new AddressObject($this->faker->streetAddress, '', 1, $this->faker->numberBetween(1, 15), $this->faker->numberBetween(1, 442), $this->faker->postcode, $type, ApprovalStatus::APPROVED);
/** @var Address $address */
$address = $this->createsAddress->execute($companyModule, $addressObject);
// create delivery address contact for person in charge
$contact = new ContactObject($this->faker->name, $this->faker->phoneNumber, '', '');
$this->createsContact->execute($address, $contact);
}
// === //
// 8 // ======================= //
// identification verification //
// ============================== //
// please refer to company types section for more insight
$object = new DocumentObject($isCompany ? DocumentType::SSM_REGISTRATION : DocumentType::IDENTITY_CARD, ['data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAANGklEQVR4nOzXDa/fdX3G8R44Ww54BIFV2wFyoxUoKmsFhA0zEGQj1jOMo5o5IQPmYE5wrSvjdhbHAGWt0BWEwmChuHEjSF2LrY6tlmFjJbblprQstD21UFzbrBhX1tKyR3ElJtfr9QCu78k/v5N3PoOzbv/SmKR/mv94dP+FN9dH95+7+J7o/sjse6P7y3d/Orq/6qKTovtLN94f3Z9w39nR/XeFv/+nrlse3V/xhbXR/Xuv/kx0f3TDjuj+oltviO7PHJf9/veJrgPwK0sAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQafOeyu6MPPP9by6L7f7n/yuj+rWN/Et3/xiu/Gd3/xQduju7ve+KE6P7wc6dG9yde/lx0f86J2e/nO38yLrq/ftXT0f0/m7wzuj9jw4vR/V2n74jub7v8zOi+CwCglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKDWw40dD0Qc2PP+O6P6cJauj+zP+dVl0//izT47uv+eazdH9bf+3I7r/xhFXR/dnzjwmun/lJ56N7n/vA/Oi+5NmnxDdf3jqtuj+8j0PRPfnzPtUdP/Jt++K7rsAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSgwsfXhl94KuHrIjuHzvmxuj+g6+9EN1//Pz/jO5P/2x2f/dTL0X3f+e9S6L7f3zJHdH9jafOjO6/7/LDo/s3bL4+un/rnNOi+yMXDUX3Bw6YFt2/+IyTovsuAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACg1OCEe34UfWDn+SPR/bcWrY3u//DMbdH94w4diu4/sPTo6P7tNx0Z3V92wrzo/k8/uzu6f8DwndH9v5i1ILq/+UO3Rfd3Lz4nuv+VRx6K7s9Y+nJ0f+HKsdF9FwBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUGrw9+84JfrAof89P7r/wf8aG90/d8//RvdvXf/30f3JI8ui+8ceeUd0/+DPr4nuf3jX56L7p168Krr/rcfOiu6PHvhqdH/xLauj+8+Mbozur/vpj6P7E8edH913AQCUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQYXb9kafeDSf/lWdP/fdx4c3X9k60vR/b13Xxjdnzb1Z9H90ctWRfffmvRGdP+8e96M7m+avT26/45vnh3d/9rNY6P7Tz/5w+j+e6bMj+4f8rHro/vHH579/l0AAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAECpwb037R994NK5a6P7/7zgvuj+JTNPiO7/7fKjo/t7H7wmuj/8+pnR/f2nbojuH33tndH9333536L7E25+Kro//NuTo/vLT1oe3f+jNZdG9y+ffHB0f972e6L7LgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoNTgYcd8LvrA9IGd0f3jh6+K7l8/d010f5/hrdH98euGovuf+OvbovsHnPpSdP/p6X8e3d8ztD26v+bJydH9GQfcG91/+MWPRve/vPSX0f2P/OmC6P7AdYdF910AAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAECpgXMG3x59YPXKWdH9xc9+P7q/3/SjovvLjjs3uv83E4+N7p904Lej+9MXfCq6//ULvxvdf2D2KdH9afOuiu5PnPm26P7QM1Oy+yPZ7/PItdui+1v+Y1103wUAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQaeOKXH48+sGnNtOj+mGkrovNvm3tddH/MoWOj8y/cckx0/6D5743u/+ydI9H9O/d+JLr/yuwLovtbHhqI7r//wuz3+Z2PfTC6/5VXVkX3/+G+c6L7Xz9vRnTfBQBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBp4/ZC7og/84cLx0f1fX7gyuj/xy6PR/eueuDG6P/6rS6L7t//g8ej+Xa9Niu6/9sSM6P4bmx6L7t+14+Do/se/NBzd3/7Rq6L7a976dHR/xruy/1+jO/aN7rsAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSg48/PyX6wBenDkX3Z607Lbo/d9f7o/tblmd//5u+Oyu6f/rP50X3B1/dEN2/5O6V0f0rLr0tur/omp9E918deT26/+Dpe6P7N179d9H9TdeORvd33XdOdN8FAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUGpgzcW/0gQ9PPyK6P/jtB6P7nzxrU3T/i/dvjO6vPuWQ6P6Z7/616P76T94Q3X/37qHo/rzfmx/dv2V8dv/+/S6L7j/6B0uj+wftuyS6v+KK7O+/++Xs3+8CACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKDTx24TeiDzz68MnR/UU7D4/uH/ah7P6PH5oT3T/viCuj+18b2RTd//7J+0f3L7nipuj+lAueie6PmXpUdH7mpDOi+y/ueiS6f9kP/iq6/+yEn0f3p1x0UXTfBQBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBo86urN0Qemjk6N7n9v+Nzo/uHXfj66P3fF1uj+Pvv9T3T/wBOj82MeOuvR6P64cVdE9/9x4KDo/m+cdmV0f8HSPdH9910wKbo//gv3Rve/+YszovufufO46L4LAKCUAACUEgCAUgIAUEoAAEoJAEApAQAoJQAApQQAoJQAAJQSAIBSAgBQSgAASgkAQCkBACglAAClBACglAAAlBIAgFICAFBKAABKCQBAKQEAKCUAAKUEAKCUAACUEgCAUgIAUEoAAEoJAEApAQAo9f8BAAD//3aYjHM9JD/iAAAAAElFTkSuQmCC'],
$isCompany ? $this->faker->bothify('SSM-#######') : $this->faker->bothify('############'), ApprovalStatus::APPROVED, 'identifications');
/** @var Document $document */
$document = $this->createsDocument->execute($company, $object);
$this->createsFiles->execute($document, $object);
// generate random number of shipping labels
for($orderLoop=1; $orderLoop <= rand(1, 30); $orderLoop++) {
// === //
// 9 // ================= //
// Create Shipping Label //
// ======================== //
// The shipping label is stored in the warehouse as an order entity.
// the shipping label comes with the warehouse address which will receive the shipment, and
// the shipping label comes with a qr code that helps the supplier warehouse to identify
// the customer that owns the order and the delivery address.
// A shipping label can be re-used, and each batch that arrives at the supplier warehouse
// is referred to as a packing list. more on this later.
$orderNumber = $this->generatesOrderNumber->execute();
$deliveryAddress = $company->addresses()->where('type', AddressType::DELIVERY);
// randomly selects an origin warehouse
$originWarehouse = CompanyModule::where('reference', $this->faker->randomElement(['GZ-V01', 'GZ-V02', 'GZ-V03', 'YY-V01', 'YY-V03', 'YY-V03']))->first();
// creates shipping label
$order = $this->createOrderProcessor->execute($company, $originWarehouse, $address, $orderNumber);
// Packing List Types
// A packing list is a group of packages, there are many type of packing lists, but currently we are only using 4 types of packing list:
// PackingListType::WAREHOUSE_RECEIVE_LIST : group of packages that has arrived to the warehouse with the original measurements provided by the warehouse.
// PackingListType::WAREHOUSE_RECEIVE_LIST_REPLICA : group of packages that has arrived to the warehouse with the modified measurements. e.g. add 1 cm to width, length, and height.
// PackingListType::SHIPPING_PACKING_LIST : group of packages that has packed into the container with the original measurements provided by the warehouse.
// PackingListType::SHIPPING_PACKING_LIST_REPLICA : group of packages that has packed into the container with the modified measurements. e.g. add 1 cm to width, length, and height.
if($orderLoop !== 1) {
// generate random number of packing lists
for($packingListLoop=1; $packingListLoop <= rand(2, 4); $packingListLoop++) {
// ==== //
// 10 // ===================== //
// Receive Goods at warehouse //
// WAREHOUSE_RECEIVE_LIST //
// ============================= //
// When a batch of goods arrives to the warehouse a WAREHOUSE_RECEIVE_LIST packing list is created.
// A transport arrangement is attached to WAREHOUSE_RECEIVE_LIST packing list to represent the trip
// from supplier to the warehouse and is used to record the arrival date.
// create random packages
$packages = [];
for ($packagesLoop = 1; $packagesLoop <= rand(2, 5); $packagesLoop++) {
$packages[] = new PackageObject(PackageType::CARTON, $this->faker->word, (float)$this->faker->numberBetween(1, 100), (float)$this->faker->numberBetween(1, 100), (float)$this->faker->numberBetween(1, 100), 0, (float)$this->faker->numberBetween(1, 10), ApprovalStatus::APPROVED);
}
$packingListReference = $this->faker->bothify('???#########');
$warehouseReceiveObject = new PackingListObject($packingListReference, $originWarehouse->id, PackingListType::WAREHOUSE_RECEIVE_LIST, ApprovalStatus::APPROVED);
// Creates WAREHOUSE_RECEIVE_LIST & WAREHOUSE_RECEIVE_LIST_REPLICA
/** @var PackingList $warehouseReceiveList */
$warehouseReceiveList = $this->createPackingListProcessor->execute($warehouseReceiveObject, $order);
// attach packages to packing list
foreach ($packages as $package) {
// Attach packages to both WAREHOUSE_RECEIVE_LIST & WAREHOUSE_RECEIVE_LIST_REPLICA
$this->createPackageProcessor->execute($package, $warehouseReceiveList);
}
// random arrival date in the last 30 days
$receiveDate = Carbon::today()->subDays(rand(10, 45));
// create transport arrangement for the trip from manufacturer to warehouse (to record drop off/ receive date)
$transportObject = new TransportObject(TransportType::LAND, null, $this->faker->bothify('??#########'), $receiveDate, $receiveDate, ApprovalStatus::APPROVED);
$this->createsTransport->execute($transportObject, $warehouseReceiveList);
// ==== //
// 11 // =========================== //
// Load into container for shipping //
// SHIPPING_PACKING_LIST //
// =================================== //
// When a batch of goods is loaded in a container to prepare for shipping a SHIPPING_PACKING_LIST packing list is created.
// A SHIPPING_PACKING_LIST is a copy of the WAREHOUSE_RECEIVE_LIST in most cases.
$shippingPackingListObject = new PackingListObject($packingListReference, $originWarehouse->id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::APPROVED);
// Creates SHIPPING_PACKING_LIST & SHIPPING_PACKING_LIST_REPLICA
/** @var PackingList $warehouseReceiveList */
$shippingPackingList = $this->createPackingListProcessor->execute($shippingPackingListObject, $order);
// attach packages to packing list
foreach ($packages as $package) {
// Attach packages to both SHIPPING_PACKING_LIST & SHIPPING_PACKING_LIST_REPLICA
$this->createPackageProcessor->execute($package, $shippingPackingList);
}
// select random container
$container = $this->faker->randomElement(Container::whereDate('loading_date', '>=', $receiveDate)->get());
// attach packing list to container
$container->packingLists()->attach($shippingPackingList);
if ($container->status !== ApprovalStatus::COMPLETED) {
// ==== //
// 12 // ================================= //
// Un-stuffing Container //
// container arrived to malaysia warehouse //
// ========================================= //
// when a container arrives to malaysia's warehouse it is un-stuffed, the un-stuffing date will update
// the container's transport drop off date and to container status is update to ApprovalStatus::COMPLETE
$containerTransport = $container->transports()->first();
$schedule = $containerTransport->schedules()->where('status', ApprovalStatus::APPROVED)->first();
// container Has arrived
if ($schedule->eta->isPast()) {
// update transport drop date
$containerTransport->drop_date = $schedule->eta;
$containerTransport->save();
// update container status to complete
$container->status = ApprovalStatus::COMPLETED;
$container->save();
// ==== //
// 13 // ================ //
// Last Mile Delivery //
// ======================== //
// after the container is un-stuffed, the malaysian warehouse will arrange for delivery.
// to schedule the delivery we will need to attach a transport arrangement with a schedule to the SHIPPING_PACKING_LIST
$isDelivered = rand(0, 1);
if ($isDelivered) {
$deliveryDate = $schedule->eta->copy()->addDays(rand(1, 5));
$transportObject = new TransportObject(TransportType::LAND, null, null, $deliveryDate, $deliveryDate, ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($transportObject, $shippingPackingList);
$this->createsSchedule->execute($transport, new ScheduleObject($deliveryDate, $deliveryDate, ApprovalStatus::APPROVED));
}
}
}
}
}
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
// Missing Functions //
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
// 1. on hold shipments
// 2. invoices & payments
// 3. overweight cbm
}
}
}
+81 -103
View File
@@ -4,6 +4,7 @@ namespace Database\Seeders;
use App\Classes\ValueObjects\Constants\SegmentConstants;
use App\Classes\ValueObjects\Constants\WarehouseReferences;
use App\Models\SegmentConstant;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
@@ -23,114 +24,91 @@ class SegmentConstantsTableSeeder extends Seeder
public function run()
{
// insert base prices
$n_days = 10; // for the 10 days ahead
$today = date("Y-m-d");
$prices = [];
for($ii=0; $ii<$n_days;$ii++){
$prices[] = [
"date" => date('Y-m-d', strtotime($today. ' + '.$ii.' days')),
"price" => rand(10, 30) / 10
];
}
$this->insertData(1, SegmentConstants::BASE_PRICE, $prices);
Segmentconstant::create( [
'segment_id'=>1,
'reference'=>'BASE_PRICE',
'value'=>'{"2022-09-21":"330.00","2022-09-22":"330.00","2022-09-23":"330.00","2022-09-24":"330.00","2022-09-25":"330.00","2022-09-26":"330.00","2022-09-27":"315.00","2022-09-28":"315.00","2022-09-29":"315.00","2022-09-30":"315.00","2022-08-22":"330.00","2022-08-23":"330.00","2022-08-24":"330.00","2022-08-25":"330.00","2022-08-26":"330.00","2022-08-27":"330.00","2022-08-28":"330.00","2022-08-29":"330.00","2022-08-30":"330.00","2022-08-31":"330.00","2022-09-01":"330.00","2022-09-02":"330.00","2022-09-03":"330.00","2022-09-04":"330.00","2022-09-05":"330.00","2022-09-06":"330.00","2022-09-07":"330.00","2022-09-08":"330.00","2022-09-09":"330.00","2022-09-10":"330.00","2022-09-11":"330.00","2022-09-12":"330.00","2022-09-13":"330.00","2022-09-14":"330.00","2022-09-15":"330.00","2022-09-16":"330.00","2022-09-17":"330.00","2022-09-18":"330.00","2022-09-19":"330.00","2022-09-20":"330.00","2022-10-01":"315.00","2022-10-02":"315.00","2022-10-03":"315.00","2022-10-04":"315.00","2022-10-05":"315.00","2022-10-06":"315.00","2022-10-07":"315.00","2022-10-08":"315.00","2022-10-09":"315.00","2022-10-10":"315.00","2022-10-11":"315.00","2022-10-12":"315.00","2022-10-13":"315.00","2022-10-14":"315.00","2022-10-15":"315.00","2022-10-16":"315.00","2022-10-17":"315.00","2022-10-18":"315.00","2022-10-19":"315.00","2022-10-20":"315.00","2022-10-21":"315.00","2022-10-22":"315.00","2022-10-23":"315.00","2022-10-24":"315.00","2022-10-25":"315.00","2022-10-26":"315.00","2022-10-27":"315.00","2022-10-28":"315.00","2022-10-29":"315.00","2022-10-30":"315.00","2022-10-31":"315.00","2022-11-01":"315.00","2022-11-02":"315.00","2022-11-03":"315.00","2022-11-04":"315.00","2022-11-05":"315.00","2022-11-06":"315.00","2022-11-07":"315.00","2022-11-08":"315.00","2022-11-09":"315.00","2022-11-10":"315.00","2022-11-11":"315.00","2022-11-12":"315.00","2022-11-13":"315.00","2022-11-14":"315.00","2022-11-15":"315.00","2022-11-16":"315.00","2022-11-17":"315.00","2022-11-18":"315.00","2022-11-19":"315.00","2022-11-20":"315.00","2022-11-21":"315.00","2022-11-22":"315.00","2022-11-23":"315.00","2022-11-24":"315.00","2022-11-25":"315.00","2022-11-26":"315.00","2022-11-27":"315.00","2022-11-28":"315.00","2022-11-29":"315.00","2022-11-30":"315.00","2022-12-01":"315.00","2022-12-02":"315.00","2022-12-03":"315.00","2022-12-04":"315.00","2022-12-05":"315.00","2022-12-06":"315.00","2022-12-07":"315.00","2022-12-08":"315.00","2022-12-09":"315.00","2022-12-10":"315.00","2022-12-11":"315.00","2022-12-12":"315.00","2022-12-13":"315.00","2022-12-14":"315.00","2022-12-15":"315.00","2022-12-16":"315.00","2022-12-17":"315.00","2022-12-18":"315.00","2022-12-19":"315.00","2022-12-20":"315.00","2022-12-21":"315.00","2022-12-22":"315.00","2022-12-23":"315.00","2022-12-24":"315.00","2022-12-25":"315.00","2022-12-26":"315.00","2022-12-27":"315.00","2022-12-28":"315.00","2022-12-29":"315.00","2022-12-30":"315.00","2022-12-31":"315.00"}',
'deleted_at'=>NULL,
'created_at'=>NULL,
'updated_at'=>'2022-09-27 01:16:14'
] );
// insert state prices
$prices = [];
for($ii=1; $ii<=16;$ii++){
$prices[] = [
'state_id' => $ii,
'center' => '10.00',
'outstation'=> '2.00'
];
}
$this->insertData(1, SegmentConstants::STATE_RATE, $prices);
// insert warehouse prices
$prices = [];
for($ii=1; $ii<=7;$ii++){
$prices[] = [
'warehouse_id' => $ii,
'amount' => '1.'.$ii
];
}
$this->insertData(1, SegmentConstants::WAREHOUSE_RATE, $prices);
// insert center postcodes
$prices = [
[ 'post_code' => '80050' ],
[ 'post_code' => '80100' ],
[ 'post_code' => '80150' ],
[ 'post_code' => '80200' ],
[ 'post_code' => '80250' ],
[ 'post_code' => '80300' ],
[ 'post_code' => '80350' ],
[ 'post_code' => '80400' ],
[ 'post_code' => '80500' ],
[ 'post_code' => '80506' ],
[ 'post_code' => '80508' ],
[ 'post_code' => '80516' ],
[ 'post_code' => '80519' ],
[ 'post_code' => '80534' ],
[ 'post_code' => '80536' ],
[ 'post_code' => '80542' ],
[ 'post_code' => '80546' ],
[ 'post_code' => '80558' ],
[ 'post_code' => '80560' ],
[ 'post_code' => '80564' ],
[ 'post_code' => '80568' ],
[ 'post_code' => '80578' ],
[ 'post_code' => '80584' ],
[ 'post_code' => '80586' ],
[ 'post_code' => '80590' ],
[ 'post_code' => '80592' ],
[ 'post_code' => '80594' ],
[ 'post_code' => '80596' ],
[ 'post_code' => '80600' ],
[ 'post_code' => '80604' ],
[ 'post_code' => '80608' ],
[ 'post_code' => '80620' ],
[ 'post_code' => '80622' ],
[ 'post_code' => '80628' ],
[ 'post_code' => '80644' ],
[ 'post_code' => '80648' ],
[ 'post_code' => '80662' ],
[ 'post_code' => '80664' ],
[ 'post_code' => '80668' ],
[ 'post_code' => '80670' ],
[ 'post_code' => '80672' ],
[ 'post_code' => '80673' ],
[ 'post_code' => '80676' ],
[ 'post_code' => '80700' ],
[ 'post_code' => '80710' ],
[ 'post_code' => '80720' ],
[ 'post_code' => '80730' ],
[ 'post_code' => '80900' ],
[ 'post_code' => '80902' ],
[ 'post_code' => '80904' ],
[ 'post_code' => '80906' ],
[ 'post_code' => '80908' ],
[ 'post_code' => '80988' ],
[ 'post_code' => '80990' ],
[ 'post_code' => '81000' ],
[ 'post_code' => '81100' ],
[ 'post_code' => '81200' ],
[ 'post_code' => '81300' ],
[ 'post_code' => '81310' ]
];
$this->insertData(1, SegmentConstants::CENTER_POSTCODE, $prices);
Segmentconstant::create( [
'segment_id'=>1,
'reference'=>'STATE_RATE',
'value'=>'[{"state_id":1,"center":"10.00","outstation":"2.00"},{"center":"10.00","outstation":"0.00"},{"center":"10.00","outstation":"0.00"},{"center":"50.00","outstation":"0.00"},{"center":"0.00","outstation":"0.00"},{"center":"345.00","outstation":"0.00"},{"center":"10.00","outstation":"0.00"},{"center":"10.00","outstation":"0.00"},{"center":"10.00","outstation":"0.00"},{"center":"10.00","outstation":"0.00"},{"center":"10.00","outstation":"0.00"},{"center":"10.00","outstation":"0.00"},{"center":"0.00","outstation":"0.00"},{"center":"185.00","outstation":"0.00"},{"center":"185.00","outstation":"0.00"},{"center":"0.00","outstation":"0.00"},{"center":"50.00","outstation":"0.00"}]',
'deleted_at'=>NULL,
'created_at'=>NULL,
'updated_at'=>'2022-09-27 01:18:15'
] );
// insert outstation prices
$prices = [
['post_code' => '80000' ]
];
$this->insertData(1, SegmentConstants::OUTSTATION_POSTCODE, $prices);
// insert customer prices
$prices = [
['id'=> 1, 'price' => 15 ]
];
$this->insertData(2, SegmentConstants::CUSTOMER_RATE, $prices);
Segmentconstant::create( [
'segment_id'=>1,
'reference'=>'WAREHOUSE_RATE',
'value'=>'{"4":{"amount":"20.00"},"2358":{"amount":"20.00"}}',
'deleted_at'=>NULL,
'created_at'=>NULL,
'updated_at'=>'2022-09-23 04:22:52'
] );
Segmentconstant::create( [
'segment_id'=>1,
'reference'=>'CENTER_POSTCODE',
'value'=>'["5150","5460","8000","9600","10150","10350","11600","12200","12200","12200","14000","14300","18000","27600","28500","28700","31150","31350","31400","31450","36000","40150","40150","40160","40300","40400","40460","41050","41200","42000","42000","42100","42200","43000","43100","43200","43200","43300","43500","43500","43700","43900","46050","46100","46200","46300","47000","47100","47120","47130","47170","47301","47400","47500","47630","47800","48050","50450","51200","52000","52100","52200","54200","55000","55100","56000","56100","57000","58000","60000","62050","63000","68100","70300","70450","71800","75250","75260","76100","76100","79150","81000","81100","81200","81300","81750","83000","86000","88300","88300","88300","88450","91000","98000","98100"]',
'deleted_at'=>NULL,
'created_at'=>NULL,
'updated_at'=>'2022-11-07 03:01:11'
] );
Segmentconstant::create( [
'segment_id'=>1,
'reference'=>'OUTSTATION_POSTCODE',
'value'=>'["93250","93350","94200","94300","94600","78556","78557","94700","94750","94760","93050","93250","94000","94500","93050","93350","93350","79466","93050","94100","94500","93050","93050","93250","93350","93050","94200","94200","93010","93010","94700","94800","94807","94809","93250","94000","93050","93050","93250","86900","82300","86800","86810","81600","86800","71600","71650","72400","71600","72200","72300","71750","71770","69000","26800","26810","26820","39000","39007","39009","39010","33300","33310","33320","33100"]',
'deleted_at'=>NULL,
'created_at'=>NULL,
'updated_at'=>'2022-09-21 03:35:19'
] );
Segmentconstant::create( [
'segment_id'=>4,
'reference'=>'CUSTOM_PRICE',
'value'=>'["-10.00"]',
'deleted_at'=>NULL,
'created_at'=>'2022-09-21 02:23:22',
'updated_at'=>'2022-09-21 03:50:38'
] );
Segmentconstant::create( [
'segment_id'=>5,
'reference'=>'CUSTOM_PRICE',
'value'=>'["-20.00"]',
'deleted_at'=>NULL,
'created_at'=>'2022-09-21 03:51:23',
'updated_at'=>'2022-09-21 03:51:59'
] );
Segmentconstant::create( [
'segment_id'=>6,
'reference'=>'CUSTOM_PRICE',
'value'=>'["-30.00"]',
'deleted_at'=>NULL,
'created_at'=>'2022-09-21 03:51:46',
'updated_at'=>'2022-09-21 03:52:05'
] );
}
}
+48 -14
View File
@@ -2,6 +2,7 @@
namespace Database\Seeders;
use App\Models\Segment;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
@@ -9,19 +10,52 @@ class SegmentsTableSeeder extends Seeder
{
public function run()
{
DB::table('segments')->insert(
[
[
'id' => 1,
'company_module_id' => 1,
'name' => 'Default Segment',
],
[
'id' => 2,
'company_module_id' => 2,
'name' => 'Normal Member',
],
]
);
Segment::create( [
'company_module_id'=>1,
'name'=>'Default Segment',
'deleted_at'=>NULL,
'created_at'=>NULL,
'updated_at'=>NULL
] );
Segment::create( [
'company_module_id'=>1,
'name'=>'No Minimum Charge',
'deleted_at'=>NULL,
'created_at'=>NULL,
'updated_at'=>NULL
] );
Segment::create( [
'company_module_id'=>1,
'name'=>'Auto Release',
'deleted_at'=>NULL,
'created_at'=>NULL,
'updated_at'=>NULL
] );
Segment::create( [
'company_module_id'=>1,
'name'=>'Gold Member',
'deleted_at'=>NULL,
'created_at'=>'2022-09-21 02:22:58',
'updated_at'=>'2022-09-21 02:22:58'
] );
Segment::create( [
'company_module_id'=>1,
'name'=>'Platinium Member',
'deleted_at'=>NULL,
'created_at'=>'2022-09-21 03:51:09',
'updated_at'=>'2022-09-21 03:51:09'
] );
Segment::create( [
'company_module_id'=>1,
'name'=>'Titanium Member',
'deleted_at'=>NULL,
'created_at'=>'2022-09-21 03:51:34',
'updated_at'=>'2022-09-21 03:51:34'
] );
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

@@ -52,8 +52,9 @@
value: {
required: false
},
'section': {
section: {
type: String,
default: 'addressSection'
}
},
File diff suppressed because one or more lines are too long
@@ -0,0 +1,68 @@
<template>
<div class="row">
<div class="col">
<loading-component style="height: 50px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading(section)"></loading-component>
<div class="row" v-show="!$store.getters.isLoading(section)">
<div class="col">
<div class="row m-b-10">
<div class="col">
<h3 class="all-caps m-b-5 bold no-margin">Assign Segment</h3>
<!-- <div class="fs-11">Select a segment to view annoucment with title <span class="bold">{{parameters.title | truncate(10) }}</span></div> -->
<div class="fs-11">Select a segment to view annoucment with title <span class="bold">{{parameters.title }}</span></div>
</div>
</div>
<div class="row m-b-5 animate__animated animate__fadeInUpBig animate__fast" v-if="error">
<div class="col">
<small class="bold fs-10 text-danger">{{error}}</small>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<validation-wrapper-component selectable :validator="$v.parameters.segment_id">
<label>Segment</label>
<selectable-component :endpoint="route('api.segment.list') + '?filters=' + JSON.stringify({'id_not_in': currentSegmentIds})" :section="'segmentsListSection_'+data.id" valueColumn="id" :labelColumn="['name']" v-model="parameters.segment_id"></selectable-component>
</validation-wrapper-component>
</div>
</div>
<div class="row">
<div class="col p-r-5">
<div class="btn btn-sm btn-default bg-master-lightest btn-block b-rad-none" data-dismiss="modal">Not Now</div>
</div>
<div class="col p-l-5">
<div class="btn btn-sm btn-success btn-block b-rad-none" @click="submit(route('api.announcement.segment.assign', data.id), 'post', section, true, false)">Assign Segment</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
import { required } from "vuelidate/lib/validators";
export default {
data(){
return {
parameters: {
segment_id: ''
}
}
},
validations: {
parameters: {
segment_id: {
required
}
}
},
computed: {
currentSegmentIds(){
return this.data.segments.map(function (value){
return value.id;
})
}
},
mixins: [ModalFormHandler]
}
</script>
@@ -0,0 +1,48 @@
<template>
<div class="row">
<div class="col">
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
<div class="row m-b-5 animate__animated animate__fadeInUpBig animate__fast" v-if="error">
<div class="col">
<small class="bold fs-10 text-danger">{{error}}</small>
</div>
</div>
<div class="row justify-content-center" v-show="!isLoading">
<div class="col">
<div class="row m-b-20">
<div class="col">
<h3 class="all-caps">Are you Sure?</h3>
<!-- <div class="fs-11">Are you sure you want to remove <span class="bold">{{this.item.name}}</span>from viewing this annoucment with title <span class="bold">{{ announcement_title | truncate(10)}}</span></div> -->
<div class="fs-11">Are you sure you want to remove <span class="bold">{{this.item.name}}</span>from viewing this annoucment with title <span class="bold">{{ announcement_title }}</span></div>
</div>
</div>
<div class="row">
<div class="col p-r-5">
<div class="btn btn-sm btn-success btn-block b-rad-none" data-dismiss="modal">Cancel</div>
</div>
<div class="col p-l-5">
<div class="btn btn-sm btn-danger btn-block b-rad-none" @click="submit(route('api.announcement.segment.detach', announcement_id, item.id), 'delete', section, true, true)">Remove Segment</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
export default {
props: {
announcement_id: {
required: true,
type: Number
},
announcement_title: {
required: true,
type: String
}
},
mixins: [componentHandler, ModalFormHandler]
}
</script>

Some files were not shown because too many files have changed in this diff Show More