Browse Source

feat(form): manual input & default value

pull/1/head
farhantock 7 months ago
parent
commit
159ed65e3f
  1. 30
      edit-mode/function/reportActivity.js

30
edit-mode/function/reportActivity.js

@ -62,22 +62,14 @@ $(document).ready(function () {
$('#ra_date_end_activity').prop('disabled', true); $('#ra_date_end_activity').prop('disabled', true);
} }
}); });
// $('#ra_date_start_activity').datepicker({
// format: 'dd-mm-yyyy', // Set the desired format
// autoclose: true // Close the datepicker when a date is selected
// });
//
// $('#ra_date_end_activity').datepicker({
// format: 'dd-mm-yyyy', // Set the desired format
// autoclose: true // Close the datepicker when a date is selected
// });
$("#ra_date_end_activity").on("change", function () { $("#ra_date_end_activity").on("change", function () {
let valEnd = $(this).val()
let valStart = $('#ra_date_start_activity').val() let valStart = $('#ra_date_start_activity').val()
let valEnd = moment($(this).val());
const compDate = moment(valEnd).isBefore(moment(valStart)) if (moment(valEnd).format('YYYY') >= moment(valStart).format('YYYY')) {
if (compDate) { if (moment(valEnd).isBefore(moment(valStart))) {
gantt.alert("End Activity Date cannot be lower than Start Activity Date"); gantt.alert("End Activity Date cannot be lower than Start Activity Date");
$('#ra_date_end_activity').val()
}
} }
}); });
@ -358,8 +350,8 @@ $(document).ready(function () {
}); });
$('#ra_date_material').datepicker({ $('#ra_date_material').datepicker({
format: 'dd-mm-yyyy', // Set the desired format format: 'dd-mm-yyyy', // Set the desired format
autoclose: true // Close the datepicker when a date is selected 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();
@ -456,7 +448,7 @@ $(document).ready(function () {
imageFormData.append("ref_id", reportId); imageFormData.append("ref_id", reportId);
imageFormData.append("category", "report_activity"); imageFormData.append("category", "report_activity");
imageFormData.append("files", image, image.name); imageFormData.append("files", image, image.name);
imageFormData.append("company_name",company_name); imageFormData.append("company_name", company_name);
if (image.name && image.size) { if (image.name && image.size) {
await axiosInstanceMultipart.post(`${base_url}image/upload`, imageFormData); await axiosInstanceMultipart.post(`${base_url}image/upload`, imageFormData);
@ -587,7 +579,7 @@ $(document).ready(function () {
var attributeString = this.outerHTML; var attributeString = this.outerHTML;
if (attributeString.includes('"=""')) { if (attributeString.includes('"=""')) {
materialName = materialName + '"'; materialName = materialName + '"';
} }
$("#report_activity_material_title").html(`Report Activity Actual ${materialName}`); $("#report_activity_material_title").html(`Report Activity Actual ${materialName}`);
$('#report_activity_material_sub_title').html(`<p style="font-size: 12px; color: #747474">Plan Date ${moment(activityEarlyStart).format('MM-DD-YYYY')} - ${moment(activityEarlyFinish).format('MM-DD-YYYY')}</p>`); $('#report_activity_material_sub_title').html(`<p style="font-size: 12px; color: #747474">Plan Date ${moment(activityEarlyStart).format('MM-DD-YYYY')} - ${moment(activityEarlyFinish).format('MM-DD-YYYY')}</p>`);
@ -623,7 +615,7 @@ $(document).ready(function () {
materialId = $(this).data('material-id'); materialId = $(this).data('material-id');
var attributeString = this.outerHTML; var attributeString = this.outerHTML;
if (attributeString.includes('"=""')) { if (attributeString.includes('"=""')) {
materialName = materialName + '"'; materialName = materialName + '"';
} }
$("#report_activity_material_title").html(`Report Activity Plan ${materialName}`); $("#report_activity_material_title").html(`Report Activity Plan ${materialName}`);
$('#report_activity_material_sub_title').html(`<p style="font-size: 12px; color: #747474">Plan Date ${moment(activityEarlyStart).format('MM-DD-YYYY')} - ${moment(activityEarlyFinish).format('MM-DD-YYYY')}</p>`); $('#report_activity_material_sub_title').html(`<p style="font-size: 12px; color: #747474">Plan Date ${moment(activityEarlyStart).format('MM-DD-YYYY')} - ${moment(activityEarlyFinish).format('MM-DD-YYYY')}</p>`);

Loading…
Cancel
Save