copy dari repo om Irfan

This commit is contained in:
2026-06-13 16:02:07 +10:00
commit db327c0305
5376 changed files with 2770667 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
$(document).ready(function () {
$('#formservice').on('submit', function (e) {
e.preventDefault();
e.stopImmediatePropagation();
var btn = $('#submit');
btn.attr('disabled', 'disabled').text('Wait...');
$.ajax({
url: $(this).attr('action'),
data: $(this).serialize(),
type: 'POST',
success: function (response) {
btn.removeAttr('disabled').text('Simpan');
if (response.status) {
Swal('Sukses', 'Data Berhasil disimpan', 'success')
.then((result) => {
if (result.value) {
window.location.href = base_url + 'index.php/ManageService';
}
});
} else {
$.each(response.errors, function (key, val) {
$('[name="' + key + '"]').closest('.form-group').addClass('has-error');
$('[name="' + key + '"]').nextAll('.help-block').eq(0).text(val);
if (val === '') {
$('[name="' + key + '"]').closest('.form-group').removeClass('has-error').addClass('has-success');
$('[name="' + key + '"]').nextAll('.help-block').eq(0).text('');
}
});
}
}
})
});
$('#formservice input, #formservice select').on('change', function () {
$(this).closest('.form-group').removeClass('has-error has-success');
$(this).nextAll('.help-block').eq(0).text('');
});
});