diff --git a/clientInfo.html b/clientInfo.html new file mode 100644 index 00000000..1cf9a78c --- /dev/null +++ b/clientInfo.html @@ -0,0 +1,136 @@ + + + + + + Client Information + + + + + +
+
+

Client Information

+
+
+ + +
+ +
+ + +
+ + +
+ + +
+ +
+ + +
+ + +
+ + +
+ +
+ +
+
+
+
+ + diff --git a/data.json b/data.json new file mode 100644 index 00000000..add41df7 --- /dev/null +++ b/data.json @@ -0,0 +1,20 @@ +{ + "users": [ + { + "username": "bhumikakukreja", + "password": "hi" + }, + { + "username": "khushi", + "password": "hello" + }, + { + "username": "BK_07_08", + "password": "hiiiiiii" + }, + { + "username": "2401730163", + "password": "hihhihi" + } + ] +} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 00000000..d99ad60f --- /dev/null +++ b/index.html @@ -0,0 +1,72 @@ + + + + + + Login Page + + + + +
+ + +
+ + + diff --git a/index2.html b/index2.html new file mode 100644 index 00000000..51559cb0 --- /dev/null +++ b/index2.html @@ -0,0 +1,12 @@ + + + + + + Document + + + Login + Login + + \ No newline at end of file diff --git a/login.html b/login.html new file mode 100644 index 00000000..a3b3cbfa --- /dev/null +++ b/login.html @@ -0,0 +1,40 @@ + + + + + Login Form + + +

Login

+
+ +

+ +

+ +
+ + + + diff --git a/register.html b/register.html new file mode 100644 index 00000000..a1743c84 --- /dev/null +++ b/register.html @@ -0,0 +1,107 @@ + + + + + + + User Registration + + + +
+

Register

+
+ + + + + + + +
+
+
+ + + + \ No newline at end of file diff --git a/server.js b/server.js new file mode 100644 index 00000000..2e3ddb8e --- /dev/null +++ b/server.js @@ -0,0 +1,148 @@ +const path = require('path'); +const fs = require('fs'); +const bodyParser = require('body-parser'); +const express = require('express'); + +const app = express(); +const PORT = 5500; + +app.use(express.static(path.join(__dirname, 'public'))); + +app.use(express.json()); + +app.post('/api/login', async function(req, res) { + try { + var username = req.body.username; + var password = req.body.password; + const data = readJson(); + console.log('Loaded data:', data); + console.log('Username:', username, 'Password:', password); + + const user = data.users.find(user => user.username === username && user.password === password); + + if (user) { + console.log('Login successful for:', username); + res.redirect('/index.html'); + console.log('Redirect successful for:', username); + } else { + console.log('Login failed for:', username); + res.send(``); + } +} + catch (error) { + console.error(error); + res.status(500).json({ error: 'Server error.' }); + } +}); + + +const filePath = path.join(__dirname, 'data.json'); + +function readJson() { + try { + const data = fs.readFileSync(filePath, 'utf8'); + return JSON.parse(data); + } catch (err) { + console.error('Error reading JSON file:', err); + return { users: [] }; + } +} + +function writeJson(data) { + try { + fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf8'); + } catch (err) { + console.error('Error writing JSON file:', err); + } +} + +function saveUser(username, password) { + const data = readJson(); + + const userExists = data.users.some(user => user.username === username); + if (userExists) return false; + + data.users.push({ username, password }); + writeJson(data); + return true; +} + +app.post('/api/register', async function(req, res) { + try { + var username = req.body.username; + var password = req.body.password; + + if (!username || !password) { + return res.status(400).json({ message: 'Username and password are required.' }); + } + + const success = saveUser(username, password); + if (success) { + console.log('User registered:', username); + res.json({ message: 'Registration successful.' }); + } else { + console.log('Registration failed: Username already exists.'); + res.status(409).json({ message: 'Username already exists.' }); + } + + } catch (error) { + console.error(error); + res.status(500).json({ error: 'Server error.' }); + } +}); + +app.post('/api/consumer', async function(req, res) { + try { + const formData = req.body; + + fs.readFile('data1.json', 'utf8', (err, data) => { + if (err) return res.status(500).json({ message: 'Error reading data file' }); + + const existingData = data ? JSON.parse(data) : []; + existingData.push(formData); + + fs.writeFile('data1.json', JSON.stringify(existingData, null, 2), (err) => { + if (err) return res.status(500).json({ message: 'Error saving data' }); + res.status(200).json({ message: 'Data saved successfully!' }); + }); + }); + + } catch (error) { + console.error(error); + res.status(500).json({ error: 'Server error.' }); + } + }); + +app.post('/api/provider', async function(req, res) { + try { + var location = req.body.location; + var time = req.body.time; + var issue = req.body.issue; + var name = req.body.name; + var contact_num = req.body.contact_num; + + console.log("successfully saved to DataBase") + res.json({ response_from_server: 'successfully saved to DataBase' }); + + } catch (error) { + console.error(error); + res.status(500).json({ error: 'Server error.' }); + } + }); + +app.post('/api/admin', async function(req, res) { + try { + var location = req.body.location; + + console.log("successfully saved to DataBase") + res.json({ response_from_server: 'successfully saved to DataBase' }); + + } catch (error) { + console.error(error); + res.status(500).json({ error: 'Server error.' }); + } + }); + +app.listen(PORT, () => { + console.log(`Server running at http://localhost:${PORT}`); +}); diff --git a/servicedb.html b/servicedb.html new file mode 100644 index 00000000..d630c231 --- /dev/null +++ b/servicedb.html @@ -0,0 +1,153 @@ + + + + + + FixIt - Bidding & Issue Reporting + + + + + + + +
+

Bidding Feature

+

Choose the best price from trusted service providers.

+ Start Bidding +
+ +
+

Report a Public Issue

+
+
+ + +
+ +
+
+ + + + + + diff --git a/serviceprovider.html b/serviceprovider.html new file mode 100644 index 00000000..d43c87f9 --- /dev/null +++ b/serviceprovider.html @@ -0,0 +1,188 @@ + + + + + + + Service Provider Information + + + + + + +
+
+

Service Provider Information

+
+ +
+ + +
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + +
+ +
+
+
+
+
+
+
+
+
+
+ + +
+ +
+ + to + +
+
+ + +
+ + +
+ +
+ +
+
+
+
+ + + + + diff --git a/serviceproviderinfo.css b/serviceproviderinfo.css new file mode 100644 index 00000000..636a28b6 --- /dev/null +++ b/serviceproviderinfo.css @@ -0,0 +1,40 @@ +body { + background: linear-gradient(to right, #00c6ff, #0072ff); + margin: 0; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; +} + +.serviceProviderInfo { + max-width: 500px; + width: 100%; + border-radius: 15px; + background: white; + box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.2), -5px -5px 15px rgba(255, 255, 255, 0.1); + transition: 0.3s; +} + +.serviceProviderInfo:hover { + transform: scale(1.02); +} + +.form-control, .form-select { + border: 1px solid #ccc; + border-radius: 5px; + box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.1); +} + +.btn { + width: 100%; + font-weight: bold; + padding: 10px; + border-radius: 8px; + transition: all 0.2s ease-in-out; +} + +.btn:hover { + background: #0056b3; + box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3); +} diff --git a/webpage.html b/webpage.html new file mode 100644 index 00000000..8a585720 --- /dev/null +++ b/webpage.html @@ -0,0 +1,181 @@ + + + + + + FixIt - Find & Report Services + + + + + + + + +
+
+

FixIt - The Ultimate Solution

+

Report issues, find service providers & get the best price through bidding!

+
+
+ +
+

Our Services

+
+
+
+
Plumbing Services
+

Find trusted plumbers easily.

+ Plumbing +
+
+
+
+
Electrician Service
+

Get professional electrical repairs.

+ Electrician +
+
+
+
+
Home Cleaning
+

Hire home and office cleaners.

+ Cleaning +
+
+
+
+
Carpentry Work
+

Fixing loose hinges and misaligned doors.

+ Carpentry +
+
+
+
+
AC & Appliance Repair
+

AC repairing services.

+ AC Repair +
+
+
+
+
Appliance Repair Services
+

Fridge, Washer, & Oven Repairs.

+ Appliance Repair +
+
+
+
+
Pest Control Services
+

Pest Infestation – Ants, roaches, or rodents.

+ Pest Control +
+
+
+
+
Home Noise & Movement Solutions
+

Squeaky doors & floors, garage door malfunctions.

+ Noise Solutions +
+
+
+
+
Comfort & HVAC Services
+

Inconsistent heating or cooling.

+ HVAC Services +
+
+
+
+
Structural & Maintenance Services
+

Peeling paint, cracked tiles, roof leaks.

+ Structural Maintenance +
+
+
+
+ +
+

Describe the Issue

+ +
+
+ + +
+ +
+ +

+
+
+ + +
+
+ + +
+ + + + \ No newline at end of file