Browse Source

Merge branch 'staging' of https://git.oslog.id/ordo/adw-gantt into dev-ibnu

pull/1/head
ibnu 1 year ago
parent
commit
356c428aff
  1. 4
      edit-mode/function/function.js
  2. 35
      edit-mode/function/ganttConfig.js
  3. 23
      edit-mode/function/milestone.js
  4. 7
      edit-mode/function/reportActivity.js
  5. 6
      edit-mode/index.html

4
edit-mode/function/function.js

@ -723,7 +723,9 @@ function updateLinksLag(data) {
let predecessor = data.data.find(item => item.id == link.source); let predecessor = data.data.find(item => item.id == link.source);
if (predecessor) { if (predecessor) {
let lag = gantt.calculateDuration(new Date(predecessor.end_date), new Date(task.start_date)); let lag = gantt.calculateDuration(new Date(predecessor.end_date), new Date(task.start_date));
link.lag = lag; if (link.type == "0" && isBaselineSet) {
link.lag = lag;
}
} }
} }
}); });

35
edit-mode/function/ganttConfig.js

@ -280,24 +280,41 @@ var allColumns = [
{ {
name: "planned_start", label: "Baseline Start", align: "center", min_width: 80, editor: editor.planned_start, resize: true, template: function (text) { name: "planned_start", label: "Baseline Start", align: "center", min_width: 80, editor: editor.planned_start, resize: true, template: function (text) {
if (!text.planned_start) { if (!text.planned_start) {
return text.start_date; return moment(text.start_date).format("DD-MM-YYYY");
} }
return text.planned_start; return moment(text.planned_start).format("DD-MM-YYYY");
} }
}, },
{ {
name: "planned_end", label: "Baseline Finish", align: "center", min_width: 80, editor: editor.planned_end, resize: true, template: function (text) { name: "planned_end", label: "Baseline Finish", align: "center", min_width: 80, editor: editor.planned_end, resize: true, template: function (text) {
if (!text.planned_end) { if (!text.planned_end) {
return text.end_date; return moment(text.end_date).format("DD-MM-YYYY");
} }
return text.planned_end; return moment(text.planned_end).format("DD-MM-YYYY");
} }
}, },
{ name: "start_date", label: "Early Start", align: "center", min_width: 80, editor: editor.start_date, resize: true }, { name: "start_date", label: "Early Start", align: "center", min_width: 80, editor: editor.start_date, resize: true, template: function (text) {
{ name: "end_date", label: "Early Finish", align: "center", min_width: 80, editor: editor.end_date, resize: true }, return moment(text.start_date).format("DD-MM-YYYY");
}
{ name: "actual_start", label: "Actual Start", align: "center", min_width: 80, resize: true }, },
{ name: "actual_end", label: "Actual Finish", align: "center", min_width: 80, resize: true }, { name: "end_date", label: "Early Finish", align: "center", min_width: 80, editor: editor.end_date, resize: true, template: function (text) {
return moment(text.end_date).format("DD-MM-YYYY");
}
},
{ name: "actual_start", label: "Actual Start", align: "center", min_width: 80, resize: true, template: function (text) {
if (!text.actual_start) {
return '';
}
return moment(text.actual_start).format("DD-MM-YYYY");
}
},
{ name: "actual_end", label: "Actual Finish", align: "center", min_width: 80, resize: true, template: function (text) {
if (!text.actual_end) {
return '';
}
return moment(text.actual_end).format("DD-MM-YYYY");
}
},
{ {
name: "bobot_planning", label: "Bobot (%)", align: "center", editor: editor.bobot_planning, resize: true, min_width: 115, template: function (text) { name: "bobot_planning", label: "Bobot (%)", align: "center", editor: editor.bobot_planning, resize: true, min_width: 115, template: function (text) {
let bobot = parseFloat(text.bobot_planning); let bobot = parseFloat(text.bobot_planning);

23
edit-mode/function/milestone.js

@ -70,7 +70,16 @@ $(document).ready(function () {
$("#name_milestone").val(data.text); $("#name_milestone").val(data.text);
}); });
$('#due_milestone').datepicker({
format: 'dd-mm-yyyy', // Set the desired format
autoclose: true // Close the datepicker when a date is selected
});
$('#deadline_milestone').datepicker({
format: 'dd-mm-yyyy', // Set the desired format
autoclose: true // Close the datepicker when a date is selected
});
$('#modal-material').on('show.bs.modal', function (event) { $('#modal-material').on('show.bs.modal', function (event) {
}); });
@ -88,8 +97,8 @@ $(document).ready(function () {
console.log("cek data form", data); console.log("cek data form", data);
let parent = data.milestone_parent; let parent = data.milestone_parent;
var taskId = 0; var taskId = 0;
var start = moment(data.due_date, "YYYY-MM-DD"); var start = moment(data.due_date, "DD-MM-YYYY");
var end = moment(data.deadline, "YYYY-MM-DD"); var end = moment(data.deadline, "DD-MM-YYYY");
let duration = moment.duration(start.diff(end)).asDays(); let duration = moment.duration(start.diff(end)).asDays();
let nameMilestone = data.status!="" ? data.status : data.id_milestone let nameMilestone = data.status!="" ? data.status : data.id_milestone
// console.log("cek duration", Math.abs(duration)); // console.log("cek duration", Math.abs(duration));
@ -97,8 +106,8 @@ $(document).ready(function () {
taskId = gantt.addTask({ taskId = gantt.addTask({
id: Math.floor(Math.random() * 1000) + 5000, id: Math.floor(Math.random() * 1000) + 5000,
text: nameMilestone, text: nameMilestone,
start_date: data.due_date, start_date: start.format("YYYY-MM-DD"),
end_date: data.deadline, end_date: end.format("YYYY-MM-DD"),
duration: Math.abs(duration), duration: Math.abs(duration),
type: "milestone", type: "milestone",
type_activity:"milestone" type_activity:"milestone"
@ -107,8 +116,8 @@ $(document).ready(function () {
taskId = gantt.addTask({ taskId = gantt.addTask({
id: Math.floor(Math.random() * 1000) + 5000, id: Math.floor(Math.random() * 1000) + 5000,
text: nameMilestone, text: nameMilestone,
start_date: data.due_date, start_date: start.format("YYYY-MM-DD"),
end_date: data.deadline, end_date: end.format("YYYY-MM-DD"),
duration: Math.abs(duration), duration: Math.abs(duration),
type: "milestone", type: "milestone",
type_activity:"milestone" type_activity:"milestone"
@ -124,4 +133,4 @@ $(document).ready(function () {
gantt.alert("Add Milestone Failed!"); gantt.alert("Add Milestone Failed!");
} }
}); });
}); });

7
edit-mode/function/reportActivity.js

@ -341,10 +341,15 @@ $(document).ready(function () {
}); });
$('#ra_date_material').datepicker({
format: 'dd-mm-yyyy', // Set the desired format
autoclose: true // Close the datepicker when a date is selected
});
$("#form_report_activity_material").on("submit", function (e) { $("#form_report_activity_material").on("submit", function (e) {
e.preventDefault(); e.preventDefault();
var formData = new FormData(this); var formData = new FormData(this);
let formattedDate = moment(formData.get("report_date"), "DD-MM-YYYY").format("YYYY-MM-DD");
formData.set('report_date', formattedDate);
formData.append("activity_id", activityId); formData.append("activity_id", activityId);
formData.append("assign_material_id", assignMaterialId); formData.append("assign_material_id", assignMaterialId);
let idRa = $("#id_ra_material").val(); let idRa = $("#id_ra_material").val();

6
edit-mode/index.html

@ -602,11 +602,11 @@
<div class="form-row"> <div class="form-row">
<div class="col-md-6 form-group"> <div class="col-md-6 form-group">
<label>Due Date</label> <label>Due Date</label>
<input id="due_milestone" type="date" name="due_date" class="form-control form-control-sm" /> <input id="due_milestone" type="text" name="due_date" class="form-control form-control-sm" />
</div> </div>
<div class="col-md-6 form-group"> <div class="col-md-6 form-group">
<label>Deadline</label> <label>Deadline</label>
<input id="deadline_milestone" type="date" name="deadline" class="form-control form-control-sm" /> <input id="deadline_milestone" type="text" name="deadline" class="form-control form-control-sm" />
</div> </div>
</div> </div>
</div> </div>
@ -723,7 +723,7 @@
</div> </div>
<div class="col-md-2 form-group"> <div class="col-md-2 form-group">
<label>Report Date</label> <label>Report Date</label>
<input type="date" id="ra_date_material" name="report_date" class="form-control form-control-sm" <input type="text" id="ra_date_material" name="report_date" class="form-control form-control-sm"
required /> required />
</div> </div>
<div class="col-md-2 form-group"> <div class="col-md-2 form-group">

Loading…
Cancel
Save