Browse Source

Merge pull request 'Upload-2023-10-12' (#45) from staging into master

Reviewed-on: ordo/adw-gantt#45
pull/1/head
farhantock 1 year ago
parent
commit
c2a18fd0ad
  1. 32
      edit-mode/function/expenseResource.js
  2. 2
      edit-mode/function/ganttConfig.js
  3. 2
      edit-mode/function/ganttEvent.js
  4. 15
      edit-mode/function/humanResource.js
  5. 7
      edit-mode/function/reportActivity.js
  6. 4
      edit-mode/index.html

32
edit-mode/function/expenseResource.js

@ -60,6 +60,7 @@ $(document).ready(function () {
});
function deleteexpenseAssign(id) {
searchReport(id);
$.ajax({
url: `${base_url}assign-material/delete/${id}`,
type: "DELETE",
@ -74,6 +75,37 @@ $(document).ready(function () {
});
}
function searchReport(id) {
var payload = {
"columns": [
{
"name": "assign_material_id",
"logic_operator": "=",
"value": id,
"operator": "AND"
}
],
// "joins": [{ "name": "m_proyek", "column_join": "proyek_id", "column_results": ["kode_sortname", "nama"] }],
}
$.ajax({
data: JSON.stringify(payload),
url: `${base_url}report-activity-material/search`,
type: "POST",
success: function (data) {
data.data.forEach(element => {
let activityId = element.activity_id;
let task = gantt.getTask(activityId);
task.actual_start = null;
task.actual_end = null;
});
actionHappen = true;
},
error: function (data) {
// gantt.alert("Failed to get the data.");
}
});
}
$("#modal-expense").on("click", "#show-form-expense", function () {
$(this).hide();
$("#hide-form-expense").show();

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();

7
edit-mode/function/reportActivity.js

@ -375,6 +375,13 @@ $(document).ready(function () {
});
async function submitStatus(formData) {
let activityId = formData.get("activity_id");
let statusActivity = formData.get("status_activity");
let task = gantt.getTask(activityId);
if (statusActivity != "done") {
task.actual_start = null;
task.actual_end = null;
}
const result = await axiosInstance
.post(`${base_url}report-activity-material/update-status`, formData)
.then(res => res)

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