Мелкие правки

This commit is contained in:
maxnes3 2023-05-20 09:10:45 +04:00
parent db5681fc25
commit 92c6c1c503
14 changed files with 156 additions and 87 deletions

View File

@ -6,7 +6,7 @@
<div id="error-div-shell" class="error-div-shell mb-2">
<div>
<p id="error-p" class="error-p"></p>
<p id="error-p" class="error-p text-danger"></p>
</div>
</div>

View File

@ -14,7 +14,7 @@
<div id="error-div-shell" class="error-div-shell mb-2">
<div>
<p id="error-p" class="error-p"></p>
<p id="error-p" class="error-p text-danger"></p>
</div>
</div>

View File

@ -6,7 +6,7 @@
<div id="error-div-shell" class="error-div-shell mb-2">
<div>
<p id="error-p" class="error-p"></p>
<p id="error-p" class="error-p text-danger"></p>
</div>
</div>

View File

@ -14,7 +14,7 @@
<div id="error-div-shell" class="error-div-shell mb-2">
<div>
<p id="error-p" class="error-p"></p>
<p id="error-p" class="error-p text-danger"></p>
</div>
</div>

View File

@ -6,7 +6,7 @@
<div id="error-div-shell" class="error-div-shell mb-2">
<div>
<p id="error-p" class="error-p"></p>
<p id="error-p" class="error-p text-danger"></p>
</div>
</div>

View File

@ -14,7 +14,7 @@
<div id="error-div-shell" class="error-div-shell mb-2">
<div>
<p id="error-p" class="error-p"></p>
<p id="error-p" class="error-p text-danger"></p>
</div>
</div>

View File

@ -5,6 +5,8 @@ const defendantInput = document.getElementById("defendant-input");
const annotationInput = document.getElementById("annotation-input");
const dateInput = document.getElementById("date-input");
const specializationSelect = document.getElementById("specialization-select");
const errorP = document.getElementById("error-p");
const errorDivShell = document.getElementById("error-div-shell");
var specializations = [];
@ -29,6 +31,35 @@ window.addEventListener("load", async () => {
}
});
const correctData = function () {
return true;
};
const validate = function () {
if (nameInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Название дела'";
return false;
}
if (applicantInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Истец'";
return false;
}
if (defendantInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Ответчик'";
return false;
}
if (annotationInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Примечание'";
return false;
}
return true;
};
createBtn.addEventListener("click", () => {
if (!correctData()) {
return;
@ -36,19 +67,7 @@ createBtn.addEventListener("click", () => {
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
};
const validate = function () {
return true;
};
createBtn.addEventListener("click", () => {
let caseModel = {
"Name": nameInput.value,
"Applicant": applicantInput.value,

View File

@ -6,6 +6,8 @@ const annotationInput = document.getElementById("annotation-input");
const dateInput = document.getElementById("date-input");
const specializationSelect = document.getElementById("specialization-select");
const caseId = document.getElementById("vb-id").dataset.id;
const errorP = document.getElementById("error-p");
const errorDivShell = document.getElementById("error-div-shell");
var specializations = [];
@ -50,6 +52,35 @@ window.addEventListener("load", async () => {
}
});
const correctData = function () {
return true;
};
const validate = function () {
if (nameInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Название дела'";
return false;
}
if (applicantInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Истец'";
return false;
}
if (defendantInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Ответчик'";
return false;
}
if (annotationInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Примечание'";
return false;
}
return true;
};
updateBtn.addEventListener("click", () => {
if (!correctData()) {
return;
@ -57,19 +88,7 @@ updateBtn.addEventListener("click", () => {
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
};
const validate = function () {
return true;
};
updateBtn.addEventListener("click", () => {
let caseModel = {
"Id": parseInt(caseId),
"Name": nameInput.value,

View File

@ -43,15 +43,6 @@ window.addEventListener("load", async () => {
}
});
saveBtn.addEventListener("click", () => {
if (!correctData()) {
return;
}
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
@ -63,6 +54,13 @@ const validate = function () {
};
saveBtn.addEventListener("click", () => {
if (!correctData()) {
return;
}
if (!validate()) {
return;
}
let dealModel = {
"Id": currentDeal.id,
"Subject": currentDeal.subject,
@ -88,10 +86,10 @@ const addAndRemoveFromList = (row) => {
var index = dataArray.indexOf(contracts.find(x => x.id === id));
if (index === -1) {
dataArray.push(contracts.find(x => x.id === id));
row.classList.add("bg-primary");
row.classList.add("bg-info");
} else {
dataArray.splice(index, 1);
row.classList.remove("bg-primary");
row.classList.remove("bg-info");
}
console.log(dataArray);
}

View File

@ -3,6 +3,8 @@ const subjectInput = document.getElementById("subject-input");
const responsibilitiesInput = document.getElementById("responsibilities-input");
const dateInput = document.getElementById("date-input");
const tbody = document.getElementById("scrollable-table__tbody")
const errorP = document.getElementById("error-p");
const errorDivShell = document.getElementById("error-div-shell");
var cases = [];
var dataArray = [];
@ -34,6 +36,30 @@ window.addEventListener("load", async () => {
}
});
const correctData = function () {
return true;
};
const validate = function () {
if (subjectInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Предмет договора'";
return false;
}
if (responsibilitiesInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Обязаности'";
return false;
}
if (dataArray.length === 0) {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните список 'Дел'";
return false;
}
return true;
};
createBtn.addEventListener("click", () => {
if (!correctData()) {
return;
@ -41,19 +67,7 @@ createBtn.addEventListener("click", () => {
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
};
const validate = function () {
return true;
};
createBtn.addEventListener("click", () => {
let dealModel = {
"Subject": subjectInput.value,
"Responsibilities": responsibilitiesInput.value,
@ -77,10 +91,10 @@ const addAndRemoveFromList = (row) => {
var index = dataArray.indexOf(cases.find(x => x.id === id));
if (index === -1) {
dataArray.push(cases.find(x => x.id === id));
row.classList.add("bg-primary");
row.classList.add("bg-info");
} else {
dataArray.splice(index, 1);
row.classList.remove("bg-primary");
row.classList.remove("bg-info");
}
console.log(dataArray);
}

View File

@ -3,6 +3,8 @@ const subjectInput = document.getElementById("subject-input");
const responsibilitiesInput = document.getElementById("responsibilities-input");
const dateInput = document.getElementById("date-input");
const dealId = document.getElementById("vb-id").dataset.id;
const errorP = document.getElementById("error-p");
const errorDivShell = document.getElementById("error-div-shell");
const formatDate = (dateString) => {
const date = new Date(dateString);
@ -28,15 +30,6 @@ window.addEventListener("load", async () => {
}
});
updateBtn.addEventListener("click", () => {
if (!correctData()) {
return;
}
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
@ -44,10 +37,32 @@ const correctData = function () {
const validate = function () {
if (subjectInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Предмет договора'";
return false;
}
if (responsibilitiesInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Обязаности'";
return false;
}
if (dataArray.length === 0) {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните список 'Дел'";
return false;
}
return true;
};
updateBtn.addEventListener("click", () => {
if (!correctData()) {
return;
}
if (!validate()) {
return;
}
let dealModel = {
"Id": parseInt(dealId),
"Subject": subjectInput.value,

View File

@ -2,6 +2,8 @@
const informationInput = document.getElementById("information-input");
const dateInput = document.getElementById("date-input");
const caseSelect = document.getElementById("case-select");
const errorP = document.getElementById("error-p");
const errorDivShell = document.getElementById("error-div-shell");
var cases = [];
@ -26,6 +28,20 @@ window.addEventListener("load", async () => {
}
});
const correctData = function () {
return true;
};
const validate = function () {
if (informationInput.value === "") {
errorDivShell.style.gridTemplateRows = "1fr";
errorP.innerHTML = "Заполните поле 'Информация по слушанию'";
return false;
}
return true;
};
createBtn.addEventListener("click", () => {
if (!correctData()) {
return;
@ -33,19 +49,7 @@ createBtn.addEventListener("click", () => {
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
};
const validate = function () {
return true;
};
createBtn.addEventListener("click", () => {
let hearingModel = {
"Information": informationInput.value,
"CaseId": parseInt(caseSelect.value),

View File

@ -3,6 +3,8 @@ const informationInput = document.getElementById("information-input");
const dateInput = document.getElementById("date-input");
const caseSelect = document.getElementById("case-select");
const hearingId = document.getElementById("vb-id").dataset.id;
const errorP = document.getElementById("error-p");
const errorDivShell = document.getElementById("error-div-shell");
var cases = [];
@ -43,15 +45,6 @@ window.addEventListener("load", async () => {
}
});
updateBtn.addEventListener("click", () => {
if (!correctData()) {
return;
}
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
@ -63,6 +56,13 @@ const validate = function () {
};
updateBtn.addEventListener("click", () => {
if (!correctData()) {
return;
}
if (!validate()) {
return;
}
let hearingModel = {
"Id": parseInt(hearingId),
"Information": informationInput.value,

View File

@ -82,10 +82,10 @@ const addAndRemoveFromList = (row) => {
var index = dataArray.indexOf(cases.find(x => x.id === id));
if (index === -1) {
dataArray.push(cases.find(x => x.id === id));
row.classList.add("bg-primary");
row.classList.add("bg-info");
} else {
dataArray.splice(index, 1);
row.classList.remove("bg-primary");
row.classList.remove("bg-info");
}
console.log(dataArray);
}