diff --git a/app/Classes/General/Eloquent/Filters/NameLike.php b/app/Classes/General/Eloquent/Filters/NameLike.php new file mode 100644 index 00000000..2019cc0a --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/NameLike.php @@ -0,0 +1,20 @@ +where('name', 'LIKE', '%'.$value.'%'); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Addresses/ControllersLogic/DeleteDistrictLogic.php b/app/Classes/Modules/Addresses/ControllersLogic/DeleteDistrictLogic.php new file mode 100644 index 00000000..13148c02 --- /dev/null +++ b/app/Classes/Modules/Addresses/ControllersLogic/DeleteDistrictLogic.php @@ -0,0 +1,57 @@ + 'Deleted District', + 'message' => 'You have successfully deleted a District' + ]; + } + + /** @var DeletesDistrict */ + private $deletesDistrict; + + /** @var FetchesDistrict */ + private $fetchesDistrict; + + /** + * DeleteDistrictControllersLogic constructor. + * @param DeletesDistrict $deletesDistrict + * @param FetchesDistrict $fetchesDistrict + */ + public function __construct(DeletesDistrict $deletesDistrict, FetchesDistrict $fetchesDistrict) + { + $this->deletesDistrict = $deletesDistrict; + $this->fetchesDistrict = $fetchesDistrict; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + $district = $this->fetchesDistrict->execute(['id' => $request->route('id')]); + + $this->deletesDistrict->execute($district); + + return $this->response([]); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Addresses/Services/Districts/DeletesDistrict.php b/app/Classes/Modules/Addresses/Services/Districts/DeletesDistrict.php new file mode 100644 index 00000000..933e6cec --- /dev/null +++ b/app/Classes/Modules/Addresses/Services/Districts/DeletesDistrict.php @@ -0,0 +1,19 @@ +handler($model); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Addresses/DeleteDistrictController.php b/app/Http/Controllers/Addresses/DeleteDistrictController.php new file mode 100644 index 00000000..3f56eff7 --- /dev/null +++ b/app/Http/Controllers/Addresses/DeleteDistrictController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Resources/DistrictResource.php b/app/Http/Resources/DistrictResource.php index c0c24f73..6d1a594c 100644 --- a/app/Http/Resources/DistrictResource.php +++ b/app/Http/Resources/DistrictResource.php @@ -17,6 +17,7 @@ class DistrictResource extends JsonResource return [ 'id' => $this->id, 'city' => $this->name, + 'postcodes' => json_decode($this->postcode), 'state' => $this->state, 'country' => $this->country ]; diff --git a/resources/assets/vue/components/address/elements/DistrictSectionComponent.vue b/resources/assets/vue/components/address/elements/DistrictSectionComponent.vue new file mode 100644 index 00000000..05f0069e --- /dev/null +++ b/resources/assets/vue/components/address/elements/DistrictSectionComponent.vue @@ -0,0 +1,82 @@ + + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/elements/DistrictComponent.vue b/resources/assets/vue/components/settings/elements/DistrictComponent.vue index a56e124e..5e3a4101 100644 --- a/resources/assets/vue/components/settings/elements/DistrictComponent.vue +++ b/resources/assets/vue/components/settings/elements/DistrictComponent.vue @@ -13,7 +13,19 @@
-
{{item.state.name}}
+
State
+
+
+
+
+
{{item.state.name}}
+
+
+
+
+
+
+
City
@@ -25,20 +37,44 @@
- - - -
Deactivate
- - + + + +
+
+
+
+
+
+
+
+
+ Postcode List +
+
+
+ +
+
+
+
@@ -52,6 +88,11 @@ default: 'districtsSection', }, }, + data(){ + return { + expanded: false, + } + }, mixins: [componentHandler] } \ No newline at end of file diff --git a/resources/assets/vue/components/settings/elements/PostcodeListComponent.vue b/resources/assets/vue/components/settings/elements/PostcodeListComponent.vue new file mode 100644 index 00000000..47202e66 --- /dev/null +++ b/resources/assets/vue/components/settings/elements/PostcodeListComponent.vue @@ -0,0 +1,38 @@ + + \ No newline at end of file diff --git a/resources/views/pages/settings.blade.php b/resources/views/pages/settings.blade.php index 25cf5499..f3ff9856 100644 --- a/resources/views/pages/settings.blade.php +++ b/resources/views/pages/settings.blade.php @@ -632,27 +632,8 @@
- -
-
-
-
-
- District -
-
-
-
-
- - - -
-
-
-
+ +
diff --git a/routes/address.php b/routes/address.php index 7f2cb172..455a0dfd 100644 --- a/routes/address.php +++ b/routes/address.php @@ -12,5 +12,6 @@ Route::group(['prefix' => 'address', 'as' => 'address.', 'namespace' => 'Address Route::group(['prefix' => 'district', 'as' => 'district.'], function () { Route::get('/list', 'ListDistrictsController@list')->name('list'); + Route::delete('/delete/{id}', 'DeleteDistrictController@destroy')->name('delete'); }); });