ui chnages of mobile viwe respo and adding login page logo
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
# return app
|
# return app
|
||||||
|
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask, redirect, url_for
|
||||||
from app.config import Config
|
from app.config import Config
|
||||||
from app.services.db_service import db
|
from app.services.db_service import db
|
||||||
|
|
||||||
@@ -42,10 +42,14 @@ def create_app():
|
|||||||
|
|
||||||
# Register blueprints
|
# Register blueprints
|
||||||
register_blueprints(app)
|
register_blueprints(app)
|
||||||
|
|
||||||
# Register error handlers
|
# Register error handlers
|
||||||
register_error_handlers(app)
|
register_error_handlers(app)
|
||||||
|
|
||||||
|
# ROOT → LOGIN
|
||||||
|
@app.route("/")
|
||||||
|
def index():
|
||||||
|
return redirect(url_for("auth.login"))
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ from app.services.user_service import UserService
|
|||||||
|
|
||||||
auth_bp = Blueprint("auth", __name__)
|
auth_bp = Blueprint("auth", __name__)
|
||||||
|
|
||||||
@auth_bp.route("/", methods=["GET", "POST"])
|
|
||||||
@auth_bp.route("/login", methods=["GET", "POST"])
|
@auth_bp.route("/login", methods=["GET", "POST"])
|
||||||
def login():
|
def login():
|
||||||
|
if session.get("user_id"):
|
||||||
|
return redirect(url_for("dashboard.dashboard"))
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
email = request.form.get("email")
|
email = request.form.get("email")
|
||||||
password = request.form.get("password")
|
password = request.form.get("password")
|
||||||
@@ -21,6 +23,7 @@ def login():
|
|||||||
|
|
||||||
return render_template("login.html", title="Login")
|
return render_template("login.html", title="Login")
|
||||||
|
|
||||||
|
|
||||||
@auth_bp.route("/logout")
|
@auth_bp.route("/logout")
|
||||||
def logout():
|
def logout():
|
||||||
session.clear()
|
session.clear()
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
from flask import Blueprint, render_template
|
|
||||||
from app.utils.helpers import login_required
|
from flask import Blueprint, render_template, session, redirect, url_for
|
||||||
|
|
||||||
dashboard_bp = Blueprint("dashboard", __name__, url_prefix="/dashboard")
|
dashboard_bp = Blueprint("dashboard", __name__, url_prefix="/dashboard")
|
||||||
|
|
||||||
@dashboard_bp.route("/")
|
@dashboard_bp.route("/")
|
||||||
@login_required
|
|
||||||
def dashboard():
|
def dashboard():
|
||||||
|
if not session.get("user_id"):
|
||||||
|
return redirect(url_for("auth.login"))
|
||||||
|
|
||||||
return render_template("dashboard.html", title="Dashboard")
|
return render_template("dashboard.html", title="Dashboard")
|
||||||
|
|||||||
Binary file not shown.
BIN
app/static/images/lcepl.png
Normal file
BIN
app/static/images/lcepl.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -7,7 +7,7 @@
|
|||||||
<title>{{ title if title else "ComparisonSoftware" }}</title>
|
<title>{{ title if title else "ComparisonSoftware" }}</title>
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
<!-- <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}"> -->
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="background:#f5f7fa;">
|
<body style="background:#f5f7fa;">
|
||||||
|
|||||||
@@ -1,17 +1,82 @@
|
|||||||
{% extends "base.html" %}
|
<!DOCTYPE html>
|
||||||
{% block content %}
|
<html lang="en">
|
||||||
<h2 class="mb-4">Login</h2>
|
|
||||||
|
|
||||||
<div class="card p-4 shadow-sm">
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>LCEPL | Login</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<!-- Bootstrap CSS -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="bg-light">
|
||||||
|
|
||||||
|
<div class="container-fluid vh-100">
|
||||||
|
<div class="row h-100 justify-content-center align-items-center">
|
||||||
|
|
||||||
|
<!-- Increased column width -->
|
||||||
|
<div class="col-12 col-sm-10 col-md-8 col-lg-5 col-xl-4">
|
||||||
|
|
||||||
|
<div class="card shadow-lg border-0">
|
||||||
|
<!-- Increased padding -->
|
||||||
|
<div class="card-body p-5">
|
||||||
|
|
||||||
|
<!-- Branding -->
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<img src="{{ url_for('static', filename='images/lcepl.png') }}" alt="LCEPL Logo"
|
||||||
|
class="img-fluid mb-3" style="max-height:80px;">
|
||||||
|
|
||||||
|
<h4 class="fw-bold mb-1">
|
||||||
|
Laxmi Civil Engineering Services Pvt Ltd
|
||||||
|
</h4>
|
||||||
|
<p class="text-muted mb-0">
|
||||||
|
Data Comparison System
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Flash messages -->
|
||||||
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||||
|
{% if messages %}
|
||||||
|
{% for category, message in messages %}
|
||||||
|
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
|
||||||
|
{{ message }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
|
<!-- Login Form -->
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
|
|
||||||
<label>Email:</label>
|
<div class="mb-4">
|
||||||
<input type="email" name="email" class="form-control mb-3" required>
|
<label class="form-label fw-semibold">User Name</label>
|
||||||
|
<input type="email" name="email" class="form-control " placeholder="Enter email"
|
||||||
<label>Password:</label>
|
required>
|
||||||
<input type="password" name="password" class="form-control mb-3" required>
|
|
||||||
|
|
||||||
<button class="btn btn-success">Login</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="form-label fw-semibold">Password</label>
|
||||||
|
<input type="password" name="password" class="form-control" placeholder="Enter password"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-success btn-lg w-100">
|
||||||
|
Login
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Bootstrap JS -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -1,18 +1,35 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div class="card shadow-sm p-4">
|
<div class="card shadow-sm p-3 p-md-4">
|
||||||
<h4 class="mb-3">Subcontractor List</h4>
|
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="row mb-3 align-items-center">
|
||||||
|
<div class="col-12 col-md-6">
|
||||||
|
<h4 class="mb-2 mb-md-0 text-center text-md-start">
|
||||||
|
Subcontractor List
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 col-md-6 text-center text-md-end">
|
||||||
|
<a href="/subcontractor/add" class="btn btn-success w-100 w-md-auto">
|
||||||
|
➕ Add Subcontractor
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Responsive Table -->
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered table-striped align-middle text-nowrap">
|
||||||
|
|
||||||
<table class="table table-bordered table-striped">
|
|
||||||
<thead class="table-dark">
|
<thead class="table-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Mobile</th>
|
<th class="d-none d-md-table-cell">Mobile</th>
|
||||||
<th>Email</th>
|
<th class="d-none d-lg-table-cell">Email</th>
|
||||||
<th>GST No</th>
|
<th class="d-none d-lg-table-cell">GST No</th>
|
||||||
<th>Action</th>
|
<th class="text-center">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@@ -20,19 +37,54 @@
|
|||||||
{% for s in subcontractors %}
|
{% for s in subcontractors %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ s.id }}</td>
|
<td>{{ s.id }}</td>
|
||||||
<td>{{ s.subcontractor_name }}</td>
|
|
||||||
<td>{{ s.mobile_no }}</td>
|
<td class="fw-semibold text-wrap">
|
||||||
<td>{{ s.email_id }}</td>
|
{{ s.subcontractor_name }}
|
||||||
<td>{{ s.gst_no }}</td>
|
</td>
|
||||||
<td>
|
|
||||||
<a href="/subcontractor/edit/{{ s.id }}" class="btn btn-sm btn-warning">Edit</a>
|
<td class="d-none d-md-table-cell">
|
||||||
|
{{ s.mobile_no }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="d-none d-lg-table-cell">
|
||||||
|
{{ s.email_id }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="d-none d-lg-table-cell">
|
||||||
|
{{ s.gst_no }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- Action Buttons -->
|
||||||
|
<td class="text-center">
|
||||||
|
<div class="d-flex flex-column gap-1">
|
||||||
|
<a href="/subcontractor/edit/{{ s.id }}" class="btn btn-sm btn-warning">
|
||||||
|
Edit
|
||||||
|
</a>
|
||||||
<a href="/subcontractor/delete/{{ s.id }}" class="btn btn-sm btn-danger"
|
<a href="/subcontractor/delete/{{ s.id }}" class="btn btn-sm btn-danger"
|
||||||
onclick="return confirm('Are you sure?')">Delete</a>
|
onclick="return confirm('Are you sure?')">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
|
<!-- TOTAL ROW -->
|
||||||
|
<tfoot>
|
||||||
|
<tr class="table-secondary fw-bold">
|
||||||
|
<td colspan="5" class="text-end">
|
||||||
|
Total Subcontractors
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
{{ subcontractors|length }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user