Bug fix for slider content field, changed to text and datagrid invoices and shipments columns added a/c to relevancy and removed mass actions

This commit is contained in:
prashant-webkul 2018-11-27 18:56:25 +05:30
parent 8b0c51c519
commit bf63545895
24 changed files with 289 additions and 237 deletions

View File

@ -32,12 +32,12 @@ class AttributeDataGrid
'aliased' => true,
'massoperations' => [
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [
@ -147,20 +147,17 @@ class AttributeDataGrid
'alias' => 'attributeId',
'type' => 'number',
'label' => 'ID',
],
[
], [
'column' => 'code',
'alias' => 'attributeCode',
'type' => 'string',
'label' => 'Code',
],
[
], [
'column' => 'admin_name',
'alias' => 'attributeAdminName',
'type' => 'string',
'label' => 'AdminName',
],
[
'label' => 'Name',
], [
'column' => 'type',
'alias' => 'attributeType',
'type' => 'string',
@ -174,13 +171,11 @@ class AttributeDataGrid
'column' => 'code',
'alias' => 'attributeCode',
'type' => 'string',
],
[
], [
'column' => 'admin_name',
'alias' => 'attributeAdminName',
'type' => 'string',
],
[
], [
'column' => 'type',
'alias' => 'attributeType',
'type' => 'string',

View File

@ -33,12 +33,12 @@ class AttributeFamilyDataGrid
'aliased' => false, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [
@ -87,7 +87,7 @@ class AttributeFamilyDataGrid
'name' => 'name',
'alias' => 'attributeFamilyName',
'type' => 'string',
'label' => 'Code',
'label' => 'Name',
'sortable' => true,
],
],

View File

@ -33,12 +33,12 @@ class CategoryDataGrid
'aliased' => true, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [
@ -112,7 +112,7 @@ class CategoryDataGrid
'alias' => 'cat_locale',
'type' => 'string',
'label' => 'Locale',
'sortable' => true,
'sortable' => false,
'filter' => [
'function' => 'orWhere',
'condition' => ['ct.locale', app()->getLocale()]

View File

@ -33,12 +33,12 @@ class ChannelDataGrid
'aliased' => false, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [

View File

@ -33,12 +33,12 @@ class CountryDataGrid
'aliased' => false, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [

View File

@ -32,12 +32,12 @@ class CurrencyDataGrid
'aliased' => false, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [

View File

@ -31,12 +31,12 @@ class CustomerDataGrid
'aliased' => true, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button', //select || button only
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button', //select || button only
// ],
],
'actions' => [

View File

@ -32,23 +32,23 @@ class CustomerGroupDataGrid
'aliased' => true, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
[
'route' => route('admin.datagrid.index'),
'method' => 'POST',
'label' => 'View Grid',
'type' => 'select',
'options' =>[
1 => 'Edit',
2 => 'Set',
3 => 'Change Status'
]
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
// [
// 'route' => route('admin.datagrid.index'),
// 'method' => 'POST',
// 'label' => 'View Grid',
// 'type' => 'select',
// 'options' =>[
// 1 => 'Edit',
// 2 => 'Set',
// 3 => 'Change Status'
// ]
// ],
],
'actions' => [
[

View File

@ -33,12 +33,12 @@ class ExchangeRatesDataGrid
'aliased' => true, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [

View File

@ -31,12 +31,12 @@ class InventorySourcesDataGrid
'aliased' => false, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [

View File

@ -32,12 +32,12 @@ class LocalesDataGrid
'aliased' => false, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [

View File

@ -31,21 +31,22 @@ class OrderInvoicesDataGrid
'aliased' => false,
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [
[
'type' => 'View',
'route' => route('admin.datagrid.delete'),
'confirm_text' => 'Do you really want to do this?',
'icon' => 'icon pencil-lg-icon',
],
// [
// 'type' => 'View',
// '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?',
@ -53,7 +54,15 @@ class OrderInvoicesDataGrid
// ]
],
'join' => [],
'join' => [
[
'join' => 'leftjoin',
'table' => 'orders as ors',
'primaryKey' => 'inv.order_id',
'condition' => '=',
'secondaryKey' => 'ors.id',
]
],
//use aliasing on secodary columns if join is performed
@ -65,23 +74,29 @@ class OrderInvoicesDataGrid
'label' => 'ID',
'sortable' => true
], [
'name' => 'inv.state',
'alias' => 'invstate',
'name' => 'inv.order_id',
'alias' => 'invorderid',
'type' => 'number',
'label' => 'State',
'label' => 'Order ID',
'sortable' => true
], [
'name' => 'inv.total_qty',
'alias' => 'invtotalqty',
'type' => 'number',
'label' => 'Quantity',
'sortable' => true
'name' => 'inv.state',
'alias' => 'invstate',
'type' => 'string',
'label' => 'State',
'sortable' => false
], [
'name' => 'inv.grand_total',
'alias' => 'invgrandtotal',
'type' => 'number',
'label' => 'Grand Total',
'sortable' => true
'label' => 'Amount',
'sortable' => false
], [
'name' => 'inv.created_at',
'alias' => 'invcreated_at',
'type' => 'date',
'label' => 'Invoice Date',
'sortable' => false
]
],

View File

@ -22,41 +22,42 @@ class OrderShipmentsDataGrid
*/
public function createOrderShipmentsDataGrid()
{
return DataGrid::make([
'name' => 'shipments',
'table' => 'shipments as ship',
'select' => 'ship.id',
'perpage' => 10,
'aliased' => false,
'aliased' => true,
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [
// [
// 'type' => 'View',
// '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',
// ]
[
'type' => 'View',
'route' => route('admin.datagrid.delete'),
'confirm_text' => 'Do you really want to do this?',
'icon' => 'icon pencil-lg-icon',
],
],
'join' => [],
'join' => [
[
'join' => 'leftjoin',
'table' => 'orders as ors',
'primaryKey' => 'ship.order_id',
'condition' => '=',
'secondaryKey' => 'ors.id',
]
],
//use aliasing on secodary columns if join is performed
'columns' => [
[
'name' => 'ship.id',
@ -64,6 +65,30 @@ class OrderShipmentsDataGrid
'type' => 'number',
'label' => 'ID',
'sortable' => true
], [
'name' => 'ship.order_id',
'alias' => 'order_id',
'type' => 'number',
'label' => 'Order ID',
'sortable' => true
], [
'name' => 'ship.total_qty',
'alias' => 'total_qty',
'type' => 'number',
'label' => 'Total Quantity',
'sortable' => true
], [
'name' => 'ors.customer_first_name',
'alias' => 'order_customer_first_name',
'type' => 'string',
'label' => 'Customer Name',
'sortable' => false
], [
'name' => 'ors.created_at',
'alias' => 'orscreated',
'type' => 'date',
'label' => 'Order Date',
'sortable' => true
], [
'name' => 'ship.status',
'alias' => 'shipstatus',
@ -81,8 +106,16 @@ class OrderShipmentsDataGrid
return '<span class="badge badge-md badge-info">Closed</span>';
else if($value == "pending")
return '<span class="badge badge-md badge-warning">Pending</span>';
else
return 'Un-Attended';
},
],
], [
'name' => 'ship.created_at',
'alias' => 'ship_date',
'type' => 'string',
'label' => 'Shipment Date',
'sortable' => false
]
],
'filterable' => [

View File

@ -168,7 +168,6 @@ class ProductDataGrid
'nlike' => "not like",
],
// 'css' => []
]);
}

View File

@ -34,12 +34,12 @@ class ProductReviewDataGrid
'aliased' => true, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [

View File

@ -33,12 +33,12 @@ class RolesDataGrid
'aliased' => false, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [

View File

@ -32,12 +32,12 @@ class SliderDataGrid
'aliased' => true, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
],
'actions' => [

View File

@ -32,23 +32,23 @@ class TaxCategoryDataGrid
'aliased' => true, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
[
'route' => route('admin.datagrid.index'),
'method' => 'POST',
'label' => 'View Grid',
'type' => 'select',
'options' =>[
1 => 'Edit',
2 => 'Set',
3 => 'Change Status'
]
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
// [
// 'route' => route('admin.datagrid.index'),
// 'method' => 'POST',
// 'label' => 'View Grid',
// 'type' => 'select',
// 'options' =>[
// 1 => 'Edit',
// 2 => 'Set',
// 3 => 'Change Status'
// ]
// ],
],
'actions' => [
[

View File

@ -31,23 +31,23 @@ class TaxRateDataGrid
'aliased' => true, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
[
'route' => route('admin.datagrid.index'),
'method' => 'POST',
'label' => 'View Grid',
'type' => 'select',
'options' =>[
1 => 'Edit',
2 => 'Set',
3 => 'Change Status'
]
],
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
// [
// 'route' => route('admin.datagrid.index'),
// 'method' => 'POST',
// 'label' => 'View Grid',
// 'type' => 'select',
// 'options' =>[
// 1 => 'Edit',
// 2 => 'Set',
// 3 => 'Change Status'
// ]
// ],
],
'actions' => [
[

View File

@ -32,25 +32,26 @@ class UserDataGrid
'perpage' => 10,
'aliased' => true, //use this with false as default and true in case of joins
'massoperations' =>[
[
'route' => route('admin.datagrid.delete'),
'method' => 'DELETE',
'label' => 'Delete',
'type' => 'button',
],
[
'route' => route('admin.datagrid.index'),
'method' => 'POST',
'label' => 'View Grid',
'type' => 'select',
'options' =>[
1 => 'Edit',
2 => 'Set',
3 => 'Change Status'
]
],
'massoperations' => [
// [
// 'route' => route('admin.datagrid.delete'),
// 'method' => 'DELETE',
// 'label' => 'Delete',
// 'type' => 'button',
// ],
// [
// 'route' => route('admin.datagrid.index'),
// 'method' => 'POST',
// 'label' => 'View Grid',
// 'type' => 'select',
// 'options' =>[
// 1 => 'Edit',
// 2 => 'Set',
// 3 => 'Change Status'
// ]
// ],
],
'actions' => [
[
'type' => 'Edit',

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeContentColumnInSlidersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('sliders', function (Blueprint $table) {
$table->text('content')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('sliders', function (Blueprint $table) {
$table->string('content')->change();
});
}
}

View File

@ -55,19 +55,15 @@ class DataGrid
* Pagination variable
* @var String
*/
protected $perpage;
/**
* Table
*
* @var String Classs name $table
*/
protected $table;
/**
* Join
*
@ -82,82 +78,63 @@ class DataGrid
* 'callback' => 'not supported yet'
* ]
*/
protected $join;
/**
* Collection Object of Column $columns
*
* @var Collection
*/
protected $columns;
/**
* array of columns
* to be filtered
* @var Array
*/
protected $filterable;
/**
* array of columns
* to be searched
*
* @var Array
*/
protected $searchable;
/**
* mass operations
*
* @var Array
*/
protected $massoperations;
/**
* Pagination $pagination
*
* @var Pagination
*/
protected $pagination;
/**
* Css $css
*
* @var Css
*/
protected $css;
/**
* Actions $action
* @var action
*/
protected $actions;
/**
* URL parse $parsed
* @var parse
*/
protected $parsed;
/*
public function __construct(
$name = null ,
@ -515,10 +492,12 @@ class DataGrid
{
$parsed = [];
$unparsed = url()->full();
if (count(explode('?', $unparsed))>1) {
if (count(explode('?', $unparsed)) > 1) {
$to_be_parsed = explode('?', $unparsed)[1];
parse_str($to_be_parsed, $parsed);
unset($parsed['page']);
return $parsed;
} else {
return $parsed;

View File

@ -8,13 +8,12 @@
@endif
@foreach ($results as $result)
<tr>
<td class="">
{{-- <td class="">
<span class="checkbox">
<input type="checkbox" class="indexers" id="{{ $result->id }}" name="checkbox[]">
<label class="checkbox-view" for="checkbox1"></label>
</span>
</td>
</td> --}}
@foreach ($columns as $column)
<td class="">{!! $column->render($result) !!}</td>
@endforeach

View File

@ -1,5 +1,5 @@
<thead>
<tr class="mass-action" style="display: none; height:63px;">
{{-- <tr class="mass-action" style="display: none; height:63px;">
<th colspan="{{ count($columns)+1 }}">
<div class="mass-action-wrapper">
@ -7,7 +7,6 @@
<span class="icon checkbox-dash-icon"></span>
</span>
{{-- Mass operation implementation --}}
@foreach($massoperations as $massoperation)
@if($massoperation['type'] == "button")
@ -68,14 +67,14 @@
@endforeach
</div>
</th>
</tr>
</tr> --}}
<tr class="table-grid-header">
<th>
{{-- <th>
<span class="checkbox">
<input type="checkbox" id="mastercheckbox">
<label class="checkbox-view" for="checkbox"></label>
</span>
</th>
</th> --}}
@foreach ($columns as $column)
@if($column->sortable == "true")
<th class="grid_head sortable"