From 59a226a616946f5d4b0cbe325ce5e3eb4e358e9a Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Tue, 23 Jan 2024 20:33:26 +0100 Subject: [PATCH] refactor(customer): Model sync with Lead. Adding missing field for verified phone, mobile --- app/Models/Customer.php | 7 ++- app/Models/Lead.php | 7 ++- ...1459_alter_customer_add_phone_verified.php | 32 +++++++++++++ resources/views/customer/index.blade.php | 47 ++++++++++++++++--- version.php | 2 +- 5 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 database/migrations/2024_01_23_181459_alter_customer_add_phone_verified.php diff --git a/app/Models/Customer.php b/app/Models/Customer.php index b6c2d11b..54c6c7c4 100755 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -130,16 +130,19 @@ class Customer extends Model protected $table = 'customer'; protected $fillable = [ - 'external_id', 'company_id', + 'external_id', 'name', 'business_name', 'dob', 'vat', 'phone', + 'phone_verified', 'extension', 'phone2', + 'phone2_verified', 'mobile', + 'mobile_verified', 'email', 'email_verified', 'email2', @@ -187,7 +190,7 @@ class Customer extends Model 'deleted_by', ]; - protected $with = ['country', 'seller', 'industry']; + protected $with = ['country', 'seller', 'industry', 'company']; public function company(): HasOne { diff --git a/app/Models/Lead.php b/app/Models/Lead.php index 736e6fcd..51d95dab 100755 --- a/app/Models/Lead.php +++ b/app/Models/Lead.php @@ -18,7 +18,7 @@ * @OA\Schema( * schema="Lead", * type="object", - * required={"name", "country"}, + * required={"name", "country", "seller_id"}, * @OA\Property( * property="name", * description="Name of the lead", @@ -100,6 +100,11 @@ * type="string", * format="url", * example="https://www.likedin.com/in/profile" + * ), + * @OA\Property( + * property="seller_id", + * description="SellerID of the lead", + * type="string" * ) * ) */ diff --git a/database/migrations/2024_01_23_181459_alter_customer_add_phone_verified.php b/database/migrations/2024_01_23_181459_alter_customer_add_phone_verified.php new file mode 100644 index 00000000..60649127 --- /dev/null +++ b/database/migrations/2024_01_23_181459_alter_customer_add_phone_verified.php @@ -0,0 +1,32 @@ +boolean('phone_verified')->nullable()->after('phone')->default(false); + $table->boolean('phone2_verified')->nullable()->after('phone2')->default(false); + $table->boolean('mobile_verified')->nullable()->after('mobile')->default(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('customer', function (Blueprint $table) { + $table->dropColumn('phone_verified'); + $table->dropColumn('phone2_verified'); + $table->dropColumn('mobile_verified'); + }); + } +}; diff --git a/resources/views/customer/index.blade.php b/resources/views/customer/index.blade.php index 95a39d82..d0b4c383 100755 --- a/resources/views/customer/index.blade.php +++ b/resources/views/customer/index.blade.php @@ -66,25 +66,25 @@ class="link-secondary link-underline-opacity-25 link-underline-opacity-100-hover {{ __('Country') }} {{ __('Province') }} Social - {{ __('Seller') }} {{ __('Industry') }} + {{ __('Seller') }} {{ __('Tags') }} {{ __('Status') }} - {{ __('Created at') }} + {{ __('Created at') }} - {{ __('Updated at') }} + {{ __('Updated at') }} {{ __('Actions') }} @@ -103,9 +103,14 @@ class="link-secondary link-underline-opacity-25 link-underline-opacity-100-hover @if($customer->phone) + target="_blank" class="link-secondary text-decoration-none"> + @if($customer->phone_verified == 1) + + @else + + @endif @@ -120,6 +125,29 @@ class="link-secondary link-underline-opacity-25 link-underline-opacity-100-hover class="link-secondary text-decoration-none"> + + @if($customer->mobile_verified == 1) + + @else + + @endif + + + + + + + + + + + + @endif @@ -140,7 +168,7 @@ class="link-secondary text-decoration-none"> @endif - @if(!empty($customer->country)) {{ $customer->country->flag }} @@ -193,8 +221,12 @@ class="link-secondary text-decoration-none"> @endif - {{ (!empty($customer->seller)) ? $customer->seller->first_name : '' }} {{ ($customer->industry) ? __($customer->industry->name) : '' }} + + @isset($customer->seller) + {{ $customer->seller->first_name }} + @endisset + @if(is_array($customer->tags) || is_object($customer->tags)) @foreach($customer->tags as $tag) @@ -236,7 +268,8 @@ class="link-secondary text-decoration-none">