Update with new price management
This commit is contained in:
70
resources/views/components/datatables/js/datatable.blade.php
Normal file
70
resources/views/components/datatables/js/datatable.blade.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<script>
|
||||
|
||||
$('#{{ $model }}-table').on( 'draw.dt', function () {
|
||||
|
||||
var table = getDatatable("{{ $model }}");
|
||||
|
||||
$('#{{ $model }}-table .btn-edit').off('click').click(function(e) {
|
||||
e.preventDefault();
|
||||
// var id = table.row(this).id();
|
||||
var id = $(this).data('id');
|
||||
@if (isset($edit_callback))
|
||||
{{ $edit_callback }}
|
||||
@else
|
||||
url = '{{ $route }}' + '/edit/' + id;
|
||||
openURL(url);
|
||||
@endif
|
||||
});
|
||||
|
||||
$('#{{ $model }}-table .btn-show').off('click').click(function(e) {
|
||||
e.preventDefault();
|
||||
// var id = table.row(this).id();
|
||||
var id = $(this).data('id');
|
||||
url = '{{ $route }}' + '/show/' + id;
|
||||
openURL(url);
|
||||
});
|
||||
|
||||
$('#{{ $model }}-table .btn-del').off('click').click(function (e) {
|
||||
e.preventDefault();
|
||||
// var id = table.row(this).id();
|
||||
var id = $(this).data('id');
|
||||
|
||||
bootbox.confirm("{{ __('admin.confirmdelete') }}", function (result) {
|
||||
if (result === false) return;
|
||||
|
||||
$.ajax({
|
||||
url: '{{ $route }}' + '/destroy/' + id,
|
||||
method: 'delete',
|
||||
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
||||
success: function(){
|
||||
// line.remove();
|
||||
table.draw();
|
||||
growl("{{ __('admin.deletesuccess') }}", 'success');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
{{ $callback ?? '' }}
|
||||
|
||||
var state = table.state.loaded();
|
||||
// console.log('state');
|
||||
// console.log(state);
|
||||
if ( state ) {
|
||||
/*
|
||||
table.columns().eq( 0 ).each( function ( colIdx ) {
|
||||
var colSearch = state.columns[colIdx].search;
|
||||
if ( colSearch.search ) {
|
||||
$('.search-input-text').eq(colIdx).val( colSearch.search );
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
// datatablesHelper.getDatatableLength('{{ $model }}', 34);
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user