From d7bbb6a65e7a8a494866fec719a2437a8ba9e834 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sat, 9 Oct 2021 13:44:33 +0800 Subject: [PATCH] separate customers list in a new page --- .../General/Eloquent/Filters/SegmentsIn.php | 21 +++ app/Http/Resources/CompanyResource.php | 3 +- app/Models/Company.php | 2 +- ...ListComponent.vue => CompanyComponent.vue} | 14 +- .../views/pages/customers/index.blade.php | 134 ++++++++++++++++++ .../profile.blade.php} | 0 resources/views/pages/settings.blade.php | 67 +-------- resources/views/partials/header.blade.php | 5 + routes/web.php | 6 +- 9 files changed, 182 insertions(+), 70 deletions(-) create mode 100644 app/Classes/General/Eloquent/Filters/SegmentsIn.php rename resources/assets/vue/components/companies/elements/{CompanyListComponent.vue => CompanyComponent.vue} (81%) create mode 100644 resources/views/pages/customers/index.blade.php rename resources/views/pages/{customers.blade.php => customers/profile.blade.php} (100%) diff --git a/app/Classes/General/Eloquent/Filters/SegmentsIn.php b/app/Classes/General/Eloquent/Filters/SegmentsIn.php new file mode 100644 index 00000000..3f756810 --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/SegmentsIn.php @@ -0,0 +1,21 @@ +whereHas('segments', function ($segment) use ($value) { + $segment->whereIn('id', $value); + }); + } +} diff --git a/app/Http/Resources/CompanyResource.php b/app/Http/Resources/CompanyResource.php index 7a9cfc00..f295dfd9 100644 --- a/app/Http/Resources/CompanyResource.php +++ b/app/Http/Resources/CompanyResource.php @@ -48,7 +48,8 @@ class CompanyResource extends JsonResource 'currencies' => $this->when($this->business_type === BusinessType::CURRENCY_VENDOR, function(){ $segment = SegmentConstant::where('reference', SegmentConstants::SUPPLIER_CURRENCIES)->where('detail->id', $this->id)->first(); return $segment ? CurrencyResource::collection(Currency::whereIn('id', $segment->detail->currencies)->get()) : []; - }) + }), + 'created_at' => $this->created_at->format('d-m-Y') ]; diff --git a/app/Models/Company.php b/app/Models/Company.php index 1922fa10..e2c9dda4 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -35,7 +35,7 @@ class Company extends AbstractModel implements Documentable protected $table = 'companies'; - protected $dates = ['deleted_at']; + protected $dates = ['deleted_at', 'created_at']; /** diff --git a/resources/assets/vue/components/companies/elements/CompanyListComponent.vue b/resources/assets/vue/components/companies/elements/CompanyComponent.vue similarity index 81% rename from resources/assets/vue/components/companies/elements/CompanyListComponent.vue rename to resources/assets/vue/components/companies/elements/CompanyComponent.vue index 5d49b650..c139c2a4 100644 --- a/resources/assets/vue/components/companies/elements/CompanyListComponent.vue +++ b/resources/assets/vue/components/companies/elements/CompanyComponent.vue @@ -1,5 +1,5 @@