Enhance interface

This commit is contained in:
Ludovic CANDELLIER
2020-07-16 15:48:31 +02:00
parent cc6edb2480
commit fcd26d13de
18 changed files with 208 additions and 46 deletions

View File

@@ -2,7 +2,7 @@
$.extend( true, $.fn.dataTable.defaults, {
language: {
url: "/assets/vendor/boilerplate/js/datatables/i18n/French.json"
}
},
});
</script>
@@ -11,30 +11,44 @@
<script>
$('#{{ $model }}-table').on( 'draw.dt', function () {
$('.btn-edit').click(function() {
url = '{{ $route }}' + '/edit/' + $(this).data('id');
window.location = url;
var table = window.LaravelDataTables["{{ $model }}-table"];
$('.btn-edit').off('click').click(function() {
var id = table.row(this).id();
url = '{{ $route }}' + '/edit/' + id;
openURL(url);
});
$('.btn-show').off('click').click(function() {
var id = table.row(this).id();
url = '{{ $route }}' + '/show/' + id;
openURL(url);
});
$('.btn-del').on('click', '.destroy', function (e) {
$('.btn-del').off('click').click(function (e) {
e.preventDefault();
var id = table.row(this).id();
bootbox.confirm("{{ __('boilerplate::shop.admin.confirmdelete') }}", function (result) {
bootbox.confirm("{{ __('admin.confirmdelete') }}", function (result) {
if (result === false) return;
$.ajax({
url: href,
url: '{{ $route }}' + '/destroy/' + id,
method: 'delete',
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
success: function(){
line.remove();
growl("{{ __('boilerplate::shop.admin.deletesuccess') }}", 'success');
table.draw();
growl("{{ __('admin.deletesuccess') }}", 'success');
}
});
});
});
});
// datatablesHelper.getDatatableLength('{{ $model }}', 34);
</script>