Skip to content

Commit

Permalink
Merge pull request #1279 from shivendra-webkul/krayin-update
Browse files Browse the repository at this point in the history
Fixed icon colors
  • Loading branch information
devansh-webkul authored Jul 19, 2024
2 parents 483cc18 + 36d367e commit e7254bd
Show file tree
Hide file tree
Showing 26 changed files with 636 additions and 438 deletions.
76 changes: 43 additions & 33 deletions packages/Webkul/Admin/src/DataGrids/Setting/RoleDataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
namespace Webkul\Admin\DataGrids\Setting;

use Illuminate\Support\Facades\DB;
use Webkul\Admin\Traits\ProvideDropdownOptions;
use Webkul\UI\DataGrid\DataGrid;
use Webkul\DataGrid\DataGrid;
use Illuminate\Database\Query\Builder;

class RoleDataGrid extends DataGrid
{
use ProvideDropdownOptions;

/**
* Prepare query builder.
*
* @return void
*/
public function prepareQueryBuilder()
public function prepareQueryBuilder(): Builder
{
$queryBuilder = DB::table('roles')
->addSelect(
Expand All @@ -26,67 +22,81 @@ public function prepareQueryBuilder()
);

$this->addFilter('id', 'roles.id');
$this->addFilter('name', 'roles.name');

$this->setQueryBuilder($queryBuilder);
return $queryBuilder;
}

/**
* Add columns.
*
* @return void
*/
public function addColumns()
public function prepareColumns(): void
{
$this->addColumn([
'index' => 'id',
'label' => trans('admin::app.datagrid.id'),
'label' => trans('admin::app.settings.roles.index.datagrid.id'),
'type' => 'string',
'sortable' => true,
'filterable' => true,
'sortable' => true,
]);

$this->addColumn([
'index' => 'name',
'label' => trans('admin::app.datagrid.name'),
'label' => trans('admin::app.settings.roles.index.datagrid.name'),
'type' => 'string',
'sortable' => true,
'filterable' => true,
'sortable' => true,
]);

$this->addColumn([
'index' => 'description',
'label' => trans('admin::app.datagrid.description'),
'label' => trans('admin::app.settings.roles.index.datagrid.description'),
'type' => 'string',
'sortable' => false,
]);

$this->addColumn([
'index' => 'permission_type',
'label' => trans('admin::app.datagrid.permission_type'),
'type' => 'dropdown',
'dropdown_options' => $this->getRoleDropdownOptions(),
'sortable' => false,
'index' => 'permission_type',
'label' => trans('admin::app.settings.roles.index.datagrid.permission-type'),
'type' => 'string',
'searchable' => true,
'filterable' => true,
'filterable_type' => 'dropdown',
'filterable_options' => [
[
'label' => trans('admin::app.settings.roles.index.datagrid.custom'),
'value' => 'custom',
],
[
'label' => trans('admin::app.settings.roles.index.datagrid.all'),
'value' => 'all',
],
],
'sortable' => true,
]);
}

/**
* Prepare actions.
*
* @return void
*/
public function prepareActions()
public function prepareActions(): void
{
$this->addAction([
'title' => trans('ui::app.datagrid.edit'),
'icon' => 'icon-edit',
'title' => trans('admin::app.settings.roles.index.datagrid.edit'),
'method' => 'GET',
'route' => 'admin.settings.roles.edit',
'icon' => 'pencil-icon',
'url' => function ($row) {
return route('admin.settings.roles.edit', $row->id);
},
]);

$this->addAction([
'title' => trans('ui::app.datagrid.delete'),
'method' => 'DELETE',
'route' => 'admin.settings.roles.delete',
'confirm_text' => trans('ui::app.datagrid.mass-action.delete', ['resource' => 'user']),
'icon' => 'trash-icon',
'icon' => 'icon-delete',
'title' => trans('admin::app.settings.roles.index.datagrid.delete'),
'method' => 'DELETE',
'url' => function ($row) {
return route('admin.settings.roles.delete', $row->id);
},
]);
}
}
42 changes: 21 additions & 21 deletions packages/Webkul/Admin/src/DataGrids/Setting/TypeDataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

namespace Webkul\Admin\DataGrids\Setting;

use Webkul\UI\DataGrid\DataGrid;
use Illuminate\Support\Facades\DB;
use Webkul\DataGrid\DataGrid;
use Illuminate\Database\Query\Builder;

class TypeDataGrid extends DataGrid
{
/**
* Prepare query builder.
*
* @return void
*/
public function prepareQueryBuilder()
public function prepareQueryBuilder(): Builder
{
$queryBuilder = DB::table('lead_types')
->addSelect(
Expand All @@ -22,51 +21,52 @@ public function prepareQueryBuilder()

$this->addFilter('id', 'lead_types.id');

$this->setQueryBuilder($queryBuilder);
return $queryBuilder;
}

/**
* Add columns.
*
* @return void
*/
public function addColumns()
public function prepareColumns(): void
{
$this->addColumn([
'index' => 'id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'string',
'sortable' => true,
'filterable' => true,
'sortable' => true,
]);

$this->addColumn([
'index' => 'name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'sortable' => true,
'filterable' => true,
'sortable' => true,
]);
}

/**
* Prepare actions.
*
* @return void
*/
public function prepareActions()
public function prepareActions(): void
{
$this->addAction([
'title' => trans('ui::app.datagrid.edit'),
'icon' => 'icon-edit',
'title' => trans('admin::app.settings.roles.index.datagrid.edit'),
'method' => 'GET',
'route' => 'admin.settings.types.edit',
'icon' => 'pencil-icon',
'url' => function ($row) {
return route('admin.settings.types.edit', $row->id);
},
]);

$this->addAction([
'title' => trans('ui::app.datagrid.delete'),
'method' => 'DELETE',
'route' => 'admin.settings.types.delete',
'confirm_text' => trans('ui::app.datagrid.mass-action.delete', ['resource' => 'type']),
'icon' => 'trash-icon',
'icon' => 'icon-delete',
'title' => trans('admin::app.settings.roles.index.datagrid.delete'),
'method' => 'DELETE',
'url' => function ($row) {
return route('admin.settings.types.delete', $row->id);
},
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
namespace Webkul\Admin\Http\Controllers\Setting;

use Illuminate\Support\Facades\Event;
use Illuminate\Http\JsonResponse;
use Illuminate\View\View;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\User\Repositories\RoleRepository;
use Webkul\Admin\DataGrids\Setting\RoleDataGrid;

class RoleController extends Controller
{
Expand All @@ -22,10 +25,10 @@ public function __construct(protected RoleRepository $roleRepository)
*
* @return \Illuminate\View\View
*/
public function index()
public function index(): View|JsonResponse
{
if (request()->ajax()) {
return app(\Webkul\Admin\DataGrids\Setting\RoleDataGrid::class)->toJson();
return datagrid(RoleDataGrid::class)->process();
}

return view('admin::settings.roles.index');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
namespace Webkul\Admin\Http\Controllers\Setting;

use Illuminate\Support\Facades\Event;
use Illuminate\Http\JsonResponse;
use Illuminate\View\View;
use Illuminate\Support\Facades\Validator;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Lead\Repositories\TypeRepository;
use Webkul\Admin\DataGrids\Setting\TypeDataGrid;

class TypeController extends Controller
{
Expand All @@ -20,13 +23,11 @@ public function __construct(protected TypeRepository $typeRepository)

/**
* Display a listing of the type.
*
* @return \Illuminate\View\View
*/
public function index()
public function index(): View|JsonResponse
{
if (request()->ajax()) {
return app(\Webkul\Admin\DataGrids\Setting\TypeDataGrid::class)->toJson();
return datagrid(TypeDataGrid::class)->process();
}

return view('admin::settings.types.index');
Expand Down
2 changes: 1 addition & 1 deletion packages/Webkul/Admin/src/Resources/assets/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@
/*--------------------------------- New UI CSS --------------------------------------------------------------- */

.sidebar-rounded::after {
@apply w-[30px] h-[30px] top-[5px] right-[-30px] absolute rounded-tl-[58%] shadow-[-13px_-5px_0px_1px_rgba(255,255,255,1)] ;
@apply w-[30px] h-[30px] top-[5px] right-[-30px] absolute rounded-tl-[58%] shadow-[-8px_-5px_0px_1px_rgba(255,255,255,1)] ;
content: "";
pointer-events: none;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/Webkul/Admin/src/Resources/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ import Axios from "./plugins/axios";
import Emitter from "./plugins/emitter";
import Flatpickr from "./plugins/flatpickr";
import VeeValidate from "./plugins/vee-validate";
import CreateElement from "./plugins/createElement";

[
Axios,
Emitter,
CreateElement,
Flatpickr,
VeeValidate
].forEach((plugin) => app.use(plugin));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { h, resolveComponent } from "vue/dist/vue.esm-bundler";

export default {
install(app) {
/**
* Create the virtual dom element
*/
app.config.globalProperties.$h = h;

/**
* Resolve the component which is globally registered
*/
app.config.globalProperties.$resolveComponent = resolveComponent;
},
};
48 changes: 46 additions & 2 deletions packages/Webkul/Admin/src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,52 @@
'id' => 'ID',
'name' => 'Name',
],
]
]
],
],

'roles' => [
'index' => [
'create-btn' => 'Create Roles',
'title' => 'Roles',
'settings' => 'Settings',
'datagrid' => [
'all' => 'All',
'custom' => 'Custom',
'delete' => 'Delete',
'description' => 'Description',
'edit' => 'Edit',
'id' => 'ID',
'name' => 'Name',
'permission-type' => 'Permission Type',
],
],

'create' => [
'access-control' => 'Access Control',
'all' => 'All',
'back-btn' => 'Back',
'custom' => 'Custom',
'description' => 'Description',
'general' => 'General',
'name' => 'Name',
'permissions' => 'Permissions',
'save-btn' => 'Save Role',
'title' => 'Create Role',
],

'edit' => [
'access-control' => 'Access Control',
'all' => 'All',
'back-btn' => 'Back',
'custom' => 'Custom',
'description' => 'Description',
'general' => 'General',
'name' => 'Name',
'permissions' => 'Permissions',
'save-btn' => 'Save Role',
'title' => 'Edit Role',
],
],
],

// ----------------------------------------------------------------Old version locale ----------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class="peer hidden"
>
<span
class="icon-checkbox-outline cursor-pointer rounded-md text-2xl"
class="icon-checkbox-outline cursor-pointer rounded-md text-2xl text-gray-500"
:class="[
applied.massActions.meta.mode === 'all' ? 'peer-checked:icon-checkbox-select peer-checked:text-brandColor ' : (
applied.massActions.meta.mode === 'partial' ? 'peer-checked:icon-checkbox-partial peer-checked:brandColor' : ''
Expand Down Expand Up @@ -121,7 +121,7 @@ class="peer hidden"
v-model="applied.massActions.indices"
>
<span class="icon-checkbox-outline peer-checked:icon-checkbox-select cursor-pointer rounded-md text-2xl peer-checked:text-brandColor">
<span class="icon-checkbox-outline peer-checked:icon-checkbox-select cursor-pointer rounded-md text-2xl text-gray-500 peer-checked:text-brandColor">
</span>
</label>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class="peer sr-only"
{{
$attributes
->except(['value', ':value', 'v-model', 'rules', ':rules', 'label', ':label', 'key', ':key'])
->merge(['class' => 'icon-checkbox-outline peer-checked:icon-checkbox-select text-2xl peer-checked:text-blue-600'])
->merge(['class' => 'text-gray-500 icon-checkbox-outline peer-checked:icon-checkbox-select text-2xl peer-checked:text-blue-600'])
->merge(['class' => $attributes->get('disabled') ? 'cursor-not-allowed opacity-70' : 'cursor-pointer'])
}}
>
Expand Down
Loading

0 comments on commit e7254bd

Please sign in to comment.