Skip to content

Commit

Permalink
Update files to make it ready to deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamal-SaadEddin committed Sep 22, 2023
1 parent 43e4e5d commit 68ba91a
Show file tree
Hide file tree
Showing 4 changed files with 241 additions and 20 deletions.
135 changes: 127 additions & 8 deletions Frontend/javascript/companyHomePage/companyHomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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) =>
Expand All @@ -74,7 +190,7 @@ async function showOffers() {
$${offer.overheadPriceExpress}
</td>
<td>
${offer.timeDeliverExpress}
${offer.timeDeliverExpress} days
</td>
<td>
$${offer.overheadPriceVillage}
Expand Down Expand Up @@ -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;
}
22 changes: 20 additions & 2 deletions Frontend/javascript/orderPageInfo/orderPageInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
98 changes: 90 additions & 8 deletions Frontend/javascript/showRequet/showRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `
<div class="oval">
<div class="table">
<table id="myTable">
Expand Down Expand Up @@ -46,8 +128,8 @@ window.onload = function () {
</div>
</div>
`;
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));
};
6 changes: 4 additions & 2 deletions Frontend/pages/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
)
.catch(Error => {
console.log(Error)
window.location.replace("/Frontend/pages/companyHomePage.html");
})
}
</script>
Expand All @@ -131,11 +132,12 @@ <h1>Sign in to Waslni</h1>
</div>
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">Email address</label>
<input type="email" class="form-control SignInput" id="exampleInputEmail1" aria-describedby="emailHelp">
<input type="email" class="form-control SignInput" id="exampleInputEmail1" aria-describedby="emailHelp"
value="admin@waslni.com">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Password</label>
<input type="password" class="form-control SignInput" id="exampleInputPassword1">
<input type="password" class="form-control SignInput" id="exampleInputPassword1" value="waslni123456">
</div>
<div class="mb-3">
<div style="padding-bottom: 5px;">Don't have account ?</div>
Expand Down

0 comments on commit 68ba91a

Please sign in to comment.