fix pbg task add toggle and rab krk dlh
This commit is contained in:
@@ -10,6 +10,7 @@ class PbgTaskAssignments {
|
||||
this.initTablePbgTaskAssignments();
|
||||
this.handleUpdateData();
|
||||
this.initDatePicker();
|
||||
this.initIsValidToggle();
|
||||
}
|
||||
|
||||
initDatePicker() {
|
||||
@@ -20,6 +21,30 @@ class PbgTaskAssignments {
|
||||
});
|
||||
}
|
||||
|
||||
initIsValidToggle() {
|
||||
const checkbox = document.getElementById("is_valid");
|
||||
const statusText = document.querySelector(".status-text");
|
||||
const statusDescription = statusText?.nextElementSibling;
|
||||
|
||||
if (checkbox && statusText) {
|
||||
checkbox.addEventListener("change", function () {
|
||||
if (this.checked) {
|
||||
statusText.textContent = "Data Valid";
|
||||
if (statusDescription) {
|
||||
statusDescription.textContent =
|
||||
"Data telah diverifikasi dan sesuai";
|
||||
}
|
||||
} else {
|
||||
statusText.textContent = "Data Tidak Valid";
|
||||
if (statusDescription) {
|
||||
statusDescription.textContent =
|
||||
"Data perlu diverifikasi atau diperbaiki";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
initTablePbgTaskAssignments() {
|
||||
let tableContainer = document.getElementById(
|
||||
"table-pbg-task-assignments"
|
||||
@@ -92,6 +117,12 @@ class PbgTaskAssignments {
|
||||
formData.forEach((value, key) => {
|
||||
formObject[key] = value;
|
||||
});
|
||||
|
||||
// Handle checkbox properly - ensure boolean value is sent
|
||||
const isValidCheckbox = document.getElementById("is_valid");
|
||||
if (isValidCheckbox) {
|
||||
formObject["is_valid"] = isValidCheckbox.checked ? 1 : 0;
|
||||
}
|
||||
fetch(form.action, {
|
||||
method: "PUT", // Ensure your Laravel route is set to accept PUT requests
|
||||
body: JSON.stringify(formObject), // Convert form data to JSON
|
||||
|
||||
Reference in New Issue
Block a user