Compare commits

...

373 Commits

Author SHA1 Message Date
edmondlang d53e2fe19a fix issue unable to generate invoice 2022-05-24 00:26:23 +08:00
edmondlang fcf3d24ae4 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into container-payment-ui 2022-05-13 23:04:17 +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
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 10d62dd8d1 update export delivery list - include state and postcode 2022-04-06 13:53:43 +08:00
edmondlang 0fa0d8daab Shipping portal - export function for Delivery list (only 'Pending Arrangement' tab) 2022-04-06 13:30:16 +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
omair saleh 68d961a681 custom clearance status 2022-04-05 11:38:21 +08:00
omair saleh 2c29e5939e custom clearance status 2022-04-05 11:25:56 +08:00
omair saleh 6910dce35f custom clearance status 2022-04-05 11:23:39 +08:00
omair saleh a19db06b6b custom clearance status 2022-04-05 11:20:45 +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
omair saleh b764ee0769 update packing list monthly summary containers 2022-04-01 17:02:36 +08:00
omair saleh ab1d92af86 fix yd missing packages from order 2022-04-01 14:58:27 +08:00
omair saleh 2ff9a38114 fix yd missing packages from order 2022-04-01 14:57:41 +08:00
omair saleh 0abdbd525e fix yd missing packages from order 2022-04-01 14:56:46 +08:00
omair saleh f44aace3c5 fix yd missing packages from order 2022-04-01 14:56:05 +08:00
omair saleh 0af84a9b7d fix yd missing packages from order 2022-04-01 14:54:09 +08:00
omair saleh 1aff95b41c fix yd missing packages from order 2022-04-01 14:51:57 +08:00
omair saleh 745f476f89 fix yd missing packages from order 2022-04-01 14:41:24 +08:00
omair saleh e1d751b859 fix yd missing packages from order 2022-04-01 11:21:44 +08:00
omair saleh 6077b1fbbb fix yd missing packages from order 2022-04-01 10:56:56 +08:00
omair saleh 5fe8a7a59e fix order address update to vt 2022-03-31 21:15:19 +08:00
omair saleh 8b38bcac8a fix order address update to vt 2022-03-31 21:10:23 +08:00
omair saleh 5561442932 fix order address update to vt 2022-03-31 21:09:01 +08:00
omair saleh f33efd373c fix order address update to vt 2022-03-31 21:05:44 +08:00
omair saleh 53c325b36d fetch only 2 months orders from yd 2022-03-31 20:47:14 +08:00
omair saleh cd141bf988 fix yd older than 2 months orders 2022-03-31 20:30:49 +08:00
omair saleh 908f3fc11b fix yd older than 2 months orders 2022-03-31 20:29:49 +08:00
omair saleh 8e9f12b17e fix yd older than 2 months orders 2022-03-31 20:29:14 +08:00
omair saleh 782bcc69f1 fix yd older than 2 months orders 2022-03-31 20:28:41 +08:00
omair saleh 144464621e fix yd older than 2 months orders 2022-03-31 20:28:07 +08:00
omair saleh b290f95426 fix yd older than 2 months orders 2022-03-31 20:27:31 +08:00
omair saleh b7e6269aa9 fix yd older than 2 months orders 2022-03-31 20:25:14 +08:00
omair saleh 7180f802b3 fix yd older than 2 months orders 2022-03-31 20:20:19 +08:00
omair saleh 7159c1c11d fix yd older than 2 months orders 2022-03-31 20:17:55 +08:00
omair saleh cce0cae57c fix yd older than 2 months orders 2022-03-31 20:17:03 +08:00
omair saleh bebce6fbaa fix yd older than 2 months orders 2022-03-31 19:50:55 +08:00
omair saleh 531ab699ba show delivery delay days 2022-03-31 19:45:06 +08:00
omair saleh 9f9c17977d show delivery delay days 2022-03-31 19:44:11 +08:00
omair saleh 24f5de8c2c fix missing yd delivery 2022-03-31 14:41:10 +08:00
omair saleh 3b8079785a fix missing yd delivery 2022-03-31 14:19:47 +08:00
omair saleh 627fb3aa96 fix missing yd delivery 2022-03-31 14:18:34 +08:00
omair saleh 2b4d3f1992 fix missing yd delivery 2022-03-31 14:16:40 +08:00
omair saleh 65daceb59c fix missing yd delivery 2022-03-31 14:13:26 +08:00
omair saleh d7457e7174 fix missing yd delivery 2022-03-31 14:10:24 +08:00
omair saleh 9753eb3a18 fix packages is missing in yd api 2022-03-31 13:56:47 +08:00
omair saleh e7df49a0d1 fix packages is missing in yd api 2022-03-31 13:54:48 +08:00
omair saleh cd4e7aab10 fix packages is missing in yd api 2022-03-31 13:52:36 +08:00
omair saleh 29350dbb86 fix packages is missing in yd api 2022-03-31 13:52:16 +08:00
omair saleh 7338ebc78a fix packages is missing in yd api 2022-03-31 13:49:47 +08:00
omair saleh 4eded7a742 update holiday announcement 2022-03-31 09:31:09 +08:00
omair saleh dc562f6554 update holiday announcement 2022-03-31 09:29:31 +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 2d965009ec move unclaimed packing lists to dashboard 2022-03-30 11:31:40 +08:00
omair saleh 7d84ddee95 fix do update bug 2022-03-30 00:25:18 +08:00
omair saleh 92b31a9342 fix do update bug 2022-03-30 00:22:05 +08:00
omair saleh 012dbfde09 fix do update bug 2022-03-30 00:21:14 +08:00
omair saleh 0b651953ea fix do update bug 2022-03-30 00:20:24 +08:00
omair saleh b34f50ae9d fix do update bug 2022-03-30 00:20:11 +08:00
omair saleh 8f0d1e6fdf fix do update bug 2022-03-30 00:19:22 +08:00
omair saleh e8990d96f7 debug do update 2022-03-30 00:06:22 +08:00
omair saleh 69ee0eea2c debug do update 2022-03-30 00:05:45 +08:00
omair saleh adcdf5909e debug do update 2022-03-29 23:57:16 +08:00
omair saleh b9523fb567 debug do update 2022-03-29 23:56:31 +08:00
omair saleh 79678d7b93 debug do update 2022-03-29 23:56:01 +08:00
omair saleh 2bdfd2772a debug do update 2022-03-29 23:54:14 +08:00
omair saleh 55513f5175 debug do update 2022-03-29 23:44:22 +08:00
omair saleh 709534ce04 debug do update 2022-03-29 23:43:29 +08:00
omair saleh 74d85eee60 debug do update 2022-03-29 23:42:32 +08:00
omair saleh 63badc08f0 debug do update 2022-03-29 23:41:34 +08:00
omair saleh 73010ed32b debug do update 2022-03-29 23:40:20 +08:00
omair saleh 7a2a90545b debug do update 2022-03-29 23:40:05 +08:00
omair saleh c0ee3a8e57 debug do update 2022-03-29 23:39:28 +08:00
omair saleh 0c7e4d5785 debug do update 2022-03-29 23:38:33 +08:00
omair saleh c3cd8ae3a0 debug do update 2022-03-29 23:35:27 +08:00
omair saleh 0e7469f1cd new registration ui flow 2022-03-29 23:15:42 +08:00
omair saleh 32476afdd4 fix vt warehouse list 2022-03-27 12:56:31 +08:00
omair saleh 8b6db1fb68 temp test vt warehouse list 2022-03-27 12:55:06 +08:00
omair saleh 43f3fbff07 temp test vt warehouse list 2022-03-27 12:54:06 +08:00
omair saleh caf8624d4c temp test vt warehouse list 2022-03-27 12:51:43 +08:00
omair saleh eb417cf389 temp test vt warehouse list 2022-03-27 12:50:23 +08:00
omair saleh 276a87ff0d temp test vt warehouse list 2022-03-27 12:49:08 +08:00
omair saleh 6d2f179025 Merge branch 'development' into 'master'
Development

See merge request CIEFWorldwideSdnBhd/shipping-portal!116
2022-03-27 03:54:48 +00:00
omair saleh 8609c926f9 Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2022-03-27 11:53:18 +08:00
omair saleh 368a055bb4 add chat box to development 2022-03-27 11:50:27 +08:00
omair saleh d617001412 fix vt YW orders 2022-03-27 11:49:32 +08:00
omair saleh c932cb00cc add chat widget 2022-03-25 17:36:27 +08:00
omair saleh 1be62a5f77 fix vt order number to filter yw 2022-03-25 16:54:10 +08:00
omair saleh 445bcb3864 small clean up 2022-03-24 13:33:04 +08:00
omair saleh d489775924 small clean up 2022-03-24 13:32:34 +08:00
omair saleh fff428882d small clean up 2022-03-24 13:31:37 +08:00
omair saleh 42205ddbc3 small clean up 2022-03-24 13:29:59 +08:00
omair saleh 722e502b3b tidy up invoices details descriptions 2022-03-24 13:26:55 +08:00
omair saleh 4f93569b4c Merge branch 'development' into 'master'
Development

See merge request CIEFWorldwideSdnBhd/shipping-portal!115
2022-03-24 05:22:35 +00:00
omair saleh e1abebc66c Merge branch 'transaction-invoice' into 'development'
transaction detail over weight

See merge request CIEFWorldwideSdnBhd/shipping-portal!114
2022-03-24 05:18:22 +00:00
omair saleh 2424882cfe Merge branch 'development' into 'transaction-invoice'
# Conflicts:
#   app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php
2022-03-24 05:18:17 +00:00
omair saleh 23f50faa84 release create warehouse arrival parcel module 2022-03-24 13:11:22 +08:00
edmondlang edc510681e Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2022-03-24 11:40:20 +08:00
omair saleh db03836ef5 add new way of detecting yd container rescheduling 2022-03-24 10:59:59 +08:00
edmondlang 3a5f404294 Tidy Up Export Customer activity details, add new filter - minOrders and minCbm 2022-03-23 00:53:16 +08:00
edmondlang 9b79f16faa Merge branch 'api-to-update-segment-constants' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2022-03-22 21:55:24 +08:00
edmondlang 4ff4418f7f Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2022-03-19 13:35:09 +08:00
glovetleong 19c8f1e658 transaction detail over weight 2022-03-18 20:46:40 +08:00
omair saleh e1c4d674b6 smc report for specific containers 2022-03-18 17:48:18 +08:00
omair saleh 3326de9c4f smc report for specific containers 2022-03-18 17:44:28 +08:00
omair saleh 54dd6d407d revert invoice changes 2022-03-18 16:18:44 +08:00
omair saleh 9ee81d9385 update rfm to table 2022-03-18 16:18:12 +08:00
omair saleh aa1ba03415 update rfm to table 2022-03-18 16:16:25 +08:00
omair saleh fb6b2173b5 update rfm to table 2022-03-18 16:14:42 +08:00
omair saleh f18e4a882f update container reschedule for yd 2022-03-17 17:47:34 +08:00
omair saleh 8edc91bb61 update container reschedule for yd 2022-03-17 17:46:24 +08:00
omair saleh 6122c288df update container reschedule for yd 2022-03-17 17:45:10 +08:00
omair saleh 9650877819 update container reschedule for yd 2022-03-17 17:43:03 +08:00
omair saleh c65d875a3d update container reschedule for yd 2022-03-17 17:41:39 +08:00
omair saleh c1bc610549 update container reschedule for yd 2022-03-17 17:41:06 +08:00
omair saleh 82d406abfc update container reschedule for yd 2022-03-17 17:39:47 +08:00
omair saleh 701610978d update container reschedule for yd 2022-03-17 17:37:07 +08:00
omair saleh f7e1665a02 update container reschedule for yd 2022-03-17 17:36:24 +08:00
omair saleh d389b87609 update container reschedule for yd 2022-03-17 17:34:51 +08:00
omair saleh 987fdcfba2 update container reschedule for yd 2022-03-17 17:33:23 +08:00
omair saleh 6214a2b723 update container reschedule for yd 2022-03-17 17:31:39 +08:00
omair saleh fe00b1fab7 update container reschedule for yd 2022-03-17 17:22:02 +08:00
omair saleh 41df3e6ae7 update container reschedule for yd 2022-03-17 17:18:47 +08:00
omair saleh cf7d9ccca5 update container reschedule for yd 2022-03-17 17:17:01 +08:00
omair saleh 384d234b50 update container reschedule for yd 2022-03-17 17:16:35 +08:00
omair saleh 3fbfa44a04 update container reschedule for yd 2022-03-17 17:14:02 +08:00
omair saleh cbc294054e update container reschedule for yd 2022-03-17 17:12:47 +08:00
omair saleh 324556985a update container reschedule for yd 2022-03-17 17:08:23 +08:00
omair saleh 1b8c6ca317 update container reschedule for yd 2022-03-17 17:08:12 +08:00
omair saleh bbd09d300c update container reschedule for yd 2022-03-17 17:07:33 +08:00
omair saleh 47c97d6151 update container reschedule for yd 2022-03-17 17:05:04 +08:00
omair saleh 435e3a8f7a update container reschedule for yd 2022-03-17 17:03:40 +08:00
omair saleh 151032bb66 update container reschedule for yd 2022-03-17 17:02:40 +08:00
omair saleh f32335d57b update container reschedule for yd 2022-03-17 16:58:52 +08:00
omair saleh 2deddc4e03 update container reschedule for yd 2022-03-17 16:57:49 +08:00
omair saleh 32e665e4f7 update container reschedule for yd 2022-03-17 16:57:03 +08:00
omair saleh a987419040 update container reschedule for yd 2022-03-17 16:36:50 +08:00
omair saleh b0a65f870c update container reschedule for yd 2022-03-17 16:33:00 +08:00
omair saleh 33a75eca7d smc monthly report 2022-03-17 13:53:50 +08:00
Leong Chee Siong deb68dc723 Merge branch 'transaction-invoice' into 'development'
billpliz callback

See merge request CIEFWorldwideSdnBhd/shipping-portal!113
2022-03-17 02:13:19 +00:00
omair saleh 519408c2b5 lawas and Limbang show kk warehouse 2022-03-17 09:55:46 +08:00
omair saleh 53907e2463 lawas and Limbang show kk warehouse 2022-03-17 09:52:24 +08:00
omair saleh 10e6f6045e lawas and Limbang show kk warehouse 2022-03-17 09:51:36 +08:00
omair saleh c06cec5b41 lawas and Limbang show kk warehouse 2022-03-17 09:47:31 +08:00
omair saleh cfe611d05d lawas and Limbang show kk warehouse 2022-03-17 09:45:24 +08:00
ahmedsophyudden b9b79ca65a Shipping Portal - Api to update segment (general, state, postcode) 2022-03-17 01:01:01 +08:00
glovetleong 9a1562386f billpliz callback 2022-03-16 23:01:38 +08:00
omair saleh 22700893a2 fix qr remark 2022-03-16 10:03:47 +08:00
omair saleh 550c9480a4 fix qr remark 2022-03-16 10:02:17 +08:00
omair saleh 48bab9998c fix qr remark 2022-03-16 09:47:26 +08:00
omair saleh 3ff81d4f00 fix qr remark 2022-03-16 09:46:23 +08:00
omair saleh cc7edfc784 sort deliveries by date 2022-03-16 01:24:37 +08:00
omair saleh 72448d656c sort deliveries by date 2022-03-16 01:20:13 +08:00
omair saleh c941f679b6 sort deliveries by date 2022-03-16 01:19:31 +08:00
omair saleh 78f6c70cad sort deliveries by date 2022-03-16 01:18:53 +08:00
omair saleh 1575d62e0f sort deliveries by date 2022-03-16 01:17:21 +08:00
omair saleh 43f4bc533a sort deliveries by date 2022-03-16 01:16:13 +08:00
omair saleh 9ae36dc400 sort deliveries by date 2022-03-16 01:14:27 +08:00
omair saleh 02c55d97b7 sort deliveries by date 2022-03-16 01:00:27 +08:00
omair saleh baeaa0f31a sort deliveries by date 2022-03-16 00:58:16 +08:00
omair saleh dadc786f1f Merge branch 'development' into 'master'
Development

See merge request CIEFWorldwideSdnBhd/shipping-portal!112
2022-03-15 16:32:13 +00:00
omair saleh bd9dab0029 hide invoice button for production 2022-03-16 00:31:24 +08:00
omair saleh e2b795c872 Merge remote-tracking branch 'origin/development' into development 2022-03-16 00:30:55 +08:00
omair saleh 9a79c6dd1d Merge branch 'development' into 'master'
Warehouse Profile

See merge request CIEFWorldwideSdnBhd/shipping-portal!111
2022-03-15 16:28:58 +00:00
omair saleh d8e1c38429 hide invoice button for production 2022-03-16 00:24:18 +08:00
Leong Chee Siong aa28afb9f0 Merge branch 'transaction-invoice' into 'development'
soft delete user

See merge request CIEFWorldwideSdnBhd/shipping-portal!110
2022-03-14 05:45:21 +00:00
glovetleong 7ec109eb3e soft delete user 2022-03-14 13:42:48 +08:00
omair saleh 7151616b04 Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2022-03-14 13:19:04 +08:00
187 changed files with 93357 additions and 997 deletions
@@ -4,7 +4,7 @@ namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class OwnerId implements Filter
class TypeIn implements Filter
{
/**
@@ -14,7 +14,7 @@ class OwnerId implements Filter
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('owner_id', $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);
@@ -26,8 +26,6 @@ use Illuminate\Support\Facades\Log;
class CallbackBillplzLogic
{
/** @var GetBillplzBill */
private $getBillplzBill;
@@ -47,12 +45,11 @@ class CallbackBillplzLogic
* @param UpdatesTransactionStatus $updatesTransactionStatus
* @param UpdatesWalletBalance $updatesWalletBalance
*/
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdatesWalletBalance $updatesWalletBalance)
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus)
{
$this->getBillplzBill = $getBillplzBill;
$this->fetchesTransaction = $fetchesTransaction;
$this->updatesTransactionStatus = $updatesTransactionStatus;
$this->updatesWalletBalance = $updatesWalletBalance;
}
@@ -84,22 +81,11 @@ class CallbackBillplzLogic
$status = $billplzXSignatureObject->getStatus() === 'failed' ? ApprovalStatus::REJECTED : ApprovalStatus::PENDING_VERIFICATION;
}
if($transaction->status !== ApprovalStatus::COMPLETED){
if($transaction->owner instanceof Wallet && $transaction->status !== ApprovalStatus::APPROVED && $status === ApprovalStatus::APPROVED) {
$this->updatesWalletBalance->execute($transaction->owner, $transaction->amount);
}
$this->updatesTransactionStatus->execute($transaction, $status);
}
$token = Auth::fromUser(User::find(1));
$request->headers->set('Authorization', 'Bearer '.$token);
$marking = $transaction->owner instanceof Booking ? $transaction->booking->marking : $transaction->owner->owner->bookings()->orderBy('id', 'DESC')->first()->marking;
return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $marking, 'transaction' => $transaction, 'status' => $status]);
$marking = $transaction->owner()->first()->owner()->first();
return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $marking->reference, 'transaction' => $transaction, 'status' => $status]);
}
}
@@ -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
*/
@@ -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,72 @@
<?php
namespace App\Classes\Modules\Exports\Services;
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 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,59 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
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;
$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,
];
}
}
@@ -0,0 +1,84 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
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 ExportsPendingArrangementDeliveryList implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
{
use Exportable;
public function headings(): array
{
return [
'Container Ref.',
'ETA',
'Unstuffing',
'Marking',
'Order Number',
'status',
'Delay Days / delivery date',
'Quantity',
'State',
'Postcode',
'Address',
'PIC',
'Phone',
'Remark'
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function query()
{
return PackingList::where('type', '=', 2)->whereHas('containers', function ($query){
$query->where('containers.status', ApprovalStatus::COMPLETED);
});
}
/**
* @param PackingList $packingList
*
* @return array
*/
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;
$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 [
$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'),
$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 : '',
];
}
}
@@ -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;
}
}
@@ -7,6 +7,7 @@ use App\Classes\Modules\Orders\Standards\Rules\CanApproveChangeOrderAddress;
use App\Classes\Modules\Orders\Services\UpdatesOrdersAddress;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackingListType;
use Illuminate\Http\Request;
class ApproveChangeOrderAddressProcessor
@@ -65,7 +66,11 @@ class ApproveChangeOrderAddressProcessor
$address->owner->addresses()->update(['status' => ApprovalStatus::EXPIRED]);
$appointee = $address->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
$appointee === 2 ? $this->updateDoFromVTPortalProcessor->execute($address) : $this->updateDoFromYDPortalProcessor->execute($address);
if($appointee === 2) {
foreach($address->owner->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST) as $packingList){
$this->updateDoFromVTPortalProcessor->execute($packingList);
}
}
}
@@ -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();
@@ -6,23 +6,9 @@ use App\Classes\Exceptions\InternalServerErrorException;
use App\Classes\Modules\Orders\Services\FetchesDataFromVTPortal;
use App\Classes\Modules\Addresses\Services\FetchesAddress;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Classes\Modules\Transports\Services\CreatesTransport;
use App\Classes\Modules\Unity\Services\UpdatesContractObligation;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Models\PackingList;
use App\Models\Transport;
use Carbon\Carbon;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\Request;
class UpdateDoFromVTPortalProcessor
{
/** @var FetchesDataFromVTPortal */
@@ -43,19 +29,20 @@ class UpdateDoFromVTPortalProcessor
}
/**
* @param $address
* @param PackingList $packing_list
* @return array
* @throws GuzzleException
* @throws InternalServerErrorException
*/
public function execute($address) {
public function execute(PackingList $packing_list) {
if(!app()->environment(['production'])){
return [];
}
try {
$order = $address->owner()->orderBy('id', 'desc')->first();
$packing_list = $order->packingLists()->orderBy('id', 'desc')->first();
$address= $packing_list->owner->addresses()->where('status', ApprovalStatus::APPROVED)->first();
$order = $packing_list->owner;
if ($packing_list) {
$contact = $address->contacts()->first();
@@ -67,7 +54,7 @@ class UpdateDoFromVTPortalProcessor
$status = 'On Hold';
if (in_array($packing_list->status, [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
if (in_array($packing_list->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
$status = 'Release';
}
@@ -77,6 +64,7 @@ class UpdateDoFromVTPortalProcessor
if ($vt_do) {
foreach ($vt_do->Rows as $key => $row) {
if($row[4] !== $packing_list->containers()->first()->reference) continue;
$vt_do_update = $this->fetchesDataFRomVTPortal->clientRequest(
'http://portal.vtnation.com.my/Services/DataControllerService.asmx/Execute',
'POST',
@@ -141,7 +129,7 @@ class UpdateDoFromVTPortalProcessor
}
} catch (\Exception $exception){
return [];
throw new InternalServerErrorException('failed to approve address due to an error related to VT portal: '.$exception->getMessage());
}
}
@@ -8,6 +8,7 @@ use App\Classes\Modules\Addresses\Services\FetchesAddress;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Models\PackingList;
use Illuminate\Support\Facades\Log;
class UpdateDoFromYDPortalProcessor
@@ -30,36 +31,34 @@ class UpdateDoFromYDPortalProcessor
}
/**
* @param $address
* @param PackingList $packingList
* @return void
* @throws InternalServerErrorException
*/
public function execute($address) {
public function execute(PackingList $packingList) {
if(!app()->environment(['production'])){
return;
}
try {
$order = $address->owner()->orderBy('id', 'desc')->first();
$packing_lists = $order->packingLists()
->where('type', PackingListType::SHIPPING_PACKING_LIST)
->where('status', '!=', ApprovalStatus::SUSPENDED)
->orderBy('id', 'desc')->get();
$address = $packingList->owner->addresses()->where('status', ApprovalStatus::APPROVED)->first();
if (!in_array($packingList->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
return;
}
foreach ($packing_lists as $key => $row) {
if ($row->status === ApprovalStatus::SUSPENDED) {
continue;
}
$contact = $address->contacts()->first();
$remark = $address->remarks()->first();
$contact = $address->contacts()->first();
$remark = $address->remarks()->first();
$phone = $contact ? $contact->phone : null;
$reference = $contact ? $contact->reference : null;
$remark = $remark ? $remark->content : 'URGENT!!! PLEASE CALL BEFORE ONE DAY DELIVERY.';
$phone = $contact ? $contact->phone : null;
$reference = $contact ? $contact->reference : null;
$remark = $remark ? $remark->content : 'URGENT!!! PLEASE CALL BEFORE ONE DAY DELIVERY.';
$this->fetchesDataFRomYDPortal->clientRequest(
'http://www.yd-wl.com/api/UpdateOrderAddress.ashx',
'POST',
$this->fetchesDataFRomYDPortal->clientRequest(
'http://www.yd-wl.com/api/UpdateOrderAddress.ashx',
'POST',
[
'expressno' => $row->reference,
'expressno' => $packingList->reference,
'customers_name' => $reference,
'cellphone' => $phone,
'postcode' => $address->postcode,
@@ -68,8 +67,6 @@ class UpdateDoFromYDPortalProcessor
]);
}
} catch (\Exception $exception){
throw new InternalServerErrorException('failed to approve address due to an error related to YD portal');
}
@@ -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();
}
@@ -56,28 +56,23 @@ class ReschedulePackingListLogic extends AbstractControllerLogic
*/
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();
$old_sechedule = $transport->schedules()->first();
$this->updatesScheduleStatus->execute($old_sechedule, ApprovalStatus::REJECTED);
$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());
}
$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));
}
}
@@ -14,6 +14,7 @@ use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Http\Resources\PackingListResource;
use App\Models\PackingList;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -70,16 +71,16 @@ class UpdatePackingListStatusLogic extends AbstractControllerLogic
{
$packingList = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
$packing_list = $this->updatesPackingListStatus->execute($packingList, $request->route('status'));
$address = $packing_list->owner()->first()->addresses()->where('status', ApprovalStatus::APPROVED)->first();
/** @var PackingList $packingList */
$packingList = $this->updatesPackingListStatus->execute($packingList, $request->route('status'));
// $appointee = $address->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
$this->updateDoFromVTPortalProcessor->execute($address);
$this->updateDoFromYDPortalProcessor->execute($address);
$this->updateDoFromVTPortalProcessor->execute($packingList);
$this->updateDoFromYDPortalProcessor->execute($packingList);
return $this->resourceResponse(new PackingListResource($packing_list));
return $this->resourceResponse(new PackingListResource($packingList));
}
}
@@ -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);
@@ -158,13 +158,9 @@ class FetchLoadedContainersFromVTPortalProcessor
}
foreach($containerDetail->Rows as $packingList){
$marking = explode('/', explode('CIEF/', $packingList[13])[1]);
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $packingList[13]));
if(!array_key_exists(1, $marking)){
continue;
}
$orderNumber = $marking[1];
$orderNumber = $marking[array_key_last($marking)];
if(!$packingList[22]){
continue;
@@ -36,6 +36,7 @@ use App\Models\Transport;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
class FetchOrderListsFromYdPortalProcessor
{
@@ -153,7 +154,6 @@ class FetchOrderListsFromYdPortalProcessor
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
foreach($rows->data as $row){
$containerReference = null;
$loadingDate = null;
$unstuffingDate = null;
@@ -168,6 +168,11 @@ class FetchOrderListsFromYdPortalProcessor
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
if(!$rows){
Log::debug($row->expressno);
continue;
}
foreach (array_reverse($rows->data) as $trackingRow) {
if ($trackingRow->tracking === '货物已送达仓库准备入库中') {
$receiveDate = Carbon::parse($trackingRow->trackingtime);
@@ -181,21 +186,43 @@ class FetchOrderListsFromYdPortalProcessor
$eta = Carbon::parse($tracking[2]);
}
if (strpos($trackingRow->tracking, '预计船时间为') !== false) {
$tracking = explode('预计船时间为', $trackingRow->tracking);
$delayDate = Carbon::parse(explode('日', $tracking[1])[0]);
$rescheduleETD = strpos($trackingRow->remark, '') || strpos($trackingRow->remark, '到港');
$rescheduleETA = strpos($trackingRow->remark, '到港');
if (($rescheduleETD !== false || $rescheduleETA !== false) && strpos($trackingRow->tracking, '货物装柜完成。') === false) {
preg_match_all('/([0-9]+.{3})/', $trackingRow->remark, $matches);
$dates = collect();
foreach($matches[0] as $date){
try {
$dates->push(Carbon::parse(str_replace('.', '/', $date).Carbon::now()->format('Y')));
} catch (\Exception $exception) {
continue;
}
}
$rescheduleDate = $dates->sortDesc()->first();
if(!$delayDate || $rescheduleDate > $delayDate){
/** @var Carbon $delayDate */
$delayDate = $rescheduleDate;
if($rescheduleETA === false && $delayDate) {
$delayDate = $delayDate->addDays('5');
}
}
}
if (strpos($trackingRow->tracking, '预计开船') !== false) {
$tracking = explode('预计开船为', $trackingRow->tracking);
$delayDate = Carbon::parse(explode('日', $tracking[1])[0]);
if ($trackingRow->tracking === '开船') {
$delayDate = Carbon::parse($trackingRow->trackingtime)->addDays('5');
}
if ($trackingRow->tracking === '货物已进目的港仓库') {
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
}
if ($trackingRow->tracking === '货物已派送完成') {
if (Str::contains($trackingRow->tracking, ['派送中'])) {
$deliveryDate = Carbon::parse($trackingRow->trackingtime);
}
}
@@ -288,6 +315,13 @@ class FetchOrderListsFromYdPortalProcessor
$this->createPackageProcessor->execute($packageObject, $packingList);
}
if(!count($row->deliverysize)){
$measurement = round(((float) $row->volume / (float) $row->goodcount) ** (1/3) * 100, 2);
$packageObject = new PackageObject(PackageType::CARTON, $row->goodname, (float) $measurement, (float) $measurement, (float) $measurement, 0, (float) $row->goodcount, ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $warehouseReceiveList);
$this->createPackageProcessor->execute($packageObject, $packingList);
}
$weightCbm = (float) $row->weight / 500;
$overWeightCbm = $weightCbm - $packingList->packages()->sum(DB::raw('(width/100) * (height/100) * (length/100) * quantity'));
@@ -344,7 +378,7 @@ class FetchOrderListsFromYdPortalProcessor
$transport = $container->transports()->first();
if(!$transport->schedules()->where('eta', '=', $delayDate)->first()) {
if(!$transport->schedules()->whereDate('eta', '>=', $delayDate)->first()) {
$etd = $transport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->etd;
$transport->schedules()->update(['status' => ApprovalStatus::EXPIRED]);
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $delayDate, ApprovalStatus::APPROVED));
@@ -373,7 +407,7 @@ class FetchOrderListsFromYdPortalProcessor
}
}
if($deliveryDate && !$packingList->transports){
if($deliveryDate && !$packingList->transports()->exists()){
$packingList->status = ApprovalStatus::COMPLETED;
$packingList->save();
@@ -134,19 +134,13 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
foreach ($response->Rows as $parcel){
$marking = explode('/', explode('CIEF/', $parcel[5])[1]);
if(!array_key_exists(1, $marking)){
continue;
}
$orderNumber = $marking[1];
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $parcel[5]));
$orderNumber = $marking[array_key_last($marking)];
if(!$parcel[9]){
continue;
}
try {
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
} catch (ResourceNotFoundException $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));
}
}
@@ -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('name'), $request->input('reference'), $request->input('detail'));
$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('rate'));
$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('rate');
$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));
}
@@ -0,0 +1,131 @@
<?php
namespace App\Classes\Modules\Segments\ControllersLogic;
use Illuminate\Http\Request;
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\AddItemToConstantValueArray;
use App\Classes\Modules\Segments\Services\RemoveItemFromConstantValueArray;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\Modules\Segments\Services\CreatesConstant;
class UpdateConstantPostcodeLogic 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 AddItemToConstantValueArray */
private $addItemToConstantValueArray;
/** @var RemoveItemFromConstantValueArray */
private $removeItemFromConstantValueArray;
/** @var CreatesConstant */
private $createsConstant;
/**
* UpdateConstantLogic constructor.
* @param CanUpdateConstant $canUpdateConstant
* @param UpdatesConstant $updatesConstant
* @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,
CreatesConstant $createsConstant
)
{
$this->canUpdateConstant = $canUpdateConstant;
$this->updatesConstant = $updatesConstant;
$this->fetchesSegment = $fetchesSegment;
$this->fetchesConstant = $fetchesConstant;
$this->addItemToConstantValueArray = $addItemToConstantValueArray;
$this->removeItemFromConstantValueArray = $removeItemFromConstantValueArray;
$this->createsConstant = $createsConstant;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function logic(Request $request) : JsonResponse
{
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
try {
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]);
$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);
return $this->resourceResponse(new ConstantResource($constant));
}
}
@@ -7,34 +7,22 @@ use App\Classes\General\Interfaces\DataTransferObject;
class ConstantObject implements DataTransferObject
{
/** @var string */
private $name;
/** @var string */
private $reference;
/** @var array */
private $detail;
private $value;
/**
* ConstantObject constructor.
* @param string $name
* @param string $reference
* @param array $detail
* @param array $value
*/
public function __construct(string $name, string $reference, array $detail)
public function __construct(string $reference, array $value)
{
$this->name = $name;
$this->reference = $reference;
$this->detail = $detail;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
$this->value = $value;
}
/**
@@ -48,9 +36,9 @@ class ConstantObject implements DataTransferObject
/**
* @return array
*/
public function getDetail(): array
public function getValue(): array
{
return $this->detail;
return $this->value;
}
@@ -0,0 +1,19 @@
<?php
namespace App\Classes\Modules\Segments\Services;
class AddItemToConstantValueArray
{
/**
* @param array $array
* @param $item
* @return array
*/
public function execute($array, $item): array {
$array[] = $item;
sort($array);
return $array;
}
}
@@ -27,11 +27,11 @@ class ConvertsConstantDetailsToResource
public function execute(SegmentConstant $constant){
if($constant->reference === SegmentConstants::SUPPLIER_CURRENCIES) {
return property_exists($constant->detail, 'id') ? new CurrencyResource($this->fetchesCurrency->execute(['id' => $constant->detail->id])) : '';
}
// if($constant->reference === SegmentConstants::SUPPLIER_CURRENCIES) {
// return property_exists($constant->detail, 'id') ? new CurrencyResource($this->fetchesCurrency->execute(['id' => $constant->detail->id])) : '';
// }
return $constant->detail;
return $constant->value;
}
@@ -18,9 +18,8 @@ class CreatesConstant extends AbstractUpdateRelationshipRecord
public function execute(Segment $segment, ConstantObject $object)
{
$model = new SegmentConstant();
$model->name = $object->getName();
$model->reference = $object->getReference();
$model->detail = json_encode($object->getDetail());
$model->value = json_encode($object->getValue());
return $this->handler($segment->constants(), $model);
}
@@ -0,0 +1,22 @@
<?php
namespace App\Classes\Modules\Segments\Services;
class RemoveItemFromConstantValueArray
{
/**
* @param array $array
* @param $item
* @return array
*/
public function execute($array, $item): array {
foreach($array as $key => $value){
if($array[$key] == $item){
unset($array[$key]);
}
}
return array_values($array);
}
}
@@ -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;
}
}
@@ -17,9 +17,8 @@ class UpdatesConstant extends AbstractUpdateRecord
*/
public function execute(SegmentConstant $model, ConstantObject $object)
{
$model->name = $object->getName();
$model->reference = $object->getReference();
$model->detail = json_encode($object->getDetail());
$model->value = json_encode($object->getValue());
return $this->handler($model);
}
@@ -0,0 +1,23 @@
<?php
namespace App\Classes\Modules\Segments\Services;
class UpdatesConstantValue
{
/**
* @param $json
* @param int $status_id
* @param Array $rate
* @return Array
*/
public function execute($json, int $state_id, Array $rate) {
$objectArray = (array) $json;
$objectArray[$state_id] = $rate;
return $objectArray;
}
}
@@ -15,9 +15,8 @@ class ConstantValidation extends AbstractValidation
protected function data($object): array {
$data = [
'name' => $object->getName(),
'reference' => $object->getReference(),
'detail' => $object->getDetail()
'value' => $object->getValue()
];
return $data;
@@ -28,9 +27,8 @@ class ConstantValidation extends AbstractValidation
*/
protected function rules(): array {
return [
'name' => 'required',
'reference' => 'required',
'detail' => 'required'
'value' => 'required'
];
}
@@ -20,7 +20,13 @@ use App\Classes\ValueObjects\Constants\TransactionType;
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\Models\Document;
use App\Models\Transaction;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
@@ -86,64 +92,46 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
{
$packing_list = $this->fetchesPackingList->execute(['id' => $request->input('packing_list_id')]);
$cbm = $packing_list->packages->sum(function($package) {
$cbm = $packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum(function($package) {
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
});
$order = $packing_list->owner()->first();
$over_weight_cbm = $packing_list->packages->where('type', PackageType::OVER_WEIGHT)->sum(function($package) {
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
});
$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]);
$base_price_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::BASE_PRICE]);
$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]);
$base_price = 0;
$warehouse_rate = 0;
$state_rate = 0;
$state_select = [];
$with_out = false;
$state_select = '';
if ($base_price_constant) {
$base_price = $base_price_constant->value->price;
}
$base_price = $this->getConstantByKey($base_price_constant, date('Y-m-d'));
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;
}
}
}
$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 ($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;
}
}
}
$stateId = $address->state_id;
$state_rate_constant = $this->getConstantByKey($state_rate_constant, $stateId);
if ($outstation_postcode_constant) {
foreach ($outstation_postcode_constant->value as $key_out => $row_out) {
if($row_out == $address->postcode) {
$with_out = true;
}
}
}
if (!empty($state_select)) {
$state_rate = $state_select->rate;
if ($with_out) {
$state_rate = $state_select->rate + $state_select->outstation_rate;
}
}
// 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[$state_select];
$price_cbm = $base_price + $warehouse_rate + $state_rate;
$total_cbm = $price_cbm * $cbm;
$total_cbm = $price_cbm * ($cbm + $over_weight_cbm);
$billNumber = $this->generatesTransactionBillNumber->execute('SHIP-');
@@ -162,19 +150,31 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
0,
0,
null,
ApprovalStatus::PENDING_SUBMISSION
ApprovalStatus::PENDING_VERIFICATION
);
/** @var Transaction $invoice_transaction */
$invoice_transaction = $this->createsTransaction->execute($packing_list, $object);
$object_detail = new TransactionDetailObject(
$invoice_transaction->bill_no,
$invoice_transaction->bill_no,
1,
$invoice_transaction->amount,
$invoice_transaction->amount
'SHIPPING_FEE',
TransactionDetailType::SHIPPING_FEE,
$cbm,
$price_cbm
);
$transaction_detail = $this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
if ($over_weight_cbm > 0) {
$object_detail = new TransactionDetailObject(
'OVER_WEIGHT_CHARGES',
TransactionDetailType::OVER_WEIGHT_CHARGES,
$over_weight_cbm,
$price_cbm
);
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
}
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice_transaction]);
@@ -185,11 +185,30 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
ApprovalStatus::COMPLETED,
'shipping_invoice'
);
/** @var Document $document */
$document = $this->createsDocument->execute($invoice_transaction, $document_object);
$this->createsFile->execute($document, $document_object);
// dd('yess');
return $this->response([]);
}
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;
}
}
}
@@ -12,7 +12,7 @@ class TransactionDetailObject implements DataTransferObject
/** @var string|null */
private $name;
/** @var int|null */
/** @var float|null */
private $quantity;
/** @var float|null */
@@ -22,10 +22,10 @@ class TransactionDetailObject implements DataTransferObject
* TransactionDetailObject constructor.
* @param string $reference
* @param string $name
* @param int $quantity
* @param float $quantity
* @param float $price
*/
public function __construct(?string $reference, ?string $name , ?int $quantity, ?float $price)
public function __construct(?string $reference, ?string $name , ?float $quantity, ?float $price)
{
$this->reference = $reference;
$this->name = $name;
@@ -50,9 +50,9 @@ class TransactionDetailObject implements DataTransferObject
}
/**
* @return int
* @return float
*/
public function getQuantity(): ?int
public function getQuantity(): ?float
{
return $this->quantity;
}
@@ -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;
}
@@ -0,0 +1,10 @@
<?php
namespace App\Classes\ValueObjects\Constants;
final class TransactionDetailType {
public const SHIPPING_FEE = 'Shipping Fee';
public const OVER_WEIGHT_CHARGES = 'Over weight 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';
@@ -43,6 +45,8 @@ final class WarehouseReferences {
public const YD_EXEMPT_LIST = [230, 294, 320, 652, 1248, 1726];
public const REPLICA_WHITE_LIST = [502];
//2376 qce
}
@@ -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;
}
}
@@ -0,0 +1,37 @@
<?php
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;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Excel;
class ExportPendingArrangementPackingListController
{
/**
* ExportPendingArrangementPackingListController 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 ExportsPendingArrangementDeliveryList($request);
$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;
}
}
@@ -24,7 +24,7 @@ class DownloadOrderQrPdfController
$warehousePrefix = '';
$deliveryPrefix = '';
$customerMarking = '';
$remark = $warehouse->remarks()->first()->content;
$remark = $warehouse->remarks()->first();
if($warehouse->reference === WarehouseReferences::VT_GUANG_ZHOU || $warehouse->reference === WarehouseReferences::VT_YIWU) {
$customerMarking = $order->companyModule->connections()->first()->invitee_reference.'/';
@@ -41,14 +41,14 @@ 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') {
if(strtolower($deliveryAddress->state->name) === 'sabah' || strtolower($deliveryAddress->state->name) === 'labuan' || in_array(strtolower($deliveryAddress->district->name), ['limbang', 'lawas'])) {
$warehousePrefix = 'KK/';
}
if(strtolower($deliveryAddress->state->name) === 'sarawak') {
if(strtolower($deliveryAddress->state->name) === 'sarawak' && !in_array(strtolower($deliveryAddress->district->name), ['limbang', 'lawas'])) {
$warehousePrefix = 'KU/';
}
}
@@ -60,7 +60,7 @@ class DownloadOrderQrPdfController
'delivery_address' => $deliveryAddress,
'warehouse_address' => $warehouseAddress,
'warehouse_contacts' => $warehouseContacts,
'remark' => $remark
'remark' => $remark ? $remark->content : ''
];
$pdf = LaravelMpdf::loadView('pdfs.qr', $data, [], [
@@ -200,4 +200,62 @@ class MonthlyReportController
})->sum('quantity'),
]]))->handler();
}
public function customerActivityReport(Request $request): JsonResponse {
$active_start = $request->input('active_start');
$active_end = $request->input('active_end');
$inactive_start = $request->input('inactive_start');
$inactive_end = $request->input('inactive_end');
$minCbm = $request->input('cbm');
$minOrders = $request->input('minOrders');
$activeCompanies = CompanyModule::where('type', \App\Classes\ValueObjects\Constants\BusinessType::IMPORTER)->whereHas('orderPackingLists', function($query) use($inactive_start, $inactive_end) {
return $query->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($inactive_start, $inactive_end) {
return $query->where('drop_date', '>=', \Carbon\Carbon::parse($inactive_start))->where('drop_date', '<=', \Carbon\Carbon::parse($inactive_end)->addDay());
});
})->pluck('id');
$companies = CompanyModule::where('type', \App\Classes\ValueObjects\Constants\BusinessType::IMPORTER)->whereHas('orderPackingLists', function($query) use($active_start, $active_end) {
return $query->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($active_start, $active_end) {
return $query->whereDate('drop_date', '>=', \Carbon\Carbon::parse($active_start))->whereDate('drop_date', '<=', \Carbon\Carbon::parse($active_end)->addDay());
});
})->whereNotIn('id', $activeCompanies)->get();
$customerActivityData = [];
$counter = 1;
foreach ($companies as $key => $company){
$connection = $company->inviters()->withPivot('invitee_reference')->first();
$marking = $connection ? $connection->pivot->invitee_reference:'';
$packingList = $company->orderPackingLists()->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::SHIPPING_PACKING_LIST)->get();
$totalCbm = $packingList->flatMap(function ($packingList) {
return $packingList->packages;
})->sum(function($package){
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
});
if ($minCbm != 'null' && $totalCbm < $minCbm) { continue; }
if ($minOrders != 'null' && $packingList->count() < $minOrders) { continue; }
array_push($customerActivityData, array(
'key' => $counter,
'marking' => $marking,
'packingListCount'=> $packingList->count(),
'totalCbm'=> $totalCbm,
));
$counter ++;
}
return (new ApiResponseObject('fetch service report Successful',
'',
HttpStatus::OK_WITH_MESSAGE, ['data' => [
'active_start' => Carbon::parse($active_start)->format('d/m/Y'),
'active_end' => Carbon::parse($active_end)->format('d/m/Y'),
'inactive_start' => Carbon::parse($inactive_start)->format('d/m/Y'),
'inactive_end' => Carbon::parse($inactive_end)->format('d/m/Y'),
'customerActivityData' => $customerActivityData,
]]))->handler();
}
}
@@ -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\UpdateConstantPostcodeLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateConstantPostcodeController
{
/**
* @param Request $request
* @param UpdateConstantPostcodeLogic $logic
* @return JsonResponse
*/
public function update(Request $request, UpdateConstantPostcodeLogic $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,
+5 -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,8 @@ 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,
];
}
+3 -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),
@@ -30,8 +30,8 @@ class CompanyResource extends JsonResource
'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 -2
View File
@@ -19,9 +19,8 @@ class ConstantResource extends JsonResource
{
return [
'id' => $this->id,
'name' => $this->name,
'reference' => $this->reference,
'detail' => (App()->make(ConvertsConstantDetailsToResource::class))->execute($this->resource)
'value' => (App()->make(ConvertsConstantDetailsToResource::class))->execute($this->resource)
];
}
}
@@ -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)),
];
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
use App\Models\SegmentConstant;
use App\Classes\ValueObjects\Constants\SegmentConstants;
class PostcodeResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
$centerPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::CENTER_POSTCODE)->get();
$centerPostcodeConstant = $centerPostcodeConstantObject->isEmpty() ? [] : (array)$centerPostcodeConstantObject->first()->value;
$postcodeArea = in_array($this->resource, $centerPostcodeConstant) ? 'CENTER_POSTCODE' : '';
$outstationPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::OUTSTATION_POSTCODE)->get();
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
in_array($this->resource, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : '';
return [
'postcode' => $this->resource,
'postcodeArea' => $postcodeArea,
];
}
}
+7 -1
View File
@@ -1,8 +1,9 @@
<?php
namespace App\Http\Resources;
use App\Models\SegmentConstant;
use Illuminate\Http\Resources\Json\JsonResource;
use App\Classes\ValueObjects\Constants\SegmentConstants;
class StateResource extends JsonResource
{
@@ -14,10 +15,15 @@ class StateResource extends JsonResource
*/
public function toArray($request)
{
$segmentConstantObject = SegmentConstant::where('reference', SegmentConstants::STATE_RATE)->get();
$segmentConstant = $segmentConstantObject->isEmpty() ? [] : (array)$segmentConstantObject->first()->value;
return [
'id' => $this->id,
'name' => $this->name,
'country' => $this->country,
'stateCharges' => array_key_exists($this->id, $segmentConstant) ? $segmentConstant[$this->id] : null,
];
}
}
+6 -2
View File
@@ -3,6 +3,7 @@
namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;
class TransportResource extends JsonResource
@@ -15,6 +16,7 @@ class TransportResource extends JsonResource
*/
public function toArray($request)
{
$currentSchedule = $this->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first();
return [
'id' => $this->id,
'type' => $this->type,
@@ -23,8 +25,10 @@ class TransportResource extends JsonResource
'dispatch_date' => $this->dispatch_date ? $this->dispatch_date->format('d-m-Y') : $this->dispatch_date,
'drop_date' => $this->drop_date ? $this->drop_date->format('d-m-Y') : $this->drop_date,
'status' => $this->status,
'current_schedule' => new ScheduleResource($this->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()),
'schedule_history' => ScheduleResource::collection($this->schedules()->where('status', '=', ApprovalStatus::EXPIRED)->get())
'current_schedule' => new ScheduleResource($currentSchedule),
'schedule_history' => ScheduleResource::collection($this->schedules()->where('status', '=', ApprovalStatus::EXPIRED)->get()),
'dropped_days' => Carbon::now()->diffInDays($this->drop_date, false),
'schedule_complete' => $currentSchedule ? $currentSchedule->eta <= Carbon::now() : false
];
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use App\Classes\General\Interfaces\Steppable;
use App\Classes\General\Interfaces\Transportable;
use App\Classes\General\Interfaces\Packable;
use App\Classes\General\Interfaces\Transactionable;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
use Staudenmeir\EloquentHasManyDeep\HasTableAlias;
class Addon extends AbstractModel
{
use SoftDeletes;
protected $table = 'addons';
protected $fillable = ['status'];
/**
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
*/
public function owner(): morphTo
{
return $this->morphTo();
}
}
+8
View File
@@ -58,6 +58,14 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable,
return $this->morphMany(PackingList::class, 'owner');
}
/**
* @return MorphMany
*/
public function addons(): morphMany
{
return $this->morphMany(Addon::class, 'owner');
}
/**
* @return MorphMany
*/
+8
View File
@@ -36,6 +36,14 @@ class PackingList extends AbstractModel implements Transportable, Steppable, Pac
return $this->morphTo();
}
/**
* @return MorphMany
*/
public function addons(): morphMany
{
return $this->morphMany(Addon::class, 'owner');
}
public function containers(): BelongsToMany
{
return $this->BelongsToMany(Container::class, ContainerPackingList::class);
+3
View File
@@ -1,8 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
class SegmentCompany extends AbstractModel
{
use SoftDeletes;
protected $table = 'segment_companies';
}
+2
View File
@@ -15,6 +15,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/
class SegmentConstant extends AbstractModel
{
use SoftDeletes;
protected $table = 'segment_constants';
public function getDetailAttribute($value)
+3 -1
View File
@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Spatie\Permission\Traits\HasRoles;
use Illuminate\Database\Eloquent\SoftDeletes;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
@@ -24,8 +25,9 @@ class User extends AbstractModel implements
AuthorizableContract,
CanResetPasswordContract
{
use HasRoles, Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail;
use HasRoles, Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail, SoftDeletes;
protected $dates = ['deleted_at'];
/**
* Get the identifier that will be stored in the subject claim of the JWT.
@@ -16,6 +16,7 @@ class CreateSegmentCompaniesTable extends Migration
Schema::create('segment_companies', function (Blueprint $table) {
$table->foreignId('segment_id');
$table->foreignId('company_id');
$table->softDeletes();
$table->timestamps();
$table->primary(['segment_id', 'company_id']);
});
@@ -18,7 +18,7 @@ class CreateTransactionDetailsTable extends Migration
$table->foreignId('transaction_id')->unsigned();
$table->string('reference');
$table->string('name');
$table->integer('quantity')->default(0);
$table->decimal('quantity', 25, 5)->default(0.00);
$table->decimal('price', 25, 5)->default(0.00);
$table->decimal('amount', 25, 5)->default(0.00);
$table->softDeletes();
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDeletedAtToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAddonsTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('addons', function (Blueprint $table) {
$table->id();
$table->morphs('owner');
$table->string('reference',200);
$table->integer('type')->default(0);
$table->integer('quantity')->default(1);
$table->integer('status')->default(0);
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('addons');
}
}
+8 -7
View File
@@ -16,6 +16,7 @@ use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
use App\Classes\Modules\Contacts\Services\CreatesContact;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\CompanyType;
use App\Classes\ValueObjects\Constants\BusinessType;
@@ -112,7 +113,7 @@ class CompaniesTableSeeder extends Seeder
/** @var CompanyModule $companyModule */
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::FREIGHT_FORWARDER);
$address = new AddressObject('Malaysian Global Innovation & Creativity Center Level 1 CWS', 'Block 3730,Persiaran APEC', 1, 15, 402, 63000);
$address = new AddressObject('Malaysian Global Innovation & Creativity Center Level 1 CWS', 'Block 3730,Persiaran APEC', 1, 15, 402, 63000, AddressType::BILLING, ApprovalStatus::APPROVED);
$this->createsAddress->execute($companyModule, $address);
$contact = new ContactObject('Office Number', '0182909252', '', '');
@@ -131,22 +132,22 @@ class CompaniesTableSeeder extends Seeder
if ($name === 'Guangzhou'){
$companyModule->update(['name' => $name, 'reference' => 'GZ-V01']);
$address = new AddressObject('白云区,大朗南路 白云湖大道自编13号 7号仓库', '高德地图导航:广州市世通行', 2, 35, 633, 510450);
$address = new AddressObject('白云区,大朗南路 白云湖大道自编13号 7号仓库', '高德地图导航:广州市世通行', 2, 35, 633, 510450, AddressType::DELIVERY, ApprovalStatus::APPROVED);
$contact = new ContactObject('杨维民', '13600055019', '', '');
} elseif ($name === 'Yiwu') {
$companyModule->update(['name' => $name, 'reference' => 'YW-V01']);
$address = new AddressObject('义乌市诚信大道义乌港A区2楼194号', '', 2, 27, 532, 322000);
$address = new AddressObject('义乌市诚信大道义乌港A区2楼194号', '', 2, 27, 532, 322000, AddressType::DELIVERY, ApprovalStatus::APPROVED);
$contact = new ContactObject('小曾', '13575982901', '', '');
} elseif ($name === 'Klang') {
$companyModule->update(['name' => $name, 'reference' => 'KL-V01']);
$address = new AddressObject('LOT 1357 A, JALAN TANJUNG SHAWAL', 'KAMPUNG SUNGAI PINANG', 1, 15, 412, 41400);
$address = new AddressObject('LOT 1357 A, JALAN TANJUNG SHAWAL', 'KAMPUNG SUNGAI PINANG', 1, 15, 412, 41400, AddressType::DELIVERY, ApprovalStatus::APPROVED);
$contact = new ContactObject('Mr. Yang', '0162237680', '', '');
} elseif ($name === 'Sabah') {
$companyModule->update(['name' => $name, 'reference' => 'SB-V01']);
$address = new AddressObject('Warehouse A & B, No. 2, Lorong Kacang Tanah 1', 'Jalan Kolombong, Kolombong', 1, 13, 316, 88450);
$address = new AddressObject('Warehouse A & B, No. 2, Lorong Kacang Tanah 1', 'Jalan Kolombong, Kolombong', 1, 13, 316, 88450, AddressType::DELIVERY, ApprovalStatus::APPROVED);
} elseif ($name === 'Sarawak') {
$companyModule->update(['name' => $name, 'reference' => 'SRW-V01']);
$address = new AddressObject('OPPOSITE HT POLE 51, LT 664 JALAN SUNGAI SALIM', '', 1, 14, 381, 96000);
$address = new AddressObject('OPPOSITE HT POLE 51, LT 664 JALAN SUNGAI SALIM', '', 1, 14, 381, 96000, AddressType::DELIVERY, ApprovalStatus::APPROVED);
}
@@ -161,7 +162,7 @@ class CompaniesTableSeeder extends Seeder
/** @var CompanyModule $companyModule */
$companyModule = $this->createCompanyModuleProcessor->execute($company, $businessType);
$address = new AddressObject('2, Jalan TSB 6, Taman Industri Sungai Buloh', '', 1, 15, 419, 47000);
$address = new AddressObject('2, Jalan TSB 6, Taman Industri Sungai Buloh', '', 1, 15, 419, 47000, AddressType::BILLING, ApprovalStatus::APPROVED);
$this->createsAddress->execute($companyModule, $address);
$contact = new ContactObject('Office Number', '036148 8108', '', '');
@@ -0,0 +1,147 @@
<?php
namespace Database\Seeders;
use App\Classes\Modules\Accounts\DataTransferObjects\RegistrationObject;
use App\Classes\Modules\Accounts\Services\CreatesUser;
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Classes\Modules\Addresses\Processors\CreateAddressFromOldAddressProcessor;
use App\Classes\Modules\Addresses\Services\CreatesAddress;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
use App\Classes\Modules\Companies\Services\CreatesCompany;
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
use App\Classes\Modules\Contacts\Services\CreatesContact;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\CompanyType;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Models\CompanyModule;
use App\Models\User;
use Illuminate\Database\Seeder;
use App\Models\Company;
class LastMileDeliveryTableSeeder extends Seeder
{
/** @var CreateCompanyProcessor */
private $createCompanyProcessor;
/** @var UpdatesCompanyStatus*/
private $updatesCompanyStatus;
/** @var CreateCompanyModuleProcessor */
private $createCompanyModuleProcessor;
/** @var CreateContactProcessor */
private $createContactProcessor;
/** @var CreatesCompanyConnection */
private $createsCompanyConnection;
/** @var ApprovesCompanyConnection */
private $approvesCompanyConnection;
/** @var CreateAddressFromOldAddressProcessor */
private $createAddressFromOldAddressProcessor;
/** @var CreatesAddress */
private $createsAddress;
/** @var CreatesCompany */
private $createsCompany;
/** @var CreatesContact */
private $createsContact;
/** @var CreatesUser */
private $createsUser;
/** @var AssignEmployeeProcessor */
private $assignEmployeeProcessor;
/**
* LastMileDeliveryTableSeeder constructor.
* @param CreateCompanyProcessor $createCompanyProcessor
* @param UpdatesCompanyStatus $updatesCompanyStatus
* @param CreateCompanyModuleProcessor $createCompanyModuleProcessor
* @param CreateContactProcessor $createContactProcessor
* @param CreatesCompanyConnection $createsCompanyConnection
* @param ApprovesCompanyConnection $approvesCompanyConnection
* @param CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor
* @param CreatesAddress $createsAddress
* @param CreatesCompany $createsCompany
* @param CreatesContact $createsContact
* @param CreatesUser $createsUser
* @param AssignEmployeeProcessor $assignEmployeeProcessor
*/
public function __construct(CreateCompanyProcessor $createCompanyProcessor, UpdatesCompanyStatus $updatesCompanyStatus, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor, CreatesAddress $createsAddress, CreatesCompany $createsCompany, CreatesContact $createsContact, CreatesUser $createsUser, AssignEmployeeProcessor $assignEmployeeProcessor)
{
$this->createCompanyProcessor = $createCompanyProcessor;
$this->updatesCompanyStatus = $updatesCompanyStatus;
$this->createCompanyModuleProcessor = $createCompanyModuleProcessor;
$this->createContactProcessor = $createContactProcessor;
$this->createsCompanyConnection = $createsCompanyConnection;
$this->approvesCompanyConnection = $approvesCompanyConnection;
$this->createAddressFromOldAddressProcessor = $createAddressFromOldAddressProcessor;
$this->createsAddress = $createsAddress;
$this->createsCompany = $createsCompany;
$this->createsContact = $createsContact;
$this->createsUser = $createsUser;
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
}
/**
* Run the database seeds.
*
* @return void
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function run()
{
$companies = [
new CompanyObject('Last Mile Delivery', 'HWT', CompanyType::COMPANY_BUSINESS, ApprovalStatus::APPROVED),
];
foreach ($companies as $companyObject) {
/** @var Company $company */
$company = $this->createsCompany->execute($companyObject);
/** @var CompanyModule $companyModule */
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::LAST_MILE_DELIVERY_AGENT);
$address = new AddressObject('B-39-13, Menara Simfoni, Jalan Simfoni 2, Balakong', 'Block 3730,Persiaran APEC', 1, 15, 432, 43300, AddressType::BILLING, ApprovalStatus::APPROVED);
$this->createsAddress->execute($companyModule, $address);
$contact = new ContactObject('Office Number', '01155543194', '', '');
$this->createsContact->execute($companyModule, $contact);
$user_object = new RegistrationObject('CQ', 'hywavetech168@gmail.com', 'FIzxqcZFFob7btVLEfWC', 'FIzxqcZFFob7btVLEfWC', RoleTypes::USER, ApprovalStatus::APPROVED);
/** @var User $user */
$user = $this->createsUser->execute($user_object);
$Object = new EmploymentObject($companyModule, $user);
$this->assignEmployeeProcessor->execute($Object);
continue;
}
}
}
@@ -17,6 +17,7 @@ use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
use App\Classes\Modules\Contacts\Services\CreatesContact;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\CompanyType;
use App\Classes\ValueObjects\Constants\BusinessType;
@@ -104,10 +105,10 @@ class ModernWarehouseTableSeeder extends Seeder
/** @var CompanyModule $companyModule */
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::WAREHOUSE);
$companyModule->update(['name' => 'Yiwu', 'reference' => 'YW-V02']);
$companyModule->update(['name' => 'Guangzhou', 'reference' => 'GZ-V02']);
$address = new AddressObject('义乌市 后宅街道 起航路233号百汇科创园园区里面', '(进口处进来第一个路口左转至出口处右手边国际物流仓库)', 2, 27, 532, 322000);
$contact = new ContactObject('韩成名', '18058489899 / 18058929899', '', '');
$address = new AddressObject('广东省 广州市 白云区 江高镇松岗街七横63号', '', 2, 35, 633, 510450, AddressType::BILLING, ApprovalStatus::APPROVED);
$contact = new ContactObject('郑先生', '13719211997', '', '');
$this->createsAddress->execute($companyModule, $address);
$this->createsContact->execute($companyModule, $contact);
@@ -19,8 +19,8 @@ class SegmentConstantsTableSeeder extends Seeder
'segment_id' => 1,
'reference' => SegmentConstants::BASE_PRICE,
'value' => json_encode([
'id'=> 1,
'price' => 500,
'2022-05-01'=> '0.00',
'2022-05-02'=> '0.00',
]),
],
[
@@ -28,21 +28,12 @@ class SegmentConstantsTableSeeder extends Seeder
'segment_id' => 1,
'reference' => SegmentConstants::WAREHOUSE_RATE,
'value' => json_encode([
'id'=> 1,
'config' => [
[
'warehouse_name' => WarehouseReferences::VT_GUANG_ZHOU,
'rate' => 10
],
[
'warehouse_name' => WarehouseReferences::YD_GUANG_ZHOU,
'rate' => 10
],
[
'warehouse_name' => WarehouseReferences::VT_YIWU,
'rate' => 10
],
]
'7' =>[
'amount' => '0.00',
],
'6' =>[
'amount' => '0.00',
],
]),
],
[
@@ -50,88 +41,69 @@ class SegmentConstantsTableSeeder extends Seeder
'segment_id' => 1,
'reference' => SegmentConstants::STATE_RATE,
'value' => json_encode([
'id'=> 1,
'config' => [
[
'status_id' => 1,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 2,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 3,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 4,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 5,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 6,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 7,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 8,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 9,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 10,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 11,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 12,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 13,
'rate' => 20,
'outstation_rate' => 2
],
[
'status_id' => 14,
'rate' => 20,
'outstation_rate' => 2
],
[
'status_id' => 15,
'rate' => 10,
'outstation_rate' => 2
],
[
'status_id' => 16,
'rate' => 10,
'outstation_rate' => 2
]
'1' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'2' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'3' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'4' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'5' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'6' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'7' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'8' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'9' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'10' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'11' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'12' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'13' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'14' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'15' =>[
'center' => '10.00',
'outstation' => '2.00'
],
'16' =>[
'center' => '10.00',
'outstation' => '2.00'
]
]),
],
+202
View File
@@ -0,0 +1,202 @@
<?php
// 1. [Required] Point to the composer or dompdf autoloader
require_once "vendor/autoload.php";
// 2. [Optional] Set the path to your font directory
// By default dompdf loads fonts to dompdf/lib/fonts
// If you have modified your font directory set this
// variable appropriately.
//$fontDir = "lib/fonts";
$fontDir = 'storage/fonts';
// *** DO NOT MODIFY BELOW THIS POINT ***
use Dompdf\Dompdf;
use Dompdf\CanvasFactory;
use Dompdf\Exception;
use Dompdf\FontMetrics;
use Dompdf\Options;
use FontLib\Font;
/**
* Display command line usage
*/
function usage() {
echo <<<EOD
Usage: {$_SERVER["argv"][0]} font_family [n_file [b_file] [i_file] [bi_file]]
font_family: the name of the font, e.g. Verdana, 'Times New Roman',
monospace, sans-serif. If it equals to "system_fonts",
all the system fonts will be installed.
n_file: the .ttf or .otf file for the normal, non-bold, non-italic
face of the font.
{b|i|bi}_file: the files for each of the respective (bold, italic,
bold-italic) faces.
If the optional b|i|bi files are not specified, load_font.php will search
the directory containing normal font file (n_file) for additional files that
it thinks might be the correct ones (e.g. that end in _Bold or b or B). If
it finds the files they will also be processed. All files will be
automatically copied to the DOMPDF font directory, and afm files will be
generated using php-font-lib (https://github.com/PhenX/php-font-lib).
Examples:
./load_font.php silkscreen /usr/share/fonts/truetype/slkscr.ttf
./load_font.php 'Times New Roman' /mnt/c_drive/WINDOWS/Fonts/times.ttf
EOD;
exit;
}
if ( $_SERVER["argc"] < 3 && @$_SERVER["argv"][1] != "system_fonts" ) {
usage();
}
$dompdf = new Dompdf();
if (isset($fontDir) && realpath($fontDir) !== false) {
$dompdf->getOptions()->set('fontDir', $fontDir);
}
/**
* Installs a new font family
* This function maps a font-family name to a font. It tries to locate the
* bold, italic, and bold italic versions of the font as well. Once the
* files are located, ttf versions of the font are copied to the fonts
* directory. Changes to the font lookup table are saved to the cache.
*
* @param Dompdf $dompdf dompdf main object
* @param string $fontname the font-family name
* @param string $normal the filename of the normal face font subtype
* @param string $bold the filename of the bold face font subtype
* @param string $italic the filename of the italic face font subtype
* @param string $bold_italic the filename of the bold italic face font subtype
*
* @throws Exception
*/
function install_font_family($dompdf, $fontname, $normal, $bold = null, $italic = null, $bold_italic = null) {
$fontMetrics = $dompdf->getFontMetrics();
// Check if the base filename is readable
if ( !is_readable($normal) )
throw new Exception("Unable to read '$normal'.");
$dir = dirname($normal);
$basename = basename($normal);
$last_dot = strrpos($basename, '.');
if ($last_dot !== false) {
$file = substr($basename, 0, $last_dot);
$ext = strtolower(substr($basename, $last_dot));
} else {
$file = $basename;
$ext = '';
}
if ( !in_array($ext, array(".ttf", ".otf")) ) {
throw new Exception("Unable to process fonts of type '$ext'.");
}
// Try $file_Bold.$ext etc.
$path = "$dir/$file";
$patterns = array(
"bold" => array("_Bold", "b", "B", "bd", "BD"),
"italic" => array("_Italic", "i", "I"),
"bold_italic" => array("_Bold_Italic", "bi", "BI", "ib", "IB"),
);
foreach ($patterns as $type => $_patterns) {
if ( !isset($$type) || !is_readable($$type) ) {
foreach($_patterns as $_pattern) {
if ( is_readable("$path$_pattern$ext") ) {
$$type = "$path$_pattern$ext";
break;
}
}
if ( is_null($$type) )
echo ("Unable to find $type face file.\n");
}
}
$fonts = compact("normal", "bold", "italic", "bold_italic");
$entry = array();
// Copy the files to the font directory.
foreach ($fonts as $var => $src) {
if ( is_null($src) ) {
$entry[$var] = $dompdf->getOptions()->get('fontDir') . '/' . mb_substr(basename($normal), 0, -4);
continue;
}
// Verify that the fonts exist and are readable
if ( !is_readable($src) )
throw new Exception("Requested font '$src' is not readable");
$dest = $dompdf->getOptions()->get('fontDir') . '/' . basename($src);
if ( !is_writeable(dirname($dest)) )
throw new Exception("Unable to write to destination '$dest'.");
echo "Copying $src to $dest...\n";
if ( !copy($src, $dest) )
throw new Exception("Unable to copy '$src' to '$dest'");
$entry_name = mb_substr($dest, 0, -4);
echo "Generating Adobe Font Metrics for $entry_name...\n";
$font_obj = Font::load($dest);
$font_obj->saveAdobeFontMetrics("$entry_name.ufm");
$font_obj->close();
$entry[$var] = $entry_name;
}
// Store the fonts in the lookup table
$fontMetrics->setFontFamily($fontname, $entry);
// Save the changes
$fontMetrics->saveFontFamilies();
}
// If installing system fonts (may take a long time)
if ( $_SERVER["argv"][1] === "system_fonts" ) {
$fontMetrics = $dompdf->getFontMetrics();
$files = glob("/usr/share/fonts/truetype/*.ttf") +
glob("/usr/share/fonts/truetype/*/*.ttf") +
glob("/usr/share/fonts/truetype/*/*/*.ttf") +
glob("C:\\Windows\\fonts\\*.ttf") +
glob("C:\\WinNT\\fonts\\*.ttf") +
glob("/mnt/c_drive/WINDOWS/Fonts/");
$fonts = array();
foreach ($files as $file) {
$font = Font::load($file);
$records = $font->getData("name", "records");
$type = $fontMetrics->getType($records[2]);
$fonts[mb_strtolower($records[1])][$type] = $file;
$font->close();
}
foreach ( $fonts as $family => $files ) {
echo " >> Installing '$family'... \n";
if ( !isset($files["normal"]) ) {
echo "No 'normal' style font file\n";
}
else {
install_font_family($dompdf, $family, @$files["normal"], @$files["bold"], @$files["italic"], @$files["bold_italic"]);
echo "Done !\n";
}
echo "\n";
}
}
else {
call_user_func_array("install_font_family", array_merge( array($dompdf), array_slice($_SERVER["argv"], 1) ));
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

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