diff --git a/app/Classes/Modules/Addresses/ControllersLogic/ListStatesLogic.php b/app/Classes/Modules/Addresses/ControllersLogic/ListStatesLogic.php
new file mode 100644
index 00000000..3d6c484f
--- /dev/null
+++ b/app/Classes/Modules/Addresses/ControllersLogic/ListStatesLogic.php
@@ -0,0 +1,54 @@
+ 'Retrieved Addresses',
+ 'message' => 'You have successfully retrieved a list of Addresses'
+ ];
+ }
+
+ /** @var ListsStates */
+ private $listStates;
+
+ /**
+ * ListStatesLogic constructor.
+ * @param ListsStates $listStates
+ */
+ public function __construct(ListsStates $listStates)
+ {
+ $this->listStates = $listStates;
+ }
+
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws \App\Classes\Exceptions\MalformedRequestException
+ */
+ public function logic(Request $request) : JsonResponse
+ {
+ $query = $this->listStates->execute($this->listStates->deserializeFilters($request->input('filters')));
+
+ return $this->collectionResponse(StateResource::collection($query));
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Addresses/Services/ListsStates.php b/app/Classes/Modules/Addresses/Services/ListsStates.php
new file mode 100644
index 00000000..5591b823
--- /dev/null
+++ b/app/Classes/Modules/Addresses/Services/ListsStates.php
@@ -0,0 +1,33 @@
+repository = $repository;
+ }
+
+
+ /**
+ * @return Builder
+ */
+ function getRepository(): Builder
+ {
+ return $this->repository->newQuery();
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Orders/Processors/UpdateDoFromVTPortalProcessor.php b/app/Classes/Modules/Orders/Processors/UpdateDoFromVTPortalProcessor.php
index 74fb7f62..980ebf01 100644
--- a/app/Classes/Modules/Orders/Processors/UpdateDoFromVTPortalProcessor.php
+++ b/app/Classes/Modules/Orders/Processors/UpdateDoFromVTPortalProcessor.php
@@ -74,7 +74,6 @@ class UpdateDoFromVTPortalProcessor
$vt_do = $this->fetchesDataFRomVTPortal->clientRequest('http://portal.vtnation.com.my/Services/DataControllerService.asmx/GetPage', 'POST', json_decode('{"controller":"Do","view":"grid1","request":{"PageIndex":-1,"PageSize":10000,"Filter": ["FullMarking:$contains$%js%\"' . $order->reference . '\"\u0000"]}}'), '');
$vt_do = $this->fetchesDataFRomVTPortal->getResponseBody($vt_do);
-
if ($vt_do) {
foreach ($vt_do->Rows as $key => $row) {
$vt_do_update = $this->fetchesDataFRomVTPortal->clientRequest(
@@ -91,7 +90,7 @@ class UpdateDoFromVTPortalProcessor
"Values": [
{
"Name": "ShippingAddress",
- "NewValue": "' . $address->street_one . ' ' . $address->street_two . ' '. $address->district->name.' '. $address->post_code.' '.$address->state->name.' '.$address->country->name.'",
+ "NewValue": "' . $address->street_one . ' ' . $address->street_two . ' '. $address->district->name.' '. $address->postcode.' '.$address->state->name.' '.$address->country->name.'",
"Modified": true,
"ReadOnly": false,
"Error": null
diff --git a/app/Classes/Modules/Orders/Processors/UpdateDoFromYDPortalProcessor.php b/app/Classes/Modules/Orders/Processors/UpdateDoFromYDPortalProcessor.php
index 2f732ffd..1404f149 100644
--- a/app/Classes/Modules/Orders/Processors/UpdateDoFromYDPortalProcessor.php
+++ b/app/Classes/Modules/Orders/Processors/UpdateDoFromYDPortalProcessor.php
@@ -45,25 +45,15 @@ class UpdateDoFromYDPortalProcessor
foreach ($packing_lists as $key => $row) {
if ($row->status === ApprovalStatus::SUSPENDED) {
- $this->fetchesDataFRomYDPortal->clientRequest(
- 'http://www.yd-wl.com/api/UpdateOrderAddress.ashx',
- 'POST',
- [
- 'expressno' => $row->reference,
- 'customers_name' => '',
- 'cellphone' => '',
- 'postcode' => '',
- 'streetAddress' => ''
- ]);
-
-
continue;
}
$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.';
$this->fetchesDataFRomYDPortal->clientRequest(
'http://www.yd-wl.com/api/UpdateOrderAddress.ashx',
@@ -73,7 +63,7 @@ class UpdateDoFromYDPortalProcessor
'customers_name' => $reference,
'cellphone' => $phone,
'postcode' => $address->postcode,
- 'streetAddress' => $address->street_one . ' ' . $address->street_two . ' '. $address->district->name.' '. $address->post_code.' '.$address->state->name.' '.$address->country->name.' '.$address->postcode
+ 'streetAddress' => $address->street_one . ' ' . $address->street_two . ' '. $address->district->name.' '. $address->post_code.' '.$address->state->name.' '.$address->country->name.' '.$address->postcode.' || '.$remark
]);
diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/UpdatePackingListStatusLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/UpdatePackingListStatusLogic.php
index d7d8a8a4..4eb67646 100644
--- a/app/Classes/Modules/PackingLists/ControllersLogic/UpdatePackingListStatusLogic.php
+++ b/app/Classes/Modules/PackingLists/ControllersLogic/UpdatePackingListStatusLogic.php
@@ -11,6 +11,7 @@ use App\Classes\Modules\PackingLists\Services\UpdatesPackingListStatus;
use App\Classes\Modules\PackingLists\Standards\Rules\CanUpdatePackingList;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
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 ErrorException;
@@ -70,7 +71,8 @@ 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()->first();
+ $address = $packing_list->owner()->first()->addresses()->where('status', ApprovalStatus::APPROVED)->first();
+
$appointee = $address->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
$appointee === 2 ? $this->updateDoFromVTPortalProcessor->execute($address) : $this->updateDoFromYDPortalProcessor->execute($address);
diff --git a/app/Http/Controllers/Addresses/ListStatesController.php b/app/Http/Controllers/Addresses/ListStatesController.php
new file mode 100644
index 00000000..dee2d1c6
--- /dev/null
+++ b/app/Http/Controllers/Addresses/ListStatesController.php
@@ -0,0 +1,20 @@
+execute($request);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Resources/CompanyResource.php b/app/Http/Resources/CompanyResource.php
index 38459a35..6d16651b 100644
--- a/app/Http/Resources/CompanyResource.php
+++ b/app/Http/Resources/CompanyResource.php
@@ -28,10 +28,10 @@ class CompanyResource extends JsonResource
'business_type' => (int) $this->business_type,
'status' => (int) $this->status,
'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())),
- 'employee' => new UserResource($companyModule->employees()->first()),
+ 'employee' => (int) $this->business_type == 1 ? 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' => (int) $this->business_type == 1 ? new OrderResource($companyModule ? $companyModule->orders()->orderBy('id', 'DESC')->first(): null) : '',
+ 'order_count' => (int) $this->business_type == 1 ? $this->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')
diff --git a/app/Http/Resources/StateResource.php b/app/Http/Resources/StateResource.php
new file mode 100644
index 00000000..b9d71dae
--- /dev/null
+++ b/app/Http/Resources/StateResource.php
@@ -0,0 +1,23 @@
+ $this->id,
+ 'name' => $this->name,
+ 'country' => $this->country,
+ ];
+ }
+}
diff --git a/app/Models/State.php b/app/Models/State.php
index fa920454..3f7036ac 100644
--- a/app/Models/State.php
+++ b/app/Models/State.php
@@ -2,7 +2,7 @@
namespace App\Models;
-use Illuminate\Database\Eloquent\Relations\HasOne;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
@@ -21,10 +21,10 @@ class State extends AbstractModel
protected $dates = ['deleted_at'];
/**
- * @return HasOne
+ * @return BelongsTo
*/
- public function country(): HasOne
+ public function country(): BelongsTo
{
- return $this->hasOne(Country::class, 'country_id', 'id');
+ return $this->belongsTo(Country::class, 'country_id', 'id');
}
}
diff --git a/resources/assets/sass/modules/_typography.scss b/resources/assets/sass/modules/_typography.scss
index dbc80e6f..a22dc2fc 100644
--- a/resources/assets/sass/modules/_typography.scss
+++ b/resources/assets/sass/modules/_typography.scss
@@ -643,6 +643,10 @@ hr{
cursor: pointer !important;
}
+.not-allowed {
+ cursor: not-allowed !important;
+}
+
/* Labels
------------------------------------
*/
diff --git a/resources/assets/vue/components/general/forms/SelectableComponent.vue b/resources/assets/vue/components/general/forms/SelectableComponent.vue
index ab0ed0b5..d86c35cc 100644
--- a/resources/assets/vue/components/general/forms/SelectableComponent.vue
+++ b/resources/assets/vue/components/general/forms/SelectableComponent.vue
@@ -34,7 +34,7 @@
if(!success){return;}
let vm = this;
- let mappedList = $.map(response.payload.data, function(value){
+ let mappedList = response.payload.data.map(function(value){
let preservedValue = value;
return {'id': !isNaN(value[vm.valueColumn]) ? parseInt(value[vm.valueColumn]) : value[vm.valueColumn],
'text': vm.labelColumn.map(function(label){
diff --git a/resources/assets/vue/components/orders/sections/OrdersTableSectionComponent.vue b/resources/assets/vue/components/orders/sections/OrdersTableSectionComponent.vue
new file mode 100644
index 00000000..0175534f
--- /dev/null
+++ b/resources/assets/vue/components/orders/sections/OrdersTableSectionComponent.vue
@@ -0,0 +1,290 @@
+
+ Nothing To Show Here
+
+
+
+
+
+
+ Order No
+ Warehouse
+ Delivery Address
+ Marking
+ Date
+ Total CBM
+
+
+
+ {{data.reference}}
+ {{data.warehouse.name}} {{$store.getters.isAdmin ? data.warehouse.reference : ''}}
+ {{data.address.reference}}
+ {{data.company_module.marking}}
+ {{data.created_at}}
+ {{(Math.ceil((data.parcels.origin_warehouse_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + data.parcels.in_transit_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + data.parcels.destination_warehouse_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + data.parcels.delivered_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0)) * 10000) / 10000).toFixed(3)}}
+
+
+
+
+
+
+ 
{{data.name}}
+ {{data.name}}
+