|
|
|
@ -56,7 +56,6 @@ $(document).ready(function () {
|
|
|
|
|
}); |
|
|
|
|
$("#ra_select_status").on("change", function () { |
|
|
|
|
let val = $(this).val() |
|
|
|
|
console.log(val) |
|
|
|
|
if (val == 'done') { |
|
|
|
|
$('#ra_date_end_activity').prop('disabled', false); |
|
|
|
|
} else { |
|
|
|
@ -178,7 +177,6 @@ $(document).ready(function () {
|
|
|
|
|
d.type = 'actual'; |
|
|
|
|
}, |
|
|
|
|
"error": function (xhr, error, code) { |
|
|
|
|
console.log(xhr, error, code); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
"columns": [ |
|
|
|
@ -397,8 +395,6 @@ $(document).ready(function () {
|
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
// console.log("cek result", result);
|
|
|
|
|
|
|
|
|
|
if (result && result.data.code == 200) { |
|
|
|
|
gantt.alert("Update Status report activity Success!"); |
|
|
|
|
resetFormAddRa(); |
|
|
|
@ -417,8 +413,6 @@ $(document).ready(function () {
|
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
// console.log("cek result", result);
|
|
|
|
|
|
|
|
|
|
if (result && result.status == 200) { |
|
|
|
|
gantt.alert("Add report activity Success!"); |
|
|
|
|
resetFormAddRa(); |
|
|
|
@ -435,8 +429,6 @@ $(document).ready(function () {
|
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
// console.log("cek result", result);
|
|
|
|
|
|
|
|
|
|
if (result && result.status == 200) { |
|
|
|
|
gantt.alert("Edit report activity Success!"); |
|
|
|
|
resetFormAddRa(); |
|
|
|
@ -464,9 +456,10 @@ $(document).ready(function () {
|
|
|
|
|
imageFormData.append("ref_id", reportId); |
|
|
|
|
imageFormData.append("category", "report_activity"); |
|
|
|
|
imageFormData.append("files", image, image.name); |
|
|
|
|
imageFormData.append("company_name",company_name); |
|
|
|
|
|
|
|
|
|
if (image.name && image.size) { |
|
|
|
|
const resultImage = await axiosInstanceMultipart.post(`${base_url}image/upload`, imageFormData); |
|
|
|
|
await axiosInstanceMultipart.post(`${base_url}image/upload`, imageFormData); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (result.status === 200) { |
|
|
|
@ -474,9 +467,11 @@ $(document).ready(function () {
|
|
|
|
|
resetFormAddRaMaterial(); |
|
|
|
|
tableRaMaterialActual.draw(); |
|
|
|
|
} else { |
|
|
|
|
$('#btn_add_ra_material').html('Add'); |
|
|
|
|
throw new Error("Add report activity material failed."); |
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
|
$('#btn_add_ra_material').html('Add'); |
|
|
|
|
throw new Error("Image upload failed."); |
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
@ -505,14 +500,13 @@ $(document).ready(function () {
|
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
// console.log("cek result", result);
|
|
|
|
|
|
|
|
|
|
if (result && result.status == 200) { |
|
|
|
|
gantt.alert("Edit report activity Success!"); |
|
|
|
|
resetFormAddRaMaterial(); |
|
|
|
|
tableRaMaterialActual.draw(); |
|
|
|
|
} else { |
|
|
|
|
resetFormAddRaMaterial(); |
|
|
|
|
$('#btn_add_ra_material').html('Add'); |
|
|
|
|
gantt.alert("Edit report activity failed, try again later!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -533,7 +527,7 @@ $(document).ready(function () {
|
|
|
|
|
|
|
|
|
|
$("#table_activity_material_actual").on("click", ".btn-ram-delete", function () { |
|
|
|
|
let id = $(this).data('id'); |
|
|
|
|
var box = gantt.confirm({ |
|
|
|
|
gantt.confirm({ |
|
|
|
|
text: "Report activity material will be deleted from activity material, continue?", |
|
|
|
|
ok: "Delete", |
|
|
|
|
cancel: "Cancel", |
|
|
|
@ -556,9 +550,8 @@ $(document).ready(function () {
|
|
|
|
|
gantt.alert({ type: "error", text: "Failed to get report image" }); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (data && data.image) { |
|
|
|
|
$("#report-image").html(`<img src="${base_url_image}${data.image}" class="img-responsive" style="height: 75vh;" />`); |
|
|
|
|
$("#report-image").html(`<img src="${base_url_image}${moment(data.created_at).format('YYYY-MM')}/image/${data.image}" class="img-responsive" style="height: 75vh;" />`); |
|
|
|
|
$('#modal-report-image').modal('show'); |
|
|
|
|
} |
|
|
|
|
// kalo gambarnya banyak belum di handle...
|
|
|
|
@ -596,7 +589,6 @@ $(document).ready(function () {
|
|
|
|
|
if (attributeString.includes('"=""')) { |
|
|
|
|
materialName = materialName + '"'; |
|
|
|
|
} |
|
|
|
|
// console.log(" okeee ",{ assignMaterialId, activityId, materialName });
|
|
|
|
|
$("#report_activity_material_title").html(`Report Activity Actual ${materialName}`) |
|
|
|
|
$("#modal_report_activity").hide(); |
|
|
|
|
|
|
|
|
@ -632,7 +624,6 @@ $(document).ready(function () {
|
|
|
|
|
if (attributeString.includes('"=""')) { |
|
|
|
|
materialName = materialName + '"'; |
|
|
|
|
} |
|
|
|
|
// console.log(" okeee ",{ assignMaterialId, activityId, materialName });
|
|
|
|
|
$("#report_activity_material_title").html(`Report Activity Plan ${materialName}`) |
|
|
|
|
$("#modal_report_activity").hide(); |
|
|
|
|
// $("#show_form_ra_material").hide();
|
|
|
|
@ -669,7 +660,7 @@ $(document).ready(function () {
|
|
|
|
|
function deleteRaMaterial(id) { |
|
|
|
|
searchReport(assignMaterialId, false); |
|
|
|
|
$.ajax({ |
|
|
|
|
url: `${base_url}report-activity-material/delete/${id}`, |
|
|
|
|
url: `${base_url}report-activity-material/delete/${id}/${company_id}`, |
|
|
|
|
type: "DELETE", |
|
|
|
|
success: function (data) { |
|
|
|
|
actionHappen = true; |
|
|
|
@ -685,20 +676,16 @@ $(document).ready(function () {
|
|
|
|
|
$("#table_report").on("click", ".btn_report_edit", function () { |
|
|
|
|
let id = $(this).data('id'); |
|
|
|
|
$("#id_ra").val(id); |
|
|
|
|
// console.log("cek edit id", id);
|
|
|
|
|
$.ajax({ |
|
|
|
|
url: `${base_url}report-activity/edit/${id}`, |
|
|
|
|
type: "get", |
|
|
|
|
success: function (data) { |
|
|
|
|
// console.log("data report-activity edit", data);
|
|
|
|
|
if (data && data.code == 200) { |
|
|
|
|
let dataRes = data.data |
|
|
|
|
// console.log("dataRes", dataRes);
|
|
|
|
|
$('#btn_add_ra').html('Edit'); |
|
|
|
|
var newOption = new Option(dataRes.user_name, dataRes.user_id, true, true); |
|
|
|
|
$('#select_ra_hr').append(newOption).trigger('change'); |
|
|
|
|
let reportDate = moment(dataRes.report_date).format("YYYY-MM-DD"); |
|
|
|
|
// console.log("reportDate", reportDate);
|
|
|
|
|
$("#ra_date").val(reportDate); |
|
|
|
|
$("#volume_pekerjaan").val(dataRes.job_count_report); |
|
|
|
|
$("#ra_description").val(dataRes.description); |
|
|
|
@ -709,9 +696,6 @@ $(document).ready(function () {
|
|
|
|
|
resetFormAddRa(); |
|
|
|
|
gantt.alert("Edit Report Activity Failed, try again later!"); |
|
|
|
|
} |
|
|
|
|
// actionHappen = true;
|
|
|
|
|
// gantt.alert("Delete Report Activity Success!");
|
|
|
|
|
// tableRa.draw();
|
|
|
|
|
}, |
|
|
|
|
error: function (data) { |
|
|
|
|
resetFormAddRa(); |
|
|
|
|