Browse Source

Merge pull request 'fix milestone dateformat' (#28) from dev-wahyu into staging

Reviewed-on: ordo/adw-gantt#28
pull/1/head
ibnu 1 year ago
parent
commit
63fe930652
  1. 21
      edit-mode/function/milestone.js
  2. 7
      edit-mode/function/reportActivity.js
  3. 6
      edit-mode/index.html

21
edit-mode/function/milestone.js

@ -70,6 +70,15 @@ $(document).ready(function () {
$("#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) {
@ -88,8 +97,8 @@ $(document).ready(function () {
console.log("cek data form", data);
let parent = data.milestone_parent;
var taskId = 0;
var start = moment(data.due_date, "YYYY-MM-DD");
var end = moment(data.deadline, "YYYY-MM-DD");
var start = moment(data.due_date, "DD-MM-YYYY");
var end = moment(data.deadline, "DD-MM-YYYY");
let duration = moment.duration(start.diff(end)).asDays();
let nameMilestone = data.status!="" ? data.status : data.id_milestone
// console.log("cek duration", Math.abs(duration));
@ -97,8 +106,8 @@ $(document).ready(function () {
taskId = gantt.addTask({
id: Math.floor(Math.random() * 1000) + 5000,
text: nameMilestone,
start_date: data.due_date,
end_date: data.deadline,
start_date: start.format("YYYY-MM-DD"),
end_date: end.format("YYYY-MM-DD"),
duration: Math.abs(duration),
type: "milestone",
type_activity:"milestone"
@ -107,8 +116,8 @@ $(document).ready(function () {
taskId = gantt.addTask({
id: Math.floor(Math.random() * 1000) + 5000,
text: nameMilestone,
start_date: data.due_date,
end_date: data.deadline,
start_date: start.format("YYYY-MM-DD"),
end_date: end.format("YYYY-MM-DD"),
duration: Math.abs(duration),
type: "milestone",
type_activity:"milestone"

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) {
e.preventDefault();
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("assign_material_id", assignMaterialId);
let idRa = $("#id_ra_material").val();

6
edit-mode/index.html

@ -602,11 +602,11 @@
<div class="form-row">
<div class="col-md-6 form-group">
<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 class="col-md-6 form-group">
<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>
@ -723,7 +723,7 @@
</div>
<div class="col-md-2 form-group">
<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 />
</div>
<div class="col-md-2 form-group">

Loading…
Cancel
Save