From d01c31e28d97286b544c50274e3b143c7f5a9c4c Mon Sep 17 00:00:00 2001
From: DevSoni2022 <121338813+DevSoni2022@users.noreply.github.com>
Date: Sat, 23 Sep 2023 10:00:35 +0530
Subject: [PATCH 1/9] lift sim WIP
---
src/index.html | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/index.html b/src/index.html
index e69de29b..d2da568f 100644
--- a/src/index.html
+++ b/src/index.html
@@ -0,0 +1,21 @@
+
+
+
+
+
+ Lift Simulation
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From 000292e6ee6f0f122e605cc150bd46af319ec4f1 Mon Sep 17 00:00:00 2001
From: DevSoni2022 <121338813+DevSoni2022@users.noreply.github.com>
Date: Sat, 23 Sep 2023 10:05:52 +0530
Subject: [PATCH 2/9] js
---
src/js/main.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/js/main.js b/src/js/main.js
index e69de29b..c09904c2 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -0,0 +1,6 @@
+
+const body1 = document.querySelector("body")
+
+const button1 = document.querySelector(".formButton");
+const input1 = document.querySelector(".input1")
+const input2 = document.querySelector(".input2")
From e53096f30155cee4f9368d1a0e85f416bdfe2f18 Mon Sep 17 00:00:00 2001
From: DevSoni2022 <121338813+DevSoni2022@users.noreply.github.com>
Date: Sat, 23 Sep 2023 10:08:25 +0530
Subject: [PATCH 3/9] fix
---
src/css/main.css | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/css/main.css b/src/css/main.css
index e69de29b..0a268058 100644
--- a/src/css/main.css
+++ b/src/css/main.css
@@ -0,0 +1,9 @@
+.flexClass{
+ margin: auto;
+ align-items: center;
+ text-align: center;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+
+}
From 16fbe5b45fab231992a819903014c2bd061aab9a Mon Sep 17 00:00:00 2001
From: DevSoni2022 <121338813+DevSoni2022@users.noreply.github.com>
Date: Sat, 23 Sep 2023 21:04:24 +0530
Subject: [PATCH 4/9] lift simulation
---
src/css/main.css | 173 +++++
src/index.html | 3 +
src/js/main.js | 334 ++++++++
src/popular_v1.svg | 1821 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 2331 insertions(+)
create mode 100644 src/popular_v1.svg
diff --git a/src/css/main.css b/src/css/main.css
index 0a268058..ea516e59 100644
--- a/src/css/main.css
+++ b/src/css/main.css
@@ -1,3 +1,8 @@
+*{
+ margin: 0;
+ padding: 0;
+ font-family: 'Roboto', sans-serif;
+}
.flexClass{
margin: auto;
align-items: center;
@@ -7,3 +12,171 @@
gap: 10px;
}
+
+.btn{
+ font-weight:600
+}
+form{
+ border: 0.2rem black solid;
+ padding: 2rem;
+}
+
+#myDiv{
+ background-color: #000;
+ padding-top: 2rem;
+
+}
+
+
+body{
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+}
+
+
+section{
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ border: 1px solid black;
+}
+
+
+.floors{
+ border-bottom: 0.1rem black solid;
+ display: flex;
+ flex-direction: row;
+ justify-content: flex-start;
+ height: 99px;
+ z-index: 2;
+
+}
+
+.lift{
+ width: 50px;
+ height: 80px;
+ display: flex;
+ flex-direction: row;
+ background-color: #00b5b7
+}
+
+@media screen and (max-width: 1000px){
+ .lift{
+ width: 25px;
+ height: 40px;
+ display: flex;
+ flex-direction: row;
+ background-color: #00b5b7
+ }
+
+
+}
+
+.upAndDown{
+ display: flex;
+ flex-direction: column;
+ margin: 1rem;
+ width: 5rem;
+ justify-content: space-around;
+ width: 10%;
+}
+
+
+
+.liftContainer{
+ width: 100%;
+ display: flex;
+ flex-direction: row;
+ justify-content: space-evenly;
+ align-items: flex-end;
+ background-image: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);}
+/* */
+
+
+.floorName{
+
+ margin: 1rem;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ width: 4rem;
+ font-weight: 600;
+
+}
+
+@media screen and (max-width:1000px) {
+ .floorName{
+
+ margin: 1rem;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ width: 1rem;
+ font-size: 10px;
+
+
+
+ }
+
+}
+
+.door-left{
+ border: 1px black solid;
+ width: 50%;
+ height: 100%;
+ background-color: #000;
+}
+
+
+
+
+.door-right{
+ /* border: 1px black solid; */
+ width: 50%;
+ height: 100%;
+ background-color: #000;
+ /* animation: slideRight 4s ; */
+ /* background-color: blue; */
+
+
+}
+
+
+
+.backbutton{
+ width: 100%;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ padding: 1rem;
+}
+
+button{
+ border: 1px solid #20262e;
+ border-radius: 4px;
+ color: #080a08;
+ line-height: 18px;
+ cursor: pointer;
+ margin: 2px;
+ width: 110px;
+ height: 35px;
+ display: -moz-box;
+ display: flex;
+ -moz-box-align: center;
+ align-items: center;
+ -moz-box-pack: center;
+ justify-content: center;
+ text-align: center;
+ background-color: #20262e;
+ color: #fff;
+}
+
+
+.backbut{
+ height: 2rem;
+}
\ No newline at end of file
diff --git a/src/index.html b/src/index.html
index d2da568f..da3155b0 100644
--- a/src/index.html
+++ b/src/index.html
@@ -5,6 +5,9 @@
Lift Simulation
+
+
+
diff --git a/src/js/main.js b/src/js/main.js
index c09904c2..ee042035 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -4,3 +4,337 @@ const body1 = document.querySelector("body")
const button1 = document.querySelector(".formButton");
const input1 = document.querySelector(".input1")
const input2 = document.querySelector(".input2")
+
+
+button1.addEventListener('click',(event)=>{
+
+ const numberOfFloors = parseInt(input1.value);
+ const numberOfLifts = parseInt(input2.value);
+ if(inputValidation(numberOfFloors,numberOfLifts)){
+ loadpage(numberOfFloors,numberOfLifts)
+ const bb = document.querySelector('body');
+ const form = document.querySelector(".flexClass");
+ form.style.display = "none"
+
+ }
+
+ event.preventDefault();
+
+
+})
+
+
+//**************************layout begins***********************
+
+
+function loadpage(numberOfFloors, numberOfLifts){
+
+ const section1 = document.createElement("SECTION");
+ section1.setAttribute("id","layoutDiv");
+ const body2 = document.querySelector("body");
+
+ const bbdiv = document.createElement("div");
+ body2.appendChild(bbdiv);
+
+ const backButton = document.createElement("BUTTON");
+ backButton.textContent = "Reset";
+ backButton.setAttribute("class","backbut");
+ bbdiv.appendChild(backButton)
+ bbdiv.setAttribute("class","backbutton")
+
+ body2.appendChild(section1);
+
+ for(let i = numberOfFloors; i >=1;i-- ){
+ const floor = document.createElement("div"); //creating floor
+ section1.appendChild(floor); //appending floor to section
+ floor.setAttribute("class","floors");
+ floor.setAttribute("data-floorNo",i); //setting the class for the floors
+
+ const upAndDown = document.createElement("div") //creating a upAndDown div for the floor
+ upAndDown.setAttribute("class","upAndDown") //setting the class for the upAnd Down div where the buttons will go
+ floor.appendChild(upAndDown); //appending the upAndDown div for the floor
+
+
+ if(i == numberOfFloors) //if floor is the top floor, which it will be because we start
+ { //the loop from top floor and we need only one down button
+ const buttonDown = document.createElement("BUTTON");
+ buttonDown.textContent = "Down";
+ buttonDown.setAttribute("class","Btn");
+ buttonDown.setAttribute("data-assigned","false");
+ floor.setAttribute("data-liftAssigned","false")
+ buttonDown.setAttribute("data-buttonFloor",i);
+ buttonDown.addEventListener("click",callingLift);
+ upAndDown.appendChild(buttonDown);
+ }
+ else if(i == 1 ) // if floor is ground floor, we only need the up button
+ {
+ const buttonUp = document.createElement("BUTTON");
+ buttonUp.textContent = "Up";
+ buttonUp.setAttribute("class","Btn");
+ buttonUp.setAttribute("data-buttonFloor",i);
+ buttonUp.setAttribute("data-assigned","true");
+ buttonUp.addEventListener("click",callingLift);
+ floor.setAttribute("data-liftAssigned","true");
+ upAndDown.appendChild(buttonUp);
+ }
+ else
+ { // in all other cases we need 2 buttons
+ const buttonUp = document.createElement("BUTTON");
+ buttonUp.setAttribute("class","Btn");
+ buttonUp.setAttribute("data-buttonFloor",i);
+ buttonUp.addEventListener("click",callingLift);
+ // buttonUp.setAttribute("data-assigned","false");
+ const buttonDown = document.createElement("BUTTON");
+ buttonDown.setAttribute("class","Btn");
+ buttonDown.setAttribute("data-buttonFloor",i);
+ buttonDown.setAttribute("data-assigned","false");
+ buttonDown.addEventListener("click",callingLift);
+ buttonUp.textContent = "Up";
+ buttonDown.textContent = "Down";
+ upAndDown.appendChild(buttonUp);
+ upAndDown.appendChild(buttonDown);
+ }
+
+ const liftContainer = document.createElement("div");
+ liftContainer.setAttribute("class","liftContainer")
+ floor.appendChild(liftContainer);
+
+
+ const fn = document.createElement("div");
+ fn.setAttribute("class","floorName");
+ fn.textContent = "Floor"
+ floor.appendChild(fn);
+ fno = document.createElement("div");
+ fno.textContent = i;
+ fn.appendChild(fno);
+
+
+ if(i == 1)
+ {
+ for(let j = 1; j <= numberOfLifts;j++ )
+ {
+ const lift = document.createElement("div");
+ lift.setAttribute("class","lift");
+ lift.setAttribute("data-liftno",j);
+ lift.setAttribute("data-liftfloor",i);
+ lift.setAttribute("data-liftAvailability","Available");
+ liftContainer.appendChild(lift);
+
+ const door1 = document.createElement("div");
+ const door2 = document.createElement("div");
+ door1.setAttribute("class","door-left");
+ door2.setAttribute("class","door-right");
+ lift.appendChild(door1);
+ lift.appendChild(door2);
+
+
+ }
+ }
+
+ }
+
+
+ //------Reset Button Click---------
+ backButton.addEventListener('click',()=>{
+ const bb = document.querySelector('body');
+ bb.removeChild(section1);
+ const form = document.querySelector(".flexClass");
+ const input1 = document.querySelector(".input1")
+ const input2 = document.querySelector(".input2")
+ input1.value = '';
+ input2.value = '';
+ form.style.display = "block";
+ backButton.style.display = "none";
+ });
+}
+
+
+let liftRequest = []; // this stores the floor numbers of the button where the lifts are called in a queue
+
+let liftAvail = []; // shows the availability of the lifts, the size of this changes according to the number of lifts available
+
+let currentOccupiedFloors = []; // shows on which floors are the lifts available currently
+
+let currentClick = [];
+
+function LiftStatus(Array){
+
+ for(let i = 0; i < Array.length; i++)
+ {
+ let status = Array[i].getAttribute("data-liftAvailability");
+ if(status == "Available"){
+ return i;
+ }
+ }
+
+}
+
+function checkingAllBusy(Array){
+
+ for(let i = 0; i < Array.length; i++)
+ {
+ let status = Array[i].getAttribute("data-liftAvailability");
+ if(status == "Available"){
+ return false;
+ }
+ }
+ return true;
+}
+
+function closestLift(buttonFloor,Array){
+ let cL;
+ let minDistance = Infinity;
+ for(let i = 0; i< Array.length; i++)
+ {
+ diffInFloors = 0;
+ if(Array[i].getAttribute("data-liftAvailability") == "Available"){
+ let floorOccupiedByLift = Array[i].getAttribute("data-liftfloor");
+ let diffInFloors = Math.abs(buttonFloor-floorOccupiedByLift);
+ if(minDistance > diffInFloors){
+ cL = i;
+ minDistance = diffInFloors;
+ }
+ }
+ }
+ return cL;
+};
+
+
+const callingLift = (event)=>{
+
+
+ const buttonClicked = event.target;
+
+ const buttonFloor = buttonClicked.getAttribute("data-buttonFloor");
+
+ if(currentClick.includes(buttonFloor))
+ {
+ return;
+ }
+
+ currentClick.push(buttonFloor);
+ console.log("clicked floors are",currentClick)
+
+
+ console.log("According to new fn floor clicked is ",buttonFloor);
+
+ const liftObject = document.querySelectorAll('.lift');
+ let liftArray = Array.from(liftObject);
+ // console.log(liftArray)
+ // LiftStatus(liftArray)
+ // let AvailableLift = LiftStatus(liftArray);
+ let AvailableLift = closestLift(buttonFloor,liftArray);
+ console.log("available closest lift = ",AvailableLift);
+ // console.log("Available lift is", LiftStatus(liftArray));
+ // console.log(typeof(AvailableLift))
+ if(checkingAllBusy(liftArray))
+ {
+ console.log("all lifts are busy");
+ if(!liftRequest.includes(parseInt(buttonFloor))){
+ liftRequest.push(parseInt(buttonFloor));
+ }
+
+ console.log(liftRequest);
+ }
+ else{
+
+ movingLift(buttonFloor,AvailableLift);
+ }
+
+
+
+}
+
+
+const movingLift = (floorCalled, AvailableLift)=>{
+
+ const liftObject = document.querySelectorAll('.lift');
+ let liftArray = Array.from(liftObject);
+
+ const currentfloor = liftArray[AvailableLift].getAttribute("data-liftfloor");
+
+ const floorDiff = Math.abs(floorCalled - currentfloor);
+
+ setTimeout(() => {
+ liftArray[AvailableLift].setAttribute("data-liftAvailability", "busy");
+ liftArray[AvailableLift].style.transition = `transform ${floorDiff * 2}s ease-in-out`;
+ liftArray[AvailableLift].style.transform = `translateY(${-(floorCalled - 1) * 100}px)`;
+ liftArray[AvailableLift].setAttribute("data-liftfloor", floorCalled);
+ }, 0);
+
+ setTimeout(() => {
+ openDoors(liftArray, AvailableLift);
+ }, floorDiff * 2000);
+
+ setTimeout(() => {
+ closeDoors(liftArray, AvailableLift);
+ // liftArray[l].setAttribute("data-liftAvailability", "Available");
+ }, floorDiff * 2000 + 2500);
+ setTimeout(()=>{
+ liftArray[AvailableLift].setAttribute("data-liftAvailability", "Available");
+ if(liftRequest.length !== 0 ){
+ const consequentRequest = liftRequest[0];
+ movingLift(consequentRequest,AvailableLift);
+ liftRequest.shift();
+ console.log(liftRequest);
+ }
+ currentClick.shift();
+ },(floorDiff*2000)+5000)
+
+
+}
+
+function openDoors(liftArray,l){
+ liftArray[l].children[0].style.transform=`translateX(${-100}%)`;
+ liftArray[l].children[1].style.transform=`translateX(${100}%)`;
+ liftArray[l].children[0].style.transition=`transform 2.5s`;
+ liftArray[l].children[1].style.transition=`transform 2.5s`;
+}
+
+function closeDoors(liftArray,l){
+ const floorNumber = parseInt(liftArray[l].getAttribute("data-liftfloor"));
+ liftArray[l].removeAttribute("data-assigned");
+ liftArray[l].children[0].style.transform=`translateX(${0}%)`;
+ liftArray[l].children[1].style.transform=`translateX(${0}%)`;
+ liftArray[l].children[0].style.transition=`transform 2.5s`;
+}
+
+
+
+
+
+const inputValidation = (floorCount, liftCount) => {
+ if (isNaN(floorCount) || isNaN(liftCount) || floorCount === "" || liftCount === "") {
+ alert("Input cannot be empty");
+ return false;
+ } else if (floorCount % 1 !== 0 || liftCount % 1 !== 0) {
+ alert("Numbers should be whole (non-decimal) values");
+ return false;
+ }
+ else if (window.innerWidth <= 1000 && liftCount > 3) {
+ alert("On mobile, for flawless experience, number of lifts should be 3 or less");
+ return false;
+ }else if (window.innerWidth <= 1000 && floorCount > 5) {
+ alert("On mobile, for flawless experience, number of floors should be 5 or less");
+ return false;
+ } else if (window.innerWidth > 1000 && liftCount > 10) {
+ alert("On desktop,for flawless experience, number of lifts should be 10 or less");
+ return false;
+ } else {
+ return true;
+ }
+};
+
+
+
+
+function adjustPlaceholderText() {
+ const input1 = document.querySelector('.input1');
+ const input2 = document.querySelector('.input2');
+ const isMobile = window.innerWidth <= 1000; // Adjust the breakpoint to 1000px
+
+}
+
+adjustPlaceholderText();
+
+window.addEventListener('resize', adjustPlaceholderText);
diff --git a/src/popular_v1.svg b/src/popular_v1.svg
new file mode 100644
index 00000000..6f36e4d9
--- /dev/null
+++ b/src/popular_v1.svg
@@ -0,0 +1,1821 @@
+
From c0bea64206fa1a4ef8d6d61f0523f03ebfdbb7da Mon Sep 17 00:00:00 2001
From: DevSoni2022 <121338813+DevSoni2022@users.noreply.github.com>
Date: Sat, 23 Sep 2023 21:07:53 +0530
Subject: [PATCH 5/9] un used
---
src/css/main.css | 30 ------------------------------
1 file changed, 30 deletions(-)
diff --git a/src/css/main.css b/src/css/main.css
index ea516e59..1977b4e4 100644
--- a/src/css/main.css
+++ b/src/css/main.css
@@ -42,8 +42,6 @@ section{
width: 100%;
border: 1px solid black;
}
-
-
.floors{
border-bottom: 0.1rem black solid;
display: flex;
@@ -51,9 +49,7 @@ section{
justify-content: flex-start;
height: 99px;
z-index: 2;
-
}
-
.lift{
width: 50px;
height: 80px;
@@ -70,10 +66,7 @@ section{
flex-direction: row;
background-color: #00b5b7
}
-
-
}
-
.upAndDown{
display: flex;
flex-direction: column;
@@ -82,9 +75,6 @@ section{
justify-content: space-around;
width: 10%;
}
-
-
-
.liftContainer{
width: 100%;
display: flex;
@@ -92,11 +82,7 @@ section{
justify-content: space-evenly;
align-items: flex-end;
background-image: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);}
-/* */
-
-
.floorName{
-
margin: 1rem;
display: flex;
flex-direction: column;
@@ -104,12 +90,10 @@ section{
justify-content: center;
width: 4rem;
font-weight: 600;
-
}
@media screen and (max-width:1000px) {
.floorName{
-
margin: 1rem;
display: flex;
flex-direction: column;
@@ -117,11 +101,7 @@ section{
justify-content: center;
width: 1rem;
font-size: 10px;
-
-
-
}
-
}
.door-left{
@@ -135,18 +115,10 @@ section{
.door-right{
- /* border: 1px black solid; */
width: 50%;
height: 100%;
background-color: #000;
- /* animation: slideRight 4s ; */
- /* background-color: blue; */
-
-
}
-
-
-
.backbutton{
width: 100%;
display: flex;
@@ -175,8 +147,6 @@ button{
background-color: #20262e;
color: #fff;
}
-
-
.backbut{
height: 2rem;
}
\ No newline at end of file
From 6be077c093abb0c9b57b3dde8e04814f2f6eeaa1 Mon Sep 17 00:00:00 2001
From: DevSoni2022 <121338813+DevSoni2022@users.noreply.github.com>
Date: Sun, 24 Sep 2023 14:49:12 +0530
Subject: [PATCH 6/9] css changes
---
src/css/main.css | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/css/main.css b/src/css/main.css
index 1977b4e4..7075fbdf 100644
--- a/src/css/main.css
+++ b/src/css/main.css
@@ -10,9 +10,13 @@
display: flex;
flex-direction: column;
gap: 10px;
-
+ position: relative;
}
+form{
+ position: absolute !important;
+ transform: translate(-50%, 50%);
+}
.btn{
font-weight:600
}
From 7ff2a1348a5186eb6a3eb797cd52e4bb86148d59 Mon Sep 17 00:00:00 2001
From: DevSoni2022 <121338813+DevSoni2022@users.noreply.github.com>
Date: Sun, 24 Sep 2023 14:51:12 +0530
Subject: [PATCH 7/9] css
---
src/css/main.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/css/main.css b/src/css/main.css
index 7075fbdf..8cf46063 100644
--- a/src/css/main.css
+++ b/src/css/main.css
@@ -21,7 +21,7 @@ form{
font-weight:600
}
form{
- border: 0.2rem black solid;
+ border: 0.2rem #00000026 solid;
padding: 2rem;
}
From 97bdef635c2b9ebc7aa4e3a6d1f9fa6c15af3904 Mon Sep 17 00:00:00 2001
From: DevSoni2022 <121338813+DevSoni2022@users.noreply.github.com>
Date: Mon, 25 Sep 2023 11:57:42 +0530
Subject: [PATCH 8/9] negative
---
src/js/main.js | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/js/main.js b/src/js/main.js
index ee042035..5b90f3b5 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -304,25 +304,25 @@ function closeDoors(liftArray,l){
const inputValidation = (floorCount, liftCount) => {
- if (isNaN(floorCount) || isNaN(liftCount) || floorCount === "" || liftCount === "") {
- alert("Input cannot be empty");
- return false;
- } else if (floorCount % 1 !== 0 || liftCount % 1 !== 0) {
- alert("Numbers should be whole (non-decimal) values");
- return false;
- }
- else if (window.innerWidth <= 1000 && liftCount > 3) {
- alert("On mobile, for flawless experience, number of lifts should be 3 or less");
- return false;
- }else if (window.innerWidth <= 1000 && floorCount > 5) {
- alert("On mobile, for flawless experience, number of floors should be 5 or less");
- return false;
- } else if (window.innerWidth > 1000 && liftCount > 10) {
- alert("On desktop,for flawless experience, number of lifts should be 10 or less");
- return false;
- } else {
- return true;
- }
+ if (isNaN(floorCount) || isNaN(liftCount) || floorCount === "" || liftCount === "") {
+ alert("Input cannot be empty");
+ return false;
+ } else if (floorCount % 1 !== 0 || liftCount % 1 !== 0) {
+ alert("Numbers should be whole (non-decimal) values");
+ return false;
+ }
+ else if (window.innerWidth <= 1000 && liftCount > 3) {
+ alert("On mobile, for flawless experience, number of lifts should be 3 or less");
+ return false;
+ }else if (window.innerWidth <= 1000 && floorCount > 5) {
+ alert("On mobile, for flawless experience, number of floors should be 5 or less");
+ return false;
+ } else if (window.innerWidth > 1000 && liftCount > 10) {
+ alert("On desktop,for flawless experience, number of lifts should be 10 or less");
+ return false;
+ } else {
+ return true;
+ }
};
From df1b69635ce241b0d424879d30e6167acf8fa491 Mon Sep 17 00:00:00 2001
From: DevSoni2022 <121338813+DevSoni2022@users.noreply.github.com>
Date: Mon, 25 Sep 2023 11:59:25 +0530
Subject: [PATCH 9/9] fix
---
src/js/main.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/js/main.js b/src/js/main.js
index 5b90f3b5..2fe900c0 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -310,7 +310,8 @@ const inputValidation = (floorCount, liftCount) => {
} else if (floorCount % 1 !== 0 || liftCount % 1 !== 0) {
alert("Numbers should be whole (non-decimal) values");
return false;
- }
+ } else if (floorCount <= 0 || liftCount <= 0) {
+ alert("Numbers should be positive and also greater than zero");}
else if (window.innerWidth <= 1000 && liftCount > 3) {
alert("On mobile, for flawless experience, number of lifts should be 3 or less");
return false;