|
|
@ -426,23 +426,23 @@ $(document).ready(function () { |
|
|
|
|
|
|
|
|
|
|
|
const reportId = result.data.data.report_id; |
|
|
|
const reportId = result.data.data.report_id; |
|
|
|
try { |
|
|
|
try { |
|
|
|
const image = formData.get("files"); |
|
|
|
const image = formData.get("files"); |
|
|
|
const imageFormData = new FormData(); |
|
|
|
const imageFormData = new FormData(); |
|
|
|
imageFormData.append("ref_id", reportId); |
|
|
|
imageFormData.append("ref_id", reportId); |
|
|
|
imageFormData.append("category", "report_activity"); |
|
|
|
imageFormData.append("category", "report_activity"); |
|
|
|
imageFormData.append("files", image, image.name); |
|
|
|
imageFormData.append("files", image, image.name); |
|
|
|
|
|
|
|
|
|
|
|
if (image.name && image.size) { |
|
|
|
if (image.name && image.size) { |
|
|
|
const resultImage = await axiosInstanceMultipart.post(`${base_url}image/upload`, imageFormData); |
|
|
|
const resultImage = await axiosInstanceMultipart.post(`${base_url}image/upload`, imageFormData); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (result.status === 200) { |
|
|
|
if (result.status === 200) { |
|
|
|
gantt.alert("Add report activity material Success!"); |
|
|
|
gantt.alert("Add report activity material Success!"); |
|
|
|
resetFormAddRaMaterial(); |
|
|
|
resetFormAddRaMaterial(); |
|
|
|
tableRaMaterialActual.draw(); |
|
|
|
tableRaMaterialActual.draw(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new Error("Add report activity material failed."); |
|
|
|
throw new Error("Add report activity material failed."); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
} catch (error) { |
|
|
|
throw new Error("Image upload failed."); |
|
|
|
throw new Error("Image upload failed."); |
|
|
|
} |
|
|
|
} |
|
|
|