Browse Source

fix hr date

pull/1/head
wahyu 1 year ago
parent
commit
f66ded0927
  1. 2
      edit-mode/function/ganttConfig.js
  2. 2
      edit-mode/function/ganttEvent.js
  3. 15
      edit-mode/function/humanResource.js
  4. 4
      edit-mode/index.html

2
edit-mode/function/ganttConfig.js

@ -10,6 +10,8 @@ let userToVersionGanttId = 0
let activityId = 0;
let actionHappen = false;
let activityName = "";
let activityEarlyStart;
let activityEarlyFinish;
let token = getUrlParameter("token");
let forceDurationUpdateTriggered = false;
let editEndDateDurationTriggered = false;

2
edit-mode/function/ganttEvent.js

@ -17,6 +17,8 @@ gantt.attachEvent("onTaskRowClick", function (id, row) {
activityId = id;
var activity = gantt.getTaskBy("id", id);
activityName = activity[0]?.name;
activityEarlyStart = new Date(activity[0]?.start_date);
activityEarlyFinish = new Date(activity[0]?.end_date);
});
gantt.ext.inlineEditors.attachEvent("onBeforeEditStart", function (state) {

15
edit-mode/function/humanResource.js

@ -153,6 +153,21 @@ $(document).ready(function () {
});
$("#hr-start-date").on('change', (e) => {
let start_date = new Date($("#hr-start-date").val());
if (start_date < activityEarlyStart || start_date > activityEarlyFinish) {
gantt.alert("Start date should be inside activity date range !");
$("#hr-start-date").val("");
}
})
$("#hr-end-date").on('change', (e) => {
let end_date = new Date($("#hr-end-date").val());
if (end_date < activityEarlyStart || end_date > activityEarlyFinish) {
gantt.alert("End date should be inside activity date range !");
$("#hr-end-date").val("");
}
})
$("#form-assign-hr").on('submit', function (e) {
e.preventDefault();

4
edit-mode/index.html

@ -138,7 +138,7 @@
<div class="modal-body">
<form id="form-assign-hr">
<div class="form-row">
<div class="col-md-10 form-group">
<div class="col-md-7 form-group">
<label>Human Resource</label>
<select id="select-hr" name="user_id[]" multiple="multiple" class="form-control form-control-sm" style="width:100%;"></select>
</div>
@ -150,7 +150,7 @@
<label>End Date</label>
<input type="date" id="hr-end-date" class="form-control form-control-sm" />
</div>
<div class="col-md-2 form-group">
<div class="col-md-1 form-group">
<button style="margin-top: 31px;" id="btn-assign-hr" type="submit"
class="btn btn-sm btn-primary">Assign</button>
</div>

Loading…
Cancel
Save