chess/resources/views/content/ref/TeamRole/action.blade.php

55 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2024-08-29 03:56:32 +00:00
<script>
// INIT FORM
function clearForm() {
$('#get_id').val('');
$("#formData")[0].reset();
validation.resetForm();
$('#mForm_title').html(`Tambah Data`);
$('#mForm_subTitle').html(`Tambah Data `+title);
reInitForm();
}
function edit(id) {
clearForm();
$('#mForm').modal('show');
znLoadingModal('mForm');
$('#mForm_title').html(`Edit Data`);
$('#mForm_subTitle').html(`Edit Data `+title);
let formData = new FormData();
formData.append('id',id);
doPost(routeEdit, formData, function (msg, res) {
znLoadingModalEnd('mForm');
var data = res.data;
$('#get_id').val(id);
$('#definition').val(data.definition);
var active = data.is_active?'true':'false';
$('#is_active').val(active);
// $('#formData').data('bootstrapValidator').validate();
})
}
//VALIDASI
$(document).ready(function () {
validation = FormValidation.formValidation(
KTUtil.getById('formData'),
{
fields: {
definition: {
validators: {
notEmpty: {
message: 'Wajib diisi!'
}
}
},
},
plugins: {
trigger: new FormValidation.plugins.Trigger(),
bootstrap: new FormValidation.plugins.Bootstrap()
}
}
);
});
</script>