fix: disabled false button report #4

Merged
farhantock merged 3 commits from dev-wahyun into master 5 months ago
  1. 5
      edit-mode/function/ganttConfig.js
  2. 9
      edit-mode/function/reportActivity.js

5
edit-mode/function/ganttConfig.js

@ -4,10 +4,9 @@ const proyekId = getUrlParameter("proyek_id");
const timestamp = getUrlParameter("timestamp"); const timestamp = getUrlParameter("timestamp");
let base_url = getUrlParameter("base_url"); let base_url = getUrlParameter("base_url");
const role_name = getUrlParameter("role_name"); const role_name = getUrlParameter("role_name");
const company_name = getUrlParameter("company_name"); const base_url_image = `https://project-api.ospro.id/assets/`;
const base_url_image = `https://si-api.ospro.id/assets/${company_name}/`;
const ganttName = getUrlParameter("gantt_name"); const ganttName = getUrlParameter("gantt_name");
// const base_url_image = `http://localhost:8444/generic-ospro-backend/assets/${company_name}/`; // const base_url_image = `http://localhost:8444/generic-ospro-backend/assets/`;
const adwIntegrationUrl = "https://adw-api.ospro.id/api"; const adwIntegrationUrl = "https://adw-api.ospro.id/api";
let userToVersionGanttId = 0 let userToVersionGanttId = 0

9
edit-mode/function/reportActivity.js

@ -448,7 +448,6 @@ $(document).ready(function () {
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);
imageFormData.append("company_name", company_name);
if (image.name && image.size) { if (image.name && image.size) {
await axiosInstanceMultipart.post(`${base_url}image/upload`, imageFormData); await axiosInstanceMultipart.post(`${base_url}image/upload`, imageFormData);
@ -460,10 +459,12 @@ $(document).ready(function () {
tableRaMaterialActual.draw(); tableRaMaterialActual.draw();
} else { } else {
$('#btn_add_ra_material').html('Add'); $('#btn_add_ra_material').html('Add');
$('#btn_add_ra_material').prop("disabled", false);
throw new Error("Add report activity material failed."); throw new Error("Add report activity material failed.");
} }
} catch (error) { } catch (error) {
$('#btn_add_ra_material').html('Add'); $('#btn_add_ra_material').html('Add');
$('#btn_add_ra_material').prop("disabled", false);
throw new Error("Image upload failed."); throw new Error("Image upload failed.");
} }
} catch (error) { } catch (error) {
@ -480,7 +481,8 @@ $(document).ready(function () {
} }
}); });
} else { } else {
resetFormAddRaMaterial(); $('#btn_add_ra_material').html('Add');
$('#btn_add_ra_material').prop("disabled", false);
gantt.alert("Add report activity material failed."); gantt.alert("Add report activity material failed.");
} }
} }
@ -493,12 +495,13 @@ $(document).ready(function () {
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.status == 200) { if (result && result.status == 200) {
gantt.alert("Edit report activity Success!");
resetFormAddRaMaterial(); resetFormAddRaMaterial();
gantt.alert("Edit report activity Success!");
tableRaMaterialActual.draw(); tableRaMaterialActual.draw();
} else { } else {
resetFormAddRaMaterial(); resetFormAddRaMaterial();
$('#btn_add_ra_material').html('Add'); $('#btn_add_ra_material').html('Add');
$('#btn_add_ra_material').prop("disabled", false);
gantt.alert("Edit report activity failed, try again later!"); gantt.alert("Edit report activity failed, try again later!");
} }
} }

Loading…
Cancel
Save