Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ambrishgoswami authored Jun 8, 2024
0 parents commit 1c83809
Show file tree
Hide file tree
Showing 24 changed files with 1,009 additions and 0 deletions.
Binary file added Image/Copy of Untitled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/LOGO (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/banner1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/banner2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/bike.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/carosal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/p1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/p2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/parking 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/parking3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/parking4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/parking5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/places.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image/work.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions bootstrap.min.js

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions contact.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 27, 2021 at 10:21 AM
-- Server version: 10.4.22-MariaDB
-- PHP Version: 8.1.0

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `parking`
--

-- --------------------------------------------------------

--
-- Table structure for table `contact`
--

CREATE TABLE `contact` (
`id` int(100) NOT NULL,
`Name` varchar(100) NOT NULL,
`Email` varchar(100) NOT NULL,
`Message` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `contact`
--

INSERT INTO `contact` (`id`, `Name`, `Email`, `Message`) VALUES
(2, 'Ambrish Goswami', '[email protected]', 'hiiiiiiii');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `contact`
--
ALTER TABLE `contact`
ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `contact`
--
ALTER TABLE `contact`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
170 changes: 170 additions & 0 deletions core2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
//Entry Class: Represent each entry in the parking lot
class Entry{
constructor(firstName,lastName,mobileNumber,licensePlate,entryDate,exitDate){
this.firstName = firstName;
this.lastName = lastName;
this.mobileNumber = mobileNumber;
this.licensePlate = licensePlate;
this.entryDate = entryDate;
this.exitDate = exitDate;
}
}
//UI Class: Handle User Interface Tasks
class UI{
static displayEntries(){

const entries = Store.getEntries();
entries.forEach((entry) => UI.addEntryToTable(entry));
}
static addEntryToTable(entry){
const tableBody=document.querySelector('#tableBody');
const row = document.createElement('tr');
row.innerHTML = ` <td>${entry.firstName}</td>
<td>${entry.lastName}</td>
<td>${entry.mobileNumber}</td>
<td>${entry.licensePlate}</td>
<td>${entry.entryDate}</td>
<td>${entry.exitDate}</td>
<td><button class="btn btn-danger delete">X</button></td>
`;
tableBody.appendChild(row);
}
static clearInput(){
//Selects all the inputs
const inputs = document.querySelectorAll('.form-control');
//Clear the content of each input
inputs.forEach((input)=>input.value="");
}
static deleteEntry(target){
if(target.classList.contains('delete')){
target.parentElement.parentElement.remove();
}
}
static showAlert(message,className){
const div = document.createElement('div');
div.className=`alert alert-${className} w-50 mx-auto`;
div.appendChild(document.createTextNode(message));
const formContainer = document.querySelector('.form-container');
const form = document.querySelector('#entryForm');
formContainer.insertBefore(div,form);
setTimeout(() => document.querySelector('.alert').remove(),3000);
}
static validateInputs(){
const firstName = document.querySelector('#firstName').value;
const lastName = document.querySelector('#lastName').value;
const mobileNumber = document.querySelector('#mobileNumber').value;
const licensePlate = document.querySelector('#licensePlate').value;
const entryDate = document.querySelector('#entryDate').value;
const exitDate = document.querySelector('#exitDate').value;
var licensePlateRegex = /[A-Z]{2}-[0-9]{2}[ -]?[A-Z]{1}-[0-9]{4}/;
if(firstName === '' || lastName === '' || mobileNumber === '' || licensePlate === '' || entryDate === '' || exitDate === ''){
UI.showAlert('All fields must me filled!','danger');
return false;
}
if(exitDate < entryDate){
UI.showAlert('Exit Date cannot be lower than Entry Date','danger');
return false;
}
if(!licensePlateRegex.test(licensePlate)){
UI.showAlert('License Plate must be like MH-12 K-1234','danger');
return false;
}
return true;
}
}

//Store Class: Handle Local Storage
class Store{
static getEntries(){
let entries;
if(localStorage.getItem('entries') === null){
entries = [];
}
else{
entries = JSON.parse(localStorage.getItem('entries'));
}
return entries;
}
static addEntries(entry){
const entries = Store.getEntries();
entries.push(entry);
localStorage.setItem('entries', JSON.stringify(entries));
}
static removeEntries(licensePlate){
const entries = Store.getEntries();
entries.forEach((entry,index) => {
if(entry.licensePlate === licensePlate){
entries.splice(index, 1);
}
});
localStorage.setItem('entries', JSON.stringify(entries));
}
}
//Event Display
document.addEventListener('DOMContentLoaded',UI.displayEntries);
//Event Add
document.querySelector('#entryForm').addEventListener('submit',(e)=>{
// e.preventDefault();

//Declare Variables
const firstName = document.querySelector('#firstName').value;
const lastName = document.querySelector('#lastName').value;
const mobileNumber = document.querySelector('#mobileNumber').value;
const licensePlate = document.querySelector('#licensePlate').value;
const entryDate = document.querySelector('#entryDate').value;
const exitDate = document.querySelector('#exitDate').value;
if(!UI.validateInputs()){
return;
}
//Instatiate Entry
const entry = new Entry(firstName, lastName, mobileNumber, licensePlate, entryDate, exitDate);
//Add the entry do de UI table
UI.addEntryToTable(entry);
Store.addEntries(entry);
//Delete content of input's
UI.clearInput();

UI.showAlert('Car successfully added to the parking lot','success');

});
//Event Remove
document.querySelector('#tableBody').addEventListener('click',(e)=>{
//Call to UI function that removes entry from the table
UI.deleteEntry(e.target);
//Get license plate to use as unique element of an entry
var licensePlate = e.target.parentElement.previousElementSibling.previousElementSibling.previousElementSibling.textContent;
//Call to Store function to remove entry from the local storage
Store.removeEntries(licensePlate);
var mobileNumber = e.target.parentElement.previousElementSibling.previousElementSibling.previousElementSibling.textContent;
Store.removeEntries(mobileNumber);
//Show alert that entry was removed
UI.showAlert('Car successfully removed from the parking lot list','success');
})

//Event Search
document.querySelector('#searchInput').addEventListener('keyup', function searchTable(){
//Get value of the input search
const searchValue = document.querySelector('#searchInput').value.toUpperCase();
//Get all lines of table body
const tableLine = (document.querySelector('#tableBody')).querySelectorAll('tr');
//for loop #1 (used to pass all the lines)
for(let i = 0; i < tableLine.length; i++){
var count = 0;
//Get all collumns of each line
const lineValues = tableLine[i].querySelectorAll('td');
//for loop #2 (used to pass all the collumns)
for(let j = 0; j < lineValues.length - 1; j++){
//Check if any collumn of the line starts with the input search string
if((lineValues[j].innerHTML.toUpperCase()).startsWith(searchValue)){
count++;
}
}
if(count > 0){
//If any collumn contains the search value the display block
tableLine[i].style.display = '';
}else{
//Else display none
tableLine[i].style.display = 'none';
}
}
})
84 changes: 84 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<center><h2><p>Park Yours Vehicles</p></center></h2>

<div class="container">
<ul class="parking-rules">
<li class="parking-rule">
<a href="index1.html"></a><ul>
<li><h3>Fire truck Parking Only</li></h3>
<h4><li>24hrs</li>
<li> Mon Thru Fri </li></h4>
</ul>
</li>
<li class="parking-rule">
<ul>
<li><h3>Ambulance Parking Only</li></h3>
<h4><li>24hrs</li>
<li> Saturday to Sunday </li></h4>
</ul>
</li>
<li class="parking-rule">
<ul>
<li><h3>Car Parking</li></h3>
<h4><li>3am to 9pm </li>
<li> Mon Thru Fri </li></h4>
</ul>
</li>
<li class="parking-rule">
<ul>
<li><h3>Bike Parking</li></h3>
<h4><li>2am to 10pm </li>
<li> Mon Thru Fri </li></h4>
</ul>
</li>


<li class="parking-rule">
<ul>
<li><h3>Bicycle Parking</li></h3>
<h4><li>3pm to 6pm </li>
<li> Mon Thru Fri </li></h4>
</ul>
</li>
</ul>
<section class="drop-zone">

<h1 style="color: rgb(0, 229, 255);">Click On Vehicles That You Want to Parking<span id="changingText"></span></h1>
</section>
<section class="drag-vehicle">
<ul class="vehicles">
<li>
<!-- draggable objects must have draggable attribute -->
<a href="index1.html"><img id="ft" alt="fire truck" src="https://cdn.glitch.com/20f985bd-431d-4807-857b-e966e015c91b%2Ftruck-clip-art-fire-truck4.png?1519011787956"></a>
</li>
<li>
<a href="index1.html"><img id="ambulance" alt="ambulance" src="https://cdn.glitch.com/20f985bd-431d-4807-857b-e966e015c91b%2Fambulance5.png?1519011787610"></a>
</li>
<li>
<a href="index1.html"><img id="car" alt="car" src="https://cdn.glitch.com/20f985bd-431d-4807-857b-e966e015c91b%2Fcar-20clip-20art-1311497037_Vector_Clipart.png?1519011788408"></a>
</li>

<li>
<a href="index1.html"><img id="car" alt="car" src="Image/bike.jpg"></a>
</li>


<li>
<a href="index1.html"><img id="bike" alt="bicycle" src="https://cdn.glitch.com/20f985bd-431d-4807-857b-e966e015c91b%2Fbicycle-20clip-20art-bicycle3.png?1519011787816"></a>
</li>
</ul>



</section>
</div>
</body>
</html>
Loading

0 comments on commit 1c83809

Please sign in to comment.