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