';
for (var count = 0; count < data.errors.length; count++) {
html += '
' + data.errors[count] + '
';
}
html += '
';
}
if (data.success) {
html = '
' + data.success + '
';
$('#deposit_category_form')[0].reset();
$('#deposit_category-table').DataTable().ajax.reload();
}
$('.deposit_category_result').html(html).slideDown(300).delay(5000).slideUp(300);
}
});
});
$(document).on('click', '.deposit_category_edit', function () {
var id = $(this).attr('id');
$('.deposit_category_result').html('');
var target = "{{ route('deposit_category.index') }}/" + id + '/edit';
$.ajax({
url: target,
dataType: "json",
success: function (html) {
console.log(html);
$('input[name="name_edit"]').val(html.data.name);
$('#hidden_deposit_category_id').val(html.data.id);
$('#depositCategoryEditModal').modal('show');
}
});
});
$('#deposit_category_edit_submit').on('click', function (event) {
event.preventDefault();
let nameEdit = $('input[name="name_edit"]').val();
let hidden_deposit_category_id = $('#hidden_deposit_category_id').val();
$.ajax({
url: "{{ route('deposit_category.update') }}",
method: "POST",
data: { name: nameEdit, hidden_deposit_category_id: hidden_deposit_category_id },
success: function (data) {
var html = '';
if (data.errors) {
html = '
';
for (var count = 0; count < data.errors.length; count++) {
html += '
' + data.errors[count] + '
';
}
html += '
';
}
if (data.success) {
html = '
' + data.success + '
';
$('#deposit_category_form_edit')[0].reset();
$('#depositCategoryEditModal').modal('hide');
$('#deposit_category-table').DataTable().ajax.reload();
}
$('.deposit_category_result_edit').html(html).slideDown(300).delay(3000).slideUp(300);
setTimeout(function () {
$('#depositCategoryEditModal').modal('hide')
}, 5000);
}
});
});
$(document).on('click', '.deposit_category_delete', function () {
let delete_id = $(this).attr('id');
let target = "{{ route('deposit_category.index') }}/" + delete_id + '/delete';
if (confirm('{{__('Are You Sure you want to delete this data')}}')) {
$.ajax({
url: target,
success: function (data) {
var html = '';
html = '