diff --git a/app/Http/Resources/AddressResource.php b/app/Http/Resources/AddressResource.php
index 95a60b9f..f86d5c29 100644
--- a/app/Http/Resources/AddressResource.php
+++ b/app/Http/Resources/AddressResource.php
@@ -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,
diff --git a/app/Http/Resources/DistrictResource.php b/app/Http/Resources/DistrictResource.php
index 0f5a01dc..a922f2ed 100644
--- a/app/Http/Resources/DistrictResource.php
+++ b/app/Http/Resources/DistrictResource.php
@@ -20,6 +20,7 @@ class DistrictResource extends JsonResource
'state' => $this->state,
'country' => $this->country,
'postcode' => $this->postcode,
+ 'postcodeArray' => PostcodeResource::collection(json_decode($this->postcode)),
];
}
}
diff --git a/app/Http/Resources/PostcodeResource.php b/app/Http/Resources/PostcodeResource.php
new file mode 100644
index 00000000..92c9abb0
--- /dev/null
+++ b/app/Http/Resources/PostcodeResource.php
@@ -0,0 +1,33 @@
+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,
+ ];
+ }
+}
diff --git a/resources/assets/vue/components/containers/elements/PackingListComponent.vue b/resources/assets/vue/components/containers/elements/PackingListComponent.vue
index 1139f971..991eccc5 100644
--- a/resources/assets/vue/components/containers/elements/PackingListComponent.vue
+++ b/resources/assets/vue/components/containers/elements/PackingListComponent.vue
@@ -18,7 +18,7 @@
{{item.order.address.street_one+' '+(item.order.address.street_two ? item.order.address.street_two : '')+', '+ item.order.address.district.name+', '+item.order.address.post_code+' '+item.order.address.state.name+', '+item.order.address.country.name}}
{{item.order.address.remark ? item.order.address.remark.content: ''}}
This postcode is yet to be declare. Plase choose the area.