diff --git a/app/Classes/Modules/Exports/Services/ExportsAllCustomersInfoForLarkSystem.php b/app/Classes/Modules/Exports/Services/ExportsAllCustomersInfoForLarkSystem.php
new file mode 100644
index 00000000..06988abb
--- /dev/null
+++ b/app/Classes/Modules/Exports/Services/ExportsAllCustomersInfoForLarkSystem.php
@@ -0,0 +1,71 @@
+execute(
+ Company::query()->with([
+ 'employees',
+ 'segments',
+ 'contacts'
+ ]),
+ ['business_type' => 2]
+ );
+ }
+
+ public function map($company): array
+ {
+ $employeeEmail = '';
+ if ($company->employees->first()) {
+ $employeeEmail = $company->employees->first()->email;
+ }
+
+ $contactPhone = '';
+ if ($company->contacts->first()) {
+ $contactPhone = $company->contacts->first()->phone;
+ }
+
+ $segments = '';
+ if ($company->segments->first()) {
+ $segments = $company->segments->pluck('name')->implode(', ');
+ }
+
+ return [
+ $company->reference,
+ $company->name,
+ $contactPhone,
+ $employeeEmail,
+ $company->created_at ? $company->created_at->toDateString() : '',
+ $company->updated_at ? $company->updated_at->toDateString() : '',
+ $segments,
+ ];
+ }
+}
diff --git a/app/Http/Controllers/Exports/ExportCustomersToExcelController.php b/app/Http/Controllers/Exports/ExportCustomersToExcelController.php
index b693f326..8452dd6b 100644
--- a/app/Http/Controllers/Exports/ExportCustomersToExcelController.php
+++ b/app/Http/Controllers/Exports/ExportCustomersToExcelController.php
@@ -24,6 +24,7 @@ use App\Classes\Modules\Exports\Services\ExportsImportedReceiptMappeds;
use App\Classes\Modules\Exports\Services\ExportsWhiteFormTransactions;
use Illuminate\Support\Facades\Storage;
use App\Classes\General\AWSS3Helper;
+use App\Classes\Modules\Exports\Services\ExportsAllCustomersInfoForLarkSystem;
use Illuminate\Support\Carbon;
class ExportCustomersToExcelController
@@ -241,5 +242,25 @@ class ExportCustomersToExcelController
return $response;
}
}
+
+ public function exportAllCustomersInfoForLarkSystem(Request $request)
+ {
+ $password = $request->input('password');
+ if ($password !== 'all_customers_data') {
+ return response()->json(['error' => 'Invalid password'], 403);
+ }
+
+ $exportsAllCustomersInfoForLarkSystem = new ExportsAllCustomersInfoForLarkSystem($request);
+ $exportFileName = 'all_customers_info_for_lark_system.xls';
+
+ $filesystemDriver = Storage::getDefaultDriver();
+ if ($filesystemDriver === 's3') {
+ return response(['src' => AWSS3Helper::S3Exportable($exportFileName, $exportsAllCustomersInfoForLarkSystem)]);
+ } else {
+ $response = $exportsAllCustomersInfoForLarkSystem->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
+ ob_end_clean();
+ return $response;
+ }
+ }
}
diff --git a/resources/assets/vue/components/general/elements/PasswordProtectedDownloadComponent.vue b/resources/assets/vue/components/general/elements/PasswordProtectedDownloadComponent.vue
new file mode 100644
index 00000000..22b68ce6
--- /dev/null
+++ b/resources/assets/vue/components/general/elements/PasswordProtectedDownloadComponent.vue
@@ -0,0 +1,156 @@
+
+
+
+ Enter Password
+