Skip to content

Commit

Permalink
Resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jitendra-webkul committed Aug 16, 2024
2 parents b220b05 + 6bf6182 commit a030bed
Show file tree
Hide file tree
Showing 119 changed files with 4,243 additions and 758 deletions.
1 change: 1 addition & 0 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Kernel extends HttpKernel
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Webkul\Installer\Http\Middleware\CanInstall::class,
];

/**
Expand Down
23 changes: 14 additions & 9 deletions packages/Webkul/Admin/src/DataGrids/Activity/ActivityDataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function prepareColumns(): void
'type' => 'string',
'searchable' => false,
'sortable' => true,
'filterable' => true,
'closure' => function ($row) {
$route = urldecode(route('admin.settings.users.index', ['id[eq]' => $row->created_by_id]));

Expand Down Expand Up @@ -124,33 +125,37 @@ public function prepareColumns(): void
'type' => 'string',
'searchable' => false,
'filterable' => false,
'closure' => fn ($row) => trans('admin::app.activities.'.$row->type),
'sortable' => true,
'closure' => fn ($row) => trans('admin::app.activities.index.datagrid.'.$row->type),
]);

$this->addColumn([
'index' => 'schedule_from',
'label' => trans('admin::app.activities.index.datagrid.schedule_from'),
'type' => 'date',
'searchable' => false,
'sortable' => true,
'searchable' => true,
'filterable' => true,
'closure' => fn ($row) => core()->formatDate($row->schedule_from),
]);

$this->addColumn([
'index' => 'schedule_to',
'label' => trans('admin::app.activities.index.datagrid.schedule_to'),
'type' => 'date',
'searchable' => false,
'sortable' => true,
'searchable' => true,
'filterable' => true,
'closure' => fn ($row) => core()->formatDate($row->schedule_to),
]);

$this->addColumn([
'index' => 'created_at',
'label' => trans('admin::app.activities.index.datagrid.created_at'),
'type' => 'date',
'searchable' => false,
'sortable' => true,
'searchable' => true,
'filterable' => true,
'closure' => fn ($row) => core()->formatDate($row->created_at),
]);
}
Expand Down Expand Up @@ -184,9 +189,10 @@ public function prepareMassActions(): void
{

$this->addMassAction([
'icon' => 'icon-delete',
'title' => trans('admin::app.activities.index.datagrid.mass-delete'),
'url' => route('admin.activities.mass_delete'),
'method' => 'POST',
'url' => route('admin.activities.mass_delete'),
]);

$this->addMassAction([
Expand All @@ -195,11 +201,10 @@ public function prepareMassActions(): void
'method' => 'POST',
'options' => [
[
'label' => trans('admin::app.catalog.products.index.datagrid.active'),
'label' => trans('admin::app.activities.index.datagrid.done'),
'value' => 1,
],
[
'label' => trans('admin::app.catalog.products.index.datagrid.disable'),
], [
'label' => trans('admin::app.activities.index.datagrid.not-done'),
'value' => 0,
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function prepareColumns(): void

$this->addColumn([
'index' => 'persons_count',
'label' => trans('admin::app.datagrid.persons_count'),
'label' => trans('admin::app.contacts.organizations.index.datagrid.persons-count'),
'type' => 'string',
'searchable' => false,
'sortable' => false,
Expand All @@ -83,9 +83,7 @@ public function prepareColumns(): void
'filterable' => true,
'filterable_type' => 'date_range',
'sortable' => true,
'closure' => function ($row) {
return core()->formatDate($row->created_at);
},
'closure' => fn ($row) => core()->formatDate($row->created_at),
]);
}

Expand All @@ -98,18 +96,14 @@ public function prepareActions(): void
'icon' => 'icon-edit',
'title' => trans('admin::app.contacts.organizations.index.datagrid.edit'),
'method' => 'GET',
'url' => function ($row) {
return route('admin.contacts.organizations.edit', $row->id);
},
'url' => fn ($row) => route('admin.contacts.organizations.edit', $row->id),
]);

$this->addAction([
'icon' => 'icon-delete',
'title' => trans('admin::app.contacts.organizations.index.datagrid.delete'),
'method' => 'DELETE',
'url' => function ($row) {
return route('admin.contacts.organizations.delete', $row->id);
},
'url' => fn ($row) => route('admin.contacts.organizations.delete', $row->id),
]);
}

Expand Down
39 changes: 22 additions & 17 deletions packages/Webkul/Admin/src/DataGrids/Contact/PersonDataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ public function prepareColumns(): void
'type' => 'integer',
'filterable' => true,
'sortable' => true,
'searchable' => true,
]);

$this->addColumn([
'index' => 'person_name',
'label' => trans('admin::app.contacts.persons.index.datagrid.name'),
'type' => 'string',
'sortable' => true,
'closure' => function ($row) {
'index' => 'person_name',
'label' => trans('admin::app.contacts.persons.index.datagrid.name'),
'type' => 'string',
'sortable' => true,
'filterable' => true,
'searchable' => true,
'closure' => function ($row) {
[$bgColorClass, $textColorClass] = $this->generateRandomColorClasses();

$nameParts = explode(' ', $row->person_name);
Expand All @@ -82,23 +85,25 @@ public function prepareColumns(): void
]);

$this->addColumn([
'index' => 'emails',
'label' => trans('admin::app.contacts.persons.index.datagrid.emails'),
'type' => 'string',
'sortable' => false,
'closure' => function ($row) {
'index' => 'emails',
'label' => trans('admin::app.contacts.persons.index.datagrid.emails'),
'type' => 'string',
'sortable' => false,
'filterable' => true,
'searchable' => true,
'closure' => function ($row) {
return collect(json_decode($row->emails, true) ?? [])->pluck('value')->join(', ');
},
]);

$this->addColumn([
'index' => 'contact_numbers',
'label' => trans('admin::app.contacts.persons.index.datagrid.contact-numbers'),
'type' => 'string',
'sortable' => false,
'closure' => function ($row) {
return collect(json_decode($row->contact_numbers, true) ?? [])->pluck('value')->join(', ');
},
'index' => 'contact_numbers',
'label' => trans('admin::app.contacts.persons.index.datagrid.contact-numbers'),
'type' => 'string',
'sortable' => true,
'filterable' => true,
'searchable' => true,
'closure' => fn ($row) => collect(json_decode($row->contact_numbers, true) ?? [])->pluck('value')->join(', '),
]);

$this->addColumn([
Expand Down
65 changes: 24 additions & 41 deletions packages/Webkul/Admin/src/DataGrids/Lead/LeadDataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Webkul\Admin\DataGrids\Lead;

use Illuminate\Contracts\Database\Query\Builder;
use Illuminate\Support\Facades\DB;
use Webkul\DataGrid\DataGrid;
use Webkul\Lead\Repositories\PipelineRepository;
Expand Down Expand Up @@ -40,10 +41,8 @@ public function __construct(

/**
* Prepare query builder.
*
* @return void
*/
public function prepareQueryBuilder()
public function prepareQueryBuilder(): Builder
{
$queryBuilder = DB::table('leads')
->addSelect(
Expand Down Expand Up @@ -100,11 +99,9 @@ public function prepareQueryBuilder()
}

/**
* Add columns.
*
* @return void
* Prepare columns.
*/
public function prepareColumns()
public function prepareColumns(): void
{
$this->addColumn([
'index' => 'id',
Expand Down Expand Up @@ -149,9 +146,7 @@ public function prepareColumns()
'label' => trans('admin::app.leads.index.datagrid.lead-value'),
'type' => 'string',
'sortable' => true,
'closure' => function ($row) {
return core()->formatBasePrice($row->lead_value, 2);
},
'closure' => fn ($row) => core()->formatBasePrice($row->lead_value, 2),
]);

$this->addColumn([
Expand Down Expand Up @@ -228,19 +223,15 @@ public function prepareColumns()

/**
* Prepare actions.
*
* @return void
*/
public function prepareActions()
public function prepareActions(): void
{
if (bouncer()->hasPermission('leads.view')) {
$this->addAction([
'icon' => 'icon-eye',
'title' => trans('admin::app.leads.index.datagrid.view'),
'method' => 'GET',
'url' => function ($row) {
return route('admin.leads.view', $row->id);
},
'url' => fn ($row) => route('admin.leads.view', $row->id),
]);
}

Expand All @@ -249,39 +240,31 @@ public function prepareActions()
'icon' => 'icon-delete',
'title' => trans('admin::app.leads.index.datagrid.delete'),
'method' => 'delete',
'url' => function ($row) {
return route('admin.leads.delete', $row->id);
},
'url' => fn ($row) => route('admin.leads.delete', $row->id),
]);
}
}

/**
* Prepare mass actions.
*
* @return void
*/
public function prepareMassActions()
public function prepareMassActions(): void
{
// $stages = [];

// foreach ($this->pipeline->stages->toArray() as $stage) {
// $stages[$stage['name']] = $stage['id'];
// }

// $this->addMassAction([
// 'type' => 'delete',
// 'label' => trans('ui::app.datagrid.delete'),
// 'action' => route('admin.leads.mass_delete'),
// 'method' => 'PUT',
// ]);
$this->addMassAction([
'icon' => 'icon-delete',
'title' => trans('admin::app.leads.index.datagrid.mass-delete'),
'method' => 'POST',
'url' => route('admin.leads.mass_delete'),
]);

// $this->addMassAction([
// 'type' => 'update',
// 'label' => trans('admin::app.leads.index.datagrid.update_stage'),
// 'action' => route('admin.leads.mass_update'),
// 'method' => 'PUT',
// 'options' => $stages,
// ]);
$this->addMassAction([
'title' => trans('admin::app.leads.index.datagrid.mass-update'),
'url' => route('admin.leads.mass_update'),
'method' => 'POST',
'options' => $this->pipeline->stages->map(fn ($stage) => [
'label' => $stage->name,
'value' => $stage->id,
])->toArray(),
]);
}
}
Loading

0 comments on commit a030bed

Please sign in to comment.