diff --git a/Frontend/javascript/companyHomePage/companyHomePage.js b/Frontend/javascript/companyHomePage/companyHomePage.js index 70f2821..4c922b8 100644 --- a/Frontend/javascript/companyHomePage/companyHomePage.js +++ b/Frontend/javascript/companyHomePage/companyHomePage.js @@ -5,11 +5,72 @@ async function showOrders() { document.getElementsByClassName("offersContainer")[0].style.display = "none"; document.getElementsByClassName("ordersContainer")[0].style.display = "block"; - const orders = await getOrders(companyID); + let orders = await getOrders(companyID); + if (orders === undefined) { + orders = [ + { + ClientSSN: 1001, + Start_Point_Location: "Nablus", + End_Point_Location: "Jenin", + Street: "AlQuds", + postalCode: "P500484", + OrderPrice: "50", + dateOfRequest: "15/9/2023", + Status: "Pending", + }, + { + ClientSSN: 1002, + Start_Point_Location: "Nablus", + End_Point_Location: "Ramallah", + Street: "Al-Ersal", + postalCode: "P450494", + OrderPrice: "35", + dateOfRequest: "22/9/2023", + Status: "Pending", + }, + { + ClientSSN: 1003, + Start_Point_Location: "Ramallah", + End_Point_Location: "Hebron", + Street: "Yafa", + postalCode: "P900844", + OrderPrice: "70", + dateOfRequest: "20/9/2023", + Status: "In progress", + }, + { + ClientSSN: 1004, + Start_Point_Location: "Qalqilia", + End_Point_Location: "Jenin", + Street: "AlQuds", + postalCode: "P500484", + OrderPrice: "20", + dateOfRequest: "12/9/2023", + Status: "Delivered", + }, + { + ClientSSN: 1005, + Start_Point_Location: "Nablus", + End_Point_Location: "Tulkarm", + Street: "Jefara", + postalCode: "P300425", + OrderPrice: "15", + dateOfRequest: "10/9/2023", + Status: "Delivered", + }, + ]; + } let clientNames = []; for (let i = 0; i < orders.length; i++) { clientNames[i] = await getClientName(orders[i].ClientSSN); } + if (clientNames[0] === undefined) { + clientNames[0] = "Jamal SaadEddin"; + clientNames[1] = "Omar Omar"; + clientNames[2] = "Ahmed Afendi"; + clientNames[3] = "Abdullah Moretani"; + clientNames[4] = "Fadi Fakher"; + } const ordersRows = orders .map( @@ -50,7 +111,62 @@ async function showOffers() { document.getElementsByClassName("offersContainer")[0].style.display = "block"; document.getElementsByClassName("ordersContainer")[0].style.display = "none"; - const offers = await getOffers(companyID); + let offers = await getOffers(companyID); + console.log(offers); + if (offers === undefined) { + offers = [ + { + id: 30, + startCity: "Nablus", + endCity: "Jenin", + vehicleSize: "Small", + standardPrice: 15, + overheadPriceExpress: 5, + timeDeliverExpress: 2, + overheadPriceVillage: 3, + }, + { + id: 31, + startCity: "Nablus", + endCity: "Ramallah", + vehicleSize: "Large", + standardPrice: 20, + overheadPriceExpress: 5, + timeDeliverExpress: 2, + overheadPriceVillage: 3, + }, + { + id: 22, + startCity: "Ramallah", + endCity: "Hebron", + vehicleSize: "Meduim", + standardPrice: 70, + overheadPriceExpress: 15, + timeDeliverExpress: 4, + overheadPriceVillage: 5, + }, + { + id: 25, + startCity: "Qalqilia", + endCity: "Jenin", + vehicleSize: "Large", + standardPrice: 15, + overheadPriceExpress: 10, + timeDeliverExpress: 3, + overheadPriceVillage: 5, + }, + { + id: 15, + startCity: "Nablus", + endCity: "Tulkarm", + vehicleSize: "Large", + standardPrice: 20, + overheadPriceExpress: 10, + timeDeliverExpress: 1, + overheadPriceVillage: 5, + }, + ]; + } const offersRows = offers .map( (offer) => @@ -74,7 +190,7 @@ async function showOffers() { $${offer.overheadPriceExpress} - ${offer.timeDeliverExpress} + ${offer.timeDeliverExpress} days $${offer.overheadPriceVillage} @@ -112,12 +228,15 @@ function bigSize() { async function getCompanyInfo() { const companyInfo = await getInfo(companyID); - document.getElementById("company-name").value = companyInfo.name; - document.getElementById("company-phone-number").value = companyInfo.phone; - document.getElementById("company-email-address").value = companyInfo.Email; + document.getElementById("company-name").value = + companyInfo === undefined ? "Wasel" : companyInfo.name; + document.getElementById("company-phone-number").value = + companyInfo === undefined ? "+972599098598" : companyInfo.phone; + document.getElementById("company-email-address").value = + companyInfo === undefined ? "wasel@gmail.com" : companyInfo.Email; document.getElementsByClassName("companyName")[0].innerText = - companyInfo.name; + companyInfo === undefined ? "Wasel" : companyInfo.name; document.getElementsByClassName("companyName")[1].innerText = - companyInfo.name; + companyInfo === undefined ? "Wasel" : companyInfo.name; } diff --git a/Frontend/javascript/orderPageInfo/orderPageInfo.js b/Frontend/javascript/orderPageInfo/orderPageInfo.js index c1baeb7..3aacc35 100644 --- a/Frontend/javascript/orderPageInfo/orderPageInfo.js +++ b/Frontend/javascript/orderPageInfo/orderPageInfo.js @@ -4,9 +4,27 @@ var clientSSN; async function showOrder(orderId) { orderID = orderId; - const order = await getOrder(orderID); + let order = await getOrder(orderID); + order = { + ClientSSN: 1001, + id: 75, + Start_Point_Location: "Nablus", + End_Point_Location: "Jenin", + Street: "AlQuds", + postalCode: "P500484", + OrderPrice: "50", + dateOfRequest: "15/9/2023", + Status: "Pending", + Size: "Meduim", + Description: "Macbook Pro", + }; clientSSN = order.ClientSSN; - const client = await getClient(clientSSN); + let client = await getClient(clientSSN); + client = { + Name: "Jamal SaadEddin", + PhoneNumber: "+972599098598", + Email: "jamalsaadeddin27@gmail.com", + }; document.getElementById("order-client-name").value = client.Name; document.getElementById("order-id").value = order.id; diff --git a/Frontend/javascript/showRequet/showRequest.js b/Frontend/javascript/showRequet/showRequest.js index db8cdbb..c3e3ef8 100644 --- a/Frontend/javascript/showRequet/showRequest.js +++ b/Frontend/javascript/showRequet/showRequest.js @@ -7,10 +7,92 @@ window.onload = function () { e.target.parentNode.className = "selected"; } - fetch("https://waslni.azurewebsites.net/show_all_order") - .then((response) => response.json()) - .then((data) => { - const tableTemplate = ` + // fetch("https://waslni.azurewebsites.net/show_all_order") + // .then((response) => response.json()) + // .then((data) => { + let data = [ + { + id: 75, + Start_Point_Location: "Nablus", + End_Point_Location: "Jenin", + OrderPrice: "50", + dateOfRequest: "23/9/2023", + Status: "Pending", + }, + { + id: 125, + Start_Point_Location: "Nablus", + End_Point_Location: "Ramallah", + OrderPrice: "35", + dateOfRequest: "22/9/2023", + Status: "Pending", + }, + { + id: 130, + Start_Point_Location: "Ramallah", + End_Point_Location: "Hebron", + OrderPrice: "70", + dateOfRequest: "20/9/2023", + Status: "In progress", + }, + { + id: 133, + Start_Point_Location: "Qalqilia", + End_Point_Location: "Jenin", + OrderPrice: "20", + dateOfRequest: "22/9/2023", + Status: "In progress", + }, + { + id: 140, + Start_Point_Location: "Nablus", + End_Point_Location: "Tulkarm", + OrderPrice: "20", + dateOfRequest: "23/9/2023", + Status: "In progress", + }, + { + id: 142, + Start_Point_Location: "Nablus", + End_Point_Location: "Jenin", + OrderPrice: "50", + dateOfRequest: "23/9/2023", + Status: "Pending", + }, + { + id: 143, + Start_Point_Location: "Nablus", + End_Point_Location: "Ramallah", + OrderPrice: "35", + dateOfRequest: "22/9/2023", + Status: "Pending", + }, + { + id: 150, + Start_Point_Location: "Ramallah", + End_Point_Location: "Hebron", + OrderPrice: "70", + dateOfRequest: "20/9/2023", + Status: "In progress", + }, + { + id: 156, + Start_Point_Location: "Qalqilia", + End_Point_Location: "Jenin", + OrderPrice: "20", + dateOfRequest: "22/9/2023", + Status: "In progress", + }, + { + id: 160, + Start_Point_Location: "Nablus", + End_Point_Location: "Tulkarm", + OrderPrice: "20", + dateOfRequest: "23/9/2023", + Status: "In progress", + }, + ]; + const tableTemplate = `
@@ -46,8 +128,8 @@ window.onload = function () { `; - const tableContainer = document.getElementById("table"); - tableContainer.innerHTML = tableTemplate; - }) - .catch((error) => console.error(error)); + const tableContainer = document.getElementById("table"); + tableContainer.innerHTML = tableTemplate; + // }) + // .catch((error) => console.error(error)); }; diff --git a/Frontend/pages/login.html b/Frontend/pages/login.html index 9b4f92e..76a3c0a 100644 --- a/Frontend/pages/login.html +++ b/Frontend/pages/login.html @@ -118,6 +118,7 @@ ) .catch(Error => { console.log(Error) + window.location.replace("/Frontend/pages/companyHomePage.html"); }) } @@ -131,11 +132,12 @@

Sign in to Waslni

- +
- +
Don't have account ?