Case_accounting/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Contracts/contract-create.js

40 lines
948 B
JavaScript
Raw Normal View History

const createBtn = document.getElementById("create-button");
const serviceInput = document.getElementById("service-input")
const coastInput = document.getElementById("coast-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 contract = {
"Service": serviceInput.value,
"Coast": parseFloat(coastInput.value),
"Date": new Date(dateInput.value),
};
console.log(contract)
$.ajax({
url: "/contracts/create",
type: "POST",
contentType: "application/json",
data: JSON.stringify(contract)
}).done(() => {
window.location.href = "/Home/Contracts";
});
});