Case_accounting/CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deal-create.js

40 lines
976 B
JavaScript
Raw Normal View History

const createBtn = document.getElementById("create-button");
const subjectInput = document.getElementById("subject-input");
const responsibilitiesInput = document.getElementById("responsibilities-input");
const dateInput = document.getElementById("date-input");
createBtn.addEventListener("click", () => {
if (!correctData()) {
return;
}
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
};
const validate = function () {
return true;
};
createBtn.addEventListener("click", () => {
let dealModel = {
"Subject": subjectInput.value,
"Responsibilities": responsibilitiesInput.value,
"Date": new Date(dateInput.value)
};
console.log(dealModel)
$.ajax({
url: "/deal/create",
type: "POST",
contentType: "application/json",
data: JSON.stringify(dealModel)
}).done(() => {
window.location.href = "/Home/Deals";
});
});