40 lines
971 B
JavaScript
40 lines
971 B
JavaScript
|
const createBtn = document.getElementById("create-button");
|
|||
|
const informationInput = document.getElementById("information-input");
|
|||
|
const dateInput = document.getElementById("date-input");
|
|||
|
const caseSelect = document.getElementById("case-select");
|
|||
|
|
|||
|
createBtn.addEventListener("click", () => {
|
|||
|
if (!correctData()) {
|
|||
|
return;
|
|||
|
}
|
|||
|
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),
|
|||
|
"Date": new Date(dateInput.value)
|
|||
|
};
|
|||
|
console.log(dealModel)
|
|||
|
$.ajax({
|
|||
|
url: "/hearing/create",
|
|||
|
type: "POST",
|
|||
|
contentType: "application/json",
|
|||
|
data: JSON.stringify(hearingModel)
|
|||
|
}).done(() => {
|
|||
|
window.location.href = "/Home/Hearings";
|
|||
|
});
|
|||
|
});
|