diff --git a/app/Classes/General/Eloquent/Filters/CompanySegmentsIn.php b/app/Classes/General/Eloquent/Filters/CompanySegmentsIn.php
new file mode 100644
index 00000000..dd86d514
--- /dev/null
+++ b/app/Classes/General/Eloquent/Filters/CompanySegmentsIn.php
@@ -0,0 +1,24 @@
+whereHas('companyModules', function ($module) use ($value) {
+ $module->whereHas('connections', function ($connection) use ($value) {
+ $connection->whereHas('connectionSegments', function ($segment) use ($value) {
+ $segment->whereIn('segment_id', $value);
+ });
+ });
+ });
+ }
+}
diff --git a/app/Classes/Modules/Companies/ControllersLogic/AssignCompanyConnectionToConnectionSegmentLogic.php b/app/Classes/Modules/Companies/ControllersLogic/AssignCompanyConnectionToConnectionSegmentLogic.php
index e832b854..614e882d 100644
--- a/app/Classes/Modules/Companies/ControllersLogic/AssignCompanyConnectionToConnectionSegmentLogic.php
+++ b/app/Classes/Modules/Companies/ControllersLogic/AssignCompanyConnectionToConnectionSegmentLogic.php
@@ -69,7 +69,7 @@ class AssignCompanyConnectionToConnectionSegmentLogic extends AbstractController
$this->assignCompanyConnectionToConnectionSegmentProcessor->execute($companyConnection, $request->input('segment_id'));
- if ($request->input('segment_id') == 11) {
+ if ($request->input('segment_id') != 12) {
$contactObject = new ContactObject('Whatsapp: ' . $request->input('name'), $request->input('phone'), null, null);
$this->createContactProcessor->execute($contactObject, $company);
}
diff --git a/app/Http/Resources/CompanyResource.php b/app/Http/Resources/CompanyResource.php
index d969ac0d..27a04166 100644
--- a/app/Http/Resources/CompanyResource.php
+++ b/app/Http/Resources/CompanyResource.php
@@ -40,7 +40,8 @@ class CompanyResource extends JsonResource
'last_order' => $companyModule->type === 7 ? new DeliveryOrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()) : new OrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()),
'order_count' => $companyModule->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')
+ 'created_at' => $this->created_at->format('d-m-Y'),
+ 'whatsapp' => new ContactResource($this->contacts()->where('reference', 'LIKE', '%Whatsapp%')->orderBy('created_at', 'DESC')->first())
];
diff --git a/app/Http/Resources/SegmentResource.php b/app/Http/Resources/SegmentResource.php
index 2ec22145..85c61f61 100644
--- a/app/Http/Resources/SegmentResource.php
+++ b/app/Http/Resources/SegmentResource.php
@@ -18,7 +18,7 @@ class SegmentResource extends JsonResource
$constant = $this->constants->where('reference', SegmentConstants::CUSTOM_PRICE)->first();
return [
'id' => $this->id,
- 'name' => $this->name,
+ 'name' => ucwords(str_replace('_', ' ', $this->name)),
'price' => $constant ? $constant->value[0] : 0
];
}
diff --git a/app/Models/CompanyConnection.php b/app/Models/CompanyConnection.php
index b382e237..894cdafc 100644
--- a/app/Models/CompanyConnection.php
+++ b/app/Models/CompanyConnection.php
@@ -69,4 +69,12 @@ class CompanyConnection extends AbstractModel
return $this->belongsToMany(Segment::class, (new ConnectionSegment())->getTable(), 'company_connection_id', 'segment_id');
}
+ /**
+ * @return belongsToMany
+ */
+ public function connectionSegments(): HasMany
+ {
+ return $this->hasMany(ConnectionSegment::class, 'company_connection_id');
+ }
+
}
diff --git a/resources/assets/vue/components/companies/elements/CompanyComponent.vue b/resources/assets/vue/components/companies/elements/CompanyComponent.vue
index 293bca54..2353102d 100644
--- a/resources/assets/vue/components/companies/elements/CompanyComponent.vue
+++ b/resources/assets/vue/components/companies/elements/CompanyComponent.vue
@@ -10,6 +10,10 @@
{{this.item.name}}
CIEF/{{this.item.company_module.marking}}
+
+
Whatsapp:
+
{{ this.item.whatsapp.reference.replace('Whatsapp:', '') }}: {{ this.item.whatsapp.phone }}
+
Orders
{{this.item.order_count}}
diff --git a/resources/assets/vue/components/companies/elements/FulfilmentConfirmationFormComponent.vue b/resources/assets/vue/components/companies/elements/FulfilmentConfirmationFormComponent.vue
deleted file mode 100644
index 70222929..00000000
--- a/resources/assets/vue/components/companies/elements/FulfilmentConfirmationFormComponent.vue
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
diff --git a/resources/assets/vue/components/companies/elements/FulfilmentLaterFormComponent.vue b/resources/assets/vue/components/companies/elements/FulfilmentInterestedFormComponent.vue
similarity index 57%
rename from resources/assets/vue/components/companies/elements/FulfilmentLaterFormComponent.vue
rename to resources/assets/vue/components/companies/elements/FulfilmentInterestedFormComponent.vue
index 2d803989..28492048 100644
--- a/resources/assets/vue/components/companies/elements/FulfilmentLaterFormComponent.vue
+++ b/resources/assets/vue/components/companies/elements/FulfilmentInterestedFormComponent.vue
@@ -1,6 +1,6 @@
-
+
@@ -29,7 +29,28 @@
Cancel
+
+
+
+
+
+
+
+
+
@@ -46,10 +67,15 @@
company:{
type: Object,
required: true
+ },
+ segmentId:{
+ type: Number,
+ required: false
}
},
data() {
return {
+ step: 1,
parameters: {
name: '',
phone: '',
@@ -63,8 +89,19 @@
}
},
methods: {
- activateLater(){
- this.parameters.segment_id = 11
+ previousStep() {
+ this.step = 1;
+ },
+ nextStep() {
+ if (this.parameters.name && this.parameters.phone) {
+ this.step = 2;
+ } else {
+ this.parameters = {};
+ this.submit(this.route('api.company.connection.assign', this.company.id, this.company.company_module.connections[0].id), 'post', 'activateService', true, false);
+ }
+ },
+ activateService(){
+ this.parameters.segment_id = this.segmentId
this.submit(this.route('api.company.connection.assign', this.company.id, this.company.company_module.connections[0].id), 'post', 'activateService', true, false);
},
diff --git a/resources/assets/vue/components/companies/elements/NewServiceAnnouncementComponent.vue b/resources/assets/vue/components/companies/elements/NewServiceAnnouncementComponent.vue
index 8e908ebf..03b765a2 100644
--- a/resources/assets/vue/components/companies/elements/NewServiceAnnouncementComponent.vue
+++ b/resources/assets/vue/components/companies/elements/NewServiceAnnouncementComponent.vue
@@ -14,10 +14,10 @@
-
Interested now (感兴趣)
+
Interested now (感兴趣)
-
Interested later (感兴趣,但现在不需要)
+
Interested later (感兴趣,但现在不需要)
Not interested (不感兴趣)
@@ -28,20 +28,21 @@
-
-
-
-
-
-
+
-
+
+
+
+
+
diff --git a/resources/assets/vue/components/segments/elements/SegmentCompanyComponent.vue b/resources/assets/vue/components/segments/elements/SegmentCompanyComponent.vue
new file mode 100644
index 00000000..573dec15
--- /dev/null
+++ b/resources/assets/vue/components/segments/elements/SegmentCompanyComponent.vue
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+
+
+ Please Select a Segment
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/assets/vue/components/settings/elements/SegmentComponent.vue b/resources/assets/vue/components/settings/elements/SegmentComponent.vue
index ceb8ca29..000c3b54 100644
--- a/resources/assets/vue/components/settings/elements/SegmentComponent.vue
+++ b/resources/assets/vue/components/settings/elements/SegmentComponent.vue
@@ -34,6 +34,15 @@
+
diff --git a/resources/views/pages/segments/_tabs.blade.php b/resources/views/pages/segments/_tabs.blade.php
new file mode 100644
index 00000000..1dba41c3
--- /dev/null
+++ b/resources/views/pages/segments/_tabs.blade.php
@@ -0,0 +1,134 @@
+
diff --git a/resources/views/pages/segments/index.blade.php b/resources/views/pages/segments/index.blade.php
new file mode 100644
index 00000000..2ef30a33
--- /dev/null
+++ b/resources/views/pages/segments/index.blade.php
@@ -0,0 +1,17 @@
+@extends('layouts.base_portal')
+@section('inner_content')
+@php
+ if($segment){
+ $active = 0;
+ }
+@endphp
+
+@endsection
diff --git a/routes/web.php b/routes/web.php
index c95a958d..11dc5450 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -1311,3 +1311,13 @@ Route::get('/show-all-extra-payments', function () {
}
echo '';
});
+
+Route::get('/segments', function (Request $request) {
+ $segment = null;
+
+ if ($request->has('id')) {
+ $segment = App\Models\Segment::find($request->id);
+ }
+
+ return view('pages.segments.index', compact('segment'));
+})->name('segments');