fixes and style changes
This commit is contained in:
parent
cc37e352a8
commit
7a7cacf515
|
|
@ -14,3 +14,4 @@ Homestead.yaml
|
|||
npm-debug.log
|
||||
yarn-error.log
|
||||
.env
|
||||
/ignorables/*
|
||||
|
|
@ -22,120 +22,72 @@ class DataGridController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
// $select_verbs = [
|
||||
// 0 => "aggregate",
|
||||
// 1 => "columns",
|
||||
// 2 => "from",
|
||||
// 3 => "joins",
|
||||
// 4 => "wheres",
|
||||
// 5 => "groups",
|
||||
// 6 => "havings",
|
||||
// 7 => "orders",
|
||||
// 8 => "limit",
|
||||
// 9 => "offset",
|
||||
// 10 => "lock"
|
||||
// ];
|
||||
// $bindings = [
|
||||
// "select" => [],
|
||||
// "from" => [],
|
||||
// "join" => [],
|
||||
// "where" => [],
|
||||
// "having" => [],
|
||||
// "order" => [],
|
||||
// "union" => [],
|
||||
// ];
|
||||
// $operators = [
|
||||
// 'eq' => "=",
|
||||
// 'lt' => "<",
|
||||
// 'gt' => ">",
|
||||
// 'lte' => "<=",
|
||||
// 'gte' => ">=",
|
||||
// 'neqs' => "<>",
|
||||
// 'neqn' => "!=",
|
||||
// 'ceq' => "<=>",
|
||||
// 'like' => "like",
|
||||
// 'likebin' => "like binary",
|
||||
// 'ntlike' => "not like",
|
||||
// 'ilike' => "ilike",
|
||||
// 'regex' => "regexp",
|
||||
// 'notregex' => "not regexp",
|
||||
// 'simto' => "similar to",
|
||||
// 'nsimto' => "not similar to",
|
||||
// 'nilike' => "not ilike",
|
||||
// ];
|
||||
DataGrid::make([
|
||||
'name' => 'authors',
|
||||
'table' => 'authors as a',
|
||||
'select' => 'a.id',
|
||||
'name' => 'Admin Datagrid',
|
||||
'table' => 'admins as u',
|
||||
'select' => 'u.id',
|
||||
'aliased' => true , //boolean to validate aliasing on the basis of this.
|
||||
'filterable' => [
|
||||
[
|
||||
'column' => 'a.id',
|
||||
'column' => 'u.id',
|
||||
'type' => 'integer',
|
||||
'label' => 'Admin ID'
|
||||
], [
|
||||
'column' => 'a.email',
|
||||
'column' => 'u.email',
|
||||
'type' => 'string',
|
||||
'label' => 'Admin E-Mail',
|
||||
], [
|
||||
'column' => 'a.first_name',
|
||||
'column' => 'u.name',
|
||||
'type' => 'string',
|
||||
'label' => 'Admin Name',
|
||||
]
|
||||
],
|
||||
'searchables' =>[
|
||||
[
|
||||
'name' => 'a.id',
|
||||
'name' => 'u.id',
|
||||
'label' => 'ID',
|
||||
'label' => 'Admin ID',
|
||||
],
|
||||
[
|
||||
'name' => 'a.name',
|
||||
'name' => 'u.name',
|
||||
'label' => 'Name',
|
||||
'label' => 'Admin Name',
|
||||
]
|
||||
],
|
||||
'join' => [
|
||||
// [
|
||||
// 'join' => 'leftjoin',
|
||||
// 'table' => 'posts as p',
|
||||
// 'primaryKey' => 'a.id',
|
||||
// 'condition' => '=',
|
||||
// 'secondaryKey' => 'p.author_id',
|
||||
// ]
|
||||
[
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'roles as r',
|
||||
'primaryKey' => 'u.role_id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'r.id',
|
||||
]
|
||||
],
|
||||
'columns' => [
|
||||
[
|
||||
'name' => 'a.id',
|
||||
'name' => 'u.id',
|
||||
'type' => 'string',
|
||||
'label' => 'Admin ID',
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
],
|
||||
[
|
||||
'name' => 'a.email',
|
||||
'name' => 'u.email',
|
||||
'type' => 'string',
|
||||
'label' => 'Admin E-Mail',
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
],
|
||||
// [
|
||||
// 'name' => 'p.content as pp',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Content',
|
||||
// 'sortable' => true,
|
||||
// 'filterable' => false,
|
||||
// ],
|
||||
[
|
||||
'name' => 'a.first_name',
|
||||
'name' => 'u.name',
|
||||
'type' => 'string',
|
||||
'label' => 'Admin Name',
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
// will create on run time query
|
||||
// 'filter' => [
|
||||
// 'function' => 'where', // orwhere
|
||||
// 'condition' => ['name', '=', 'Admin'] // multiarray
|
||||
// 'function' => 'orwhere', // orwhere
|
||||
// 'condition' => ['name', 'like', 'u'] // multiarray
|
||||
// ],
|
||||
'attributes' => [
|
||||
'class' => 'class-a class-b',
|
||||
|
|
@ -143,10 +95,23 @@ class DataGridController extends Controller
|
|||
'onclick' => "window.alert('alert from datagrid column')"
|
||||
],
|
||||
'wrapper' => function ($value, $object) {
|
||||
return '<a href="'.$value.'">' . $object->first_name . '</a>';
|
||||
return '<a href="'.$value.'">' . $object->name . '</a>';
|
||||
},
|
||||
],
|
||||
|
||||
[
|
||||
'name' => 'r.name as x',
|
||||
'type' => 'string',
|
||||
'label' => 'Admin\'s Role',
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'r.id as xx',
|
||||
'type' => 'integer',
|
||||
'label' => 'Role ID',
|
||||
'sortable' => false,
|
||||
'filterable' => false
|
||||
],
|
||||
],
|
||||
|
||||
'operators' => [
|
||||
|
|
@ -174,13 +139,6 @@ class DataGridController extends Controller
|
|||
]);
|
||||
$result = DataGrid::render();
|
||||
return $result;
|
||||
// $prepareMassAction = DataGrid::massAction();
|
||||
// if ($prepareMassAction) {
|
||||
// $result = DataGrid::render();
|
||||
// return $result;
|
||||
// } else {
|
||||
// throw new \Exception('Mass Actions Attributes Have Some Unknown Problems');
|
||||
// }
|
||||
}
|
||||
|
||||
//for performing mass actions
|
||||
|
|
@ -213,7 +171,6 @@ class DataGridController extends Controller
|
|||
]
|
||||
];
|
||||
$result = DataGrid::makeMassAction($make);
|
||||
// return $result;
|
||||
}
|
||||
|
||||
public function massDelete(Request $r)
|
||||
|
|
|
|||
|
|
@ -10,54 +10,18 @@ Vue.component("category-nav", require("./components/category-nav.vue"));
|
|||
Vue.component("category-item", require("./components/category-item.vue"));
|
||||
Vue.component("image-slider", require("./components/imageSlider.vue"));
|
||||
|
||||
$(window).resize(function() {
|
||||
var w = $(document).width();
|
||||
var window = {};
|
||||
window.width = $(document).width();
|
||||
window.height = $(document).height();
|
||||
if (window.width < 785) {
|
||||
$(".header").css("margin-bottom", "0");
|
||||
$(".header-top").css("margin-bottom", "0");
|
||||
$("ul.search-container").css("display", "none");
|
||||
$(".header-bottom").css("display", "none");
|
||||
$("div.right-content").css("display", "none");
|
||||
$(".right-responsive").css("display", "inherit");
|
||||
} else if (window.width > 785) {
|
||||
$(".header").css("margin-bottom", "21px");
|
||||
$(".header-top").css("margin-bottom", "16px");
|
||||
$("ul.search-container").css("display", "inherit");
|
||||
$(".header-bottom").css("display", "block");
|
||||
$("div.right-content").css("display", "inherit");
|
||||
$(".right-responsive").css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
/* Responsiveness script goes here */
|
||||
var w = $(document).width();
|
||||
var window = {};
|
||||
window.width = $(document).width();
|
||||
window.height = $(document).height();
|
||||
if (window.width < 785) {
|
||||
$(".header").css("margin-bottom", "0");
|
||||
$(".header-top").css("margin-bottom", "0");
|
||||
$("ul.search-container").css("display", "none");
|
||||
$(".header-bottom").css("display", "none");
|
||||
$("div.right-content").css("display", "none");
|
||||
$(".right-responsive").css("display", "inherit");
|
||||
}
|
||||
/* Responsiveness script ends here */
|
||||
$(document).ready(function () {
|
||||
|
||||
const app = new Vue({
|
||||
el: "#app",
|
||||
|
||||
mounted: function() {
|
||||
mounted: function () {
|
||||
this.addServerErrors();
|
||||
this.addFlashMessages();
|
||||
},
|
||||
|
||||
methods: {
|
||||
onSubmit: function(e) {
|
||||
onSubmit: function (e) {
|
||||
this.$validator.validateAll().then(result => {
|
||||
if (result) {
|
||||
e.target.submit();
|
||||
|
|
@ -65,7 +29,7 @@ $(document).ready(function() {
|
|||
});
|
||||
},
|
||||
|
||||
addServerErrors: function() {
|
||||
addServerErrors: function () {
|
||||
var scope = null;
|
||||
for (var key in serverErrors) {
|
||||
const field = this.$validator.fields.find({
|
||||
|
|
@ -83,14 +47,14 @@ $(document).ready(function() {
|
|||
}
|
||||
},
|
||||
|
||||
addFlashMessages: function() {
|
||||
addFlashMessages: function () {
|
||||
const flashes = this.$refs.flashes;
|
||||
|
||||
flashMessages.forEach(function(flash) {
|
||||
flashMessages.forEach(function (flash) {
|
||||
flashes.addFlash(flash);
|
||||
}, this);
|
||||
},
|
||||
responsiveHeader: function() {}
|
||||
responsiveHeader: function () { }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
:item="item">
|
||||
</category-item>
|
||||
<li>
|
||||
<img class="icon" src="vendor/webkul/shop/assets/images/offer-zone.svg" style="margin-right:5px;" />Offer Zone
|
||||
<img src="vendor/webkul/shop/assets/images/offer-zone.svg"/>
|
||||
<span>Offer Zone</span>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ body {
|
|||
// color: $offer-color;
|
||||
// }
|
||||
// }
|
||||
|
||||
ul.nav {
|
||||
display: block;
|
||||
font-size:16px;
|
||||
|
|
@ -240,8 +241,13 @@ body {
|
|||
}
|
||||
|
||||
.nav > li:last-child {
|
||||
display:flex; align-items:center;
|
||||
border-radius: 0 0 4px 0;
|
||||
margin-right: 0;
|
||||
float:right;
|
||||
|
||||
img {
|
||||
margin-right:6px;
|
||||
}
|
||||
}
|
||||
|
||||
.nav > li:last-child > a {
|
||||
|
|
|
|||
|
|
@ -74,4 +74,46 @@
|
|||
<div class="header-bottom">
|
||||
@include('shop::store.header.nav-menu.navmenu')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@section('javascript')
|
||||
<script>
|
||||
$(window).resize(function() {
|
||||
var w = $(document).width();
|
||||
var window = {};
|
||||
window.width = $(document).width();
|
||||
window.height = $(document).height();
|
||||
if (window.width < 785) {
|
||||
$(".header").css("margin-bottom", "0");
|
||||
$(".header-top").css("margin-bottom", "0");
|
||||
$("ul.search-container").css("display", "none");
|
||||
$(".header-bottom").css("display", "none");
|
||||
$("div.right-content").css("display", "none");
|
||||
$(".right-responsive").css("display", "inherit");
|
||||
} else if (window.width > 785) {
|
||||
$(".header").css("margin-bottom", "21px");
|
||||
$(".header-top").css("margin-bottom", "16px");
|
||||
$("ul.search-container").css("display", "inherit");
|
||||
$(".header-bottom").css("display", "block");
|
||||
$("div.right-content").css("display", "inherit");
|
||||
$(".right-responsive").css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function (){
|
||||
/* Responsiveness script goes here */
|
||||
var w = $(document).width();
|
||||
var window = {};
|
||||
window.width = $(document).width();
|
||||
window.height = $(document).height();
|
||||
if (window.width < 785) {
|
||||
$(".header").css("margin-bottom", "0");
|
||||
$(".header-top").css("margin-bottom", "0");
|
||||
$("ul.search-container").css("display", "none");
|
||||
$(".header-bottom").css("display", "none");
|
||||
$("div.right-content").css("display", "none");
|
||||
$(".right-responsive").css("display", "inherit");
|
||||
}
|
||||
/* Responsiveness script ends here */
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -10,6 +10,7 @@ use Webkul\Ui\DataGrid\Helpers\Column;
|
|||
use Webkul\Ui\DataGrid\Helpers\Pagination;
|
||||
use Webkul\Ui\DataGrid\Helpers\Css;
|
||||
use Webkul\Ui\DataGrid\Helpers\MassAction;
|
||||
use URL;
|
||||
|
||||
class DataGrid
|
||||
{
|
||||
|
|
@ -385,39 +386,6 @@ class DataGrid
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the URL
|
||||
* and get it ready
|
||||
* to be used.
|
||||
*/
|
||||
|
||||
// private function parse()
|
||||
// {
|
||||
// //parse the url here
|
||||
// if (isset($_SERVER['QUERY_STRING'])) {
|
||||
// $qr = $_SERVER['QUERY_STRING'];
|
||||
// parse_str($qr, $parsed);
|
||||
// foreach ($parsed as $k=>$v) {
|
||||
// parse_str($v, $parsed[$k]);
|
||||
// }
|
||||
// return $parsed;
|
||||
// } else {
|
||||
// return $parsed = [];
|
||||
// }
|
||||
// }
|
||||
|
||||
private function parse()
|
||||
{
|
||||
$parsed = [];
|
||||
$unparsed = $_SERVER['QUERY_STRING'];
|
||||
if (isset($unparsed)) {
|
||||
parse_str($unparsed, $parsed);
|
||||
return $parsed;
|
||||
} else {
|
||||
return $parsed;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for selecting
|
||||
* the columns got in
|
||||
|
|
@ -436,6 +404,25 @@ class DataGrid
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the URL
|
||||
* and get it ready
|
||||
* to be used.
|
||||
*/
|
||||
|
||||
private function parse()
|
||||
{
|
||||
$parsed = [];
|
||||
$unparsed = url()->full();
|
||||
if (count(explode('?', $unparsed))>1) {
|
||||
$to_be_parsed = explode('?', $unparsed)[1];
|
||||
parse_str($to_be_parsed, $parsed);
|
||||
return $parsed;
|
||||
} else {
|
||||
return $parsed;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ->join('contacts', 'users.id', '=', 'contacts.user_id')
|
||||
* @return $this->query
|
||||
|
|
@ -452,6 +439,7 @@ class DataGrid
|
|||
{
|
||||
foreach ($this->columns as $column) {
|
||||
if ($column->filter) { // if the filter bag in array exists then these will be applied.
|
||||
dd($column);
|
||||
if (count($column->filter['condition']) == count($column->filter['condition'], COUNT_RECURSIVE)) {
|
||||
$this->query->{$column->filter['function']}(...$column->filter['condition']);
|
||||
} else {
|
||||
|
|
@ -651,14 +639,13 @@ class DataGrid
|
|||
foreach ($this->join as $join) {
|
||||
$name = strtolower($join['join']);
|
||||
//Allow joins i.e left or right
|
||||
if ($name=='leftjoin' || $name=='left join' || $name=='rightjoin' || $name=='right join') {
|
||||
if ($name=='leftjoin' || $name=='rightjoin') {
|
||||
|
||||
//check if the aliasing on the primary table and primaryKey in join is also the same
|
||||
$primary_key_alias = trim(explode('.', $join['primaryKey'])[0]);
|
||||
|
||||
if ($primary_key_alias == $table_alias) {
|
||||
$join_table_alias = explode('as', $join['table']);
|
||||
|
||||
if (isset($join_table_alias)) {
|
||||
$alias1 = trim($join_table_alias[1]); //important!!!!!
|
||||
|
||||
|
|
|
|||
|
|
@ -13,17 +13,6 @@ class Column extends AbstractFillable
|
|||
private $readableName = false;
|
||||
private $value = false;
|
||||
private $sortHtml = '<a href="%s">%s</a>';
|
||||
// private $sortHtml = '<span href="%s">%s</span>';
|
||||
|
||||
// protected $name;
|
||||
// protected $type;
|
||||
// protected $label;
|
||||
// protected $filterable;
|
||||
// protected $sortable;
|
||||
// protected $attributes;
|
||||
// protected $wrapper;
|
||||
// protected $callback;
|
||||
|
||||
|
||||
/**
|
||||
* Without Array it will treat it like string
|
||||
|
|
@ -53,6 +42,7 @@ class Column extends AbstractFillable
|
|||
'type',
|
||||
'label',
|
||||
'sortable',
|
||||
'searchable',
|
||||
'filterable',
|
||||
'filter' => [
|
||||
'allowed' => 'array',
|
||||
|
|
|
|||
|
|
@ -213,10 +213,9 @@ h2 {
|
|||
}
|
||||
|
||||
tbody td {
|
||||
padding: 12px 10px;
|
||||
padding: 10px;
|
||||
border-bottom: solid 1px #d3d3d3;
|
||||
color: #3a3a3a;
|
||||
vertical-align: top;
|
||||
|
||||
&.actions {
|
||||
text-align: right;
|
||||
|
|
@ -616,8 +615,6 @@ h2 {
|
|||
}
|
||||
|
||||
.grid-container {
|
||||
margin-top: 30px;
|
||||
|
||||
.filter-wrapper {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
|
|
@ -932,9 +929,8 @@ h2 {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
.label {
|
||||
background: #E7E7E7;
|
||||
background: #e7e7e7;
|
||||
border-radius: 2px;
|
||||
padding: 8px;
|
||||
color: #000311;
|
||||
|
|
@ -955,4 +951,4 @@ h2 {
|
|||
&.label-xl {
|
||||
padding: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue