export issue

This commit is contained in:
rahul shukla 2019-01-17 15:17:44 +05:30
parent 8c32a21521
commit e018d6555f
16 changed files with 73 additions and 44 deletions

View File

@ -30,7 +30,7 @@ return [
*
* Accepted Value = integer
*/
'paginate' => false,
'paginate' => true,
'operators' => [
'eq' => "=",

View File

@ -41,12 +41,21 @@ class DataGridExport implements FromView, ShouldAutoSize
public function view(): View
{
$pagination = false;
$results = [];
$columns = [];
dd($this->gridData);
foreach($this->gridData as $key => $data) {
if ($key == 'collection') {
$results = $data['data'];
}
if ($key == 'columns') {
$columns = $data;
}
}
// return view('admin::export.export', [
// 'results' => $this->gridData->render($pagination)->results,
// 'columns' => $this->gridData->render($pagination)->columns,
// ]);
return view('admin::export.export', [
'results' => $results,
'columns' => $columns,
]);
}
}

View File

@ -38,7 +38,7 @@ class ExportController extends Controller
$results = (object) $data;
$file_name = class_basename($results);
$file_name = request()->all()['file_name'];
if (request()->all()['format'] == 'csv') {
return Excel::download(new DataGridExport($results), $file_name.'.csv');

View File

@ -12,12 +12,12 @@
<h1>{{ __('admin::app.customers.customers.title') }}</h1>
</div>
<div class="page-action">
{{-- <div class="export" @click="showModal('downloadDataGrid')">
<div class="export" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i>
<span >
{{ __('admin::app.export.export') }}
</span>
</div> --}}
</div>
<a href="{{ route('admin.customer.create') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.customers.customers.add-title') }}
@ -25,32 +25,36 @@
</div>
</div>
<div class="page-content">
@inject('customer','Webkul\Admin\DataGrids\CustomerDataGrid')
{!! $customer->render() !!}
</div>
</div>
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body">
<export-form></export-form>
</div>
</modal> --}}
</modal>
@stop
@push('scripts')
{{-- <script type="text/x-template" id="export-form-template">
<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="gridData" value="{{serialize($customer)}}">
<?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">
@ -81,7 +85,7 @@
}
}
});
</script> --}}
</script>
@endpush

View File

@ -2,15 +2,15 @@
<thead>
<tr>
@foreach ($columns as $column)
<th>{{ $column->label }}</th>
<th>{{ $column['label'] }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach ($results as $result)
<tr>
@foreach ($columns as $column)
<td class="">{!! $column->render($result) !!}</td>
@foreach ($result as $value)
<td class="">{{ $value }}</td>
@endforeach
</tr>
@endforeach

View File

@ -11,14 +11,14 @@
<h1>{{ __('admin::app.sales.invoices.title') }}</h1>
</div>
{{-- <div class="page-action">
<div class="page-action">
<div class="export" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i>
<span>
{{ __('admin::app.export.export') }}
</span>
</div>
</div> --}}
</div>
</div>
<div class="page-content">
@ -27,25 +27,30 @@
</div>
</div>
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body">
<export-form></export-form>
</div>
</modal> --}}
</modal>
@stop
@push('scripts')
{{-- <script type="text/x-template" id="export-form-template">
<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="gridData" value="{{serialize($orderInvoicesGrid)}}">
<?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">
@ -76,6 +81,6 @@
}
}
});
</script> --}}
</script>
@endpush

View File

@ -11,14 +11,14 @@
<h1>{{ __('admin::app.sales.orders.title') }}</h1>
</div>
{{-- <div class="page-action">
<div class="page-action">
<div class="export" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i>
<span>
{{ __('admin::app.export.export') }}
</span>
</div>
</div> --}}
</div>
</div>
<div class="page-content">
@ -27,25 +27,30 @@
</div>
</div>
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body">
<export-form></export-form>
</div>
</modal> --}}
</modal>
@stop
@push('scripts')
{{-- <script type="text/x-template" id="export-form-template">
<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="gridData" value="{{serialize($orderGrid)}}">
<?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">
@ -65,7 +70,7 @@
</button>
</form>
</script> --}}
</script>
<script>
Vue.component('export-form', {

View File

@ -30,7 +30,8 @@ $data = array(); // array to pass back data
$data['errors'] = $errors;
} else {
$currentLocation = explode("/", getcwd());
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
@ -66,7 +67,7 @@ $data = array(); // array to pass back data
if ($connection == 'mysql' ) {
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
@$conn = new mysqli($servername, $username, $password, $dbname);
// check connection
if ($conn->connect_error) {

View File

@ -57,13 +57,11 @@ class Permission {
*/
private function getPermission($folder)
{
$currentLocation = explode("/", getcwd());
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
$fileLocation = $desiredLocation . '/' .$folder;
return substr(sprintf('%o', fileperms($fileLocation)), -4);

View File

@ -0,0 +1 @@
Deny from all

View File

@ -0,0 +1 @@
Deny from all

View File

@ -61,7 +61,8 @@ $data = array(); // array to pass back data
// if there are no errors process our form, then return a message
// getting env file location
$currentLocation = explode("/", getcwd());
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
@ -119,7 +120,7 @@ $data = array(); // array to pass back data
// checking database connection(mysql only)
if ($_POST["database_connection"] == 'mysql') {
// Create connection
$conn = new mysqli($_POST["host_name"], $_POST["user_name"], $_POST["user_password"], $_POST["database_name"]);
@$conn = new mysqli($_POST["host_name"], $_POST["user_name"], $_POST["user_password"], $_POST["database_name"]);
// check connection
if ($conn->connect_error) {

View File

@ -1,6 +1,7 @@
<?php
// getting env file
$currentLocation = explode("/", getcwd());
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
@ -39,7 +40,7 @@
$connection = $databaseData['DB_CONNECTION'];
if ($connection == 'mysql') {
$conn = new mysqli($servername, $username, $password, $dbname);
@$conn = new mysqli($servername, $username, $password, $dbname);
if (!$conn->connect_error) {
// retrieving admin entry

View File

@ -1,6 +1,7 @@
<?php
// getting env file
$currentLocation = explode("/", getcwd());
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
$envFile = $desiredLocation . '/' . '.env';
@ -38,7 +39,7 @@
$connection = $databaseData['DB_CONNECTION'];
if ($connection == 'mysql') {
$conn = new mysqli($servername, $username, $password, $dbname);
@$conn = new mysqli($servername, $username, $password, $dbname);
if (!$conn->connect_error) {
// retrieving admin entry

View File

@ -0,0 +1 @@
Deny from all

View File

@ -0,0 +1 @@
Deny from all