Compare commits

...

434 Commits

Author SHA1 Message Date
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
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
omair saleh 1b230dbce0 Merge branch 'development' into 'master'
seperate log in page and sign up page for marketing

See merge request CIEFWorldwideSdnBhd/shipping-portal!131
2022-07-28 04:49:21 +00:00
edmondlang 4329f77e95 Merge branch 'payment-and-billing-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-07-27 20:20:41 +08:00
edmondlang 2f999d7e3c code tidy up 2022-07-27 20:20:16 +08:00
edmondlang 302aa521ed Merge branch 'payment-and-billing-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-07-27 20:10:46 +08:00
edmondlang 50ca61c587 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-07-27 20:10:30 +08:00
edmondlang a6cbec3523 payment-and-billing ui 2022-07-27 20:09:53 +08:00
omair saleh ee2208c992 debug claim packing list 2022-07-26 11:05:28 +08:00
omair saleh b73ef5a386 debug claim packing list 2022-07-26 11:00:36 +08:00
omair saleh cecc0a1b1b debug claim packing list 2022-07-26 10:55:20 +08:00
omair saleh b92a6fe710 debug claim packing list 2022-07-26 10:52:04 +08:00
omair saleh 24bd8be09d debug claim packing list 2022-07-26 10:51:07 +08:00
omair saleh d8801408ae debug claim packing list 2022-07-26 10:49:44 +08:00
edmondlang 274b64de7e Merge branch 'development' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into payment-and-billing-ui 2022-07-23 23:32:54 +08:00
edmondlang 06da9bb435 add missing code 2022-07-23 23:32:31 +08:00
edmondlang a276bc9582 Merge branch 'development' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into payment-and-billing-ui
# Conflicts:
#	routes/web.php
2022-07-23 20:30:41 +08:00
edmondlang 72f555d7d2 payments and billing 2022-07-23 20:28:50 +08:00
edmondlang 9db80220b8 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	resources/assets/vue/components/containers/elements/PackingListComponent.vue
#	resources/assets/vue/components/orders/elements/UnclaimedPackinglistComponent.vue
2022-07-23 19:56:06 +08:00
omair saleh 55882aaacb delete packinglist when deleting warehouselist 2022-07-22 19:17:18 +08:00
omair saleh ca669f6f0a fix exports pending delivery lists 2022-07-22 19:15:38 +08:00
omair saleh ec70a390d0 fix exports pending delivery lists 2022-07-22 19:04:07 +08:00
omair saleh 987418d51a fix exports pending delivery lists 2022-07-22 18:57:44 +08:00
omair saleh 6b641d44f2 fix exports pending delivery lists 2022-07-22 18:56:34 +08:00
omair saleh b57dbe77be delete unclaimed packing list button 2022-07-22 14:22:15 +08:00
omair saleh b9ddd42f82 delete unclaimed packing list button 2022-07-22 14:21:43 +08:00
omair saleh 039a048150 delete unclaimed packing list button 2022-07-22 14:18:54 +08:00
omair saleh f727389add delete unclaimed packing list button 2022-07-22 14:18:18 +08:00
omair saleh 2bb6816794 delete unclaimed packing list button 2022-07-22 14:15:26 +08:00
omair saleh 0616ee0bac show more data for unclaimed packages 2022-07-22 14:08:57 +08:00
omair saleh c038324339 fix vt wrong delivery date 2022-07-21 11:00:32 +08:00
omair saleh ac839c5835 break address words in packing list component 2022-07-21 10:48:38 +08:00
omair saleh d4b85f2952 fix vt packing list api 2022-07-21 10:43:40 +08:00
omair saleh 2be24c4dac fix vt packing list api 2022-07-19 19:24:05 +08:00
omair saleh 6caa68cfa4 fix vt packing list api 2022-07-19 19:21:55 +08:00
omair saleh 582534849a fix vt packing list api 2022-07-19 19:00:55 +08:00
omair saleh b4f816b90d fix vt packing list api 2022-07-19 19:00:00 +08:00
omair saleh 0c939dca6f fix vt packing list api 2022-07-19 18:59:11 +08:00
omair saleh f5b2664f5f fix vt packing list api 2022-07-19 18:56:44 +08:00
omair saleh 9613ed32c1 fix vt packing list api 2022-07-19 18:46:54 +08:00
omair saleh 202456289b fix vt packing list api 2022-07-19 18:46:10 +08:00
omair saleh c59bbd6677 fix vt packing list api 2022-07-19 18:41:27 +08:00
omair saleh ebfa25933d fix vt packing list api 2022-07-19 18:39:34 +08:00
omair saleh 3dedb75239 fix vt packing list api 2022-07-19 18:38:56 +08:00
omair saleh 9152bae815 fix vt packing list api 2022-07-19 18:38:35 +08:00
omair saleh a88512e973 fix vt packing list api 2022-07-19 18:36:23 +08:00
omair saleh 2f59295f67 fix vt packing list api 2022-07-19 18:34:01 +08:00
omair saleh bdb81daf1a fix vt packing list api 2022-07-19 16:45:44 +08:00
omair saleh 42935d025d fix vt packing list api 2022-07-19 16:36:22 +08:00
omair saleh 92b463b78e fix vt packing list api 2022-07-18 14:41:46 +08:00
omair saleh f62fc48636 fix vt packing list api 2022-07-18 14:39:40 +08:00
omair saleh a71ca9dd29 fix vt packing list api 2022-07-18 09:44:31 +08:00
omair saleh 651dea8f3a fix vt packing list api 2022-07-18 09:31:15 +08:00
omair saleh 79ada10312 fix vt containers api 2022-07-18 09:15:04 +08:00
omair saleh 66ef0c08f5 fix vt warehouse list api 2022-07-18 08:45:41 +08:00
omair saleh fafc716109 fix vt warehouse list api 2022-07-18 08:37:54 +08:00
omair saleh d93d51ff09 fix vt warehouse list api 2022-07-18 08:35:23 +08:00
omair saleh b260d30e42 fix vt warehouse list api 2022-07-18 08:02:56 +08:00
omair saleh af2d3adbcd fix vt warehouse list api 2022-07-18 08:01:44 +08:00
omair saleh 846f617e00 fix packinglist without package bug in packinglist component 2022-07-18 06:25:23 +08:00
omair saleh daa8618616 fix packinglist without package bug in packinglist component 2022-07-18 06:23:12 +08:00
omair saleh 22aaccbe21 yd fetch daily 2022-07-18 04:38:44 +08:00
omair saleh 1be99a0730 yd fetch daily 2022-07-18 04:30:54 +08:00
omair saleh ac461a48b7 yd fetch daily 2022-07-18 04:20:07 +08:00
omair saleh 1619bc212f yd fetch daily 2022-07-18 04:05:49 +08:00
omair saleh c487b31673 yd fetch daily 2022-07-18 04:03:45 +08:00
omair saleh 0775c2687f yd fetch daily 2022-07-18 04:03:13 +08:00
omair saleh 7767b4f177 yd fetch daily 2022-07-18 03:51:16 +08:00
omair saleh ee7acbc683 yd fetch daily 2022-07-18 03:49:13 +08:00
omair saleh b3b048ef2b yd fetch daily 2022-07-18 03:47:02 +08:00
omair saleh 12e2ce4de1 yd fetch daily 2022-07-18 03:44:49 +08:00
omair saleh d90347d2ee yd debug 2022-07-18 03:42:34 +08:00
omair saleh ad39cdd124 yd debug 2022-07-18 03:41:34 +08:00
omair saleh e0f0e0e59e yd debug 2022-07-18 03:38:53 +08:00
omair saleh e497eec331 yd debug 2022-07-18 03:37:38 +08:00
omair saleh 1429f97bca yd debug 2022-07-18 03:35:51 +08:00
omair saleh 952333e5cb yd debug 2022-07-18 03:34:46 +08:00
omair saleh e4af160ad2 yd debug 2022-07-18 03:33:59 +08:00
omair saleh 16031665a9 yd debug 2022-07-18 03:32:49 +08:00
omair saleh 39e1c09f05 yd debug 2022-07-18 03:11:00 +08:00
omair saleh 0d4db39013 yd debug 2022-07-18 03:09:50 +08:00
edmondlang 1e634ddc44 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-07-11 15:00:15 +08:00
omair saleh 06015cea72 remove customer profile junk code 2022-07-07 11:31:07 +08:00
omair saleh 3ccf7a088a debug smc report 2022-07-06 10:40:34 +08:00
omair saleh 258b8085ee debug smc report 2022-07-06 10:39:03 +08:00
omair saleh 76c05b7c77 debug smc report 2022-07-06 10:37:05 +08:00
omair saleh 6ebe22b798 debug smc report 2022-07-06 10:36:40 +08:00
omair saleh 17042b4312 debug smc report 2022-07-06 10:34:14 +08:00
omair saleh f935cc10a6 debug smc report 2022-07-06 10:03:01 +08:00
omair saleh 415b5d7697 debug smc report 2022-07-06 10:00:00 +08:00
omair saleh 591575081a add customer to yd exempt list 2022-06-30 09:20:28 +08:00
omair saleh 96fcfb241a update air shipment product list 2022-06-29 11:08:28 +08:00
omair saleh 5b9a286467 Merge remote-tracking branch 'origin/development' into development 2022-06-29 11:07:29 +08:00
omair saleh 5ed84c1ee9 update air shipment product list 2022-06-29 11:07:05 +08:00
omair saleh 40fec78213 update yd list to fetch 3 months 2022-06-24 11:47:35 +08:00
ahmedsophyudden b4dcc0f049 Create approve shipping invoice endpoint 2022-06-18 22:51:15 +08:00
ahmedsophyudden 6873ddb7cf New endpoint to add/edit/delete item in shipping invoiceNew endpoint to add/edit/delete item in shipping invoice 2022-06-17 14:45:34 +08:00
ahmedsophyudden 84e45f9824 New endpoint to add/edit/delete item in shipping invoice 2022-06-17 09:28:14 +08:00
ahmedsophyudden 8079584f04 Merge branch 'development' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-06-17 09:25:50 +08:00
ahmedsophyudden 866dda9d98 New endpoint to add/edit/delete item in shipping invoice 2022-06-17 09:25:47 +08:00
edmondlang 8715997f88 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-06-16 23:25:06 +08:00
omair saleh 822c9c467f fix development js compile error 2022-06-16 14:52:38 +08:00
omair saleh 59d2b5c50a fix development js compile error 2022-06-16 14:51:50 +08:00
omair saleh 6676951dee temp disable vt 2022-06-15 11:17:31 +08:00
omair saleh 1ac7657870 Merge branch 'EXCHANGE-648-Shipping-Estimation-Calculator-API' into 'development'
implement ShippingEstimationCalculator

See merge request CIEFWorldwideSdnBhd/shipping-portal!132
2022-06-14 07:30:33 +00:00
omair saleh 761dedf427 Merge branch 'EXCHANGE-653-Revise-data-structure-of-the-segment_constant-table' into 'development'
implementing new data structure for segment_constant table

See merge request CIEFWorldwideSdnBhd/shipping-portal!133
2022-06-14 07:30:21 +00:00
edmondlang 0c2c64c637 Merge branch 'new-air-shipment-module' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-06-13 23:05:42 +08:00
edmondlang 10b699990f Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-06-13 22:59:07 +08:00
edmondlang 606325706e air shipment module 2022-06-13 22:58:41 +08:00
omair saleh 742d26bdd3 update vt container packing list api 2022-06-13 11:39:41 +08:00
omair saleh 308a1bcdc0 update vt container packing list api 2022-06-13 11:36:21 +08:00
omair saleh f0f70e421e update vt container packing list api 2022-06-13 11:24:32 +08:00
omair saleh 3dff650b04 update vt container packing list api 2022-06-13 11:23:25 +08:00
omair saleh 5a55b4ccf2 update vt container packing list api 2022-06-13 11:22:50 +08:00
omair saleh 303b1abff1 update vt container packing list api 2022-06-13 11:21:07 +08:00
omair saleh 69a2743056 update vt container packing list api 2022-06-13 11:19:09 +08:00
omair saleh cf49a661e1 update vt container packing list api 2022-06-13 11:17:21 +08:00
omair saleh 4bcb67e972 update vt container packing list api 2022-06-13 11:16:28 +08:00
omair saleh e8564ee3b5 update vt container packing list api 2022-06-13 11:13:38 +08:00
omair saleh 23e5e1e268 update vt container packing list api 2022-06-13 11:13:25 +08:00
omair saleh cce1979388 update vt container packing list api 2022-06-13 11:12:21 +08:00
omair saleh f39f9ee2a7 update vt container packing list api 2022-06-13 11:09:59 +08:00
omair saleh c1cf22544f update vt container packing list api 2022-06-13 11:07:53 +08:00
omair saleh 321002ed04 remove old notice 2022-06-09 17:45:47 +08:00
omair saleh de237a4110 update new notice 2022-06-09 17:41:08 +08:00
omair saleh ee408da523 update smc monthly summary containers ref 2022-05-31 16:16:05 +08:00
omair saleh de797d65ee update smc monthly summary containers ref 2022-05-31 16:15:14 +08:00
omair saleh 9831ff29af update smc monthly summary containers ref 2022-05-31 16:14:22 +08:00
omair saleh 0102dabdba update smc monthly summary containers ref 2022-05-31 15:18:40 +08:00
omair saleh 86913ad80b update smc monthly summary containers ref 2022-05-31 15:15:20 +08:00
omair saleh fad2685534 update smc monthly summary containers ref 2022-05-31 15:14:22 +08:00
omair saleh 589422a9a8 update smc monthly summary containers ref 2022-05-31 15:09:05 +08:00
omair saleh e2b96d7281 update smc monthly summary containers ref 2022-05-31 15:03:47 +08:00
omair saleh df14f196b9 holiday announcement 2022-05-30 17:25:23 +08:00
omair saleh 7698c35b85 fix onhold packing list 2022-05-30 11:19:25 +08:00
omair saleh 88c0b4303e update vt new warehouselist 2022-05-26 10:14:12 +08:00
omair saleh c4eec73803 update vt new warehouselist 2022-05-26 10:11:55 +08:00
marjuqi@ad 6932b3291c implementing new data structure for segment_constant table 2022-05-25 10:28:51 +07:00
edmondlang cbaf05389e Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-05-24 00:12:34 +08:00
marjuqi@ad 00f4f141c4 remove unused newline 2022-05-20 09:07:24 +07:00
marjuqi@ad 7771b903ae refactor codes in ShippingEstimationCalculatorLogic.php 2022-05-20 09:06:20 +07:00
marjuqi@ad 6de35b13f1 rearrange the lines of code to improve readability 2022-05-20 08:14:14 +07:00
marjuqi@ad 46da64fc47 revert the changes for CreateShippingInvoiceTransactionLogic.php and Helper.php 2022-05-20 08:11:28 +07:00
marjuqi@ad 0821db2899 refactor functions: getConstantByKey, checkPostcodeExistInConstant 2022-05-19 06:23:19 +07:00
marjuqi@ad 74005ba312 remove unused lines 2022-05-19 06:07:28 +07:00
marjuqi@ad 7935be2912 update logic for state_rate 2022-05-19 05:40:13 +07:00
omair saleh 8e0d23a208 update yd fetch api to include delivery missing cases 2022-05-18 16:59:49 +08:00
omair saleh 2a077edcde update vt api url for new warehouse list 2022-05-18 16:41:15 +08:00
marjuqi@ad 142904b0af activate lines after executing SegmentConstantsTableSeeder 2022-05-18 11:15:25 +07:00
marjuqi@ad 97fe1d9192 revise logic for ShippingEstimationCalculator following Omair's feedback 2022-05-18 10:43:09 +07:00
omair saleh 27940854e2 add chi bin to vt 2022-05-17 17:26:09 +08:00
marjuqi@ad d4c35a5286 initial commit for ShippingEstimationCalculator 2022-05-17 15:31:17 +07:00
omair saleh 35dec3042b fix export arrival list 2022-05-17 11:47:30 +08:00
omair saleh 918db70429 fix export arrival list 2022-05-17 11:46:24 +08:00
omair saleh 1796ddefbf fix export arrival list 2022-05-17 11:45:13 +08:00
edmondlang e1ee96f77c Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-05-13 23:03:35 +08:00
omair saleh 31e28c3dfa fix export arrival list 2022-05-13 12:51:20 +08:00
omair saleh faf4d35340 fix export arrival list 2022-05-13 12:50:36 +08:00
omair saleh 4fef6f8e6f fix export arrival list 2022-05-13 12:45:54 +08:00
omair saleh 5d504b5111 fix export arrival list 2022-05-13 12:44:19 +08:00
omair saleh 3854884370 fix export arrival list 2022-05-12 12:14:29 +08:00
omair saleh fe70c4b111 fix export arrival list 2022-05-11 18:00:13 +08:00
omair saleh dad2f95eaa fix export arrival list 2022-05-11 14:03:52 +08:00
omair saleh 764e709135 fix export arrival list 2022-05-11 14:01:02 +08:00
omair saleh 9b35f8c374 fix export arrival list 2022-05-11 13:51:13 +08:00
omair saleh 2e03ce370d fix export arrival list 2022-05-11 13:42:26 +08:00
omair saleh d972e98732 fix export arrival list 2022-05-10 19:50:19 +08:00
omair saleh 9041d9623b fix export arrival list 2022-05-10 19:46:16 +08:00
omair saleh f4a96fec78 fix export arrival list 2022-05-10 19:41:35 +08:00
omair saleh c299c60d38 fix export arrival list 2022-05-10 19:38:04 +08:00
omair saleh 96eeb5a63e fix export arrival list 2022-05-10 19:37:49 +08:00
omair saleh fc6c365792 fix export arrival list 2022-05-10 19:37:39 +08:00
omair saleh 6094adadec fix export arrival list 2022-05-10 19:35:16 +08:00
omair saleh 78ce2084b9 fix export arrival list 2022-05-10 19:31:04 +08:00
omair saleh 4fb284c85c fix export arrival list 2022-05-10 19:27:45 +08:00
omair saleh 9e060bccd3 fix export arrival list 2022-05-10 19:24:02 +08:00
omair saleh 3100d42bd7 fix export arrival list 2022-05-10 19:23:03 +08:00
omair saleh 0640e0de9b fix export arrival list 2022-05-10 19:13:36 +08:00
omair saleh aa1d1dccc5 fix export arrival list 2022-05-10 18:57:22 +08:00
omair saleh e369bc7f9e fix export arrival list 2022-05-10 15:42:33 +08:00
omair saleh 6713542dc9 fix export arrival list 2022-05-10 15:02:06 +08:00
omair saleh f73094ca06 fix export arrival list 2022-05-10 15:01:35 +08:00
omair saleh 453683ca76 fix export arrival list 2022-05-10 14:59:43 +08:00
edmondlang caef08aa98 update generate invoice api 2022-05-07 22:28:13 +08:00
edmondlang 2c2e4eece8 update generate invoice api 2022-05-07 20:08:22 +08:00
omair saleh a30421a3e9 fix addons table migration 2022-05-07 16:42:44 +08:00
omair saleh 056342308e fix addons table migration 2022-05-07 16:37:48 +08:00
omair saleh f7ca8558f5 fix addons table migration 2022-05-07 16:32:02 +08:00
edmondlang 92255056cc Merge branch 'container-payment-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-05-07 16:28:40 +08:00
edmondlang 5e1626e6a4 add soft delete in segemtns model 2022-05-07 16:28:11 +08:00
edmondlang c533c0c4a6 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-05-06 21:34:57 +08:00
omair saleh e8eb02430b update warehouse operation time 2022-05-06 13:49:14 +08:00
edmondlang f17bfea250 fix generate invoice api and database seeder for segment constant 2022-05-05 21:05:45 +08:00
edmondlang 24ceb3cb39 Merge branch 'new-signup' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-05-02 12:05:40 +08:00
edmondlang b6086554e2 sepereate delivery login component and shipping login component 2022-05-02 12:05:19 +08:00
edmondlang fee73f7708 Merge branch 'new-signup' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-30 21:08:29 +08:00
edmondlang cd7ee3afb3 new signup 2022-04-30 11:57:32 +08:00
edmondlang 3329028860 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-30 10:18:56 +08:00
omair saleh 6507b84e55 update warehouse operation time 2022-04-28 10:12:27 +08:00
omair saleh eab465e837 update gz default warehouse 2022-04-27 17:29:26 +08:00
omair saleh 1cc0303539 update raya announcement 2022-04-27 12:55:49 +08:00
omair saleh 305ae6c217 update raya announcement 2022-04-27 12:51:39 +08:00
omair saleh bcd926b4c9 update crisp session data 2022-04-25 15:14:11 +08:00
edmondlang cd84348542 Merge branch 'delete-packing-list' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-24 23:30:18 +08:00
edmondlang 8e0efdf6e7 delete packing list 2022-04-24 23:30:02 +08:00
edmondlang 37cdbbb2c4 Merge branch 'api-intergration' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-24 23:04:26 +08:00
edmondlang 86893efe3d update base price date range 2022-04-23 14:59:52 +08:00
edmondlang 3dfec9fd6d update list base price section component 2022-04-22 22:23:35 +08:00
edmondlang 0634fbf78e update constant base price 2022-04-22 21:41:02 +08:00
edmondlang 6375ac753e clean up error in console for settiongs page 2022-04-22 00:23:59 +08:00
edmondlang 3899dd8416 update base price api 2022-04-22 00:18:12 +08:00
edmondlang 8ca1cc1625 Merge branch 'api-intergration' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-21 22:08:07 +08:00
edmondlang d0ee2473ac update section name 2022-04-21 22:07:50 +08:00
edmondlang b67b676704 Merge branch 'update-delivery-date' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-21 21:42:53 +08:00
edmondlang 2f98dc976a add file RescheduleTransportDateFormComponent 2022-04-21 21:42:32 +08:00
edmondlang 2421dd0988 Merge branch 'update-delivery-date' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-21 21:02:38 +08:00
edmondlang 20237d69fb update 2022-04-21 21:02:25 +08:00
edmondlang 03851deeea Merge branch 'update-delivery-date' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-21 20:59:16 +08:00
edmondlang 22f1548eac update delivery date 2022-04-21 20:58:27 +08:00
omair saleh 4e4475ad12 switch back to temp warehouse 2022-04-21 14:12:23 +08:00
omair saleh a287a1193a allow admin to add arrived parcels 2022-04-21 12:19:57 +08:00
omair saleh a80b3013c3 go to previous yd warehouse 2022-04-21 10:31:24 +08:00
edmondlang 4224c3e436 Merge branch 'api-intergration' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-21 09:31:12 +08:00
edmondlang 33124d6588 update declare postcode and implement api 2022-04-21 09:30:56 +08:00
edmondlang 77c2ede28e Merge branch 'api-intergration' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-21 01:14:33 +08:00
edmondlang 86e257106a add code to check if postcode constant does not exist, insert new postcode constant 2022-04-21 01:13:46 +08:00
edmondlang edb644eaeb remove insert segment if segment does not exist 2022-04-21 01:12:32 +08:00
edmondlang 8418268731 Merge branch 'api-intergration' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-19 20:50:28 +08:00
edmondlang 98dc43d23a update segment constant logic 2022-04-19 20:50:09 +08:00
edmondlang 5fdc6d5719 Merge branch 'api-intergration' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-19 15:10:12 +08:00
edmondlang cfd6757a84 tidy up 2022-04-19 15:09:56 +08:00
edmondlang 08517e8ee7 Merge branch 'api-intergration' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-19 14:58:17 +08:00
edmondlang eb31291e25 update warehouse api 2022-04-19 14:57:38 +08:00
edmondlang ddbecaae6f Merge branch 'api-intergration' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-19 13:31:04 +08:00
edmondlang 7b88fd5c3c update state charges 2022-04-19 13:28:56 +08:00
edmondlang 1814352780 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into api-intergration 2022-04-19 13:26:23 +08:00
edmondlang 8795f1c203 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-19 11:00:57 +08:00
omair saleh f5cf2ac2df fix login error handler & add new modern warehouse 2022-04-19 00:00:12 +08:00
omair saleh 2767d94a16 fix login error handler & add new modern warehouse 2022-04-18 23:56:27 +08:00
omair saleh f68ef5c5e2 fix login error handler & add new modern warehouse 2022-04-18 23:46:25 +08:00
omair saleh 639ccd3927 fix login error handler & add new modern warehouse 2022-04-18 23:40:08 +08:00
omair saleh 5651ed7010 fix LMD to HWT 2022-04-18 15:47:25 +08:00
omair saleh fd89233e49 fix LMD to HWT 2022-04-18 15:44:58 +08:00
omair saleh be70afd9bf fix LMD to HWT 2022-04-18 15:44:25 +08:00
omair saleh efac46264e fix LMD to HWT 2022-04-18 15:43:43 +08:00
omair saleh a0817dbb6e debug delivery registration 2022-04-18 15:42:10 +08:00
omair saleh dfa7013f04 debug delivery registration 2022-04-18 15:39:57 +08:00
omair saleh 28a57887b6 debug forget password 2022-04-18 04:59:49 +08:00
edmondlang 762e9b8dca update segment migration files 2022-04-17 23:54:44 +08:00
edmondlang d8c9c77d8d Merge branch 'api-intergration' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-17 23:42:26 +08:00
edmondlang f21708ff57 Merge branch 'notification-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	routes/web.php
2022-04-17 23:38:10 +08:00
edmondlang ac4fcb05e9 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	resources/views/vendor/js.blade.php
2022-04-17 23:36:42 +08:00
edmondlang b3a296f2eb update notification ui, display no result found if no notification 2022-04-17 21:10:52 +08:00
edmondlang 5a723c5fd1 update notification ui - solve ui bug when only have 1 notification 2022-04-16 23:54:51 +08:00
edmondlang 6e9a27024b update notification ui 2022-04-16 16:19:25 +08:00
omair saleh 8a96941127 debug forget password 2022-04-15 14:55:21 +08:00
omair saleh 3a5423a308 on hold packing list export 2022-04-15 14:21:08 +08:00
omair saleh ddd1b7b29e on hold packing list export 2022-04-15 14:20:20 +08:00
omair saleh 5433c202a7 on hold packing list export 2022-04-15 14:19:32 +08:00
omair saleh b967e4f9ab on hold packing list export 2022-04-15 14:18:38 +08:00
omair saleh e9b7de47fa on hold packing list export 2022-04-15 14:17:43 +08:00
omair saleh 3c942af883 on hold packing list export 2022-04-15 14:17:20 +08:00
omair saleh baa9f79272 on hold packing list export 2022-04-15 14:00:13 +08:00
omair saleh 10c66dc2dc export delivery list excel 2022-04-15 11:58:37 +08:00
omair saleh 05d4b7fe36 fix fetch from vt 2022-04-15 11:43:17 +08:00
omair saleh 7fc4568fbf fix fetch from vt 2022-04-14 13:14:47 +08:00
omair saleh f55a57c222 fix fetch from vt 2022-04-14 13:12:56 +08:00
omair saleh 301d7b5520 update hywavetech lineclear excel format 2022-04-14 10:15:07 +08:00
omair saleh 9f965109c7 update hywavetech lineclear excel format 2022-04-14 10:01:10 +08:00
omair saleh 108a952ee3 update hywavetech lineclear excel format 2022-04-13 21:56:21 +08:00
omair saleh 1426d804e5 fix yd fetch 2022-04-13 15:10:10 +08:00
omair saleh 88b3dc8b84 fix yd fetch 2022-04-13 14:27:08 +08:00
omair saleh 4b3274f6d5 fix yd fetch 2022-04-13 14:24:50 +08:00
omair saleh da1b6b1b6d fix yd fetch 2022-04-13 13:22:23 +08:00
omair saleh ac0a90c168 fix yd fetch 2022-04-13 13:17:04 +08:00
omair saleh a5e47324b2 fix yd fetch 2022-04-13 13:11:30 +08:00
omair saleh 40d22de809 fix customer profile 2022-04-13 12:19:34 +08:00
omair saleh 7154b5a943 fix customer profile 2022-04-13 12:15:32 +08:00
omair saleh 863c2874dd fix yd fetch 2022-04-13 11:50:23 +08:00
omair saleh 862398b0d5 update qr pdf 2022-04-13 11:30:53 +08:00
omair saleh 9e20b717a6 update qr pdf 2022-04-13 11:29:15 +08:00
omair saleh 129f3ecf10 update crisp to production 2022-04-13 00:25:49 +08:00
omair saleh f71f1fecd4 update crisp to production 2022-04-13 00:18:57 +08:00
omair saleh 6f5f854827 update crisp to production 2022-04-13 00:18:44 +08:00
omair saleh f4275f20a3 update crisp to production 2022-04-13 00:17:19 +08:00
omair saleh 35d9a1f8d8 update crisp to production 2022-04-13 00:15:51 +08:00
omair saleh de1afc26dc update crisp to production 2022-04-12 16:22:57 +08:00
omair saleh 904fb3d9e5 update crisp to production 2022-04-12 16:18:33 +08:00
omair saleh 304337d5e2 update crisp to production 2022-04-12 16:02:00 +08:00
omair saleh aa312c8f6e Merge remote-tracking branch 'origin/master' 2022-04-12 15:20:41 +08:00
omair saleh 05d079f261 update crisp to production 2022-04-12 15:20:13 +08:00
omair saleh a1cb511125 Merge branch 'export-arrived-parcel' into 'master'
export-arrived-parcel

See merge request CIEFWorldwideSdnBhd/shipping-portal!130
2022-04-12 07:10:44 +00:00
omair saleh 8d29a25793 create replica white list 2022-04-12 09:42:27 +08:00
edmondlang a7593e4ab2 export-arrived-parcel 2022-04-11 23:29:39 +08:00
omair saleh 8ecb306e92 update final touch up for last delivery integration 2022-04-09 20:43:00 +08:00
omair saleh 918fd0d17d update final touch up for last delivery integration 2022-04-09 20:41:48 +08:00
omair saleh 4f888da29a Merge branch 'last-mile-integration' into 'master'
update field change value of  'Pickup_Address_Type' from sender to Default'

See merge request CIEFWorldwideSdnBhd/shipping-portal!129
2022-04-09 12:20:56 +00:00
edmondlang 559de29acf update field change value of 'Pickup_Address_Type' from sender to Default'
export multiple sheet with the correct name of each field
2022-04-09 15:10:54 +08:00
edmondlang 5ba46a96a3 api intergration 2022-04-08 21:08:54 +08:00
edmondlang 1c79d88d8d remove service set up and add in base price 2022-04-08 19:05:18 +08:00
edmondlang 029f25a003 update state charges 2022-04-08 18:42:30 +08:00
edmondlang 557881104c implement api for warehouse charges 2022-04-08 18:23:54 +08:00
edmondlang d30dab61ea intergrate api for decalreing postcode area 2022-04-07 23:45:36 +08:00
edmondlang e0018de70d Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-07 22:57:28 +08:00
edmondlang 87116d29c9 last mile delivery search order ui and search order number function 2022-04-07 22:54:02 +08:00
omair saleh d9eeaf4bef update final touch up for last delivery integration 2022-04-07 22:47:30 +08:00
omair saleh 5dabc88fa9 update final touch up for last delivery integration 2022-04-07 22:40:01 +08:00
omair saleh 8c29fcda1f update final touch up for last delivery integration 2022-04-07 22:28:51 +08:00
omair saleh edd6b0d6ff update final touch up for last delivery integration 2022-04-07 22:22:22 +08:00
omair saleh 6940290570 update final touch up for last delivery integration 2022-04-07 22:21:21 +08:00
omair saleh 327bd75cc9 update final touch up for last delivery integration 2022-04-07 22:20:47 +08:00
omair saleh 9f760d8694 Merge branch 'last-mile-integration' into 'master'
updates last mile intergration - add functions

See merge request CIEFWorldwideSdnBhd/shipping-portal!128
2022-04-07 14:13:57 +00:00
omair saleh f5a0e9cd07 Merge branch 'last-mile-integration' into 'development'
update final touch up for last delivery integration

See merge request CIEFWorldwideSdnBhd/shipping-portal!127
2022-04-07 13:28:33 +00:00
omair saleh 4a1905abde update final touch up for last delivery integration 2022-04-07 21:27:53 +08:00
omair saleh 908c547ddc Merge branch 'last-mile-integration' into 'development'
update final touch up for last delivery integration

See merge request CIEFWorldwideSdnBhd/shipping-portal!126
2022-04-07 13:21:17 +00:00
omair saleh 5d1ff709eb update final touch up for last delivery integration 2022-04-07 21:20:13 +08:00
omair saleh cdda3ff5e1 Merge branch 'last-mile-integration' into 'development'
update final touch up for last delivery integration

See merge request CIEFWorldwideSdnBhd/shipping-portal!125
2022-04-07 13:17:48 +00:00
omair saleh a50b475525 update final touch up for last delivery integration 2022-04-07 21:16:59 +08:00
omair saleh 27bacd412a Merge branch 'last-mile-integration' into 'development'
Last mile integration

See merge request CIEFWorldwideSdnBhd/shipping-portal!124
2022-04-07 13:13:58 +00:00
omair saleh 97ec65e292 Merge remote-tracking branch 'origin/last-mile-integration' into last-mile-integration 2022-04-07 21:13:21 +08:00
omair saleh 5df226c153 update final touch up for last delivery integration 2022-04-07 21:12:15 +08:00
edmondlang 424ac600c3 Merge branch 'export-customer-order-list' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-07 12:31:05 +08:00
edmondlang 715635954a update file name 2022-04-07 12:30:39 +08:00
edmondlang a5a450a7d4 Merge branch 'export-customer-order-list' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-07 11:50:03 +08:00
edmondlang 3e87f320bf Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into last-mile-integration 2022-04-07 11:45:56 +08:00
edmondlang 2919544769 Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into export-customer-order-list 2022-04-07 11:37:10 +08:00
edmondlang e3284fdf98 export customer order list 2022-04-07 11:36:03 +08:00
omair saleh 114a083627 Merge branch 'last-mile-integration' into 'development'
update last mile delivery logo

See merge request CIEFWorldwideSdnBhd/shipping-portal!123
2022-04-07 03:13:22 +00:00
omair saleh 408a3a1211 update last mile delivery logo 2022-04-07 11:12:27 +08:00
omair saleh bed78c053a remove memo 2022-04-07 10:59:50 +08:00
omair saleh 32a509d090 Merge branch 'last-mile-integration' into 'development'
updates last mile intergration - add functions

See merge request CIEFWorldwideSdnBhd/shipping-portal!122
2022-04-07 01:54:39 +00:00
omair saleh c53ebf76b3 hide admin menu flashing 2022-04-07 09:53:59 +08:00
omair saleh bd2b7b236b Merge branch 'last-mile-integration' into 'development'
hide admin menu flashing

See merge request CIEFWorldwideSdnBhd/shipping-portal!121
2022-04-07 01:48:33 +00:00
omair saleh 4085ac4829 hide admin menu flashing 2022-04-07 09:46:22 +08:00
omair saleh 6a08d88031 Merge branch 'last-mile-integration' into 'development'
hide admin menu flashing

See merge request CIEFWorldwideSdnBhd/shipping-portal!120
2022-04-07 01:45:16 +00:00
omair saleh 778729b81d hide admin menu flashing 2022-04-07 09:44:02 +08:00
omair saleh ef95893c3b Merge branch 'last-mile-integration' into 'development'
update last mile delivery module

See merge request CIEFWorldwideSdnBhd/shipping-portal!119
2022-04-06 10:53:05 +00:00
omair saleh 54c212e905 update last mile delivery module 2022-04-06 18:51:08 +08:00
edmondlang 5043b32191 Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-06 18:31:15 +08:00
omair saleh 7169ba423c Merge branch 'last-mile-integration' into 'development'
updates last mile intergration - add functions

See merge request CIEFWorldwideSdnBhd/shipping-portal!118
2022-04-06 10:25:09 +00:00
omair saleh 5b370a299c update pending delivery report excel 2022-04-06 16:01:31 +08:00
omair saleh e57dc231e6 update pending delivery report excel 2022-04-06 16:01:03 +08:00
omair saleh 5727801918 update pending delivery report excel 2022-04-06 15:59:28 +08:00
omair saleh bf325ff028 update pending delivery report excel 2022-04-06 15:55:31 +08:00
omair saleh 229e757663 Merge branch 'export-delivery-list' into 'master'
Export delivery list

See merge request CIEFWorldwideSdnBhd/shipping-portal!117
2022-04-06 07:32:01 +00:00
edmondlang f8e7573cfd Merge branch 'export-delivery-list' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-06 14:37:23 +08:00
edmondlang bb59a444cf update export excel form 2022-04-06 11:24:24 +08:00
edmondlang 45c878a2ed add orders created date to the table 2022-04-06 10:21:40 +08:00
edmondlang e871f4b287 hide tick and show only for admin 2022-04-05 20:03:27 +08:00
edmondlang 5aa93b30c7 update container select packing list 2022-04-05 19:05:57 +08:00
edmondlang 8c35601ccd Merge branch 'development' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2022-04-05 19:04:24 +08:00
omair saleh 0ec9226226 add crisp 2022-04-05 13:26:24 +08:00
omair saleh 3286939ccc Merge remote-tracking branch 'origin/development' into development 2022-04-05 13:21:07 +08:00
omair saleh 3a2146146c add crisp 2022-04-05 13:20:52 +08:00
edmondlang 6eaa810b67 remove text order list 2022-04-05 11:40:58 +08:00
edmondlang 4e53e1b48a updates last mile intergration - add functions
- admin cancel order
- add filter to display only active orders
- hide customer page
- show parcel weight as total weight (quantity * weight per quantity)
    - in create order form
    - order table
    - export excel
- update export excel, only include the data of the selected Ids
2022-04-05 10:45:30 +08:00
omair saleh aef9b82918 Merge remote-tracking branch 'origin/last-mile-integration' into last-mile-integration
# Conflicts:
#	resources/views/pages/delivery/admin.blade.php
2022-04-04 19:41:43 +08:00
omair saleh f96fef94fe finalize last mile delivery 2022-04-04 19:40:54 +08:00
edmondlang ab141ae160 update admin view for last mile intergration 2022-04-04 14:21:59 +08:00
edmondlang bf4830ba7a update mobile responsive for delivery order form component 2022-04-03 23:47:58 +08:00
edmondlang 5baf04c835 fix mobile responsive 2022-04-03 23:39:27 +08:00
edmondlang 4917c54868 remove vuetable 2022-04-03 23:26:45 +08:00
edmondlang 9c7d07f603 remove imports that are not using 2022-04-03 20:20:09 +08:00
edmondlang 6f9320f3a4 Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into last-mile-integration 2022-04-03 19:13:24 +08:00
omair saleh c69c043576 fix the user ui, create delivery order, delivery customer dashboard 2022-04-03 19:10:06 +08:00
edmondlang 745655dbfa last mile intergration 2022-04-02 15:21:14 +08:00
edmondlang d96a35a49f revert RegistrationFormComponent 2022-03-30 20:01:45 +08:00
edmondlang 8024fef2e8 Merge branch 'new-registration-ui' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into last-mile-integration 2022-03-30 19:54:35 +08:00
omair saleh 0e7469f1cd new registration ui flow 2022-03-29 23:15:42 +08:00
edmondlang e2e8f69f90 update notification add List Notifications API and UI 2022-03-15 16:14:21 +08:00
edmondlang e5c28faba7 Merge branch 'development' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into notification-ui 2022-03-14 12:38:13 +08:00
edmondlang 4b81666cf2 Merge branch 'development' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into notification-ui 2022-03-13 22:16:16 +08:00
edmondlang 4a2fb8e9e4 update notification icon 2022-03-12 17:10:38 +08:00
edmondlang ea772c3916 Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into notification-ui 2022-03-12 17:02:36 +08:00
edmondlang f8d65d05da notification-ui 2022-01-15 13:39:17 +08:00
216 changed files with 8266 additions and 1236 deletions
@@ -0,0 +1,23 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
class DoesNotHaveTransactionType implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereDoesntHave('transactions', function (Builder $query) use($value) {
$query->where('type', $value);
})->whereHas('containers', function ($query){
return $query->whereDate('loading_date', '>=', Carbon::parse('08-08-2022'));
});
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class HasInvoiceStatusIn 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('type', 1)->whereIn('status', $value);
});
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class HasTransactionType 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('type', $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);
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
class TargetId implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('target_type', User::class)->where('target_id', $value);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class TypeIn implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereIn('type', $value);
}
}
@@ -15,6 +15,7 @@ use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
use App\Classes\Modules\Documents\Processors\UploadIdentityDocumentProcessor;
@@ -76,6 +77,9 @@ class CreateCustomerLogic extends AbstractControllerLogic
/** @var GenerateEmailVerificationAttemptProcessor */
private $generateEmailVerificationAttemptProcessor;
/** @var FetchesCompanyModule */
private $fetchesCompanyModule;
/**
* CreateCustomerLogic constructor.
* @param CreateUserProcessor $createUserProcessor
@@ -88,8 +92,9 @@ class CreateCustomerLogic extends AbstractControllerLogic
* @param UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor
* @param AuthenticationProcessor $authenticationProcessor
* @param GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor
* @param FetchesCompanyModule $fetchesCompanyModule
*/
public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor)
public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor, FetchesCompanyModule $fetchesCompanyModule)
{
$this->createUserProcessor = $createUserProcessor;
$this->createCompanyProcessor = $createCompanyProcessor;
@@ -101,6 +106,7 @@ class CreateCustomerLogic extends AbstractControllerLogic
$this->uploadIdentityDocumentProcessor = $uploadIdentityDocumentProcessor;
$this->authenticationProcessor = $authenticationProcessor;
$this->generateEmailVerificationAttemptProcessor = $generateEmailVerificationAttemptProcessor;
$this->fetchesCompanyModule = $fetchesCompanyModule;
}
/**
@@ -126,7 +132,9 @@ class CreateCustomerLogic extends AbstractControllerLogic
/** @var CompanyModule $companyModule */
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::IMPORTER);
$connectionObject = new CompanyConnectionObject($companyModule, 'CIEF', mt_rand(1000, 9999).(new GeneratesInitials())->name($company->name)->length(3)->generate());
$inviter = $this->fetchesCompanyModule->execute(['reference'=>'CIEF']);
$connectionObject = new CompanyConnectionObject($companyModule, $inviter, mt_rand(1000, 9999).(new GeneratesInitials())->name($company->name)->length(3)->generate(), 'CIEF');
$connection = $this->createsCompanyConnection->execute($connectionObject);
@@ -12,6 +12,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\ValueObjects\Constants\Notifications;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class GeneratePasswordResetLogic extends AbstractControllerLogic
{
@@ -2,6 +2,7 @@
namespace App\Classes\Modules\Accounts\Services;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Models\User;
@@ -11,6 +12,11 @@ class AuthenticationRedirect
public function url(User $user){
if($user->type === RoleTypes::USER){
if (in_array($user->companyModule()->first()->type, [BusinessType::ONLINE_SELLER, BusinessType::LAST_MILE_DELIVERY_AGENT])) {
return route('last_mile_delivery.dashboard');
}
return route('dashboard');
}
@@ -68,7 +68,11 @@ class GeneratesAuthenticationToken {
$companyModule = $user->companyModule()->first();
$claims = array_merge($claims, [
'company_id' => $companyModule->company_id
'company_id' => $companyModule->company_id,
'company_module_id' => $companyModule->id,
'company_module_type' => $companyModule->type,
'company_name' => $companyModule->name,
'company_marking' => $companyModule->type !== 8 ? $companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference : 'HWT',
]);
}
@@ -14,6 +14,7 @@ use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Http\Resources\AddressResource;
use App\Models\Address;
use ErrorException;
@@ -82,7 +83,7 @@ class CreateAddressLogic extends AbstractControllerLogic
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), $request->input('reference'));
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), $request->input('type'), ApprovalStatus::APPROVED, $request->input('reference'));
$this->canCreateAddress->passes($object);
@@ -13,6 +13,8 @@ use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Http\Resources\AddressResource;
use App\Models\Address;
use Illuminate\Http\JsonResponse;
@@ -79,7 +81,7 @@ class UpdateAddressLogic extends AbstractControllerLogic
{
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), $request->input('reference'));
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), AddressType::DELIVERY, ApprovalStatus::APPROVED, $request->input('reference'));
$this->canUpdateAddress->passes($object);
@@ -26,6 +26,12 @@ class AddressObject implements DataTransferObject
/** @var int */
private $postCode;
/** @var int */
private $type;
/** @var int */
private $status;
/** @var string|null */
private $reference;
@@ -37,9 +43,11 @@ class AddressObject implements DataTransferObject
* @param int $stateId
* @param int $districtId
* @param int $postCode
* @param int $type
* @param int $status
* @param null|string $reference
*/
public function __construct(string $streetOne, ?string $streetTwo, int $countryId, int $stateId, int $districtId, int $postCode, ?string $reference = null, ?int $status = ApprovalStatus::APPROVED)
public function __construct(string $streetOne, ?string $streetTwo, int $countryId, int $stateId, int $districtId, int $postCode, int $type, int $status, ?string $reference = null)
{
$this->streetOne = $streetOne;
$this->streetTwo = $streetTwo;
@@ -47,8 +55,9 @@ class AddressObject implements DataTransferObject
$this->stateId = $stateId;
$this->districtId = $districtId;
$this->postCode = $postCode;
$this->reference = $reference;
$this->type = $type;
$this->status = $status;
$this->reference = $reference;
}
/**
@@ -100,11 +109,11 @@ class AddressObject implements DataTransferObject
}
/**
* @return null|string
* @return int
*/
public function getReference(): ?string
public function getType(): int
{
return $this->reference;
return $this->type;
}
/**
@@ -115,5 +124,13 @@ class AddressObject implements DataTransferObject
return $this->status;
}
/**
* @return null|string
*/
public function getReference(): ?string
{
return $this->reference;
}
}
@@ -10,6 +10,8 @@ namespace App\Classes\Modules\Addresses\Services;
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\District;
use App\Models\OldAddress;
@@ -31,7 +33,7 @@ class CleansOldAddress
return null;
}
return new AddressObject($this->cleanAddress($address->street_one, $district, $address->post_code), $this->cleanAddress($address->street_two, $district, $address->post_code), $district->country_id, $district->state_id, $district->id, $address->post_code, 'Delivery Address');
return new AddressObject($this->cleanAddress($address->street_one, $district, $address->post_code), $this->cleanAddress($address->street_two, $district, $address->post_code), $district->country_id, $district->state_id, $district->id, $address->post_code, AddressType::DELIVERY, ApprovalStatus::APPROVED, 'Delivery Address');
}
@@ -29,6 +29,7 @@ class CreatesAddress extends AbstractUpdateRelationshipRecord
$model->district_id = $object->getDistrictId();
$model->postcode = $object->getPostCode();
$model->status = $object->getStatus();
$model->type = $object->getType();
return $this->handler($addressable->addresses(), $model);
@@ -14,6 +14,8 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Documents\Services\FetchesDocument;
use App\Classes\Modules\Documents\Services\ApprovesDocument;
use App\Classes\Modules\Notifications\DataTransferObjects\NotificationObject;
Use App\Classes\Modules\Notifications\Processors\CreateNotificationProcessor;
use App\Models\Document;
use Illuminate\Http\JsonResponse;
@@ -50,6 +52,9 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
/** @var UpdatesOrdersStatus */
private $updatesOrdersStatus;
/** @var CreateNotificationProcessor */
private $createNotificationProcessor;
/**
* ApproveIdentificationDocumentLogic constructor.
* @param CanApproveDocument $canApproveDocument
@@ -58,8 +63,9 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
* @param FetchesDocument $fetchesDocument
* @param UpdatesCompanyStatus $updatesCompanyStatus
* @param UpdatesOrdersStatus $updatesOrdersStatus
* @param CreateNotificationProcessor $createNotificationProcessor
*/
public function __construct(CanApproveDocument $canApproveDocument, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, UpdatesCompanyStatus $updatesCompanyStatus, UpdatesOrdersStatus $updatesOrdersStatus)
public function __construct(CanApproveDocument $canApproveDocument, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, UpdatesCompanyStatus $updatesCompanyStatus, UpdatesOrdersStatus $updatesOrdersStatus, CreateNotificationProcessor $createNotificationProcessor)
{
$this->canApproveDocument = $canApproveDocument;
$this->approvesDocument = $approvesDocument;
@@ -67,6 +73,7 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
$this->fetchesDocument = $fetchesDocument;
$this->updatesCompanyStatus = $updatesCompanyStatus;
$this->updatesOrdersStatus = $updatesOrdersStatus;
$this->createNotificationProcessor = $createNotificationProcessor;
}
/**
@@ -90,6 +97,16 @@ 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);
if($status === 'approve'){
$orders = $this->updatesOrdersStatus->execute($document->owner, ApprovalStatus::APPROVED);
}
@@ -10,6 +10,9 @@ class CompanyConnectionObject implements DataTransferObject
/** @var CompanyModule */
private $invitee;
/** @var CompanyModule */
private $inviter;
/** @var string */
private $inviterReference;
@@ -20,12 +23,14 @@ class CompanyConnectionObject implements DataTransferObject
/**
* CompanyConnectionObject constructor.
* @param CompanyModule $invitee
* @param CompanyModule $inviter
* @param string $inviterReference
* @param string $inviteeReference
*/
public function __construct(CompanyModule $invitee, string $inviterReference, string $inviteeReference)
public function __construct(CompanyModule $invitee, CompanyModule $inviter, string $inviteeReference, string $inviterReference)
{
$this->invitee = $invitee;
$this->inviter = $inviter;
$this->inviterReference = $inviterReference;
$this->inviteeReference = $inviteeReference;
}
@@ -38,6 +43,14 @@ class CompanyConnectionObject implements DataTransferObject
return $this->invitee;
}
/**
* @return CompanyModule
*/
public function getInviter(): CompanyModule
{
return $this->inviter;
}
/**
* @return string
*/
@@ -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;
@@ -30,10 +30,8 @@ class CreatesCompanyConnection extends AbstractUpdateRecord
public function execute(CompanyConnectionObject $object)
{
$companyModule = $this->fetchesCompany->execute(['id', 1])->companyModules()->first();
$connection = new CompanyConnection();
$connection->inviter_id = $companyModule->id;
$connection->inviter_id = $object->getInviter()->id;
$connection->invitee_id = $object->getInvitee()->id;
$connection->inviter_reference = $object->getInviterReference();
$connection->invitee_reference = $object->getInviteeReference();
@@ -0,0 +1,58 @@
<?php
namespace App\Classes\Modules\Delivery\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Orders\Services\CancelsOrder;
use App\Classes\Modules\Orders\Services\FetchesOrder;
use App\Http\Resources\DeliveryOrderResource;
use App\Models\Order;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CancelDeliveryOrderLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification(): array
{
return [
'title' => 'Cancelled Order',
'message' => 'You have successfully cancelled an order'
];
}
/** @var CancelsOrder */
private $cancelsOrder;
/** @var FetchesOrder */
private $fetchesOrder;
/**
* CancelDeliveryOrderLogic constructor.
* @param CancelsOrder $cancelsOrder
* @param FetchesOrder $fetchesOrder
*/
public function __construct(CancelsOrder $cancelsOrder, FetchesOrder $fetchesOrder)
{
$this->cancelsOrder = $cancelsOrder;
$this->fetchesOrder = $fetchesOrder;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function logic(Request $request): JsonResponse
{
/** @var Order $order */
$order = $this->fetchesOrder->execute(['id' => $request->route('id')]);
return $this->resourceResponse(new DeliveryOrderResource($this->cancelsOrder->execute($order)));
}
}
@@ -0,0 +1,150 @@
<?php
namespace App\Classes\Modules\Delivery\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\General\Services\GeneratesInitials;
use App\Classes\Modules\Accounts\Processors\AuthenticationProcessor;
use App\Classes\Modules\Accounts\Processors\CreateUserProcessor;
use App\Classes\Modules\Accounts\Processors\GenerateEmailVerificationAttemptProcessor;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyConnectionObject;
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
use App\Classes\Modules\Documents\Processors\UploadIdentityDocumentProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\CompanyType;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Models\Company;
use App\Models\CompanyModule;
use App\Models\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use Illuminate\Support\Facades\Log;
class CreateDeliveryCustomerLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification(): array
{
return [
'title' => 'Created User',
'message' => 'You have successfully created a new User'
];
}
/** @var CreateUserProcessor */
private $createUserProcessor;
/** @var CreateCompanyProcessor */
private $createCompanyProcessor;
/** @var CreateCompanyModuleProcessor */
private $createCompanyModuleProcessor;
/** @var CreateContactProcessor */
private $createContactProcessor;
/** @var CreatesCompanyConnection */
private $createsCompanyConnection;
/** @var ApprovesCompanyConnection */
private $approvesCompanyConnection;
/** @var AssignEmployeeProcessor */
private $assignEmployeeProcessor;
/** @var UploadIdentityDocumentProcessor */
private $uploadIdentityDocumentProcessor;
/** @var AuthenticationProcessor */
private $authenticationProcessor;
/** @var GenerateEmailVerificationAttemptProcessor */
private $generateEmailVerificationAttemptProcessor;
/** @var FetchesCompanyModule */
private $fetchesCompanyModule;
/**
* CreateDeliveryCustomerLogic constructor.
* @param CreateUserProcessor $createUserProcessor
* @param CreateCompanyProcessor $createCompanyProcessor
* @param CreateCompanyModuleProcessor $createCompanyModuleProcessor
* @param CreateContactProcessor $createContactProcessor
* @param CreatesCompanyConnection $createsCompanyConnection
* @param ApprovesCompanyConnection $approvesCompanyConnection
* @param AssignEmployeeProcessor $assignEmployeeProcessor
* @param UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor
* @param AuthenticationProcessor $authenticationProcessor
* @param GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor
* @param FetchesCompanyModule $fetchesCompanyModule
*/
public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor, FetchesCompanyModule $fetchesCompanyModule)
{
$this->createUserProcessor = $createUserProcessor;
$this->createCompanyProcessor = $createCompanyProcessor;
$this->createCompanyModuleProcessor = $createCompanyModuleProcessor;
$this->createContactProcessor = $createContactProcessor;
$this->createsCompanyConnection = $createsCompanyConnection;
$this->approvesCompanyConnection = $approvesCompanyConnection;
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
$this->uploadIdentityDocumentProcessor = $uploadIdentityDocumentProcessor;
$this->authenticationProcessor = $authenticationProcessor;
$this->generateEmailVerificationAttemptProcessor = $generateEmailVerificationAttemptProcessor;
$this->fetchesCompanyModule = $fetchesCompanyModule;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\AccessUnauthorisedException
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function logic(Request $request): JsonResponse
{
/** @var User $user */
$user = $this->createUserProcessor->execute($request, RoleTypes::USER, !App::environment(['production']) ? ApprovalStatus::APPROVED : ApprovalStatus::PENDING_VERIFICATION);
/** @var Company $company */
$company = $this->createCompanyProcessor->execute($request->input('name'), CompanyType::PERSONAL_BUSINESS, ApprovalStatus::PENDING_SUBMISSION);
$contactObject = new ContactObject($request->input('name'), $request->input('phone'), $request->input('contact_email'), $request->input('wechat_id'));
$this->createContactProcessor->execute($contactObject, $company);
/** @var CompanyModule $companyModule */
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::ONLINE_SELLER);
$inviter = $this->fetchesCompanyModule->execute(['reference'=>'HWT']);
$connectionObject = new CompanyConnectionObject($companyModule, $inviter, mt_rand(1000, 9999).(new GeneratesInitials())->name($company->name)->length(3)->generate(), 'HWT');
$connection = $this->createsCompanyConnection->execute($connectionObject);
$this->approvesCompanyConnection->execute($connection);
$Object = new EmploymentObject($companyModule, $user);
$this->assignEmployeeProcessor->execute($Object);
return $this->response($this->authenticationProcessor->execute($request));
}
}
@@ -0,0 +1,178 @@
<?php
namespace App\Classes\Modules\Delivery\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Classes\Modules\Addresses\Services\CreatesAddress;
use App\Classes\Modules\Addresses\Services\FetchesAddress;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
use App\Classes\Modules\Orders\Services\CreatesOrder;
use App\Classes\Modules\Orders\Services\GeneratesOrderNumber;
use App\Classes\Modules\Orders\Standards\Rules\CanCreateOrder;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Classes\Modules\PackingLists\Services\CreatesPackingList;
use App\Classes\Modules\PackingLists\Services\Packages\CreatesPackage;
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\OrderType;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Http\Resources\DeliveryOrderResource;
use App\Models\Address;
use App\Models\CompanyModule;
use App\Models\Order;
use App\Models\PackingList;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CreateDeliveryOrderLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification(): array
{
return [
'title' => 'Created Order',
'message' => 'You have successfully created a new Order'
];
}
/** @var FetchesCompany */
private $fetchesCompany;
/** @var fetchesAddress */
private $fetchesAddress;
/** @var CanCreateOrder */
private $canCreateOrder;
/** @var CreatesOrder */
private $createsOrder;
/** @var CreatesAddress */
private $createAddress;
/** @var CreateContactProcessor */
private $createContactProcessor;
/** @var CreateRemarkProcessor */
private $createRemarkProcessor;
/** @var GeneratesOrderNumber */
private $generatesOrderNumber;
/** @var CreatesPackingList */
private $createsPackingList;
/** @var CreatesPackage */
private $createsPackage;
/**
* CreateDeliveryOrderLogic constructor.
* @param FetchesCompany $fetchesCompany
* @param FetchesAddress $fetchesAddress
* @param CanCreateOrder $canCreateOrder
* @param CreatesOrder $createsOrder
* @param CreatesAddress $createAddress
* @param CreateContactProcessor $createContactProcessor
* @param CreateRemarkProcessor $createRemarkProcessor
* @param GeneratesOrderNumber $generatesOrderNumber
* @param CreatesPackingList $createsPackingList
* @param CreatesPackage $createPackage
*/
public function __construct(FetchesCompany $fetchesCompany, FetchesAddress $fetchesAddress, CanCreateOrder $canCreateOrder, CreatesOrder $createsOrder, CreatesAddress $createAddress, CreateContactProcessor $createContactProcessor, CreateRemarkProcessor $createRemarkProcessor, GeneratesOrderNumber $generatesOrderNumber, CreatesPackingList $createsPackingList, CreatesPackage $createsPackage)
{
$this->fetchesCompany = $fetchesCompany;
$this->fetchesAddress = $fetchesAddress;
$this->canCreateOrder = $canCreateOrder;
$this->createsOrder = $createsOrder;
$this->createAddress = $createAddress;
$this->createContactProcessor = $createContactProcessor;
$this->createRemarkProcessor = $createRemarkProcessor;
$this->generatesOrderNumber = $generatesOrderNumber;
$this->createsPackingList = $createsPackingList;
$this->createsPackage = $createsPackage;
}
/**
* @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
{
$company = $this->fetchesCompany->execute(['id' => $request->input('company_id')]);
$senderAddress = $this->fetchesAddress->execute(['id' => $request->input('sender_address_id')]);
$deliveryAddress = $this->fetchesAddress->execute(['id' => $request->input('delivery_address_id')]);
/** @var CompanyModule $companyModule */
$companyModule = $company->companyModules()->where('type', BusinessType::ONLINE_SELLER)->first();
$orderObject = new OrderObject($this->generatesOrderNumber->execute('168M', 7), OrderType::LAST_MILE_DELIVERY, ApprovalStatus::APPROVED);
$this->canCreateOrder->passes($orderObject);
/** @var Order $order */
$order = $this->createsOrder->execute($companyModule, $orderObject);
$senderAddressObject = new AddressObject($senderAddress->street_one, $senderAddress->street_two, $senderAddress->country_id, $senderAddress->state_id, $senderAddress->district_id, $senderAddress->postcode, $senderAddress->type, ApprovalStatus::APPROVED, $senderAddress->reference);
$deliveryAddressObject = new AddressObject($deliveryAddress->street_one, $deliveryAddress->street_two, $deliveryAddress->country_id, $deliveryAddress->state_id, $deliveryAddress->district_id, $deliveryAddress->postcode, $deliveryAddress->type, ApprovalStatus::APPROVED, $deliveryAddress->reference);
/** @var Address $orderSenderAddress */
$orderSenderAddress = $this->createAddress->execute($order, $senderAddressObject);
/** @var Address $orderDeliveryAddress */
$orderDeliveryAddress = $this->createAddress->execute($order, $deliveryAddressObject);
$senderContact = $senderAddress->contacts()->first();
$deliveryContact = $deliveryAddress->contacts()->first();
$contactObject = new ContactObject($senderContact->reference, $senderContact->phone, '','');
$this->createContactProcessor->execute($contactObject, $orderSenderAddress);
$contactObject = new ContactObject($deliveryContact->reference, $deliveryContact->phone, '','');
$this->createContactProcessor->execute($contactObject, $orderDeliveryAddress);
$senderRemark = $senderAddress->remarks()->first();
$deliveryRemark = $deliveryAddress->remarks()->first();
if ($senderRemark){
$remarkObject = new RemarkObject($senderRemark->content, Auth()->user()->id);
if($remarkObject->getContent()){
$this->createRemarkProcessor->execute($orderSenderAddress, $remarkObject);
}
}
if ($deliveryRemark){
$remarkObject = new RemarkObject($deliveryRemark->content, Auth()->user()->id);
if($remarkObject->getContent()){
$this->createRemarkProcessor->execute($orderDeliveryAddress, $remarkObject);
}
}
$packingListObject = new PackingListObject($order->reference, $companyModule->id, PackingListType::DELIVERY_PACKING_LIST, ApprovalStatus::PENDING_VERIFICATION);
/** @var PackingList $packingList */
$packingList = $this->createsPackingList->execute($packingListObject, $order);
$packageObject = new PackageObject($request->input('packing_list.type'), $request->input('packing_list.description'), (float) 1, (float) 1, (float) 1, $request->input('packing_list.weight'), (float) $request->input('packing_list.quantity'), ApprovalStatus::APPROVED);
$this->createsPackage->execute($packageObject, $packingList);
return $this->resourceResponse(new DeliveryOrderResource($order));
}
}
@@ -0,0 +1,57 @@
<?php
namespace App\Classes\Modules\Delivery\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Orders\Services\ListsOrders;
use App\Classes\Modules\Orders\Standards\Rules\CanListOrders;
use App\Classes\ValueObjects\Constants\OrderType;
use App\Http\Resources\DeliveryOrderResource;
use App\Http\Resources\OrderResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ListOrdersLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Orders',
'message' => 'You have successfully retrieved a list of Orders'
];
}
/** @var CanListOrders */
private $canListOrders;
/** @var ListsOrders */
private $listsOrders;
/**
* ListOrdersLogic constructor.
* @param CanListOrders $canListOrders
* @param ListsOrders $listsOrders
*/
public function __construct(CanListOrders $canListOrders, ListsOrders $listsOrders)
{
$this->canListOrders = $canListOrders;
$this->listsOrders = $listsOrders;
}
public function logic(Request $request) : JsonResponse
{
$this->canListOrders->passes();
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true, 'type_in' => [OrderType::LAST_MILE_DELIVERY]]));
return $this->collectionResponse(DeliveryOrderResource::collection($query));
}
}
@@ -0,0 +1,73 @@
<?php
namespace App\Classes\Modules\Exports\Services;
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 ExportsArrivedParcel implements WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, FromQuery
{
use Exportable;
public function headings(): array
{
return [
'ORDER NUMBER',
'Marking',
'Warehouse',
'Cbm',
'Description',
'quantity',
'Received Date',
'Remarks'
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function query()
{
return PackingList::where('type', '=', 1)->where('status', '=', 2)->where('owner_type', Order::class);
}
/**
* @param $packingList
* @return array
*/
public function map($packingList): array
{
$order = $packingList->owner;
$connection = $order->companyModule()->first()->inviters()->withPivot('invitee_reference')->first();
$marking = $connection ? $connection->pivot->invitee_reference:'';
$warehouse = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee;
$cbm = $packingList->packages->sum(function($package){
return (($package->width / 100) * ($package->height / 100) * ($package->length / 100)) * $package->quantity;
});
$arrival_date = $packingList->transports()->first()->drop_date->format('d-m-Y');
return [
$packingList->owner->reference,
$marking,
$warehouse->reference,
$cbm,
$packingList->packages->implode('description', ', '),
$packingList->packages->sum('quantity'),
$arrival_date,
''
];
}
}
@@ -0,0 +1,91 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Models\Container;
use App\Models\Package;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Carbon\Carbon;
class ExportsCompanyModuleSummary implements FromCollection, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
{
use Exportable;
protected $companyModuleId, $containerIds;
public function headings(): array
{
return [
'Date',
'Full Marking',
'Container',
'Description',
'Ctns',
'L (cm)',
'H (cm)',
'W (cm)',
'CBM'
];
}
public function setParameters($companyModuleId, $containerIds)
{
$this->companyModuleId = $companyModuleId;
$this->containerIds = $containerIds;
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function collection()
{
$packagesArray = collect();
$containers = Container::whereIn('reference', explode(',', $this->containerIds))->get();
foreach ($containers as $container){
$company_module_id = $this->companyModuleId;
$packingLists = $container->packingLists()->get()->filter(function ($packingList) use ($company_module_id) {
return $packingList->owner->company_module_id == $company_module_id;
});
foreach ($packingLists as $packingList){
if($packingList->packingLists->first()){
$packingList = $packingList->packingLists->first();
}
$packages = $packingList->packages;
foreach ($packages as $package){
$packagesArray->push($package);
}
}
}
return $packagesArray;
}
/**
* @param Package $package
*
* @return array
*/
public function map($package): array
{
$connection = $package->packingList->owner->companyModule->inviters()->withPivot('invitee_reference')->first();
$marking = $connection ? $connection->pivot->invitee_reference:'';
return [
Carbon::parse($package->created_at)->format('d-m-Y'),
$marking,
$package->packingList->containers()->first()->reference,
$package->description,
$package->quantity,
$package->length,
$package->height,
$package->width,
((($package->length / 100) * ($package->height / 100) * ($package->width / 100)) * $package->quantity)
];
}
}
@@ -0,0 +1,120 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\OrderType;
use App\Classes\ValueObjects\Constants\PackageType;
use App\Models\Order;
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 Maatwebsite\Excel\Concerns\WithTitle;
class ExportsDeliveryOrders implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, WithTitle
{
use Exportable;
private $request;
public function __construct(Request $request)
{
$this->request = $request;
}
public function headings(): array
{
return [
'Types_Of_Services',
'Service_Type',
'Sender_Name',
'Sender_Company_Name',
'Sender_Building_Unit',
'Sender_Address',
'Sender_Address_2',
'Sender_Postal_Code',
'Sender_Phone_Number',
'Delivery_Name',
'Delivery Company Name',
'Delivery_Building_Unit',
'Delivery_Address',
'Delivery_Address_2',
'Delivery_Postal_Code',
'Delivery_Phone_Number',
'Shipment_Type',
'Mode',
'Pickup_Address_Type',
'Reference_Number',
'Quantity',
'Weight',
'Length',
'Width',
'Height',
'COD_Amount',
'DO_Numbers'
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function query()
{
$selectedIds = array_map(function($value){
return ['id' => $value];
}, json_decode($this->request->input('ids')));
return Order::where('type', OrderType::LAST_MILE_DELIVERY)->whereIn('id', $selectedIds);
}
public function title(): string
{
return 'bulk-shipment';
}
/**
* @param Order $order
*
* @return array
*/
public function map($order): array
{
$senderAddress = $order->addresses()->where('type', AddressType::PICK_UP)->first();
$deliveryAddress = $order->addresses()->where('type', AddressType::DELIVERY)->first();
$package = $order->packingLists()->first()->packages()->first();
return [
'Domestic Shipment',
'ST00000020',
$senderAddress->contacts()->first()->reference,
$senderAddress->reference ? $senderAddress->reference : $order->companyModule->name,
$senderAddress->street_one,
$senderAddress->street_two.' '.$senderAddress->district->name.' '.$senderAddress->postcode.' '.$senderAddress->state->name.' '.$senderAddress->country->name,
'',
$senderAddress->postcode,
$senderAddress->contacts()->first()->phone,
$deliveryAddress->contacts()->first()->reference,
$deliveryAddress->reference,
$deliveryAddress->street_one,
$deliveryAddress->street_two.' '.$deliveryAddress->district->name.' '.$deliveryAddress->postcode.' '.$deliveryAddress->state->name.' '.$deliveryAddress->country->name,
'',
$deliveryAddress->postcode,
$deliveryAddress->contacts()->first()->phone,
$package->type === PackageType::CARTON ? 'Package' : ($package->type === PackageType::PALLET ? 'Pallet' : 'Documents'),
'Pick Up',
'Default',
$order->reference,
$package->quantity,
$package->weight * $package->quantity,
1,
1,
1,
'',
''
];
}
}
@@ -0,0 +1,74 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\FromCollection;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Concerns\WithTitle;
class ExportsDeliveryValidValues implements WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, WithTitle, FromCollection
{
use Exportable;
private $request;
/**
* ExportsDeliveryValidValues constructor.
* @param Request $request
*/
public function __construct(Request $request)
{
$this->request = $request;
}
public function headings(): array
{
return [
'Types_Of_Services',
'Service_Type',
'Mode',
'Flag',
'Pickup Address'
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function collection()
{
$returnArray = collect();
$returnArray->push(['Domestic Shipment', 'Package', 'Pick Up', 'Yes', 'Default']);
$returnArray->push(['', 'Documents', 'Lodge In / Walk In', 'No', 'Sender']);
$returnArray->push(['', 'Pallet', '', '', '']);
return $returnArray;
}
public function title(): string
{
return 'valid-values';
}
/**
* @param ReturnArray $returnArray
*
* @return array
*/
public function map($returnArray): array
{
return [
$returnArray[0],
$returnArray[1],
$returnArray[2],
$returnArray[3],
$returnArray[4],
];
}
}
@@ -0,0 +1,38 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\Modules\Exports\Services\ExportsDeliveryOrders;
use App\Classes\Modules\Exports\Services\ExportsDeliveryValidValues;
use App\Models\Order;
use Maatwebsite\Excel\Concerns\Exportable;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
class ExportsMultipleDeliveryOrders implements WithMultipleSheets
{
use Exportable;
protected $request;
/**
* ExportsMultipleDeliveryOrders constructor.
* @param Request $request
*/
public function __construct(Request $request)
{
$this->request = $request;
}
/**
* @return array
*/
public function sheets(): array
{
$sheets = [];
$sheets[] = new ExportsDeliveryOrders($this->request);
$sheets[] = new ExportsDeliveryValidValues($this->request);
return $sheets;
}
}
@@ -0,0 +1,61 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Order;
use App\Models\PackingList;
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 Carbon\Carbon;
class ExportsOnHoldPackingList implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
{
use Exportable;
public function headings(): array
{
return [
'Container Ref.',
'ETA',
'Unstuffing',
'Marking',
'Order Number'
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function query()
{
return PackingList::where('type', '=', 2)->whereIn('status', [4, 5])->whereHas('containers');
}
/**
* @param PackingList $packingList
*
* @return array
*/
public function map($packingList): array
{
$container = $packingList->containers()->first();
$ContainerTransport = $container->transports()->first();
$order = $packingList->owner;
if(!$order instanceof Order)return [];
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
return [
$container->reference,
$ContainerTransport ? $ContainerTransport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->eta : 'n/a',
$ContainerTransport ? $ContainerTransport->drop_date : 'n/a',
$marking,
$order->reference,
];
}
}
@@ -20,16 +20,20 @@ class ExportsPendingArrangementDeliveryList implements FromQuery, WithHeadings,
public function headings(): array
{
return [
'Order Number',
'Container Ref.',
'ETA',
'Unstuffing',
'Marking',
'Order Number',
'status',
'Delay Days / delivery date',
'Quantity',
'Remark',
'Contact Person Name',
'Contact Number',
'Delivery Date',
'Delivery Address',
'Delivery State',
'Delivery Postcode'
'State',
'Postcode',
'Address',
'PIC',
'Phone',
'Remark'
];
}
@@ -40,7 +44,7 @@ class ExportsPendingArrangementDeliveryList implements FromQuery, WithHeadings,
{
return PackingList::where('type', '=', 2)->whereHas('containers', function ($query){
$query->where('containers.status', ApprovalStatus::COMPLETED);
})->whereDoesntHave('transports');
});
}
/**
@@ -50,26 +54,32 @@ class ExportsPendingArrangementDeliveryList implements FromQuery, WithHeadings,
*/
public function map($packingList): array
{
$container = $packingList->containers()->first();
$ContainerTransport = $container->transports()->first();
$order = $packingList->owner;
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
$defaultAddress = $order->companyModule->addresses()->defaultAddress()->first();
$defaultAddress = $defaultAddress ? $defaultAddress : $order->companyModule->addresses()->first();
$address = $defaultAddress->street_one.', '.$defaultAddress->street_two.' '.$defaultAddress->district->name.' '.$defaultAddress->postcode.' '.$defaultAddress->state->name.' '.$defaultAddress->country->name;
$contacts = $defaultAddress->contacts->first() ? $defaultAddress->contacts->first(): '';
$inviter = $order->companyModule ? $order->companyModule->inviters()->withPivot('invitee_reference')->first() : null;
$marking = $inviter ? $inviter->pivot->invitee_reference : 'Unclaimed';
$address = $order->addresses()->where('status', ApprovalStatus::APPROVED)->first();
$contacts = $address->contacts->first() ? $address->contacts->first(): '';
$originalPackingList = $packingList->owner instanceof PackingList ? $packingList->owner : $packingList;
$transport = $originalPackingList->containers()->first()->transports()->first();
$deliveryTransport = $originalPackingList->transports()->first();
return [
$order->reference,
$container->reference,
$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' : ''),
$packingList->packages()->sum('quantity'),
$defaultAddress->remarks->first() ? $defaultAddress->remarks->first()->content: '',
$address->state->name,
$address->postcode,
$address->street_one.', '.$address->street_two.' '.$address->district->name.' '.$address->postcode.' '.$address->state->name.' '.$address->country->name,
$address->remarks->first() ? $address->remarks->first()->content: '',
$contacts ? $contacts ->reference : '',
$contacts ? $contacts ->phone : '',
$transport ? Carbon::now()->diffInDays($transport->drop_date, false) . ' Days' : '',
$address,
$defaultAddress->state->name,
$defaultAddress->postcode
];
}
}
@@ -0,0 +1,61 @@
<?php
namespace App\Classes\Modules\Notifications\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Notifications\Services\ListsNotification;
use App\Http\Resources\NotificationResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ListNotificationsLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieve Notifications',
'message' => 'You have successfully retrieved a list of Notifications'
];
}
/** @var ListsNotification */
private $listsNotification;
/**
* ListNotificationsLogic constructor.
* @param ListsNotification $listsNotification
*/
public function __construct(
ListsNotification $listsNotification
)
{
$this->listsNotification = $listsNotification;
}
/**
* @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
{
$filters = [
// 'target_id'=>auth()->user()->id,
// 'per_page'=>$request->route('per_page')
];
$notifications = $this->listsNotification->execute($filters);
return $this->collectionResponse(NotificationResource::collection($notifications));
}
}
@@ -0,0 +1,33 @@
<?php
namespace App\Classes\Modules\Notifications\Services;
use App\Classes\General\Eloquent\AbstractListRecord;
use Illuminate\Database\Eloquent\Builder;
use App\Models\Notification;
class ListsNotification extends AbstractListRecord
{
/** @var Bank */
private $repository;
/**
* ListsBank constructor.
* @param Notification $repository
*/
public function __construct(Notification $repository)
{
$this->repository = $repository;
}
/**
* @return Builder
*/
function getRepository(): Builder
{
return $this->repository->newQuery();
}
}
@@ -6,6 +6,7 @@ namespace App\Classes\Modules\Orders\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Orders\Services\ListsOrders;
use App\Classes\Modules\Orders\Standards\Rules\CanListOrders;
use App\Classes\ValueObjects\Constants\OrderType;
use App\Http\Resources\OrderResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
@@ -44,7 +45,7 @@ class ListOrdersLogic extends AbstractControllerLogic
{
$this->canListOrders->passes();
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true]));
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true, 'type_in' => [OrderType::SHARED_CONTAINER, OrderType::DEDICATED_CONTAINER]]));
return $this->collectionResponse(OrderResource::collection($query));
@@ -9,7 +9,7 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus;
class OrderObject implements DataTransferObject
{
/** @var int */
/** @var string */
private $reference;
/** @var int */
@@ -20,11 +20,11 @@ class OrderObject implements DataTransferObject
/**
* OrderObject constructor.
* @param int $reference
* @param string $reference
* @param int $type
* @param int|null $status
*/
public function __construct(int $reference, int $type, ?int $status = ApprovalStatus::PENDING_VERIFICATION)
public function __construct(string $reference, int $type, ?int $status)
{
$this->reference = $reference;
$this->type = $type;
@@ -32,9 +32,9 @@ class OrderObject implements DataTransferObject
}
/**
* @return int
* @return string
*/
public function getReference(): int
public function getReference(): string
{
return $this->reference;
}
@@ -48,12 +48,13 @@ class OrderObject implements DataTransferObject
}
/**
* @return int
* @return int|null
*/
public function getStatus(): int
public function getStatus(): ?int
{
return $this->status;
}
}
@@ -84,7 +84,7 @@ class CreateOrderProcessor
/** @var Order $order */
$order = $this->createsOrder->execute($importer, $orderObject);
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode,$address->reference);
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode, $address->type, ApprovalStatus::APPROVED, $address->reference);
/** @var Address $order_address */
$order_address = $this->createAddress->execute($order, $addressObject);
@@ -8,6 +8,7 @@ use App\Classes\Modules\Addresses\Services\CreatesAddress;
use App\Classes\Modules\Addresses\Services\FetchesAddress;
use App\Classes\Modules\Addresses\Services\DeletesAddress;
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
@@ -76,7 +77,7 @@ class RequestChangeOrderAddressProcessor
}
$address = $this->fetchesAddress->execute(['id' => $request->get('address_id')]);
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode, $address->reference, ApprovalStatus::PENDING_VERIFICATION);
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode, AddressType::DELIVERY, ApprovalStatus::PENDING_VERIFICATION, $address->reference);
$order_address = $this->createsAddress->execute($order, $addressObject);
$contact = $address->contacts()->first();
@@ -21,7 +21,7 @@ class ChecksIfOrderNumberExists
$this->repository = $repository;
}
public function execute(int $orderNumber): bool {
public function execute(string $orderNumber): bool {
return $this->repository->where('reference', $orderNumber)->exists();
}
@@ -20,11 +20,13 @@ class GeneratesOrderNumber
/**
* @return int
* @param null|string $prefix
* @param int|null $length
* @return string
*/
public function execute(): int {
public function execute(?string $prefix = '', ?int $length = 9): string {
$reference = rand(100000001, 999999999);
$reference = $prefix.rand((int)('1'.str_repeat(0, $length - 2).'1'), (int) str_repeat(9, $length));
return !$this->checkIfOrderNumberExists->execute($reference) ? $reference : self::execute();
}
@@ -2,6 +2,7 @@
namespace App\Classes\Modules\PackingLists\ControllersLogic;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\Orders\Services\FetchesOrder;
@@ -134,20 +135,25 @@ class AssignPackingListOrderLogic extends AbstractControllerLogic
$this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations);
$packing_list = $this->fetchesPackingList->execute([
'reference' => $warehouse_packing_list->reference,
'type' => PackingListType::SHIPPING_PACKING_LIST
]);
try {
$packing_list = $this->fetchesPackingList->execute([
'reference' => $warehouse_packing_list->reference,
'type' => PackingListType::SHIPPING_PACKING_LIST
]);
$warehouse_packing_list = $this->updatesPackingListOwner->execute($packing_list, $order);
$this->updatesPackingListContractReference->execute($packing_list, $contractReference);
$warehouse_packing_list = $this->updatesPackingListOwner->execute($packing_list, $order);
$this->updatesPackingListContractReference->execute($packing_list, $contractReference);
foreach($contractObligations as $obligation) {
$stepObject = new StepsObject($order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->id, $obligation->reference, $obligation->sequence, $obligation->hash_id);
$this->createsStep->execute($packing_list, $stepObject);
}
} catch (ResourceNotFoundException $exception) {
foreach($contractObligations as $obligation) {
$stepObject = new StepsObject($order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->id, $obligation->reference, $obligation->sequence, $obligation->hash_id);
$this->createsStep->execute($packing_list, $stepObject);
}
return $this->resourceResponse(new PackingListResource($warehouse_packing_list));
}
}
@@ -7,6 +7,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
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 ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -58,9 +59,11 @@ class DeletePackingListLogic extends AbstractControllerLogic
$this->canDeletePackingList->passes();
$query = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
$warehouseList = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
$packingList = $this->fetchesPackingList->execute(['reference' => $warehouseList->reference, 'type' => PackingListType::SHIPPING_PACKING_LIST]);
$this->deletesPackingList->execute($query);
$this->deletesPackingList->execute($warehouseList);
$this->deletesPackingList->execute($packingList);
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,51 +39,57 @@ 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
{
try {
$packing_list = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
$packing_list = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
$transport = $packing_list->transports()->first();
$transport = $packing_list->transports()->first();
$old_sechedule = $transport->schedules()->first();
$this->updatesScheduleStatus->execute($old_sechedule, ApprovalStatus::REJECTED);
$scheduleObject = new ScheduleObject(
Carbon::parse($request->input('eta')),
Carbon::parse($request->input('etd')),
ApprovalStatus::APPROVED
);
$schedule = $this->createsSchedule->execute($transport, $scheduleObject);
return $this->resourceResponse(new PackingListResource($packing_list));
} catch (\Exception $exception){
throw new ErrorException($exception->getMessage(), $exception->getCode());
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);
}
$transport->schedules()->update([
'status' => ApprovalStatus::REJECTED
]);
$scheduleObject = new ScheduleObject(
Carbon::parse($request->input('eta')),
Carbon::parse($request->input('etd')),
ApprovalStatus::APPROVED
);
$schedule = $this->createsSchedule->execute($transport, $scheduleObject);
return $this->resourceResponse(new PackingListResource($packing_list));
}
}
@@ -6,6 +6,8 @@ namespace App\Classes\Modules\PackingLists\Processors;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
use App\Classes\Modules\PackingLists\Services\Packages\CreatesPackage;
use App\Classes\Modules\PackingLists\Standards\Rules\Packages\CanCreatePackage;
use App\Classes\ValueObjects\Constants\WarehouseReferences;
use App\Models\Order;
use App\Models\PackingList;
class CreatePackageProcessor
@@ -48,6 +50,11 @@ class CreatePackageProcessor
if($replica) {
$modificationValue = 1;
if($replica->owner->owner instanceof Order){
$modificationValue = in_array( $replica->owner->owner->companyModule->id, WarehouseReferences::REPLICA_WHITE_LIST) ? 0 : 1;
}
$packageObject = new PackageObject($object->getType(), $object->getDescription(), $object->getWidth() + $modificationValue, $object->getHeight() + $modificationValue, $object->getLength() + $modificationValue, $object->getWeight(), $object->getQuantity(), $object->getStatus());
$package = $this->createsPackage->execute($packageObject, $replica);
}
@@ -10,7 +10,10 @@ use App\Classes\Modules\PackingLists\Standards\Rules\CanCreatePackingList;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\WarehouseReferences;
use App\Models\Order;
use App\Models\PackingList;
use function PHPUnit\Framework\isInstanceOf;
class CreatePackingListProcessor
{
@@ -51,6 +54,7 @@ class CreatePackingListProcessor
$appointee_id = $packingList->owner_id == 1 ? 2037 : $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
$type = $object->getType() === PackingListType::SHIPPING_PACKING_LIST ? PackingListType::SHIPPING_PACKING_LIST_REPLICA : PackingListType::WAREHOUSE_RECEIVE_LIST_REPLICA;
/** create packing list replica */
$object = new PackingListObject($object->getReference().'_01', $appointee_id, $type, ApprovalStatus::PENDING_SUBMISSION);
$this->createsPackingList->execute($object, $packingList);
@@ -91,7 +91,6 @@ class FetchDeliveryListFromVTPortalProcessor
$deliveryStep->update(['status' => ApprovalStatus::COMPLETED]);
} catch (GuzzleException $exception) {
dd($exception);
continue;
}
@@ -7,12 +7,15 @@ use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\Orders\Services\FetchesDataFromVTPortal;
use App\Classes\Modules\Orders\Services\FetchesOrder;
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\Services\Containers\FetchesContainer;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
use App\Classes\Modules\Steps\Services\CreatesStep;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Classes\Modules\Transports\Services\CreatesTransport;
use App\Classes\Modules\Unity\Processors\ActivateContractProcessor;
use App\Classes\Modules\Unity\Processors\AssignContractEntityProcessor;
@@ -21,10 +24,13 @@ use App\Classes\Modules\Unity\Services\CreatesContract;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\ContainerTypes;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Models\Order;
use App\Models\PackingList;
use App\Models\Transport;
use Carbon\Carbon;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\DB;
@@ -124,9 +130,8 @@ class FetchLoadedContainersFromVTPortalProcessor
*/
public function execute(?Carbon $start = null, ?Carbon $end = null){
DB::beginTransaction();
try {
$start = $start ? $start : Carbon::now()->subDays(10);
$start = $start ? $start : Carbon::today()->subDays(5);
$startLimit = Carbon::parse('11-08-2021');
@@ -134,80 +139,162 @@ class FetchLoadedContainersFromVTPortalProcessor
$start = $startLimit;
}
$end = $end ? $end : Carbon::now();
$end = $end ? $end : Carbon::today()->addDay();
$filter = '["LoadedTime:$between$%js%\"'.$start->format('Y-m-d').'T00:00:00.000\"$and$%js%\"'.$end->format('Y-m-d').'T00:00:00.000\"\u0000"]';
$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[11].'"]';
$containerDetailRequest = $this->fetchesDataFRomVTPortal->clientRequest('http://portal.vtnation.com.my/Services/DataControllerService.asmx/GetPage', 'POST', json_decode('{"controller":"VPodetailparcel","view":"grid1","request":{"PageIndex":-1,"PageSize":10000,"SortExpression":"CreatedOn asc","Filter":'.$filter.'}}'), '');
$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.'}}'), '');
$containerDetail = $this->fetchesDataFRomVTPortal->getResponseBody($containerDetailRequest);
$containerObject = new ContainerObject($container[0], str_replace(' ', '', $container[24]), str_replace(' ', '', $container[15]), ContainerTypes::FORTY_FEET_DRY_CONTAINER, Carbon::parse($container[5]), ApprovalStatus::PENDING_VERIFICATION);
$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){
$warehouseId = $container[12];
$warehouseId = $container[13];
$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);
$delayDate = $containerInfo[7];
$containerStatus = $containerInfo[10];
$unstuffingDate = $containerInfo[8];
$transport = $container->transports()->first();
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);
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $eta, ApprovalStatus::APPROVED));
}
if($delayDate){
$delayDate = Carbon::parse($delayDate);
$transport = $container->transports()->first();
if(!$transport->schedules()->where('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));
}
}
if($containerStatus === 'Unstuffing'){
$container->update(['status' => ApprovalStatus::COMPLETED]);
$container->transports()->first()->update(['drop_date' => Carbon::parse($unstuffingDate)->subDay(), 'status' => ApprovalStatus::COMPLETED]);
/** @var PackingList $packingList */
foreach($container->packingLists as $packingList){
if($packingList->status === ApprovalStatus::PENDING_VERIFICATION){
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
}
}
}
foreach($containerDetail->Rows as $packingList){
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $packingList[13]));
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $packingList[39]));
$orderNumber = $marking[array_key_last($marking)];
if(!$packingList[22]){
if(!$packingList[11]){
continue;
}
$allow_contract = true;
try {
/** @var Order $order */
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
} catch (ResourceNotFoundException $exception){
continue;
$warehousePackingList = $this->fetchesPackingList->execute(['reference' => $packingList[3]]);
if(!$warehousePackingList->owner instanceof Order) throw new ResourceNotFoundException;
$order = $warehousePackingList->owner;
} catch (ResourceNotFoundException $exception) {
try {
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
} catch (ResourceNotFoundException $exception) {
try {
$order = $this->fetchesOrder->execute(['reference' => substr($orderNumber, -9)]);
} catch (ResourceNotFoundException $exception) {
$order = $this->fetchesCompanyModule->execute(['id' => 1]);
$allow_contract = false;
}
}
}
$packingListReference = $packingList[16];
try{
$this->fetchesPackingList->execute(['reference' => $packingListReference]);
$packingListReference = $packingList[3];
$package = $packingList;
$deliveryDate = $package[1] ? Carbon::parse($package[1]) : null;
try {
$packingList = $this->fetchesPackingList->execute(['reference' => $packingListReference, 'type' => PackingListType::SHIPPING_PACKING_LIST]);
} catch (ResourceNotFoundException $exception){
$contract = $this->unityCreateContract->execute();
$contractReference = $contract->hash_id;
$contractObligations = $contract->contract_obligation_list;
if ($allow_contract) {
$appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
// $contract = $this->unityCreateContract->execute();
// $contractReference = $contract->hash_id;
// $contractObligations = $contract->contract_obligation_list;
//
// $this->unityActivateContract->execute($contractReference);
//
// $supervisorHashId = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->unity_hash_id;
//
// $supervisorContractEntity = $this->unityCreateContractEntity->execute($contractReference, $supervisorHashId);
// $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->update(['entity_hash_id' => $supervisorContractEntity->hash_id, 'entity_signature' => $supervisorContractEntity->entity_signature_hash_id]);
//
// $importerContractEntity = $this->unityCreateContractEntity->execute($contractReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->appointee->unity_hash_id);
// $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->update(['entity_hash_id' => $importerContractEntity->hash_id, 'entity_signature' => $importerContractEntity->entity_signature_hash_id]);
//
// $this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations);
} else {
$appointee_id = 2037;
}
$this->unityActivateContract->execute($contractReference);
$supervisorHashId = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->unity_hash_id;
$supervisorContractEntity = $this->unityCreateContractEntity->execute($contractReference, $supervisorHashId);
$order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->update(['entity_hash_id' => $supervisorContractEntity->hash_id, 'entity_signature' => $supervisorContractEntity->entity_signature_hash_id]);
$importerContractEntity = $this->unityCreateContractEntity->execute($contractReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->appointee->unity_hash_id);
$order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->update(['entity_hash_id' => $importerContractEntity->hash_id, 'entity_signature' => $importerContractEntity->entity_signature_hash_id]);
$this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations);
$connection = $order->companyModule->connections()->first();
$marking = $connection->invitee_reference;
$packingListObject = new PackingListObject($packingListReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::SUSPENDED, $contractReference);
$packingListObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::SUSPENDED, null);
/** @var PackingList $packingList */
$packingList = $this->createPackingListProcessor->execute($packingListObject, $order);
$container->packingLists()->attach($packingList);
}
foreach($contractObligations as $obligation) {
$stepObject = new StepsObject($order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->id, $obligation->reference, $obligation->sequence, $obligation->hash_id);
$this->createsStep->execute($packingList, $stepObject);
$container->packingLists()->detach($packingList);
$container->packingLists()->attach($packingList);
$packingList->packages()->delete();
$replica = $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
if($replica) $replica->packages()->delete();
$packageObject = new PackageObject(PackageType::CARTON, $package[8], $package[21], $package[22], $package[20], 0, $package[11], ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $packingList);
if($containerStatus === 'Unstuffing'){
$packingList->transports()->delete();
if($deliveryDate) {
// && !$packingList->transports()->exists()
$packingList->status = ApprovalStatus::COMPLETED;
$packingList->save();
$transportObject = new TransportObject(TransportType::LAND, null, null, $deliveryDate, $deliveryDate, ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($transportObject, $packingList);
$this->createsSchedule->execute($transport, new ScheduleObject($deliveryDate, $deliveryDate, ApprovalStatus::APPROVED));
}
}
}
@@ -217,8 +304,6 @@ class FetchLoadedContainersFromVTPortalProcessor
Log::error($exception);
}
DB::commit();
return [];
}
@@ -132,11 +132,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::now()->subMonths(2);
$start = $start ? $start : Carbon::today()->subMonths(1);
$startLimit = Carbon::parse('01-12-2021');
@@ -144,7 +145,7 @@ class FetchOrderListsFromYdPortalProcessor
$start = $startLimit;
}
$end = $end ? $end : Carbon::now();
$end = $end ? $end : Carbon::today()->addDay();
$orderRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/GetOrderList.ashx', 'GET', [
'begintime' => $start->timestamp,
@@ -154,6 +155,7 @@ class FetchOrderListsFromYdPortalProcessor
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
foreach($rows->data as $row){
$containerReference = null;
$loadingDate = null;
$unstuffingDate = null;
@@ -169,7 +171,6 @@ class FetchOrderListsFromYdPortalProcessor
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
if(!$rows){
Log::debug($row->expressno);
continue;
}
@@ -202,6 +203,7 @@ class FetchOrderListsFromYdPortalProcessor
}
$rescheduleDate = $dates->sortDesc()->first();
if(!$delayDate || $rescheduleDate > $delayDate){
/** @var Carbon $delayDate */
$delayDate = $rescheduleDate;
@@ -213,20 +215,38 @@ 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, ['派送中', '签收完成', ' 第三方提货', '货物已派送完成'])) {
$deliveryDate = Carbon::parse($trackingRow->trackingtime);
}
}
$client = new \GuzzleHttp\Client(['cookies' => true, 'headers' => ['Cookie' => 'utc_offset=480']]);
$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;
}
}
$customerno = preg_split('(-|\(|\)|\/)', $row->customerno);
$orderNumber = $customerno[array_key_last($customerno)];
@@ -244,8 +264,6 @@ class FetchOrderListsFromYdPortalProcessor
}
DB::beginTransaction();
$packingListReference = $row->expressno;
try{
@@ -333,7 +351,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, ['2192KAA', '2353GFE', '6866DTR', '153DSR', '1291NSC', '8288MIB', '1152AAT', '962LOW', '3992WHE', '1290CSW', '9493TYS', '3397GSH'])){
$this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/confirmsendorder.ashx', 'GET', [
'expressno' => $row->expressno
]);
@@ -398,11 +416,14 @@ class FetchOrderListsFromYdPortalProcessor
$packingList->save();
}
$signature = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->entity_sigiture;
foreach($packingList->steps()->where('reference', '!=', 'DELIVERY')->get() as $step){
$this->updatesContractObligations->execute($signature, $step->obligation_hash_id);
$step->update(['status' => ApprovalStatus::COMPLETED]);
if ($allow_contract) {
$signature = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->entity_sigiture;
foreach($packingList->steps()->where('reference', '!=', 'DELIVERY')->get() as $step){
$this->updatesContractObligations->execute($signature, $step->obligation_hash_id);
$step->update(['status' => ApprovalStatus::COMPLETED]);
}
}
}
}
}
@@ -417,13 +438,16 @@ class FetchOrderListsFromYdPortalProcessor
$transport = $this->createsTransport->execute($transportObject, $packingList);
$this->createsSchedule->execute($transport, new ScheduleObject($deliveryDate, $deliveryDate, ApprovalStatus::APPROVED));
$deliveryStep = $packingList->steps()->where('reference', '=', 'LAST_MILE_DELIVERY')->first();
$signature = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->entity_sigiture;
$this->updatesContractObligations->execute($signature, $deliveryStep->obligation_hash_id);
$deliveryStep->update(['status' => ApprovalStatus::COMPLETED]);
if ($allow_contract) {
$deliveryStep = $packingList->steps()->where('reference', '=', 'LAST_MILE_DELIVERY')->first();
$signature = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->entity_sigiture;
$this->updatesContractObligations->execute($signature, $deliveryStep->obligation_hash_id);
$deliveryStep->update(['status' => ApprovalStatus::COMPLETED]);
}
}
DB::commit();
echo 'successful';
}
@@ -46,42 +46,32 @@ class FetchPackingListFromVTPortalProcessor
*/
public function execute(){
$packingLists = PackingList::where('type', '=', PackingListType::SHIPPING_PACKING_LIST)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::SUSPENDED])->whereDoesntHave('containers', function($query){
$packingLists = PackingList::where('type', '=', PackingListType::SHIPPING_PACKING_LIST)->where('reference', 'not like', '%PO%')->whereIn('claimant_id', [2])->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::SUSPENDED])->whereDoesntHave('containers', function($query){
$query->where('status', '=', ApprovalStatus::COMPLETED);
})->get();
})->limit(10)->get();
DB::beginTransaction();
foreach($packingLists as $packingList){
try {
$filter = '["PoID:=%js%'.$packingList->reference.'"]';
$filter = '["PoNumber:=%js%\"'.$packingList->reference.'\"\u0000"]';
$shippingPackingListsRequest = $this->fetchesDataFRomVTPortal->clientRequest('http://portal.vtnation.com.my/Services/DataControllerService.asmx/GetPage', 'POST', json_decode('{"controller":"VPodetailparcel","view":"grid1","request":{"PageIndex":-1,"PageSize":10000,"SortExpression":"CreatedOn asc","Filter":'.$filter.'}}'), '');
$shippingPackingListsRequest = $this->fetchesDataFRomVTPortal->clientRequest('http://portal.vtnation.com.my/Services/DataControllerService.asmx/GetPage', 'POST', json_decode('{"controller":"Po","view":"grid1","request":{"PageIndex":-1,"PageSize":1000,"Filter":'.$filter.'}}'), '');
$shippingPackingLists = $this->fetchesDataFRomVTPortal->getResponseBody($shippingPackingListsRequest);
if(count($shippingPackingLists->Rows)) {
$packingList->packages()->delete();
$replica = $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
if($replica) $replica->packages()->delete();
foreach($shippingPackingLists->Rows as $shippingPackingList){
if(!$shippingPackingList[22]) {
continue;
}
$packageObject = new PackageObject(PackageType::CARTON, $shippingPackingList[19], $shippingPackingList[31], $shippingPackingList[30], $shippingPackingList[29], 0, $shippingPackingList[22], ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $packingList);
}
} else {
dump($packingList->reference);
}
} catch (GuzzleException $exception) {
dd($exception);
Log::error($exception);
continue;
}
}
DB::commit();
return [];
@@ -116,7 +116,7 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
try {
$start = $start ? $start : Carbon::now()->subMonth();
$start = $start ? $start : Carbon::today()->subDays(5);
$startLimit = Carbon::parse('11-08-2021');
@@ -124,76 +124,40 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
$start = $startLimit;
}
$end = $end ? $end : Carbon::now();
$end = $end ? $end : Carbon::today()->addDay();
$filter = '["ParcelDate:$between$%js%\"'.$start->format('Y-m-d').'T00:00:00.000\"$and$%js%\"'.$end->format('Y-m-d').'T00:00:00.000\"\u0000"]';
$warehouseListRequest = $this->fetchesDataFRomVTPortal->clientRequest('http://portal.vtnation.com.my/Services/DataControllerService.asmx/GetPage', 'POST', json_decode('{"controller":"WarehouseList","view":"grid1","request":{"PageIndex":-1,"PageSize":10000,"SortExpression":"ParcelDate asc","Filter":'.$filter.'}}'), '');
$warehouseListRequest = $this->fetchesDataFRomVTPortal->clientRequest('http://portal.vtnation.com.my/Services/DataControllerService.asmx/GetPage', 'POST', json_decode('{"controller":"Parcel","view":"grid1","request":{"PageIndex":-1,"PageSize":10000,"SortExpression":"ParcelDate asc","Filter":'.$filter.'}}'), '');
$response = $this->fetchesDataFRomVTPortal->getResponseBody($warehouseListRequest);
foreach ($response->Rows as $parcel){
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $parcel[5]));
$allow_contract = true;
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $parcel[11]));
$orderNumber = $marking[array_key_last($marking)];
if(!$parcel[9]){
$quantity = $parcel[16];
if(!$quantity){
continue;
}
try {
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
$appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
} catch (ResourceNotFoundException $exception) {
$oldOrder = OldOrders::where('marking', '=', $orderNumber)->first();
if(!$oldOrder){
continue;
}
$customerMarking = str_replace('/', '', str_replace(' ', '', explode('CIEF/', $oldOrder->company->marking)[1]));
$companyModule = CompanyModule::whereHas('inviters', function($query) use ($customerMarking) {
return $query->where('invitee_reference', '=', $customerMarking);
})->first();
if(!$companyModule){
log::error('unknown customer: '.$customerMarking);
continue;
}
if(!$oldOrder->address) {
continue;
}
/** @var Address $address */
$address = $this->createAddressFromOldAddressProcessor->execute($oldOrder->address, $companyModule);
if(!$address){
continue;
}
$warehouseId = $parcel[0];
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $warehouseId === 11 ? 3 : 4]);
$order = $this->createOrderProcessor->execute($companyModule->company, $originWarehouse, $address, $orderNumber);
$order->created_at = Carbon::parse($parcel[1]);
$order->save();
$allow_contract = false;
$order = $this->fetchesCompanyModule->execute(['id' => 1]);
$appointee_id = 2037;
}
$packingListReference = $parcel[17];
$quantity = $parcel[9];
$measurement = round(($parcel[10]/$quantity) ** (1/3) * 100, 2);
$description = $parcel[7];
$tracking = $parcel[6];
$packingListReference = $parcel[0];
// $measurement = round(($parcel[10]/$quantity) ** (1/3) * 100, 2);
$description = $parcel[13];
$tracking = $parcel[37];
$receiveDate = $parcel[1];
$packingListObject = new PackingListObject($packingListReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->id, PackingListType::WAREHOUSE_RECEIVE_LIST, ApprovalStatus::APPROVED);
$packingListObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::WAREHOUSE_RECEIVE_LIST, $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
/** @var PackingList $packingList */
$packingList = $order->packingLists()->where('reference', '=', $packingListReference)->first();
@@ -216,7 +180,7 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
$packingList->packages()->delete();
if($replica) $replica->packages()->delete();
$packageObject = new PackageObject(PackageType::CARTON, $description, $measurement, $measurement, $measurement, 0, $quantity, ApprovalStatus::APPROVED);
$packageObject = new PackageObject(PackageType::CARTON, $description, $parcel[23], $parcel[22], $parcel[21], 0, $quantity, ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $packingList);
}
} catch (\Exception $exception){
@@ -0,0 +1,121 @@
<?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\Services\UpdatesBasePriceConstantByDates;
use App\Classes\Modules\Segments\Services\CreatesConstant;
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\Classes\ValueObjects\Constants\SegmentConstants;
use App\Http\Resources\ConstantResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CreateBasePriceLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Create Base Price',
'message' => 'You have successfully created a Base 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 UpdatesBasePriceConstantByDates */
private $updatesBasePriceConstantByDates;
/**
* UpdateConstantLogic constructor.
* @param CanUpdateConstant $canUpdateConstant
* @param UpdatesConstant $updatesConstant
* @param FetchesSegment $fetchesSegment
* @param FetchesConstant $fetchesConstant
* @param CanCreateConstant $canCreateConstant
* @param CreatesConstant $createsConstant
* @param UpdatesBasePriceConstantByDates $updatesBasePriceConstantByDates
*/
public function __construct(
CanUpdateConstant $canUpdateConstant,
UpdatesConstant $updatesConstant,
FetchesSegment $fetchesSegment,
FetchesConstant $fetchesConstant,
CanCreateConstant $canCreateConstant,
CreatesConstant $createsConstant,
UpdatesBasePriceConstantByDates $updatesBasePriceConstantByDates
)
{
$this->canUpdateConstant = $canUpdateConstant;
$this->updatesConstant = $updatesConstant;
$this->fetchesSegment = $fetchesSegment;
$this->fetchesConstant = $fetchesConstant;
$this->canCreateConstant = $canCreateConstant;
$this->createsConstant = $createsConstant;
$this->updatesBasePriceConstantByDates = $updatesBasePriceConstantByDates;
}
/**
* @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' => SegmentConstants::BASE_PRICE]);
} catch (ResourceNotFoundException $exception){
$constantObject = [];
$object = new ConstantObject(
SegmentConstants::BASE_PRICE,
$constantObject
);
$constant = $this->createsConstant->execute($segment, $object);
}
$constantValue = $this->updatesBasePriceConstantByDates->execute($constant->value, $request->input('dateFrom'), $request->input('dateTo'), $request->input('rate'));
$object = new ConstantObject(SegmentConstants::BASE_PRICE, $constantValue);
$this->canUpdateConstant->passes($object);
$constant = $this->updatesConstant->execute($constant, $object);
return $this->resourceResponse(new ConstantResource($constant));
}
}
@@ -0,0 +1,68 @@
<?php
namespace App\Classes\Modules\Segments\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Segments\Services\FetchesConstant;
use App\Classes\ValueObjects\Constants\SegmentConstants;
use App\Http\Resources\ConstantResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Carbon\CarbonPeriod;
class FetchBasePriceLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Base Price',
'message' => 'You have successfully retrieved the Base Price'
];
}
/** @var FetchesConstant */
private $fetchesConstant;
/**
* FetchConstantLogic constructor.
* @param FetchesConstant $fetchesConstant
*/
public function __construct(FetchesConstant $fetchesConstant)
{
$this->fetchesConstant = $fetchesConstant;
}
/**
* @param Request $request
* @return JsonResponse
*/
public function logic(Request $request) : JsonResponse
{
$constant = $this->fetchesConstant->execute(['segment_id' => $request->route('id'), 'reference' => SegmentConstants::BASE_PRICE]);
$constantObject = (array) $constant->value;
if ($request->input('dateFrom') !== null && $request->input('dateTo') !== null) {
$period = CarbonPeriod::create($request->input('dateFrom'), $request->input('dateTo'));
$returnObject = [];
foreach ($period as $date) {
array_key_exists($date->format('Y-m-d'), $constantObject) === true ? $returnObject[$date->format('Y-m-d')] = $constantObject[$date->format('Y-m-d')] : '';
}
$constant->value = json_encode($returnObject);
}
return $this->resourceResponse(new ConstantResource($constant));
}
}
@@ -0,0 +1,178 @@
<?php
namespace App\Classes\Modules\Segments\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Segments\Services\ListsSegments;
use App\Http\Resources\AirShipmentItemPriceResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ListAirShipmentPriceLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Air Shipment Price List',
'message' => 'You have successfully retrieved a list of Air Shipment Price'
];
}
/** @var ListsSegments */
private $listsSegments;
/**
* ListSegmentLogic constructor.
* @param ListsSegments $listsSegments
*/
public function __construct(ListsSegments $listsSegments)
{
$this->listsSegments = $listsSegments;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function logic(Request $request) : JsonResponse
{
// $query = $this->listsSegments->execute($this->listsSegments->deserializeFilters($request->input('filters')));
// category - Dimension / perKg
$price = array(
[
'details' => json_encode([
'name' => 'Sound system speakers - MINI',
'pricePerKg' => '',
'pricePerPcs' => '',
'isProhibited' => '',
'hasGram' => '',
'hasDimensionCharges' => '',
'tax' => '50',
])
],
[
'details' => json_encode([
'name' => 'Sound system speakers - SMALL',
'pricePerKg' => '',
'pricePerPcs' => '',
'isProhibited' => '',
'hasGram' => '',
'hasDimensionCharges' => '',
'tax' => '200',
])
],
[
'details' => json_encode([
'name' => 'Sound system speakers - LARGE',
'pricePerKg' => '',
'pricePerPcs' => '',
'isProhibited' => '',
'hasGram' => '',
'hasDimensionCharges' => '',
'tax' => '400',
])
],
[
'details' => json_encode([
'name' => 'Washing Machine - Dimension',
'pricePerKg' => '',
'pricePerPcs' => '',
'isProhibited' => '',
'hasGram' => '',
'hasDimensionCharges' => 'true',
'tax' => '',
])
],
[
'details' => json_encode([
'name' => 'Oven, Balnder - perPcs',
'pricePerKg' => '',
'pricePerPcs' => '20',
'isProhibited' => '',
'hasGram' => '',
'hasDimensionCharges' => '',
'tax' => '',
])
],
[
'details' => json_encode([
'name' => 'Perfume - perKg',
'pricePerKg' => '33',
'pricePerPcs' => '',
'isProhibited' => '',
'hasGram' => '',
'hasDimensionCharges' => '',
'tax' => '',
])
],
[
'details' => json_encode([
'name' => 'Gold - Prohibited',
'pricePerKg' => '',
'pricePerPcs' => '',
'isProhibited' => 'true',
'hasGram' => '',
'hasDimensionCharges' => '',
'tax' => '',
])
],
[
'details' => json_encode([
'name' => 'Food - hasGram',
'pricePerKg' => '',
'pricePerPcs' => '',
'isProhibited' => '',
'hasGram' => 'true',
'hasDimensionCharges' => '',
'tax' => '',
])
],
[
'details' => json_encode([
'name' => 'TV 30" - 36"',
'pricePerKg' => 28,
'pricePerPcs' => '',
'isProhibited' => '',
'hasGram' => 'true',
'hasDimensionCharges' => "true",
'tax' => 500,
])
],
[
'details' => json_encode([
'name' => 'TV 37" - 42"',
'pricePerKg' => 28,
'pricePerPcs' => '',
'isProhibited' => '',
'hasGram' => 'true',
'hasDimensionCharges' => "true",
'tax' => 1000,
])
],
[
'details' => json_encode([
'name' => 'TV 43"+"',
'pricePerKg' => 28,
'pricePerPcs' => '',
'isProhibited' => '',
'hasGram' => 'true',
'hasDimensionCharges' => "true",
'tax' => 1500,
])
]
);
return $this->collectionResponse(AirShipmentItemPriceResource::collection($price));
}
}
@@ -5,7 +5,9 @@ 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;
@@ -15,6 +17,7 @@ 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 UpdateConstantLogic extends AbstractControllerLogic
{
@@ -47,6 +50,11 @@ class UpdateConstantLogic extends AbstractControllerLogic
/** @var CreatesConstant */
private $createsConstant;
/** @var CreatesSegment */
private $createsSegment;
/** @var UpdatesConstantValue */
private $updatesConstantValue;
/**
* UpdateConstantLogic constructor.
@@ -56,8 +64,19 @@ class UpdateConstantLogic extends AbstractControllerLogic
* @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)
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;
@@ -65,6 +84,8 @@ class UpdateConstantLogic extends AbstractControllerLogic
$this->fetchesConstant = $fetchesConstant;
$this->canCreateConstant = $canCreateConstant;
$this->createsConstant = $createsConstant;
$this->updatesConstantValue = $updatesConstantValue;
$this->createsSegment = $createsSegment;
}
/**
* @param Request $request
@@ -75,28 +96,33 @@ class UpdateConstantLogic extends AbstractControllerLogic
*/
public function logic(Request $request) : JsonResponse
{
$object = new ConstantObject($request->input('reference'), $request->input('value'));
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
try {
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $object->getReference()]);
$this->canUpdateConstant->passes($object);
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]);
/** @var SegmentConstant $constant */
$constant = $this->updatesConstant->execute($constant, $object);
$constantValue = $this->updatesConstantValue->execute($constant->value, $request->input('id'), $request->input('value'));
$object = new ConstantObject($request->input('reference'), $constantValue);
$this->canUpdateConstant->passes($object);
} catch (ResourceNotFoundException $exception){
$this->canCreateConstant->passes($object);
$constantObject = [];
$constantObject[$request->input('id')] = $request->input('value');
$object = new ConstantObject(
$request->input('reference'),
$constantObject
);
/** @var SegmentConstant $constant */
$constant = $this->createsConstant->execute($segment, $object);
}
$constant = $this->updatesConstant->execute($constant, $object);
return $this->resourceResponse(new ConstantResource($constant));
}
@@ -14,6 +14,8 @@ use App\Classes\Modules\Segments\Standards\Rules\CanUpdateConstant;
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
use App\Classes\Modules\Segments\Services\AddItemToConstantValueArray;
use App\Classes\Modules\Segments\Services\RemoveItemFromConstantValueArray;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\Modules\Segments\Services\CreatesConstant;
class UpdateConstantPostcodeLogic extends AbstractControllerLogic
{
@@ -46,6 +48,8 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic
/** @var RemoveItemFromConstantValueArray */
private $removeItemFromConstantValueArray;
/** @var CreatesConstant */
private $createsConstant;
/**
* UpdateConstantLogic constructor.
@@ -54,9 +58,18 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic
* @param FetchesSegment $fetchesSegment
* @param FetchesConstant $fetchesConstant
* @param AddItemToConstantValueArray $addItemToConstantValueArray
* @param CreatesConstant $createsConstant
* @param RemoveItemFromConstantValueArray $removeItemFromConstantValueArray
*/
public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant,AddItemToConstantValueArray $addItemToConstantValueArray, RemoveItemFromConstantValueArray $removeItemFromConstantValueArray)
public function __construct(
CanUpdateConstant $canUpdateConstant,
UpdatesConstant $updatesConstant,
FetchesSegment $fetchesSegment,
FetchesConstant $fetchesConstant,
AddItemToConstantValueArray $addItemToConstantValueArray,
RemoveItemFromConstantValueArray $removeItemFromConstantValueArray,
CreatesConstant $createsConstant
)
{
$this->canUpdateConstant = $canUpdateConstant;
$this->updatesConstant = $updatesConstant;
@@ -64,6 +77,7 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic
$this->fetchesConstant = $fetchesConstant;
$this->addItemToConstantValueArray = $addItemToConstantValueArray;
$this->removeItemFromConstantValueArray = $removeItemFromConstantValueArray;
$this->createsConstant = $createsConstant;
}
/**
* @param Request $request
@@ -76,24 +90,42 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic
{
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]);
try {
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]);
$object = new ConstantObject($constant->reference, $this->addItemToConstantValueArray->execute($constant->value, $request->input('postcode')));
$this->canUpdateConstant->passes($object);
$constantValue = $this->addItemToConstantValueArray->execute($constant->value, $request->input('postcode'));
$object = new ConstantObject($request->input('reference'), $constantValue);
} catch (ResourceNotFoundException $exception){
$constantObject = [$request->input('postcode')];
$object = new ConstantObject(
$request->input('reference'),
$constantObject
);
$constant = $this->createsConstant->execute($segment, $object);
}
try {
// check if postcode exist in the opposite constant, and delete it
$oppositeConstant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE]);
$oppositeConstantValue = $this->removeItemFromConstantValueArray->execute($oppositeConstant->value, $request->input('postcode'));
$oppositeObject = new ConstantObject($request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE, $oppositeConstantValue);
$this->updatesConstant->execute($oppositeConstant, $oppositeObject);
} catch (ResourceNotFoundException $exception){
// if opposite constant does not exist, do nothing
}
$constant = $this->updatesConstant->execute($constant, $object);
$oppositeConstant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE]);
$oppositeObject = new ConstantObject($request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE, $this->removeItemFromConstantValueArray->execute($oppositeConstant->value, $request->input('postcode')));
$oppositeConstant = $this->updatesConstant->execute($oppositeConstant, $oppositeObject);
return $this->response([
'CENTER_POSTCODE' => $constant->reference == SegmentConstants::CENTER_POSTCODE ? new ConstantResource($constant) : New ConstantResource($oppositeConstant),
'OUTSTATION_POSTCODE' => $constant->reference == SegmentConstants::OUTSTATION_POSTCODE ? new ConstantResource($constant) : New ConstantResource($oppositeConstant),
]);
return $this->resourceResponse(new ConstantResource($constant));
}
}
@@ -1,87 +0,0 @@
<?php
namespace App\Classes\Modules\Segments\ControllersLogic;
use Illuminate\Http\Request;
use App\Models\SegmentConstant;
use Illuminate\Http\JsonResponse;
use App\Http\Resources\ConstantResource;
use App\Classes\ValueObjects\Constants\SegmentConstants;
use App\Classes\Modules\Segments\Services\FetchesSegment;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Segments\Services\FetchesConstant;
use App\Classes\Modules\Segments\Services\UpdatesConstant;
use App\Classes\Modules\Segments\Standards\Rules\CanUpdateConstant;
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
use App\Classes\Modules\Segments\Services\UpdatesConstantValueByState;
class UpdateConstantStateLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Updated Segment Constant',
'message' => 'You have successfully updated the Segment Constant'
];
}
/** @var CanUpdateConstant */
private $canUpdateConstant;
/** @var UpdatesConstant */
private $updatesConstant;
/** @var FetchesSegment */
private $fetchesSegment;
/** @var FetchesConstant */
private $fetchesConstant;
/** @var UpdatesConstantValueByState */
private $updatesConstantValueByState;
/**
* UpdateConstantLogic constructor.
* @param CanUpdateConstant $canUpdateConstant
* @param UpdatesConstant $updatesConstant
* @param FetchesSegment $fetchesSegment
* @param FetchesConstant $fetchesConstant
* @param UpdatesConstantValueByState $updatesConstantValueByState
*/
public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant,UpdatesConstantValueByState $updatesConstantValueByState)
{
$this->canUpdateConstant = $canUpdateConstant;
$this->updatesConstant = $updatesConstant;
$this->fetchesSegment = $fetchesSegment;
$this->fetchesConstant = $fetchesConstant;
$this->updatesConstantValueByState = $updatesConstantValueByState;
}
/**
* @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')]);
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => SegmentConstants::STATE_RATE]);
$constantValue = $this->updatesConstantValueByState->execute($constant->value, $request->input('status_id'), $request->input('rate'));
$object = new ConstantObject(SegmentConstants::STATE_RATE, (array) $constantValue);
$this->canUpdateConstant->passes($object);
$constant = $this->updatesConstant->execute($constant, $object);
return $this->resourceResponse(new ConstantResource($constant));
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Classes\Modules\Segments\Services;
use Carbon\CarbonPeriod;
class UpdatesBasePriceConstantByDates
{
/**
* @param $json
* @param int $status_id
* @param Array $rate
* @return Array
*/
public function execute($json, String $date_from, String $date_to, String $rate) {
$objectArray = (array) $json;
$period = CarbonPeriod::create($date_from, $date_to);
foreach ($period as $date) {
$objectArray[$date->format('Y-m-d')] = $rate;
}
return $objectArray;
}
}
@@ -0,0 +1,23 @@
<?php
namespace App\Classes\Modules\Segments\Services;
class UpdatesConstantValue
{
/**
* @param $json
* @param int $state_id
* @param array $rate
* @return array
*/
public function execute($json, int $state_id, Array $rate) {
$objectArray = (array) $json;
$objectArray[$state_id] = $rate;
return $objectArray;
}
}
@@ -1,32 +0,0 @@
<?php
namespace App\Classes\Modules\Segments\Services;
class UpdatesConstantValueByState
{
/**
* @param $json
* @param int $status_id
* @param int $rate
* @return string
*/
public function execute($json, int $status_id, int $rate) {
$newArray = $json;
foreach($json->config as $key => $object){
if($object->status_id == $status_id){
$newArray->config[$key] = (object) [
'rate' => $rate,
'status_id' => $object->status_id,
'outstation_rate' => $object->outstation_rate,
];
}else{
$newArray->config[$key] = $object;
}
}
return $newArray;
}
}
@@ -0,0 +1,94 @@
<?php
namespace App\Classes\Modules\Transactions\ControllersLogic;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\Modules\Documents\Services\CreatesFiles;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Documents\Services\CreatesDocument;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use App\Classes\Modules\Transactions\ControllersLogic\Document;
class ApproveShippingInvoiceTransactionLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Shipping Invoice Status',
'message' => 'You have successfully updated the shipping invoice status'
];
}
/** @var FetchesPackingList */
private $fetchesPackingList;
/** @var UpdatesTransactionStatus */
private $updatesTransactionStatus;
/** @var CreatesDocument */
private $createsDocument;
/** @var CreatesFiles */
private $createsFiles;
/**
* ApprovePaymentVerificationLogic constructor.
* @param FetchesPackingList $fetchesPackingList
* @param UpdatesTransactionStatus $updatesTransactionStatus
* @param CreatesDocument $createsDocument
* @param CreatesFiles $createsFiles
* @param CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor
*/
public function __construct(FetchesPackingList $fetchesPackingList, UpdatesTransactionStatus $updatesTransactionStatus, CreatesDocument $createsDocument, CreatesFiles $createsFiles)
{
$this->fetchesPackingList = $fetchesPackingList;
$this->updatesTransactionStatus = $updatesTransactionStatus;
$this->createsDocument = $createsDocument;
$this->createsFiles = $createsFiles;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function logic(Request $request) : JsonResponse
{
$packing_list = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
$invoice_transaction = $packing_list->transactions->where('type', TransactionType::SHIPPING_INVOICE)->first();
$this->updatesTransactionStatus->execute($invoice_transaction, ApprovalStatus::APPROVED);
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice_transaction]);
$document_object = new DocumentObject(
DocumentType::SHIPPING_INVOICE,
[chunk_split('data:application/pdf;base64,'.base64_encode($transaction_invoice_pdf->output()))],
'',
ApprovalStatus::COMPLETED,
'shipping_invoice'
);
/** @var Document $document */
$document = $this->createsDocument->execute($invoice_transaction, $document_object);
$this->createsFiles->execute($document, $document_object);
return $this->response([]);
}
}
@@ -84,8 +84,11 @@ class CreatePaymentTransactionLogic extends AbstractControllerLogic
$billPlzBill = $this->createsBillplzBill->execute(
$company_module->name,
$company_module->employees()->first()->email,
'This payment is credit topup for company ref. ' . $company_module->reference, $amount, $billNumber,
$request->input('bank_code'), true
'This payment is for the invoice number . ' . $invoice_transaction->bill_no,
$amount,
$billNumber,
$request->input('bank_code'),
true
);
$payment_reference = $billPlzBill->id;
@@ -6,6 +6,8 @@ namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\SegmentConstants\Services\FetchesSegmentConstant;
use App\Classes\Modules\Segments\Services\ListsConstants;
use App\Classes\Modules\Segments\Services\ListsSegments;
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
use App\Classes\Modules\Transactions\Services\CreatesTransactionDetail;
@@ -21,10 +23,14 @@ use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\SegmentConstants;
use App\Classes\ValueObjects\Constants\TransactionDetailType;
use App\Http\Resources\PackingListResource;
use App\Models\Document;
use App\Models\PackingList;
use App\Models\Transaction;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
@@ -34,7 +40,6 @@ use Meneses\LaravelMpdf\Facades\LaravelMpdf;
class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
{
/**
* @return array
*/
@@ -51,6 +56,9 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
/** @var FetchesSegmentConstant */
private $fetchesSegmentConstant;
/** @var ListsConstants */
private $listsConstants;
/** @var GeneratesTransactionBillNumber */
private $generatesTransactionBillNumber;
@@ -65,20 +73,24 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
/** @var CreatesFiles */
private $createsFile;
public function __construct(
FetchesPackingList $fetchesPackingList,
FetchesSegmentConstant $fetchesSegmentConstant,
GeneratesTransactionBillNumber $generatesTransactionBillNumber,
CreatesTransaction $createsTransaction,
CreatesTransactionDetail $createsTransactionDetail,
CreatesDocument $createsDocument,
CreatesFiles $createsFile
)
{
/**
* CreateShippingInvoiceTransactionLogic constructor.
* @param FetchesPackingList $fetchesPackingList
* @param FetchesSegmentConstant $fetchesSegmentConstant
* @param ListsConstants $listsConstants
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
* @param CreatesTransaction $createsTransaction
* @param CreatesTransactionDetail $createsTransactionDetail
* @param CreatesDocument $createsDocument
* @param CreatesFiles $createsFile
*/
public function __construct(FetchesPackingList $fetchesPackingList, FetchesSegmentConstant $fetchesSegmentConstant, ListsConstants $listsConstants, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CreatesTransaction $createsTransaction, CreatesTransactionDetail $createsTransactionDetail, CreatesDocument $createsDocument, CreatesFiles $createsFile)
{
$this->fetchesPackingList = $fetchesPackingList;
$this->fetchesSegmentConstant = $fetchesSegmentConstant;
$this->listsConstants = $listsConstants;
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
$this->createsTransaction = $createsTransaction;
$this->createsTransactionDetail = $createsTransactionDetail;
@@ -86,6 +98,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$this->createsFile = $createsFile;
}
public function logic(Request $request) : JsonResponse
{
$packing_list = $this->fetchesPackingList->execute(['id' => $request->input('packing_list_id')]);
@@ -98,62 +111,54 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
});
$order = $packing_list->owner()->first();
$minimum_charges = ($cbm + $over_weight_cbm) < 0.3 ? (0.3 - ($cbm + $over_weight_cbm)) : 0;
$order = $packing_list->owner;
$address = $order->addresses()->first();
$base_price_constant = $this->fetchesSegmentConstant->execute(['id' => 1]);
$warehouse_rate_constant = $this->fetchesSegmentConstant->execute(['id' => 2]);
$state_rate_constant = $this->fetchesSegmentConstant->execute(['id' => 3]);
$center_postcode_constant = $this->fetchesSegmentConstant->execute(['id' => 4]);
$outstation_postcode_constant = $this->fetchesSegmentConstant->execute(['id' => 5]);
$segments = $order->companyModule->connections->first()->segments->pluck('id');
$base_price = 0;
$warehouse_rate = 0;
$state_rate = 0;
$state_select = [];
$with_out = false;
$segment_price = 0;
$base_price_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::BASE_PRICE]);
if(count($segments)){
$segment_price_constants = $this->listsConstants->execute(['segment_id_in' => $segments, 'reference' => SegmentConstants::CUSTOM_PRICE]);
$segment_price_constant = $segment_price_constants->sortBy(function ($constant){
return $constant->value[0];
})->first();
$segment_price = $segment_price_constant->value[0];
if ($base_price_constant) {
$base_price = $base_price_constant->value->price;
}
if ($warehouse_rate_constant) {
$package_warehouse = $order->OrderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->reference;
foreach ($warehouse_rate_constant->value->config as $key_warehouse => $row_warehouse) {
if ($row_warehouse->warehouse_name == $package_warehouse) {
$warehouse_rate = $row_warehouse->rate;
}
}
}
$warehouse_rate_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::WAREHOUSE_RATE]);
$state_rate_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::STATE_RATE]);
$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]);
$state_select = '';
if ($state_rate_constant) {
foreach ($state_rate_constant->value->config as $key_state => $row_state) {
if ($row_state->status_id == $address->state_id) {
$state_select = $row_state;
}
}
}
$packing_list_drop_date = Carbon::parse(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);
$warehouse_rate = is_object($selected_warehouse_rate) ? $selected_warehouse_rate->amount : 0;
if ($outstation_postcode_constant) {
foreach ($outstation_postcode_constant->value as $key_out => $row_out) {
$stateId = $address->state_id;
$state_rate_constant = $this->getConstantByKey($state_rate_constant, $stateId);
if($row_out == $address->postcode) {
$with_out = true;
}
}
}
// get $state_rate
$postcode = $address->postcode;
$this->checkPostcodeExistInConstant($center_postcode_constant, $postcode) === true ? $state_select = 'center' : '' ;
$this->checkPostcodeExistInConstant($outstation_postcode_constant, $postcode) === true ? $state_select = 'outstation' : '' ;
$state_rate_constant = (array)$state_rate_constant;
$state_rate = $state_select == '' ? 0 : $state_rate_constant['center'] + ($state_select === 'outstation' ? $state_rate_constant['outstation'] : 0);
if (!empty($state_select)) {
$state_rate = $state_select->rate;
if ($with_out) {
$state_rate = $state_select->rate + $state_select->outstation_rate;
}
}
$price_cbm = $base_price + $segment_price + $warehouse_rate + $state_rate;
$price_cbm = $base_price + $warehouse_rate + $state_rate;
$total_cbm = $price_cbm * ($cbm + $over_weight_cbm);
$billNumber = $this->generatesTransactionBillNumber->execute('SHIP-');
$billNumber = $this->generatesTransactionBillNumber->execute('SI-');
$object = new TransactionObject(
$billNumber,
@@ -178,7 +183,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$object_detail = new TransactionDetailObject(
'SHIPPING_FEE',
TransactionDetailType::SHIPPING_FEE,
TransactionDetailType::SHIPPING_FEE.'<br>'.round($packing_list->packages->sum('quantity'), 3).' CTNS - '.$cbm.' CBM',
$cbm,
$price_cbm
);
@@ -196,21 +201,24 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
}
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice_transaction]);
$document_object = new DocumentObject(
DocumentType::SHIPPING_INVOICE,
[chunk_split('data:application/pdf;base64,'.base64_encode($transaction_invoice_pdf->output()))],
'',
ApprovalStatus::COMPLETED,
'shipping_invoice'
);
/** @var Document $document */
$document = $this->createsDocument->execute($invoice_transaction, $document_object);
$this->createsFile->execute($document, $document_object);
return $this->response([]);
return $this->resourceResponse(new PackingListResource($packing_list));
}
function getConstantByKey($segmentConstantObject, $key) {
if ($segmentConstantObject) {
$base_rate = (array) $segmentConstantObject->value;
$base_rate = array_key_exists($key, $base_rate) === true ? $base_rate[$key] : 0;
return $base_rate;
}
}
function checkPostcodeExistInConstant($segmentConstantObject, $postcode) {
$segmentConstantObject = $segmentConstantObject->value;
if (!empty($segmentConstantObject)) {
return in_array($postcode, $segmentConstantObject);
} else {
return false;
}
}
}
@@ -0,0 +1,92 @@
<?php
namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\SegmentConstants\Services\FetchesSegmentConstant;
use App\Classes\ValueObjects\Constants\SegmentConstants;
use App\Models\District;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Classes\General\Helper;
class ShippingEstimationCalculatorLogic extends AbstractControllerLogic
{
/** @var FetchesSegmentConstant */
private $fetchesSegmentConstant;
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Shipping estimation',
'message' => 'You have successfully calculate the Shipping Estimation'
];
}
public function __construct(
FetchesSegmentConstant $fetchesSegmentConstant
){
$this->fetchesSegmentConstant = $fetchesSegmentConstant;
}
public function logic(Request $request) : JsonResponse
{
$base_price = $warehouse_rate = $state_rate = 0;
$width = $request->input('width') / 100; // metre
$length = $request->input('length') / 100; // metre
$height = $request->input('height') / 100; // metre
$cbm = (float) ($width * $length * $height);
// calculate base price
$base_prices = $this->getSegmentConstantData(SegmentConstants::BASE_PRICE);
$base_price = $this->getConstantDataUsingKey($base_prices, date('Y-m-d'));
// calculate warehouse rate
$warehouse_prices = $this->getSegmentConstantData(SegmentConstants::WAREHOUSE_RATE);
$warehouse_rate = $this->getConstantDataUsingKey($warehouse_prices, $request->input('warehouse_id'), 'amount');
// calculate applied state rate
$state_prices = $this->getSegmentConstantData(SegmentConstants::STATE_RATE);
$outstation_postcodes = $this->getSegmentConstantData(SegmentConstants::OUTSTATION_POSTCODE);
$district = District::where('postcode','LIKE','%'.$request->input('postcode').'%')->first();
if(array_search($request->input('postcode'), $outstation_postcodes)!==false){
$state_rate = $this->getConstantDataUsingKey($state_prices, $district->state_id, 'outstation');
}
$price_cbm = $base_price + $warehouse_rate + $state_rate;
$total_price_cbm = $price_cbm * $cbm;
return $this->response([
'cbm' => $cbm, 'base_price' => $base_price, 'warehouse_rate' => $warehouse_rate,
'state_rate' => $state_rate, 'total_price_cbm' => $total_price_cbm
]);
}
private function getConstantDataUsingKey($data, $search_key, $field='')
{
if(array_key_exists($search_key, $data) !== true) {
return 0;
} else {
if($field!=''){
return $data[$search_key]->$field;
} else {
return $data[$search_key];
}
}
}
private function getSegmentConstantData($reference)
{
$data = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => $reference]);
return (array) $data->value;
}
}
@@ -0,0 +1,149 @@
<?php
namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Models\Transaction;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Storage;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\ValueObjects\Constants\TransactionDetailType;
use App\Classes\Modules\Documents\DataTransferObjects\FileObject;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\Transactions\Services\UpdatesTransaction;
use App\Classes\Modules\Transactions\Services\CreatesTransactionDetail;
use App\Classes\Modules\Transactions\Services\FetchesTransactionDetail;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionDetail;
use App\Classes\Modules\Transactions\Services\DeletesTransactionDetails;
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionDetailObject;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Update Shipping Invoice Transaction',
'message' => 'You have successfully update shipping invoice transaction'
];
}
/** @var FetchesPackingList */
private $fetchesPackingList;
/** @var FetchesTransaction */
private $fetchesTransaction;
/** @var UpdatesTransaction */
private $updatesTransaction;
/** @var FetchesTransactionDetail */
private $fetchesTransactionDetail;
/** @var CreatesTransactionDetail */
private $createsTransactionDetail;
/** @var UpdatesTransactionDetail */
private $updatesTransactionDetail;
/** @var DeletesTransactionDetails */
private $deletesTransactionDetails;
public function __construct(
FetchesPackingList $fetchesPackingList,
FetchesTransaction $fetchesTransaction,
UpdatesTransaction $updatesTransaction,
FetchesTransactionDetail $fetchesTransactionDetail,
CreatesTransactionDetail $createsTransactionDetail,
UpdatesTransactionDetail $updatesTransactionDetail,
DeletesTransactionDetails $deletesTransactionDetails
)
{
$this->fetchesPackingList = $fetchesPackingList;
$this->fetchesTransaction = $fetchesTransaction;
$this->updatesTransaction = $updatesTransaction;
$this->fetchesTransactionDetail = $fetchesTransactionDetail;
$this->createsTransactionDetail = $createsTransactionDetail;
$this->updatesTransactionDetail = $updatesTransactionDetail;
$this->deletesTransactionDetails = $deletesTransactionDetails;
}
public function logic(Request $request) : JsonResponse
{
$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();
$new_transaction_details = collect($request->input('transaction_details'));
$total_cbm = $invoice_transaction->amount;
foreach($old_transaction_details as $old_transaction_detail_id){
$old_transaction_detail = $this->fetchesTransactionDetail->execute(['id' => $old_transaction_detail_id]);
$total_cbm -= $old_transaction_detail->price;
if(!$new_transaction_details->contains('id', $old_transaction_detail_id)){
$this->deletesTransactionDetails->execute($old_transaction_detail);
}
}
foreach($new_transaction_details as $transaction_detail){
$transaction_detail = (object) $transaction_detail;
if(!in_array($transaction_detail->reference, ['SHIPPING_FEE', 'OVER_WHEIGHT_CHARGES'])){
$object_detail = new TransactionDetailObject(
'CUSTOM_CHARGES',
isset($transaction_detail->name) ? $transaction_detail->name : TransactionDetailType::CUSTOM_CHARGES,
$transaction_detail->quantity,
$transaction_detail->price
);
if(isset($transaction_detail->id)){
$new_transaction_detail = $this->updatesTransactionDetail->execute($this->fetchesTransactionDetail->execute(['id' => $transaction_detail->id]), $object_detail);
}else{
$new_transaction_detail = $this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
}
$total_cbm += $new_transaction_detail->amount;
}
}
$object = new TransactionObject(
$invoice_transaction->bill_no,
TransactionType::SHIPPING_INVOICE,
1,
$invoice_transaction->issuer,
1,
PaymentMethodType::CASH,
$total_cbm,
$total_cbm,
1,
1,
0,
0,
0,
null,
ApprovalStatus::PENDING_VERIFICATION
);
/** @var Transaction $invoice_transaction */
$invoice_transaction = $this->updatesTransaction->execute($invoice_transaction, $object);
return $this->response([]);
}
}
@@ -3,17 +3,17 @@
namespace App\Classes\Modules\Transactions\Services;
use App\Classes\General\Eloquent\AbstractDeleteRecord;
use App\Models\Transaction;
use App\Models\TransactionDetail;
class DeletesTransactionDetails extends AbstractDeleteRecord
{
/**
* @param Transaction $model
* @param TransactionDetail $model
* @return mixed
*/
public function execute(Transaction $model) {
return $model->transactionDetails()->delete();
public function execute(TransactionDetail $model) {
return $model->delete();
}
}
@@ -0,0 +1,27 @@
<?php
namespace App\Classes\Modules\Transactions\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionDetailObject;
use App\Models\TransactionDetail;
class UpdatesTransactionDetail extends AbstractUpdateRecord
{
/**
* @param TransactionDetail $transactionDetail
* @param TransactionDetailObject $object
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(TransactionDetail $transactionDetail, TransactionDetailObject $object) {
$transactionDetail->reference = $object->getReference();
$transactionDetail->name = $object->getName();
$transactionDetail->quantity = $object->getQuantity();
$transactionDetail->price = $object->getPrice();
$transactionDetail->amount = $object->getAmount();
return $this->handler($transactionDetail);
}
}
@@ -8,4 +8,6 @@ final class AddressType {
public const DELIVERY = 2;
public const PICK_UP = 3;
}
@@ -18,4 +18,7 @@ final class BusinessType {
public const CURRENCY_VENDOR = 6;
public const ONLINE_SELLER = 7;
public const LAST_MILE_DELIVERY_AGENT = 8;
}
@@ -8,4 +8,6 @@ final class OrderType {
public const DEDICATED_CONTAINER = 1;
public const LAST_MILE_DELIVERY = 2;
}
@@ -10,4 +10,6 @@ final class PackageType {
public const OVER_WEIGHT = 2;
public const DOCUMENT = 3;
}
@@ -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,7 +4,9 @@ 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 CUSTOM_CHARGES = 'Custom charges';
}
@@ -8,6 +8,8 @@ final class WarehouseReferences {
public const YD_GUANG_ZHOU = 'GZ-V02';
public const YD_GUANG_ZHOU_2 = 'GZ-V03';
public const VT_YIWU = 'YW-V01';
public const YD_YIWU = 'YW-V02';
@@ -41,7 +43,11 @@ final class WarehouseReferences {
public const YD_DESTINATION_WAREHOUSE = self::YD_KLANG;
public const YD_EXEMPT_LIST = [230, 294, 320, 652, 1248, 1726];
public const YD_EXEMPT_LIST = [230, 294, 320, 652, 1248, 1726, 2349, 2574, 652];
public const MIN_CBM_EXEMPT_LIST = [230, 294, 320, 652, 1248, 1726, 2349, 2574];
public const REPLICA_WHITE_LIST = [502];
//2376 qce
-3
View File
@@ -49,9 +49,6 @@ class CurlVTCommand extends Command
{
return FetchWarehouseReceiveListFromVTPortalJob::withChain([
new FetchLoadedContainersFromVTPortalJob,
new FetchPackingListFromVTPortalJob,
new FetchContainersStatusUpdateFromVTPortalJob,
new FetchDeliveryListFromVTPortalJob
])->dispatch();
}
}
+1 -1
View File
@@ -29,7 +29,7 @@ class Kernel extends ConsoleKernel
{
$schedule->command('command:curlVTCommand')
->cron('0 9-18/3 * * *')
->cron('0 8 * * *')
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/curlvt.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,20 @@
<?php
namespace App\Http\Controllers\Delivery;
use App\Classes\Modules\Delivery\ControllersLogic\CancelDeliveryOrderLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CancelDeliveryOrderController
{
/**
* @param Request $request
* @param CancelOrderLogic $logic
* @return JsonResponse
*/
public function cancel(Request $request, CancelDeliveryOrderLogic $logic): JsonResponse
{
return $logic->execute($request);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Delivery;
use App\Classes\Modules\Delivery\ControllersLogic\CreateDeliveryCustomerLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CreateDeliveryCustomerController
{
/**
* @param Request $request
* @param CreateDeliveryCustomerLogic $createDeliveryCustomerLogic
* @return JsonResponse
*/
public function create(Request $request, CreateDeliveryCustomerLogic $createDeliveryCustomerLogic): JsonResponse
{
return $createDeliveryCustomerLogic->execute($request);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Delivery;
use App\Classes\Modules\Delivery\ControllersLogic\CreateDeliveryOrderLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CreateDeliveryOrderController
{
/**
* @param Request $request
* @param CreateDeliveryOrderLogic $createDeliveryOrderLogic
* @return JsonResponse
*/
public function create(Request $request, CreateDeliveryOrderLogic $createDeliveryOrderLogic): JsonResponse
{
return $createDeliveryOrderLogic->execute($request);
}
}
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Controllers\Delivery;
use App\Classes\Modules\Exports\Services\ExportsCustomers;
use App\Classes\Modules\Exports\Services\ExportsMultipleDeliveryOrders;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Excel;
class ExportDeliveryOrdersToExcelController
{
/**
* ExportCustomersToExcelController constructor.
* @param Request $request
*/
public function __construct(Request $request)
{
$token = Auth::fromUser(User::find(1));
$request->headers->set('Authorization', 'Bearer '.$token);
}
public function lineClear(Request $request){
$exportsTransactions = new ExportsMultipleDeliveryOrders($request);
$response = $exportsTransactions->download('line-clear-export.xlsx', Excel::XLSX, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
}
@@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\Delivery;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Classes\Modules\Delivery\ControllersLogic\ListOrdersLogic;
class ListOrdersController
{
/**
* @param Request $request
* @param ListOrdersLogic $logic
* @return JsonResponse
*/
public function list(Request $request, ListOrdersLogic $logic) : JsonResponse {
return $logic->execute($request);
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers\Exports;
use App\Classes\Modules\Exports\Services\ExportsArrivedParcel;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Excel;
class ExportArrivedParcelController
{
/**
* 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 ExportsArrivedParcel($request);
$response = $exportsPendingArrangementDeliveryList->download('arrived-parcel.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\Exports;
use App\Classes\Modules\Exports\Services\ExportsCompanyModuleSummary;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Excel;
class ExportCompanyModuleSummaryController
{
/**
* ExportCompanyModuleSummaryController 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) {
$exportsCompanyModuleSummary = new ExportsCompanyModuleSummary($request);
$exportsCompanyModuleSummary->setParameters($request->route('company_module_id'), $request->input('containerNumber'));
$response = $exportsCompanyModuleSummary->download('customerid-markingno.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
}
@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Exports;
use App\Classes\Modules\Exports\Services\ExportsOnHoldPackingList;
use App\Classes\Modules\Exports\Services\ExportsPendingArrangementDeliveryList;
use App\Models\User;
use Illuminate\Http\Request;
@@ -22,7 +23,14 @@ class ExportPendingArrangementPackingListController
public function export(Request $request) {
$exportsPendingArrangementDeliveryList = new ExportsPendingArrangementDeliveryList($request);
$response = $exportsPendingArrangementDeliveryList->download('pending-arrangement-packing-list.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
$response = $exportsPendingArrangementDeliveryList->download('packing-list-delivery.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
public function onHold(Request $request) {
$exportsPendingArrangementDeliveryList = new ExportsOnHoldPackingList($request);
$response = $exportsPendingArrangementDeliveryList->download('packing-list-on-hold.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
@@ -0,0 +1,19 @@
<?php
namespace App\Http\Controllers\Notifications;
use App\Classes\Modules\Notifications\ControllersLogic\ListNotificationsLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ListNotificationsController
{
/**
* @param Request $request
* @param ListNotificationsLogic $logic
* @return JsonResponse
*/
public function list(Request $request, ListNotificationsLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
@@ -41,7 +41,7 @@ class DownloadOrderQrPdfController
$warehousePrefix = 'YW/';
}
if($warehouse->reference === WarehouseReferences::YD_GUANG_ZHOU){
if(in_array($warehouse->reference,[WarehouseReferences::YD_GUANG_ZHOU, WarehouseReferences::YD_GUANG_ZHOU_2])){
$warehousePrefix = 'YD/';
if(strtolower($deliveryAddress->state->name) === 'sabah' || strtolower($deliveryAddress->state->name) === 'labuan' || in_array(strtolower($deliveryAddress->district->name), ['limbang', 'lawas'])) {
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Segments;
use App\Classes\Modules\Segments\ControllersLogic\CreateBasePriceLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CreateBasePriceController
{
/**
* @param Request $request
* @param CreateBasePriceLogic $logic
* @return JsonResponse
*/
public function create(Request $request, CreateBasePriceLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Segments;
use App\Classes\Modules\Segments\ControllersLogic\FetchBasePriceLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class FetchBasePriceController
{
/**
* @param Request $request
* @param FetchSegmentLogic $logic
* @return JsonResponse
*/
public function fetch(Request $request, FetchBasePriceLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Segments;
use App\Classes\Modules\Segments\ControllersLogic\ListAirShipmentPriceLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ListAirShipmentPriceController
{
/**
* @param Request $request
* @param ListSegmentLogic $logic
* @return JsonResponse
*/
public function list(Request $request, ListAirShipmentPriceLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
@@ -1,20 +0,0 @@
<?php
namespace App\Http\Controllers\Segments;
use App\Classes\Modules\Segments\ControllersLogic\UpdateConstantStateLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateConstantStateController
{
/**
* @param Request $request
* @param UpdateConstantStateLogic $logic
* @return JsonResponse
*/
public function update(Request $request, UpdateConstantStateLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
@@ -0,0 +1,15 @@
<?php
namespace App\Http\Controllers\Transactions;
use App\Classes\Modules\Transactions\ControllersLogic\ApproveShippingInvoiceTransactionLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ApproveShippingInvoiceTransactionController
{
public function approve(Request $request, ApproveShippingInvoiceTransactionLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Transactions;
use App\Classes\Modules\Transactions\ControllersLogic\ShippingEstimationCalculatorLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ShippingEstimationCalculatorController
{
/**
* @param Request $request
* @param ShippingEstimationCalculatorLogic $logic
* @return JsonResponse
*/
public function calculate(Request $request, ShippingEstimationCalculatorLogic $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\UpdateShippingInvoiceTransactionLogic;
class UpdateShippingInvoiceTransactionController
{
/**
* @param Request $request
* @param UpdateShippingInvoiceTransactionLogic $logic
* @return JsonResponse
*/
public function update(Request $request, UpdateShippingInvoiceTransactionLogic $logic) : JsonResponse {
return $logic->execute($request);
}
}
+11
View File
@@ -5,6 +5,8 @@ namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Order;
use Illuminate\Http\Resources\Json\JsonResource;
use App\Models\SegmentConstant;
use App\Classes\ValueObjects\Constants\SegmentConstants;
class AddressResource extends JsonResource
{
@@ -17,6 +19,14 @@ class AddressResource extends JsonResource
public function toArray($request)
{
$centerPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::CENTER_POSTCODE)->get();
$centerPostcodeConstant = $centerPostcodeConstantObject->isEmpty() ? [] : (array)$centerPostcodeConstantObject->first()->value;
$postcodeArea = in_array($this->postcode, $centerPostcodeConstant) ? 'CENTER_POSTCODE' : '';
$outstationPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::OUTSTATION_POSTCODE)->get();
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
in_array($this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : '';
return [
'id' => $this->id,
'reference' => $this->reference,
@@ -25,6 +35,7 @@ class AddressResource extends JsonResource
'district' => $this->district,
'state' => $this->state,
'post_code' => $this->postcode,
'post_code_area' => $postcodeArea,
'country' => $this->country,
'default' => (int) $this->default,
'status' => (int) $this->status,
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class AirShipmentItemPriceResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
$object = $this->resource;
$detailsArray = (array)json_decode($object['details']);
return [
'name' => $detailsArray['name'],
'details' => $object['details'],
];
}
}
+6 -1
View File
@@ -32,6 +32,9 @@ class CompanyModuleResource extends JsonResource
$connection = $this->inviters()->withPivot('invitee_reference')->first();
$marking = $connection ? $connection->pivot->invitee_reference:'';
$segmentConstantObject = SegmentConstant::where('reference', SegmentConstants::WAREHOUSE_RATE)->get();
$segmentConstant = $segmentConstantObject->isEmpty() ? [] : (array)$segmentConstantObject->first()->value;
return [
'id' => $this->id,
'type' => $this->type,
@@ -40,7 +43,9 @@ class CompanyModuleResource extends JsonResource
'address' => new AddressResource($defaultAddress),
'company' => new CompanyResource($this->whenLoaded('company')),
'remarks' => RemarkResource::collection($this->remarks),
'marking' => $marking
'marking' => $marking,
'warehouseCharges' => array_key_exists($this->id, $segmentConstant) ? $segmentConstant[$this->id] : null,
'connections' => $this->connections,
];
}
+4 -3
View File
@@ -18,7 +18,7 @@ class CompanyResource extends JsonResource
*/
public function toArray($request)
{
$companyModule = $this->companyModules()->where('type', '=', BusinessType::IMPORTER)->first();
$companyModule = $this->companyModules()->first();
return [
'id' => $this->id,
'hash_id' => Crypt::encryptString($this->id),
@@ -27,11 +27,12 @@ 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),
'last_order' => new OrderResource($companyModule ? $companyModule->orders()->orderBy('id', 'DESC')->first(): null),
'order_count' => $this->orders()->count(),
'last_order' => $companyModule->type === 7 ? new DeliveryOrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()) : new OrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()),
'order_count' => $companyModule->orders()->count(),
'identification' => new DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED])->first()),
'created_at' => $this->created_at->format('d-m-Y')
+1 -1
View File
@@ -30,7 +30,7 @@ class ContainerResource extends JsonResource
'remarks' => RemarkResource::collection($this->remarks),
'status' => $this->status,
'packing_lists' => $this->whenLoaded('packingLists', PackingListResource::collection($this->whenLoaded('packingLists', function(){
return $this->packingLists()->whereHas('packages')->get()->sortBy(function ($packingList) {
return $this->packingLists()->get()->sortBy(function ($packingList) {
return $packingList->owner->company_module_id;
});
})))
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use Illuminate\Http\Resources\Json\JsonResource;
class DeliveryOrderResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'reference' => $this->reference,
'type' => (int) $this->type,
'status' => (int) $this->status,
'company_module' => new CompanyModuleResource($this->companyModule),
'sender_address' => new AddressResource($this->addresses()->where('status', '=', ApprovalStatus::APPROVED)->where('type', AddressType::PICK_UP)->first()),
'delivery_address' => new AddressResource($this->addresses()->where('status', '=', ApprovalStatus::APPROVED)->where('type', AddressType::DELIVERY)->first()),
'packingList' => new DeliveryPackingListResource($this->packingLists()->first()),
'remarks' => RemarkResource::collection($this->remarks),
'created_at' => $this->created_at->format('d-m-Y')
];
}
}
@@ -0,0 +1,36 @@
<?php
namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Models\Order;
use App\Models\PackingList;
use Illuminate\Http\Resources\Json\JsonResource;
class DeliveryPackingListResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
$package = $this->packages()->first();
return [
'id' => $this->id,
'claimant_id' => $this->claimant_id,
'reference' => $this->reference,
'status' => $this->status,
'transport' => new TransportResource($this->transports()->first()),
'type' => $package->type,
'description' => $package->description,
'weight' => (float) $package->weight,
'quantity' => (float) $package->quantity,
];
}
}
+1
View File
@@ -20,6 +20,7 @@ class DistrictResource extends JsonResource
'state' => $this->state,
'country' => $this->country,
'postcode' => $this->postcode,
'postcodeArray' => PostcodeResource::collection(json_decode($this->postcode)),
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\DocumentType;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Crypt;
class NotificationResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'title' => $this->title,
'description' => $this->description,
'long_ago' => $this->created_at->diffForHumans(),
'created_at' => $this->created_at->format('d-m-Y')
];
}
}

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