40 lines
976 B
JavaScript
40 lines
976 B
JavaScript
|
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";
|
|||
|
});
|
|||
|
});
|