Order Datagrid, Datagrid Currency Capabilities via wrapper and UI fixes in storefront navigation bar, admin panel menu item, datagrid actions checks before rendering of datagrid

This commit is contained in:
prashant-webkul 2018-10-18 16:34:55 +05:30
parent d33b5c276e
commit 806ffb460f
12 changed files with 111 additions and 153 deletions

View File

@ -27,10 +27,10 @@ class ExchangeRatesDataGrid
return DataGrid::make([
'name' => 'Exchange Rates',
'table' => 'currency_exchange_rates',
'select' => 'id',
'table' => 'currency_exchange_rates as cer',
'select' => 'cer.id',
'perpage' => 5,
'aliased' => false, //use this with false as default and true in case of joins
'aliased' => true, //use this with false as default and true in case of joins
'massoperations' =>[
[
@ -56,13 +56,13 @@ class ExchangeRatesDataGrid
],
'join' => [
// [
// 'join' => 'leftjoin',
// 'table' => 'roles as r',
// 'primaryKey' => 'u.role_id',
// 'condition' => '=',
// 'secondaryKey' => 'r.id',
// ]
[
'join' => 'leftjoin',
'table' => 'currencies as curr',
'primaryKey' => 'cer.target_currency',
'condition' => '=',
'secondaryKey' => 'curr.id',
]
],
//use aliasing on secodary columns if join is performed
@ -70,39 +70,38 @@ class ExchangeRatesDataGrid
'columns' => [
[
'name' => 'id',
'name' => 'cer.id',
'alias' => 'exchID',
'type' => 'number',
'label' => 'Rate ID',
'sortable' => true,
],
[
'name' => 'target_currency',
'alias' => 'exchTargetCurrency',
'name' => 'curr.name',
'alias' => 'currencyname',
'type' => 'string',
'label' => 'Target Currency',
'label' => 'Currency Name',
'sortable' => true,
],
[
'name' => 'rate',
'name' => 'cer.rate',
'alias' => 'exchRate',
'type' => 'string',
'label' => 'Exchange Rate',
],
],
//don't use aliasing in case of filters
'filterable' => [
[
'column' => 'id',
'column' => 'cer.id',
'alias' => 'exchId',
'type' => 'number',
'label' => 'Rate ID',
],
[
'column' => 'target_currency',
'column' => 'curr.name',
'alias' => 'exchTargetCurrency',
'type' => 'string',
'label' => 'Target Currency',

View File

@ -29,7 +29,8 @@ class OrderDataGrid
'table' => 'orders as or',
'select' => 'or.id',
'perpage' => 5,
'aliased' => true, //use this with false as default and true in case of joins
'aliased' => false,
//True in case of joins else aliasing key required on all cases
'massoperations' =>[
[
@ -40,36 +41,9 @@ class OrderDataGrid
],
],
'actions' => [
[
'type' => 'Edit',
'route' => route('admin.datagrid.delete'),
'confirm_text' => 'Do you really want to do this?',
'icon' => 'icon pencil-lg-icon',
], [
'type' => 'Delete',
'route' => route('admin.datagrid.delete'),
'confirm_text' => 'Do you really want to do this?',
'icon' => 'icon trash-icon',
],
],
'actions' => [ ],
'join' => [
// [
// 'join' => 'leftjoin',
// 'table' => 'order_address as oa',
// 'primaryKey' => 'or.id',
// 'condition' => '=',
// 'secondaryKey' => 'oa.order_id',
// ],
// [
// 'join' => 'leftjoin',
// 'table' => 'category_translations as cta',
// 'primaryKey' => 'cat.parent_id',
// 'condition' => '=',
// 'secondaryKey' => 'cta.category_id',
// ],
],
'join' => [],
//use aliasing on secodary columns if join is performed
@ -81,63 +55,62 @@ class OrderDataGrid
'label' => 'ID',
'sortable' => true,
], [
'name' => 'or.status',
'alias' => 'orstatus',
'name' => 'or.customer_first_name',
'alias' => 'oafirstname',
'type' => 'string',
'label' => 'Status',
'sortable' => true,
// 'wrapper' => function ($value) {
// if($value == 0)
// return "False";
// else
// return "True";
// },
'label' => 'Billed To',
'sortable' => false,
], [
'name' => 'or.base_grand_total',
'alias' => 'orbasegrandtotal',
'type' => 'string',
'label' => 'Base Total',
'sortable' => true,
'wrapper' => function ($value) {
return core()->currency($value);
}
], [
'name' => 'or.grand_total',
'alias' => 'oagrandtotal',
'type' => 'string',
'label' => 'Grand Total',
'sortable' => false,
'wrapper' => function ($value) {
return core()->currency($value);
}
], [
'name' => 'or.status',
'alias' => 'orstatus',
'type' => 'string',
'label' => 'Status',
'sortable' => true,
'wrapper' => function ($value) {
if($value == 'completed')
return '<span class="badge badge-md badge-success">Completed</span>';
else if($value == "cancelled")
return '<span class="badge badge-md badge-danger">Completed</span>';
else if($value == "closed")
return '<span class="badge badge-md badge-info">Completed</span>';
else if($value == "pending")
return '<span class="badge badge-md badge-warning">Pending</span>';
},
],
// [
// 'name' => 'or.customer_first_name',
// 'alias' => 'oafirstname',
// 'type' => 'string',
// 'label' => 'Billed To',
// 'sortable' => false,
// ], [
// 'name' => 'oa.first_name',
// 'alias' => 'oafirstname',
// 'type' => 'string',
// 'label' => 'Shipped To',
// 'sortable' => false,
// ],
],
'filterable' => [
// [
// 'column' => 'cat.id',
// 'alias' => 'catID',
// 'type' => 'number',
// 'label' => 'Category ID',
// ], [
// 'column' => 'ct.name',
// 'alias' => 'catName',
// 'type' => 'string',
// 'label' => 'Category Name',
// ], [
// 'column' => 'cta.name',
// 'alias' => 'parentName',
// 'type' => 'string',
// 'label' => 'Parent Name',
// ], [
// 'column' => 'cat.status',
// 'alias' => 'catStatus',
// 'type' => 'string',
// 'label' => 'Visible in Menu',
// ],
[
'column' => 'or.id',
'alias' => 'orderid',
'type' => 'number',
'label' => 'ID',
], [
'name' => 'or.status',
'alias' => 'orstatus',
'type' => 'string',
'label' => 'Status'
]
],
//don't use aliasing in case of searchables
'searchable' => [

View File

@ -111,13 +111,7 @@ class UserDataGrid
'label' => 'Role Name',
'sortable' => true,
],
[
'name' => 'r.id',
'alias' => 'xc',
'type' => 'string',
'label' => 'Role ID',
'sortable' => true,
],
],
//don't use aliasing in case of filters
'filterable' => [
@ -133,12 +127,7 @@ class UserDataGrid
'type' => 'number',
'label' => 'Admin ID'
],
[
'column' => 'r.id',
'alias' => 'xc',
'type' => 'number',
'label' => 'Role ID'
]
],
//don't use aliasing in case of searchables
'searchable' => [

View File

@ -29,19 +29,21 @@ class EventServiceProvider extends ServiceProvider
'route' => 'admin.sales.orders.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'sales.shipments',
'name' => 'Shipments',
'route' => 'admin.sales.orders.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'sales.invoices',
'name' => 'Invoices',
'route' => 'admin.sales.orders.index',
'sort' => 3,
'icon-class' => '',
], [
],
// [
// 'key' => 'sales.shipments',
// 'name' => 'Shipments',
// 'route' => 'admin.sales.orders.index',
// 'sort' => 2,
// 'icon-class' => '',
// ], [
// 'key' => 'sales.invoices',
// 'name' => 'Invoices',
// 'route' => 'admin.sales.orders.index',
// 'sort' => 3,
// 'icon-class' => '',
// ],
[
'key' => 'catalog',
'name' => 'Catalog',
'route' => 'admin.catalog.products.index',

View File

@ -1,10 +1,10 @@
@extends('admin::layouts.master')
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.sales.orders.title') }}
@stop
@section('content-wrapper')
@section('content')
<div class="content full-page">
<div class="page-header">
<div class="page-title">

View File

@ -16,7 +16,6 @@ class CreateCurrencyExchangeRatesTable extends Migration
Schema::create('currency_exchange_rates', function (Blueprint $table) {
$table->increments('id');
$table->decimal('rate', 10, 5);
$table->integer('target_currency')->unique()->unsigned();
$table->foreign('target_currency')->references('id')->on('currencies')->onDelete('cascade');
$table->timestamps();

View File

@ -564,7 +564,7 @@ section.slider-block {
}
.header-bottom {
height: 48px;
height: 47px;
margin-left: auto;
margin-right: auto;
border-top: 1px solid $border-color;
@ -574,7 +574,7 @@ section.slider-block {
ul.nav {
display: block;
font-size:16px;
height: 48px;
// height: 48px;
max-width: 100%;
width: auto;
margin-left: auto;

View File

@ -1,3 +1,3 @@
<button class="btn btn-lg btn-primary buynow">
<a href="/buynow" class="btn btn-lg btn-primary buynow" style="text-align: center;">
{{ __('shop::app.products.buy-now') }}
</button>
</a>

View File

@ -773,37 +773,39 @@ h2 {
}
.badge {
background: #E7E7E7;
@include border-radius(2px);
@include border-radius(50px);
color: white;
padding: 8px;
color: #000311;
display: inline-block;
&.label-sm {
&.badge-sm {
padding: 5px;
}
&.label-md {
padding: 8px;
&.badge-md {
padding: 3px 10px;
}
&.label-lg {
&.badge-lg {
padding: 11px;
}
&.label-xl {
&.badge-xl {
padding: 14px;
}
&.success {
&.badge-success {
background-color: $success-color;
}
&.danger {
&.badge-info {
background-color: $brand-color;
}
&.badge-danger {
background-color: $danger-color;
}
&.warning {
&.badge-warning {
background-color: $warning-color;
}
}
@ -836,7 +838,6 @@ h2 {
}
.remove-image {
// display: none;
background-image: linear-gradient(-180deg, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.24) 100%);
@include border-radius(0 0 4px 4px);
position: absolute;

View File

@ -18,7 +18,7 @@
@foreach ($columns as $column)
<td class="">{!! $column->render($result) !!}</td>
@endforeach
@if(count($actions))
<td class="action">
@foreach($actions as $action)
<a @if($action['type'] == "Edit") href="{{ url()->current().'/edit/'.$result->id }}" @elseif($action['type']=="Delete") href="{{ url()->current().'/delete/'.$result->id }}" @endif class="Action-{{ $action['type'] }}" id="{{ $result->id }}" onclick="return confirm_click('{{ $action['confirm_text'] }}');">
@ -26,7 +26,7 @@
</a>
@endforeach
</td>
@endif
</tr>
@endforeach
</tbody>

View File

@ -98,8 +98,10 @@
</th>
@endif
@endforeach
<th>
{{ __('ui::app.datagrid.actions') }}
</th>
@if(count($actions))
<th>
{{ __('ui::app.datagrid.actions') }}
</th>
@endif
</tr>
</thead>

View File

@ -834,16 +834,10 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
bottom: 48%;
bottom: 46%;
right: 0%;
width: 100%;
}
section.slider-block div.slider-content div.slider-control .dark-left-icon {
margin-left: 15px;
}
section.slider-block div.slider-content div.slider-control .light-right-icon {
margin-right: 15px;
}
}
.header {
@ -1174,7 +1168,7 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
}
.header .header-bottom {
height: 48px;
height: 47px;
margin-left: auto;
margin-right: auto;
border-top: 1px solid #C7C7C7;
@ -1186,7 +1180,6 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
.header .header-bottom ul.nav {
display: block;
font-size: 16px;
height: 48px;
max-width: 100%;
width: auto;
margin-left: auto;