Skip to content

Commit a79c554

Browse files
Merge branch 'master' into marketing-communication
2 parents 03273d0 + b0d4e49 commit a79c554

File tree

163 files changed

+6864
-411
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+6864
-411
lines changed

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
"Webkul\\Attribute\\": "packages/Webkul/Attribute/src",
6060
"Webkul\\Contact\\": "packages/Webkul/Contact/src",
6161
"Webkul\\Core\\": "packages/Webkul/Core/src",
62+
"Webkul\\DataGrid\\": "packages/Webkul/DataGrid/src",
63+
"Webkul\\DataTransfer\\": "packages/Webkul/DataTransfer/src",
6264
"Webkul\\Email\\": "packages/Webkul/Email/src",
6365
"Webkul\\EmailTemplate\\": "packages/Webkul/EmailTemplate/src",
6466
"Webkul\\Marketing\\": "packages/Webkul/Marketing/src",
@@ -70,8 +72,7 @@
7072
"Webkul\\User\\": "packages/Webkul/User/src",
7173
"Webkul\\Warehouse\\": "packages/Webkul/Warehouse/src",
7274
"Webkul\\WebForm\\": "packages/Webkul/WebForm/src",
73-
"Webkul\\Automation\\": "packages/Webkul/Automation/src",
74-
"Webkul\\DataGrid\\": "packages/Webkul/DataGrid/src"
75+
"Webkul\\Automation\\": "packages/Webkul/Automation/src"
7576
}
7677
},
7778
"autoload-dev": {

config/app.php

+1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@
207207
Webkul\Contact\Providers\ContactServiceProvider::class,
208208
Webkul\Core\Providers\CoreServiceProvider::class,
209209
Webkul\DataGrid\Providers\DataGridServiceProvider::class,
210+
Webkul\DataTransfer\Providers\DataTransferServiceProvider::class,
210211
Webkul\EmailTemplate\Providers\EmailTemplateServiceProvider::class,
211212
Webkul\Email\Providers\EmailServiceProvider::class,
212213
Webkul\Marketing\Providers\MarketingServiceProvider::class,

config/concord.php

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
\Webkul\User\Providers\ModuleServiceProvider::class,
1919
\Webkul\Warehouse\Providers\ModuleServiceProvider::class,
2020
\Webkul\WebForm\Providers\ModuleServiceProvider::class,
21+
\Webkul\DataTransfer\Providers\ModuleServiceProvider::class,
2122
],
2223

2324
'register_route_models' => true,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('job_batches', function (Blueprint $table) {
17+
$table->string('id')->primary();
18+
$table->string('name');
19+
$table->integer('total_jobs');
20+
$table->integer('pending_jobs');
21+
$table->integer('failed_jobs');
22+
$table->text('failed_job_ids');
23+
$table->mediumText('options')->nullable();
24+
$table->integer('cancelled_at')->nullable();
25+
$table->integer('created_at');
26+
$table->integer('finished_at')->nullable();
27+
});
28+
}
29+
30+
/**
31+
* Reverse the migrations.
32+
*
33+
* @return void
34+
*/
35+
public function down()
36+
{
37+
Schema::dropIfExists('job_batches');
38+
}
39+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('jobs', function (Blueprint $table) {
17+
$table->bigIncrements('id');
18+
$table->string('queue')->index();
19+
$table->longText('payload');
20+
$table->unsignedTinyInteger('attempts');
21+
$table->unsignedInteger('reserved_at')->nullable();
22+
$table->unsignedInteger('available_at');
23+
$table->unsignedInteger('created_at');
24+
});
25+
}
26+
27+
/**
28+
* Reverse the migrations.
29+
*
30+
* @return void
31+
*/
32+
public function down()
33+
{
34+
Schema::dropIfExists('jobs');
35+
}
36+
};

packages/Webkul/Admin/src/Config/acl.php

+32
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,39 @@
486486
'name' => 'admin::app.acl.delete',
487487
'route' => ['admin.settings.tags.delete', 'admin.settings.tags.mass_delete', 'admin.leads.tags.detach'],
488488
'sort' => 2,
489+
],
490+
[
491+
'key' => 'settings.data_transfer',
492+
'name' => 'admin::app.acl.data-transfer',
493+
'route' => 'admin.settings.data_transfer.imports.index',
494+
'sort' => 10,
495+
], [
496+
'key' => 'settings.data_transfer.imports',
497+
'name' => 'admin::app.acl.imports',
498+
'route' => 'admin.settings.data_transfer.imports.index',
499+
'sort' => 1,
500+
], [
501+
'key' => 'settings.data_transfer.imports.create',
502+
'name' => 'admin::app.acl.create',
503+
'route' => 'admin.settings.data_transfer.imports.create',
504+
'sort' => 1,
489505
], [
506+
'key' => 'settings.data_transfer.imports.edit',
507+
'name' => 'admin::app.acl.edit',
508+
'route' => 'admin.settings.data_transfer.imports.edit',
509+
'sort' => 2,
510+
], [
511+
'key' => 'settings.data_transfer.imports.delete',
512+
'name' => 'admin::app.acl.delete',
513+
'route' => 'admin.settings.data_transfer.imports.delete',
514+
'sort' => 3,
515+
], [
516+
'key' => 'settings.data_transfer.imports.import',
517+
'name' => 'admin::app.acl.import',
518+
'route' => 'admin.settings.data_transfer.imports.imports',
519+
'sort' => 4,
520+
],
521+
[
490522
'key' => 'configuration',
491523
'name' => 'admin::app.acl.configuration',
492524
'route' => 'admin.configuration.index',

packages/Webkul/Admin/src/Config/menu.php

+9
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,14 @@
261261
'route' => 'admin.settings.workflows.index',
262262
'sort' => 3,
263263
'icon-class' => 'icon-settings-flow',
264+
],
265+
[
266+
'key' => 'settings.automation.data_transfer',
267+
'name' => 'admin::app.layouts.data_transfer',
268+
'info' => 'admin::app.layouts.data_transfer_info',
269+
'route' => 'admin.settings.data_transfer.imports.index',
270+
'sort' => 4,
271+
'icon-class' => 'icon-download',
264272
], [
265273
'key' => 'settings.other_settings',
266274
'name' => 'admin::app.layouts.other-settings',
@@ -287,4 +295,5 @@
287295
'sort' => 9,
288296
'icon-class' => 'icon-configuration',
289297
],
298+
290299
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
<?php
2+
3+
namespace Webkul\Admin\DataGrids\Settings\DataTransfer;
4+
5+
use Illuminate\Database\Query\Builder;
6+
use Illuminate\Support\Facades\DB;
7+
use Webkul\DataGrid\DataGrid;
8+
9+
class ImportDataGrid extends DataGrid
10+
{
11+
/**
12+
* Prepare query builder.
13+
*/
14+
public function prepareQueryBuilder(): Builder
15+
{
16+
return DB::table('imports')
17+
->select(
18+
'id',
19+
'state',
20+
'file_path',
21+
'error_file_path',
22+
'started_at',
23+
'completed_at',
24+
'type',
25+
'summary',
26+
);
27+
}
28+
29+
/**
30+
* Prepare Columns.
31+
*/
32+
public function prepareColumns(): void
33+
{
34+
$this->addColumn([
35+
'index' => 'id',
36+
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.id'),
37+
'type' => 'integer',
38+
'filterable' => true,
39+
'sortable' => true,
40+
]);
41+
42+
$this->addColumn([
43+
'index' => 'type',
44+
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.type'),
45+
'type' => 'string',
46+
'filterable' => true,
47+
'sortable' => true,
48+
]);
49+
50+
$this->addColumn([
51+
'index' => 'state',
52+
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.state'),
53+
'type' => 'string',
54+
'filterable' => true,
55+
'sortable' => true,
56+
]);
57+
58+
$this->addColumn([
59+
'index' => 'file_path',
60+
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.uploaded-file'),
61+
'type' => 'string',
62+
'closure' => function ($row) {
63+
return '<a href="'.route('admin.settings.data_transfer.imports.download', $row->id).'" class="cursor-pointer text-blue-600 hover:underline">'.$row->file_path.'<a>';
64+
},
65+
]);
66+
67+
$this->addColumn([
68+
'index' => 'error_file_path',
69+
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.error-file'),
70+
'type' => 'string',
71+
'closure' => function ($row) {
72+
if (empty($row->error_file_path)) {
73+
return '';
74+
}
75+
76+
return '<a href="'.route('admin.settings.data_transfer.imports.download_error_report', $row->id).'" class="cursor-pointer text-blue-600 hover:underline">'.$row->error_file_path.'<a>';
77+
},
78+
]);
79+
80+
$this->addColumn([
81+
'index' => 'started_at',
82+
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.started-at'),
83+
'type' => 'date',
84+
'filterable' => true,
85+
'filterable_type' => 'date_range',
86+
'sortable' => true,
87+
]);
88+
89+
$this->addColumn([
90+
'index' => 'completed_at',
91+
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.completed-at'),
92+
'type' => 'date',
93+
'filterable' => true,
94+
'filterable_type' => 'date_range',
95+
'sortable' => true,
96+
]);
97+
98+
$this->addColumn([
99+
'index' => 'summary',
100+
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.summary'),
101+
'type' => 'string',
102+
'closure' => function ($row) {
103+
if (empty($row->summary)) {
104+
return '';
105+
}
106+
107+
$summary = json_decode($row->summary, true);
108+
109+
$stats = [];
110+
111+
foreach ($summary as $type => $value) {
112+
$stats[] = trans('admin::app.settings.data-transfer.imports.index.datagrid.'.$type).': '.$summary[$type];
113+
}
114+
115+
return implode(', ', $stats);
116+
},
117+
]);
118+
}
119+
120+
/**
121+
* Prepare actions.
122+
*/
123+
public function prepareActions(): void
124+
{
125+
if (bouncer()->hasPermission('settings.data_transfer.imports.import')) {
126+
$this->addAction([
127+
'index' => 'import',
128+
'icon' => 'icon-import',
129+
'title' => trans('admin::app.settings.data-transfer.imports.index.datagrid.import'),
130+
'method' => 'GET',
131+
'url' => function ($row) {
132+
return route('admin.settings.data_transfer.imports.import', $row->id);
133+
},
134+
]);
135+
}
136+
137+
if (bouncer()->hasPermission('settings.data_transfer.imports.edit')) {
138+
$this->addAction([
139+
'index' => 'edit',
140+
'icon' => 'icon-edit',
141+
'title' => trans('admin::app.settings.data-transfer.imports.index.datagrid.edit'),
142+
'method' => 'GET',
143+
'url' => function ($row) {
144+
return route('admin.settings.data_transfer.imports.edit', $row->id);
145+
},
146+
]);
147+
}
148+
149+
if (bouncer()->hasPermission('settings.data_transfer.imports.delete')) {
150+
$this->addAction([
151+
'index' => 'delete',
152+
'icon' => 'icon-delete',
153+
'title' => trans('admin::app.settings.data-transfer.imports.index.datagrid.delete'),
154+
'method' => 'DELETE',
155+
'url' => function ($row) {
156+
return route('admin.settings.data_transfer.imports.delete', $row->id);
157+
},
158+
]);
159+
}
160+
}
161+
}

packages/Webkul/Admin/src/Http/Controllers/Contact/Persons/PersonController.php

+4
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,12 @@ private function sanitizeRequestedPersonData(array $data): array
187187
$data['organization_id'] = null;
188188
}
189189

190+
$data['unique_id'] = $data['user_id'].'|'.$data['organization_id'].'|'.$data['emails'][0]['value'];
191+
190192
if (isset($data['contact_numbers'])) {
191193
$data['contact_numbers'] = collect($data['contact_numbers'])->filter(fn ($number) => ! is_null($number['value']))->toArray();
194+
195+
$data['unique_id'] .= '|'.$data['contact_numbers'][0]['value'];
192196
}
193197

194198
return $data;

0 commit comments

Comments
 (0)