Осталось чуть-чуть
This commit is contained in:
parent
740f8ec2ef
commit
9c75a284f7
@ -9,8 +9,32 @@ const caseId = document.getElementById("vb-id").dataset.id;
|
||||
|
||||
var specializations = [];
|
||||
|
||||
const formatDate = (dateString) => {
|
||||
const date = new Date(dateString);
|
||||
const year = date.getFullYear();
|
||||
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
||||
const day = ('0' + date.getDate()).slice(-2);
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
|
||||
window.addEventListener("load", async () => {
|
||||
try {
|
||||
let specializationId;
|
||||
await $.ajax({
|
||||
url: `/case/get?id=${caseId}`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
nameInput.value = result.name;
|
||||
applicantInput.value = result.applicant;
|
||||
defendantInput.value = result.defendant;
|
||||
annotationInput.value = result.annotation;
|
||||
dateInput.value = formatDate(result.date);
|
||||
specializationId = result.specializationId;
|
||||
});
|
||||
|
||||
let specializationIndex;
|
||||
|
||||
await $.ajax({
|
||||
url: `/case/getallspecializations`,
|
||||
type: "GET",
|
||||
@ -22,9 +46,14 @@ window.addEventListener("load", async () => {
|
||||
option.value = specialization.id;
|
||||
option.innerHTML = specialization.name;
|
||||
specializationSelect.appendChild(option);
|
||||
if(specialization.id === specializationId){
|
||||
specializationIndex = specializationSelect.selectedIndex;
|
||||
}
|
||||
specializationSelect.selectedIndex = -1;
|
||||
});
|
||||
});
|
||||
|
||||
specializationSelect.selectedIndex = specializationIndex;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -4,6 +4,22 @@ const responsibilitiesInput = document.getElementById("responsibilities-input");
|
||||
const dateInput = document.getElementById("date-input");
|
||||
const dealId = document.getElementById("vb-id").dataset.id;
|
||||
|
||||
window.addEventListener("load", async () => {
|
||||
try {
|
||||
await $.ajax({
|
||||
url: `/deal/get?id=${dealId}`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
subjectInput.value = result.subject;
|
||||
responsibilitiesInput.value = result.responsibilities;
|
||||
dateInput.value = new Date(result.date);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
|
||||
updateBtn.addEventListener("click", () => {
|
||||
if (!correctData()) {
|
||||
return;
|
||||
|
@ -8,6 +8,18 @@ var cases = [];
|
||||
|
||||
window.addEventListener("load", async () => {
|
||||
try {
|
||||
let caseId;
|
||||
await $.ajax({
|
||||
url: `/hearing/get?id=${hearingId}`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
informationInput.value = result.information;
|
||||
dateInput.value = new Date(result.date);
|
||||
caseId = result.caseId;
|
||||
});
|
||||
|
||||
let caseIndex;
|
||||
$.ajax({
|
||||
url: "/case/getallbyuser",
|
||||
type: "GET",
|
||||
@ -19,9 +31,14 @@ window.addEventListener("load", async () => {
|
||||
option.value = element.id;
|
||||
option.innerHTML = "Дело №" + element.id;
|
||||
caseSelect.appendChild(option);
|
||||
if(element.id === caseId){
|
||||
caseIndex = caseSelect.selectedIndex;
|
||||
}
|
||||
caseSelect.selectedIndex = -1;
|
||||
});
|
||||
});
|
||||
|
||||
caseSelect.selectedIndex = caseIndex;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user