Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel ecommerce RMA update in v2.0 #5

Closed
wants to merge 11 commits into from
Closed
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"autoprefixer": "^10.4.14",
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.2",
"postcss": "^8.4.23",
"tailwindcss": "^3.3.2",
"vite": "^4.0.0",
"vue": "^3.2.47"
},
"dependencies": {
"@vee-validate/i18n": "^4.9.1",
"@vee-validate/rules": "^4.9.1",
"mitt": "^3.0.0",
"vee-validate": "^4.9.1",
"vue-flatpickr": "^2.3.0"
}
}
6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
6 changes: 5 additions & 1 deletion src/Config/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
[
'key' => 'rma',
'name' => 'rma::app.admin.admin-name.rma',
'info' => 'Return merchandise authorization.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use static text, use the translation files instead.

'icon' => 'settings/order.svg',
'sort' => 2
], [
'key' => 'rma.settings',
'name' => 'rma::app.admin.setting.settings',
'info' => 'E-commerce merchant to permit the return of a product.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use static text, use the translation files instead.

'icon' => 'settings/order.svg',
'sort' => 1,
], [
'key' => 'rma.settings.general',
Expand Down Expand Up @@ -39,4 +43,4 @@
],
],
],
];
];
55 changes: 55 additions & 0 deletions src/Console/Commands/Install.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace Webkul\RMA\Console\Commands;

use Artisan;
use Illuminate\Console\Command;

class Install extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'rma:install';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Install the RMA package';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{

Artisan::call('migrate', [], $this->getOutput());

Artisan::call('db:seed', [
'--class' => "Webkul\\RMA\\Database\\Seeders\\DatabaseSeeder"
], $this->getOutput());

Artisan::call('optimize', [], $this->getOutput());

Artisan::call('vendor:publish', [
'--provider' => "Webkul\RMA\Providers\RMAServiceProvider",
'--force' => true
], $this->getOutput());
}
}
80 changes: 58 additions & 22 deletions src/DataGrids/Admin/Reasons.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Webkul\RMA\DataGrids\Admin;

use DB;
use Webkul\Ui\DataGrid\DataGrid;
use Webkul\DataGrid\DataGrid;

class Reasons extends DataGrid
{
Expand All @@ -23,6 +23,11 @@ public function __construct()
$this->invoker = $this;
}

/**
* Prepare query builder.
*
* @return \Illuminate\Database\Query\Builder
*/
public function prepareQueryBuilder()
{
if (auth()->guard('customer')->user()) {
Expand All @@ -42,10 +47,15 @@ public function prepareQueryBuilder()

$this->addFilter('status', 'rma_reasons.status');

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

public function addColumns()
/**
* Add columns.
*
* @return void
*/
public function prepareColumns()
{
$this->addColumn([
'index' => 'id',
Expand Down Expand Up @@ -91,46 +101,72 @@ public function addColumns()
]);
}

/**
* Prepare actions.
*
* @return void
*/
public function prepareActions()
{
if (bouncer()->hasPermission('rma.reason.edit')) {
$this->addAction([
'icon' => 'icon-edit',
'title' => trans('rma::app.shop.customer-rma-index.edit'),
'type' => 'Edit',
'method' => 'GET',
'route' => 'admin.rma.reason.edit',
'icon' => 'icon pencil-lg-icon'
'url' => function ($row) {
return route('admin.rma.reason.edit', $row->id);
},
]);
}

if (bouncer()->hasPermission('rma.reason.delete')) {
$this->addAction([
'icon' => 'icon-delete',
'title' => trans('rma::app.shop.customer-rma-index.delete'),
'type' => 'Delete',
'method' => 'GET',
'route' => 'admin.rma.reason.delete',
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'reasons']),
'icon' => 'icon trash-icon'
'url' => function ($row) {
return route('admin.rma.reason.delete', $row->id);
},
]);
}

}
/**
* Prepare mass actions.
*
* @return void
*/
public function prepareMassActions()
{
if (bouncer()->hasPermission('rma.reason.massdelete')) {
$this->addMassAction([
'title' => trans('rma::app.shop.customer-rma-index.delete'),
'type' => 'delete',
'label' => trans('rma::app.admin.action-name.delete'),
'action' => route('admin.rma.reason.massdelete'),
'method' => 'POST'
'title' => trans('rma::app.shop.customer-rma-index.delete'),
'type' => 'Delete',
'label' => trans('rma::app.admin.action-name.delete'),
'method' => 'POST',
'url' => route('admin.rma.reason.massdelete'),
]);

if (bouncer()->hasPermission('rma.reason.massupdate')) {
$this->addMassAction([
'title' => trans('rma::app.shop.customer-rma-index.update'),
'type' => 'update',
'label' => trans('rma::app.admin.action-name.update'),
'action' => route('admin.rma.reason.massupdate'),
'method' => 'POST',
'title' => trans('rma::app.shop.customer-rma-index.update'),
'type' => 'update',
'label' => trans('rma::app.admin.action-name.update'),
'method' => 'POST',
'url' => route('admin.rma.reason.massupdate'),
'options' => [
trans('rma::app.admin.action-name.options.enable') => 1,
trans('rma::app.admin.action-name.options.disable') => 0
]
[
'label' => trans('rma::app.admin.action-name.options.enable'),
'value' => 1,
],
[
'label' => trans('rma::app.admin.action-name.options.disable'),
'value' => 0,
],
],
]);
}
}
}
}
Loading