|
|
|
@ -1,10 +1,11 @@
|
|
|
|
|
var expenseModal = $('#modal-expense > .modal-dialog > .modal-content'); |
|
|
|
|
|
|
|
|
|
function resetFormAssignexpense() { |
|
|
|
|
$('#select-expense').val(null).trigger("change"); |
|
|
|
|
$('#select-expense').find('option').remove(); |
|
|
|
|
$('#select-expense').val(""); |
|
|
|
|
$('#uom-req-expense').val(null).trigger('change'); |
|
|
|
|
// $('#select-expense').val(null).trigger("change");
|
|
|
|
|
// $('#select-expense').find('option').remove();
|
|
|
|
|
// $('#select-expense').val("");
|
|
|
|
|
$("#desc-expense").val(""); |
|
|
|
|
$('#uom-req-expense').val("").trigger('change'); |
|
|
|
|
$('#form-assign-expense').trigger("reset"); |
|
|
|
|
$('#btn-assign-expense').html('Assign'); |
|
|
|
|
$('#btn-assign-expense').prop("disabled", false); |
|
|
|
@ -88,18 +89,18 @@ $(document).ready(function () {
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#modal-expense').on('show.bs.modal', function (event) { |
|
|
|
|
$("#desc-expense").val(activityName); |
|
|
|
|
resetFormAssignexpense(); |
|
|
|
|
$('#modal-expense-title').html("Overhead " + activityName); |
|
|
|
|
$('#modal-expense-sub-title').html(`<p style="font-size: 12px; color: #747474">Plan Date: ${moment(activityEarlyStart).format('DD MMMM YYYY')} - ${moment(activityEarlyFinish).format('DD MMMM YYYY')}</p>`); |
|
|
|
|
tableexpense.draw(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#modal-expense').on('hide.bs.modal', function (event) { |
|
|
|
|
resetFormAssignexpense(); |
|
|
|
|
$("#show-form-expense").show(); |
|
|
|
|
if (actionHappen) { |
|
|
|
|
updateActivity(activityId); |
|
|
|
|
} |
|
|
|
|
resetFormAssignexpense(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#select-expense').select2({ |
|
|
|
@ -160,7 +161,7 @@ $(document).ready(function () {
|
|
|
|
|
type: "expense", |
|
|
|
|
fom_date: required_date, |
|
|
|
|
required_date: required_date, |
|
|
|
|
proyek_id: proyekId, |
|
|
|
|
proyek_id: parseInt(proyekId), |
|
|
|
|
uom: uom, |
|
|
|
|
qty: formatReplaceTitikRibuan(qty_planning), |
|
|
|
|
price: formatReplaceTitikRibuan(price) |
|
|
|
@ -175,7 +176,6 @@ $(document).ready(function () {
|
|
|
|
|
if (data && data.code === 200) { |
|
|
|
|
material_id = data.data.id; |
|
|
|
|
resetFormAssignexpense(); |
|
|
|
|
|
|
|
|
|
let payloadAssign = { |
|
|
|
|
proyek_id: proyekId, |
|
|
|
|
activity_id: activityId, |
|
|
|
@ -192,35 +192,34 @@ $(document).ready(function () {
|
|
|
|
|
contentType: false, |
|
|
|
|
success: function (data) { |
|
|
|
|
if (data && data.code === 200) { |
|
|
|
|
resetFormAssignexpense(); |
|
|
|
|
actionHappen = true; |
|
|
|
|
gantt.alert("Data added!"); |
|
|
|
|
tableexpense.draw(); |
|
|
|
|
resetFormAssignexpense(); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
gantt.alert({ type: "error", text: data.message }); |
|
|
|
|
} else { |
|
|
|
|
$('#btn-assign-expense').html('Assign'); |
|
|
|
|
$('#btn-assign-expense').prop("disabled", false); |
|
|
|
|
gantt.alert({ type: "error", text: data.message }); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
error: function (data) { |
|
|
|
|
$('#btn-assign-expense').html('Assign'); |
|
|
|
|
$('#btn-assign-expense').prop("disabled", false); |
|
|
|
|
gantt.alert("Assign Failed, try again later!"); |
|
|
|
|
resetFormAssignexpense(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
gantt.alert({ type: "error", text: data.message }); |
|
|
|
|
} else { |
|
|
|
|
$('#btn-assign-expense').html('Assign'); |
|
|
|
|
$('#btn-assign-expense').prop("disabled", false); |
|
|
|
|
gantt.alert({ type: "error", text: data.message }); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
error: function (data) { |
|
|
|
|
$('#btn-assign-expense').html('Assign'); |
|
|
|
|
$('#btn-assign-expense').prop("disabled", false); |
|
|
|
|
gantt.alert("Overhead request Failed, try again later!"); |
|
|
|
|
resetFormAssignexpense(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// delete from row
|
|
|
|
|