Browse Source

feat: fixed bug

pull/3/head
wahyun 5 months ago
parent
commit
285b8aa8cd
  1. 35
      edit-mode/function/expenseResource.js
  2. 3
      edit-mode/function/function.js
  3. 16
      edit-mode/function/ganttConfig.js
  4. 8
      edit-mode/function/ganttSettings.js
  5. 2
      edit-mode/index.html

35
edit-mode/function/expenseResource.js

@ -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

3
edit-mode/function/function.js

@ -196,6 +196,7 @@ function getSatuan() {
]
}
}
$.ajax({
data: JSON.stringify(payload),
url: `${base_url}satuan/search`,
@ -223,7 +224,7 @@ function getSatuan() {
let newOption = new Option(option.label, option.label);
$('#uom-req-material').append(newOption);
});
$('#uom-req-expense').append(new Option('', '', true, true));
satuanList.forEach((option) => {
let newOption = new Option(option.label, option.label);
$('#uom-req-expense').append(newOption);

16
edit-mode/function/ganttConfig.js

@ -294,14 +294,14 @@ var allColumns = [
editor: editor.text,
resize: true,
template: function (text) {
function truncateText(text, maxLength) {
if (text.length > maxLength) {
return text.substring(0, maxLength) + '...';
}
return text;
}
const truncatedText = truncateText(text.text, 30);
return `<span title="${text.text}">${truncatedText}</span>`;
// function truncateText(text, maxLength) {
// if (text.length > maxLength) {
// return text.substring(0, maxLength) + '...';
// }
// return text;
// }
// const truncatedText = truncateText(text.text, 30);
return `<span title="${text.text}">${text.text}</span>`;
}
},
{

8
edit-mode/function/ganttSettings.js

@ -65,6 +65,7 @@ $(document).ready(function () {
if (result && result.status == 200) {
if (result.data && result.data.data) {
var config_dayoff = null;
if (result.data.data.config_dayoff !== null) {
config_dayoff = result.data.data.config_dayoff;
@ -130,8 +131,8 @@ $(document).ready(function () {
});
$("#dashboard-project").on('click', function (event) {
// window.location.href = `https://si.ospro.id/#/dashboard-project/${projectId}/${ganttId}false-header`;
window.location.href = `http://localhost:3000/#/dashboard-project/${projectId}/${ganttId}/false-header`;
window.location.href = `https://si.ospro.id/#/dashboard-project/${projectId}/${ganttId}?dashboardGantt=${true}`;
// window.location.href = `http://localhost:3000/#/dashboard-project/${projectId}/${ganttId}?dashboardGantt=${true}`;
});
$("#gantt-baseline").on('click', function (event) {
@ -203,6 +204,9 @@ async function initGanttSettings() {
if (result && result.status == 200) {
var config_dayoff = result.data.data.config_dayoff;
var type_gantt = result.data.data.calculation_type;
const ganttName = result.data.data.name_version;
document.getElementById("project-name-header").textContent = ganttName;
reRenderColumns(type_gantt);
var dayoff = [];
if (config_dayoff && config_dayoff.length > 0) {

2
edit-mode/index.html

@ -67,7 +67,7 @@
<div class="loading-overlay"></div>
<div class="container-header">
<div class="container-project">
<h6 id="project-name-header"></h6>
<h6 id="project-name-header" style="margin-left: 10px;"></h6>
</div>
<div class="container-action">
<div class="btn-icon-toolbar btn-sm"><span class="icon-toolbar-separator">Zoom: </span></div>

Loading…
Cancel
Save