-
-
Notifications
You must be signed in to change notification settings - Fork 858
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into marketing-communication
- Loading branch information
Showing
163 changed files
with
6,864 additions
and
411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
database/migrations/2024_09_09_094040_create_job_batches_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('job_batches', function (Blueprint $table) { | ||
$table->string('id')->primary(); | ||
$table->string('name'); | ||
$table->integer('total_jobs'); | ||
$table->integer('pending_jobs'); | ||
$table->integer('failed_jobs'); | ||
$table->text('failed_job_ids'); | ||
$table->mediumText('options')->nullable(); | ||
$table->integer('cancelled_at')->nullable(); | ||
$table->integer('created_at'); | ||
$table->integer('finished_at')->nullable(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('job_batches'); | ||
} | ||
}; |
36 changes: 36 additions & 0 deletions
36
database/migrations/2024_09_09_094042_create_jobs_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('jobs', function (Blueprint $table) { | ||
$table->bigIncrements('id'); | ||
$table->string('queue')->index(); | ||
$table->longText('payload'); | ||
$table->unsignedTinyInteger('attempts'); | ||
$table->unsignedInteger('reserved_at')->nullable(); | ||
$table->unsignedInteger('available_at'); | ||
$table->unsignedInteger('created_at'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('jobs'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 161 additions & 0 deletions
161
packages/Webkul/Admin/src/DataGrids/Settings/DataTransfer/ImportDataGrid.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
<?php | ||
|
||
namespace Webkul\Admin\DataGrids\Settings\DataTransfer; | ||
|
||
use Illuminate\Database\Query\Builder; | ||
use Illuminate\Support\Facades\DB; | ||
use Webkul\DataGrid\DataGrid; | ||
|
||
class ImportDataGrid extends DataGrid | ||
{ | ||
/** | ||
* Prepare query builder. | ||
*/ | ||
public function prepareQueryBuilder(): Builder | ||
{ | ||
return DB::table('imports') | ||
->select( | ||
'id', | ||
'state', | ||
'file_path', | ||
'error_file_path', | ||
'started_at', | ||
'completed_at', | ||
'type', | ||
'summary', | ||
); | ||
} | ||
|
||
/** | ||
* Prepare Columns. | ||
*/ | ||
public function prepareColumns(): void | ||
{ | ||
$this->addColumn([ | ||
'index' => 'id', | ||
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.id'), | ||
'type' => 'integer', | ||
'filterable' => true, | ||
'sortable' => true, | ||
]); | ||
|
||
$this->addColumn([ | ||
'index' => 'type', | ||
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.type'), | ||
'type' => 'string', | ||
'filterable' => true, | ||
'sortable' => true, | ||
]); | ||
|
||
$this->addColumn([ | ||
'index' => 'state', | ||
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.state'), | ||
'type' => 'string', | ||
'filterable' => true, | ||
'sortable' => true, | ||
]); | ||
|
||
$this->addColumn([ | ||
'index' => 'file_path', | ||
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.uploaded-file'), | ||
'type' => 'string', | ||
'closure' => function ($row) { | ||
return '<a href="'.route('admin.settings.data_transfer.imports.download', $row->id).'" class="cursor-pointer text-blue-600 hover:underline">'.$row->file_path.'<a>'; | ||
}, | ||
]); | ||
|
||
$this->addColumn([ | ||
'index' => 'error_file_path', | ||
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.error-file'), | ||
'type' => 'string', | ||
'closure' => function ($row) { | ||
if (empty($row->error_file_path)) { | ||
return ''; | ||
} | ||
|
||
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>'; | ||
}, | ||
]); | ||
|
||
$this->addColumn([ | ||
'index' => 'started_at', | ||
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.started-at'), | ||
'type' => 'date', | ||
'filterable' => true, | ||
'filterable_type' => 'date_range', | ||
'sortable' => true, | ||
]); | ||
|
||
$this->addColumn([ | ||
'index' => 'completed_at', | ||
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.completed-at'), | ||
'type' => 'date', | ||
'filterable' => true, | ||
'filterable_type' => 'date_range', | ||
'sortable' => true, | ||
]); | ||
|
||
$this->addColumn([ | ||
'index' => 'summary', | ||
'label' => trans('admin::app.settings.data-transfer.imports.index.datagrid.summary'), | ||
'type' => 'string', | ||
'closure' => function ($row) { | ||
if (empty($row->summary)) { | ||
return ''; | ||
} | ||
|
||
$summary = json_decode($row->summary, true); | ||
|
||
$stats = []; | ||
|
||
foreach ($summary as $type => $value) { | ||
$stats[] = trans('admin::app.settings.data-transfer.imports.index.datagrid.'.$type).': '.$summary[$type]; | ||
} | ||
|
||
return implode(', ', $stats); | ||
}, | ||
]); | ||
} | ||
|
||
/** | ||
* Prepare actions. | ||
*/ | ||
public function prepareActions(): void | ||
{ | ||
if (bouncer()->hasPermission('settings.data_transfer.imports.import')) { | ||
$this->addAction([ | ||
'index' => 'import', | ||
'icon' => 'icon-import', | ||
'title' => trans('admin::app.settings.data-transfer.imports.index.datagrid.import'), | ||
'method' => 'GET', | ||
'url' => function ($row) { | ||
return route('admin.settings.data_transfer.imports.import', $row->id); | ||
}, | ||
]); | ||
} | ||
|
||
if (bouncer()->hasPermission('settings.data_transfer.imports.edit')) { | ||
$this->addAction([ | ||
'index' => 'edit', | ||
'icon' => 'icon-edit', | ||
'title' => trans('admin::app.settings.data-transfer.imports.index.datagrid.edit'), | ||
'method' => 'GET', | ||
'url' => function ($row) { | ||
return route('admin.settings.data_transfer.imports.edit', $row->id); | ||
}, | ||
]); | ||
} | ||
|
||
if (bouncer()->hasPermission('settings.data_transfer.imports.delete')) { | ||
$this->addAction([ | ||
'index' => 'delete', | ||
'icon' => 'icon-delete', | ||
'title' => trans('admin::app.settings.data-transfer.imports.index.datagrid.delete'), | ||
'method' => 'DELETE', | ||
'url' => function ($row) { | ||
return route('admin.settings.data_transfer.imports.delete', $row->id); | ||
}, | ||
]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.