Merge pull request #691 from prashant-webkul/development

Development
This commit is contained in:
Jitendra Singh 2019-03-15 16:47:35 +05:30 committed by GitHub
commit 65d0a54177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 210 additions and 471 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/admin.js": "/js/admin.js?id=da5ebef9c25a064e7ed6",
"/css/admin.css": "/css/admin.css?id=54d5d3e2b0d00847e473"
}
"/js/admin.js": "/js/admin.js?id=cf418e6974a312978456",
"/css/admin.css": "/css/admin.css?id=f3580624b3d2990ad3be"
}

View File

@ -17,6 +17,8 @@ class CustomerDataGrid extends DataGrid
protected $sortOrder = 'desc'; //asc or desc
protected $itemsPerPage = 10;
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('customers as custs')

View File

@ -21,7 +21,7 @@ class DataGridExport implements FromView, ShouldAutoSize
*
* @var mixed
*/
public $gridData;
protected $gridData = array();
/**
* Create a new instance.
@ -40,22 +40,17 @@ class DataGridExport implements FromView, ShouldAutoSize
*/
public function view(): View
{
$pagination = false;
$results = [];
$columns = [];
$columns = array();
foreach($this->gridData as $key => $data) {
if ($key == 'collection') {
$results = $data['data'];
}
if ($key == 'columns') {
$columns = $data;
}
foreach($this->gridData as $key => $gridData) {
$columns = array_keys((array) $gridData);
break;
}
return view('admin::export.export', [
'results' => $results,
return view('admin::export.temp', [
'columns' => $columns,
'records' => $this->gridData,
]);
}
}

View File

@ -16,6 +16,10 @@ use Excel;
*/
class ExportController extends Controller
{
protected $exportableGrids = [
'OrderDataGrid', 'OrderInvoicesDataGrid', 'OrderShipmentsDataGrid', 'CustomerDataGrid', 'TaxRateDataGrid'
];
/**
* Create a new controller instance.
*
@ -32,18 +36,44 @@ class ExportController extends Controller
*/
public function export()
{
$results = request()->all()['gridData'];
$criteria = request()->all();
$format = $criteria['format'];
$data = json_decode($results, true);
$gridName = explode('\\', $criteria['gridName']);
$path = '\Webkul\Admin\DataGrids'.'\\'.last($gridName);
$results = (object) $data;
$proceed = false;
$file_name = request()->all()['file_name'];
if (request()->all()['format'] == 'csv') {
return Excel::download(new DataGridExport($results), $file_name.'.csv');
} else {
return Excel::download(new DataGridExport($results), $file_name.'.xlsx');
foreach($this->exportableGrids as $exportableGrid) {
if(last($gridName) == $exportableGrid) {
$proceed = true;
}
}
if($proceed) {
$gridInstance = new $path;
$records = array();
$records = $gridInstance->export();
if(count($records) == 0) {
session()->flash('warning', trans('admin::app.export.no-records'));
return redirect()->back();
}
if ($format == 'csv') {
return Excel::download(new DataGridExport($records), last($gridName).'.csv');
} else if($format == 'xls') {
return Excel::download(new DataGridExport($records), last($gridName).'.xlsx');
} else {
session()->flash('warning', trans('admin::app.export.illegal-format'));
return redirect()->back();
}
} else {
return redirect()->back();
}
}
}

View File

@ -1,6 +1,7 @@
// Body
$brand-color: #0041FF;
$border-color: rgba(162, 162, 162, 0.2);
$background-color: #f8f9fa;
// Typography
$font-family: 'Montserrat', sans-serif;

View File

@ -13,6 +13,7 @@ body {
font-weight: 500;
position: static;
min-height: 100%;
width: 100%;
}
::-webkit-scrollbar {
@ -93,55 +94,21 @@ body {
}
}
.open-nav-aside {
display: none;
width: 100%;
height: 8%;
margin-top: 2%;
padding: 5px;
text-align: center;
border: 1px solid $border-color;
cursor: pointer;
}
.close-nav-aside {
display: block;
width: 100%;
height: 8%;
margin-top: 3%;
padding: 10px;
text-align: center;
border: 1px solid $border-color;
cursor: pointer;
}
.close-nav-aside:hover, .open-nav-aside:hover {
background: $brand-color;
}
.open-nav-aside, .close-nav-aside {
.icon {
height: 28px;
width: 28px;
}
}
.navbar-left {
display: block;
position: fixed;
left: 0;
top: 60px;
bottom: 0;
width: 90px;
padding-top: 20px;
border-right: 1px solid rgba(162, 162, 162, 0.2);
height: auto;
border-right: 1px solid $border-color;
bottom: 0;
z-index: 2;
ul.menubar {
height: 93%;
// padding-bottom: 60px;
li.menu-item {
height: 90px;
padding: 10px 5px;
font-size: 11px;
text-align: center;
@ -158,6 +125,21 @@ body {
}
}
}
// .open-nav-aside {
// position: fixed;
// bottom: 0;
// left: 0;
// width: 90px;
// padding: 18px;
// text-align: center;
// border: 1px solid $border-color;
// .icon {
// height: 24px;
// width: 24px;
// }
// }
}
.content-container {
@ -168,8 +150,12 @@ body {
right: 0;
left: 0;
bottom: 0px;
overflow-x: hidden;
overflow-y: auto;
height: calc(100% - 60px);
width: 100%;
.inner-section {
height: 100%;
}
.aside-nav {
width: 280px;
@ -177,15 +163,33 @@ body {
top: 60px;
bottom: 0;
border-right: 1px solid $border-color;
background: #f8f9fa;
background: $background-color;
padding-top: 10px;
padding-bottom: 10px;
z-index: 4;
ul {
height: 93%;
overflow-y: auto;
height: 90%;
}
// .close-nav-aside {
// width: 100%;
// padding: 20px;
// text-align: center;
// border: 1px solid $border-color;
// .icon {
// height: 24px;
// width: 24px;
// }
// }
// .close-nav-aside:hover {
// background: white;
// cursor: pointer;
// }
a {
padding: 15px;
display: block;
@ -289,47 +293,8 @@ body {
}
}
//style for dummy datagrid
// .page-content {
// .table-container {
// .search-filter-wrapper {
// display: inline-block;
// box-sizing: border-box;
// width: 100%;
// padding-top: 7px;
// padding-bottom: 7px;
// .search-products {
// width: 300px;
// border: 2px solid $border-color;
// border-radius: 3px;
// height: 30px;
// padding-left: 5px;
// }
// .icon-wrapper {
// margin: 0px;
// display: inline-block;
// vertical-align: middle;
// border: 1px solid #c7c7c7;
// border-radius: 4px;
// padding-left: 5px;
// padding-right: 5px;
// .search-icon {
// height: 24px;
// width: 24px;
// }
// }
// }
// }
// }
// admin dashboard css
.dashboard {
.page-header {

View File

@ -792,7 +792,9 @@ return [
'duplicate-error' => 'Identifier must be unique, duplicate identifier :identifier at row :position.',
'enough-row-error' => 'file has not enough rows',
'allowed-type' => 'Allowed Type :',
'file-type' => 'csv, xls, xlsx.'
'file-type' => 'csv, xls, xlsx.',
'no-records' => 'Nothing to export',
'illegal-format' => 'Error! This type of format is either not supported or its illegal format'
],
'response' => [

View File

@ -26,8 +26,8 @@
</div>
<div class="page-content">
@inject('customer','Webkul\Admin\DataGrids\CustomerDataGrid')
{!! $customer->render() !!}
@inject('customerGrid','Webkul\Admin\DataGrids\CustomerDataGrid')
{!! $customerGrid->render() !!}
</div>
</div>
@ -41,51 +41,6 @@
@stop
@push('scripts')
<script type="text/x-template" id="export-form-template">
<form method="POST" action="{{ route('admin.datagrid.export') }}">
<div class="page-content">
<div class="form-container">
@csrf()
<?php
$data = json_encode((array) $customer);
?>
<input type="hidden" name="gridData" value="{{ $data }}">
<input type="hidden" name="file_name" value="Customer">
<div class="control-group">
<label for="format" class="required">
{{ __('admin::app.export.format') }}
</label>
<select name="format" class="control" v-validate="'required'">
<option value="xls">{{ __('admin::app.export.xls') }}</option>
<option value="csv">{{ __('admin::app.export.csv') }}</option>
</select>
</div>
</div>
</div>
<button type="submit" class="btn btn-lg btn-primary" @click="closeModal">
{{ __('admin::app.export.export') }}
</button>
</form>
</script>
<script>
Vue.component('export-form', {
template: '#export-form-template',
methods: {
closeModal () {
this.$parent.closeModal();
}
}
});
</script>
@include('admin::export.export', ['gridName' => $customerGrid])
@endpush

View File

@ -1,18 +1,39 @@
<table>
<thead>
<tr>
@foreach ($columns as $column)
<th>{{ $column['index'] }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach ($results as $result)
<tr>
@foreach ($columns as $column)
<td class="">{{ $result[$column['index']] }} </td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
<script type="text/x-template" id="export-form-template">
<form method="POST" action="{{ route('admin.datagrid.export') }}">
<div class="page-content">
<div class="form-container">
@csrf()
<input type="hidden" name="gridName" value="{{ get_class($gridName) }}">
<div class="control-group">
<label for="format" class="required">
{{ __('admin::app.export.format') }}
</label>
<select name="format" class="control" v-validate="'required'">
<option value="xls">{{ __('admin::app.export.xls') }}</option>
<option value="csv">{{ __('admin::app.export.csv') }}</option>
</select>
</div>
</div>
</div>
<button type="submit" class="btn btn-lg btn-primary" @click="closeModal">
{{ __('admin::app.export.export') }}
</button>
</form>
</script>
<script>
Vue.component('export-form', {
template: '#export-form-template',
methods: {
closeModal () {
this.$parent.closeModal();
}
}
});
</script>

View File

@ -0,0 +1,18 @@
<table>
<thead>
<tr>
@foreach ($columns as $key => $value)
<th>{{ $value }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach ($records as $record)
<tr>
@foreach($record as $column => $value)
<td>{{ $value }} </td>
@endforeach
</tr>
@endforeach
</tbody>
</table>

View File

@ -32,22 +32,4 @@
{{-- <div class="close-nav-aside">
<i class="icon angle-left-icon close-icon"></i>
</div> --}}
</div>
{{-- @push('scripts')
<script>
$(document).ready(function() {
$(".close-nav-aside").on('click', function(e) {
$('.content-wrapper').css("margin-left", "0px");
$('.aside-nav').css('display', 'none');
$('.open-nav-aside').css('display', 'block');
});
$(".open-nav-aside").on('click', function(e) {
$('.content-wrapper').css("margin-left", "305px");
$('.aside-nav').css('display', '');
$('.open-nav-aside').css('display', 'none');
});
});
</script>
@endpush --}}
</div>

View File

@ -11,7 +11,7 @@
@endforeach
</ul>
<div class="open-nav-aside">
{{-- <div class="open-nav-aside">
<i class="icon angle-right-icon open-icon"></i>
</div>
</div> --}}
</div>

View File

@ -1,81 +0,0 @@
<?php
return [
[
'key' => 'sales',
'name' => 'Sales',
'sort' => 1
], [
'key' => 'sales.carriers',
'name' => 'Shipping Methods',
'sort' => 1,
], [
'key' => 'sales.carriers.free',
'name' => 'Free Shipping',
'sort' => 1,
'fields' => [
[
'name' => 'title',
'title' => 'Title',
'type' => 'text',
'validation' => 'required',
'channel_based' => false,
'locale_based' => true
], [
'name' => 'description',
'title' => 'Description',
'type' => 'textarea',
'channel_based' => false,
'locale_based' => true
], [
'name' => 'active',
'title' => 'Status',
'type' => 'select',
'options' => [
[
'title' => 'Active',
'value' => true
], [
'title' => 'Inactive',
'value' => false
]
],
'validation' => 'required'
]
]
], [
'key' => 'sales.carriers.flatrate',
'name' => 'Flat Rate Shipping',
'sort' => 2,
'fields' => [
[
'name' => 'title',
'title' => 'Title',
'type' => 'text',
'validation' => 'required',
'channel_based' => true,
'locale_based' => true
], [
'name' => 'description',
'title' => 'Description',
'type' => 'textarea',
'channel_based' => true,
'locale_based' => false
], [
'name' => 'active',
'title' => 'Status',
'type' => 'select',
'options' => [
[
'title' => 'Active',
'value' => true
], [
'title' => 'Inactive',
'value' => false
]
],
'validation' => 'required'
]
]
]
];

View File

@ -37,50 +37,5 @@
@stop
@push('scripts')
<script type="text/x-template" id="export-form-template">
<form method="POST" action="{{ route('admin.datagrid.export') }}">
<div class="page-content">
<div class="form-container">
@csrf()
<?php
$data = json_encode((array) $orderInvoicesGrid);
?>
<input type="hidden" name="gridData" value="{{ $data }}">
<input type="hidden" name="file_name" value="Invoice">
<div class="control-group">
<label for="format" class="required">
{{ __('admin::app.export.format') }}
</label>
<select name="format" class="control" v-validate="'required'">
<option value="xls">XLS</option>
<option value="csv">CSV</option>
</select>
</div>
</div>
</div>
<button type="submit" class="btn btn-lg btn-primary" @click="closeModal">
{{ __('admin::app.export.export') }}
</button>
</form>
</script>
<script>
Vue.component('export-form', {
template: '#export-form-template',
methods: {
closeModal () {
this.$parent.closeModal();
}
}
});
</script>
@include('admin::export.export', ['gridName' => $orderInvoicesGrid])
@endpush

View File

@ -37,50 +37,5 @@
@stop
@push('scripts')
<script type="text/x-template" id="export-form-template">
<form method="POST" action="{{ route('admin.datagrid.export') }}">
<div class="page-content">
<div class="form-container">
@csrf()
<?php
$data = json_encode((array) $orderGrid);
?>
<input type="hidden" name="gridData" value="{{ $data }}">
<input type="hidden" name="file_name" value="Order">
<div class="control-group">
<label for="format" class="required">
{{ __('admin::app.export.format') }}
</label>
<select name="format" class="control" v-validate="'required'">
<option value="xls">XLS</option>
<option value="csv">CSV</option>
</select>
</div>
</div>
</div>
<button type="submit" class="btn btn-lg btn-primary" @click="closeModal">
{{ __('admin::app.export.export') }}
</button>
</form>
</script>
<script>
Vue.component('export-form', {
template: '#export-form-template',
methods: {
closeModal () {
this.$parent.closeModal();
}
}
});
</script>
@include('admin::export.export', ['gridName' => $orderGrid])
@endpush

View File

@ -37,50 +37,5 @@
@stop
@push('scripts')
<script type="text/x-template" id="export-form-template">
<form method="POST" action="{{ route('admin.datagrid.export') }}">
<div class="page-content">
<div class="form-container">
@csrf()
<?php
$data = json_encode((array) $orderShipmentsGrid);
?>
<input type="hidden" name="gridData" value="{{ $data }}">
<input type="hidden" name="file_name" value="Shipment">
<div class="control-group">
<label for="format" class="required">
{{ __('admin::app.export.format') }}
</label>
<select name="format" class="control" v-validate="'required'">
<option value="xls">XLS</option>
<option value="csv">CSV</option>
</select>
</div>
</div>
</div>
<button type="submit" class="btn btn-lg btn-primary" @click="closeModal">
{{ __('admin::app.export.export') }}
</button>
</form>
</script>
<script>
Vue.component('export-form', {
template: '#export-form-template',
methods: {
closeModal () {
this.$parent.closeModal();
}
}
});
</script>
@include('admin::export.export', ['gridName' => $orderShipmentsGrid])
@endpush

View File

@ -32,8 +32,8 @@
</div>
<div class="page-content">
@inject('taxrates', 'Webkul\Admin\DataGrids\TaxRateDataGrid')
{!! $taxrates->render() !!}
@inject('taxRateGrid', 'Webkul\Admin\DataGrids\TaxRateDataGrid')
{!! $taxRateGrid->render() !!}
</div>
</div>
@ -69,50 +69,5 @@
@endsection
@push('scripts')
<script type="text/x-template" id="export-form-template">
<form method="POST" action="{{ route('admin.datagrid.export') }}">
<div class="page-content">
<div class="form-container">
@csrf()
<?php
$data = json_encode((array) $taxrates);
?>
<input type="hidden" name="gridData" value="{{ $data }}">
<input type="hidden" name="file_name" value="Tax rates">
<div class="control-group">
<label for="format" class="required">
{{ __('admin::app.export.format') }}
</label>
<select name="format" class="control" v-validate="'required'">
<option value="xls">{{ __('admin::app.export.xls') }}</option>
<option value="csv">{{ __('admin::app.export.csv') }}</option>
</select>
</div>
</div>
</div>
<button type="submit" class="btn btn-lg btn-primary" @click="closeModal">
{{ __('admin::app.export.export') }}
</button>
</form>
</script>
<script>
Vue.component('export-form', {
template: '#export-form-template',
methods: {
closeModal () {
this.$parent.closeModal();
}
}
});
</script>
@include('admin::export.export', ['gridName' => $taxRateGrid])
@endpush

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/shop.js": "/js/shop.js?id=e019a3a0b0cbcc981fd8",
"/css/shop.css": "/css/shop.css?id=a3670098698673f115f6"
"/css/shop.css": "/css/shop.css?id=460297557fd9ee391499"
}

View File

@ -8,6 +8,8 @@ $link-color: #2650EF;
$background-color: #F2F2F2;
$dark-background: #121212;
$disc-price: #FF6472;
$radio-button: #FF6472;
$radio-button-disabled: rgba(255, 100, 113, 0.400);
$danger-color: #FF6472;
$disc-price-pro: #A5A5A5;
$other-font-color: #5E5E5E;

View File

@ -194,6 +194,7 @@ input {
border: 2px solid $disc-price;
border-radius: 50%;
}
/* Create the indicator (the dot/circle - hidden when not checked) */
.checkmark:after {
content: "";
@ -216,6 +217,12 @@ input {
display: block;
}
/* Show the indic */
.radio-container input:disabled ~ .checkmark {
display: block;
border: 2px solid $radio-button-disabled;
}
//CSS for loader
.cp-spinner {
width: 48px;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=0219a3829322d1811a09",
"/css/ui.css": "/css/ui.css?id=212dcb4147a9796aee09"
}
"/js/ui.js": "/js/ui.js?id=83b5b520995eba4ce1f3",
"/css/ui.css": "/css/ui.css?id=60a9d7816658e7caaf81"
}

View File

@ -314,4 +314,19 @@ abstract class DataGrid
return view('ui::datagrid.table')->with('results', ['records' => $this->getCollection(), 'columns' => $this->completeColumnDetails, 'actions' => $this->actions, 'massactions' => $this->massActions, 'index' => $this->index, 'enableMassActions' => $this->enableMassAction, 'enableActions' => $this->enableAction, 'paginated' => $this->paginate, 'norecords' => trans('ui::app.datagrid.no-records')]);
}
public function export()
{
$this->paginate = false;
$this->addColumns();
$this->prepareActions();
$this->prepareMassActions();
$this->prepareQueryBuilder();
return $this->getCollection();
}
}

View File

@ -11,6 +11,11 @@
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
.dropdown-filters {
position: absolute;
right: 25px;
}
}
.filter-row-two {

View File

@ -61,7 +61,7 @@ class RoleController extends Controller
*/
public function create()
{
return view($this->_config['view'], compact('roleItems'));
return view($this->_config['view']);
}
/**