- front export updated
This commit is contained in:
parent
66c71bff68
commit
0da20547a9
2 changed files with 14 additions and 12 deletions
|
|
@ -6,11 +6,11 @@
|
|||
<h4>Période :</h4>
|
||||
<input type="date" name="startdate" id="startdate" value="{{ $startdate }}">
|
||||
<input type="date" name="enddate" id="enddate" value="{{ $enddate }}">
|
||||
<input type="hidden" name="csrf" id="csrf" value="<?php echo csrf_token(); ?>">
|
||||
<input type="hidden" name="csrf" id="csrf" value="<?php echo csrf_token(); ?>">
|
||||
<a href="#" class="add-button export-data"><i class="fas fa-file-export"></i> Exporter les données</a>
|
||||
</div>
|
||||
@foreach ($sites as $site)
|
||||
|
||||
|
||||
<h4>{{ $site->site_nom }} ({{ $site->site_id }})</h4>
|
||||
@if (isset($site->coupons) && $site->coupons->count()>0)
|
||||
@foreach ($site->coupons as $coupon)
|
||||
|
|
@ -38,15 +38,19 @@
|
|||
if($(this).is(':checked')){
|
||||
ids.push($(this).val());
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
if (ids.length === 0) {
|
||||
alert('Vous devez sélectionner au moins un coupon.');
|
||||
return;
|
||||
}
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('#csrf').val()
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: '/exportCoupon',
|
||||
url: '/bo/export/coupon',
|
||||
type: 'POST',
|
||||
data: {
|
||||
ids: ids,
|
||||
|
|
@ -54,11 +58,11 @@
|
|||
enddate: $('#enddate').val(),
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function (response) {
|
||||
success: function (response) {
|
||||
$.each(response, function(index, element){
|
||||
$('.dl-pdf').attr("href", '/'+element);
|
||||
$('.dl-pdf').get(0).click();
|
||||
})
|
||||
})
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e.responseText);
|
||||
|
|
@ -67,4 +71,4 @@
|
|||
})
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Middleware\ProcessSpecificUrl;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
|
|
@ -55,7 +54,8 @@ Route::group(['prefix' => 'bo', 'middleware' => ['auth', 'saveroute']], function
|
|||
// ---- Route de changement de site
|
||||
Route::post('/brand-change', 'BrandChangeController')->name('brand-change');
|
||||
// ---- Route Export PDF
|
||||
Route::get('export', 'ExportController@show')->name('export.coupons');
|
||||
Route::get('/export', 'ExportController@show')->name('export.coupons');
|
||||
Route::post('/export/coupon', 'ExportController@export_coupons');
|
||||
});
|
||||
|
||||
// ---- Routes Ajax:
|
||||
|
|
@ -73,8 +73,6 @@ Route::group(['prefix' => 'bo', 'middleware' => ['auth', 'saveroute']], function
|
|||
Route::post('/cleanBaskets', 'AjaxController@clean_baskets');
|
||||
// ---- Statistiques
|
||||
Route::post('/loadStat', 'StatistiqueController@load_stats');
|
||||
// ---- Export Coupons
|
||||
Route::post('/exportCoupon', 'ExportController@export_coupons');
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue