Bladeren bron

changes for login and redirect part

VISHAL BHANUSHALI 3 maanden geleden
bovenliggende
commit
ca0e837a63

+ 16 - 3
content_quality_tool/settings.py

@@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/5.2/ref/settings/
 
 from pathlib import Path
 import os
-
+from django.contrib.messages import constants as messages
 
 # Build paths inside the project like this: BASE_DIR / 'subdir'.
 BASE_DIR = Path(__file__).resolve().parent.parent
@@ -59,7 +59,7 @@ ROOT_URLCONF = 'content_quality_tool.urls'
 TEMPLATES = [
     {
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
-        'DIRS': [],
+        'DIRS': [BASE_DIR / "templates", BASE_DIR/ 'content_quality_tool_public/templates'],
         'APP_DIRS': True,
         'OPTIONS': {
             'context_processors': [
@@ -121,6 +121,10 @@ USE_TZ = True
 
 STATIC_URL = 'static/'
 
+STATICFILES_DIRS = [
+    os.path.join(BASE_DIR, "content_quality_tool_public/static"),
+]
+
 # Default primary key field type
 # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
 
@@ -138,4 +142,13 @@ from django.conf.urls.static import static
 
 urlpatterns = [
     # ... your routes
-] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+
+
+MESSAGE_TAGS = {
+    messages.ERROR: 'danger',  # Map Django's error to Bootstrap's danger
+    messages.SUCCESS: 'success',
+    messages.INFO: 'info',
+    messages.WARNING: 'warning',
+    messages.DEBUG: 'debug',
+}

+ 7 - 1
content_quality_tool/urls.py

@@ -17,9 +17,15 @@ Including another URLconf
 from django.contrib import admin
 from django.urls import path
 from django.urls import path, include
+from content_quality_tool_public import views
+# from template import views
 
 urlpatterns = [
     path('admin/', admin.site.urls),
-    path("core/", include("core.urls")),
+    path("", views.login_view, name="login_view"),
+    path('', include('content_quality_tool_public.urls')),  # Your app's routes
+
+    # path("core/", include("core.urls")),
+    # path("", views.login_view, name="login_view"),
 ]
 

+ 0 - 0
content_quality_tool_public/__init__.py


+ 3 - 0
content_quality_tool_public/admin.py

@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.

+ 6 - 0
content_quality_tool_public/apps.py

@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class ContentQualityToolPublicConfig(AppConfig):
+    default_auto_field = 'django.db.models.BigAutoField'
+    name = 'content_quality_tool_public'

+ 10 - 0
content_quality_tool_public/decorators.py

@@ -0,0 +1,10 @@
+from functools import wraps
+from django.shortcuts import redirect
+
+def login_required(view_func):
+    @wraps(view_func)
+    def _wrapped_view(request, *args, **kwargs):
+        if 'user_email' not in request.session:
+            return redirect('login_view')  # Redirect to your login URL name
+        return view_func(request, *args, **kwargs)
+    return _wrapped_view

+ 0 - 0
content_quality_tool_public/migrations/__init__.py


+ 3 - 0
content_quality_tool_public/models.py

@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.

+ 309 - 0
content_quality_tool_public/static/css/login.css

@@ -0,0 +1,309 @@
+/*
+Project Name: WFM
+Date : 05-11-2020
+Author: Amar Kholambe (amar.kholambe@luminad.com)
+*/
+body {
+    background: rgb(239, 138, 227);
+    background: url('./../images/45.jpg') no-repeat center center fixed;
+    -webkit-background-size: cover;
+    -moz-background-size: cover;
+    -o-background-size: cover;
+    background-size: cover;
+}
+
+.login {
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    transform: translate(-50%, -50%);
+    background: #fff;
+}
+
+.login-container {
+    width: 800px;
+    margin: 0 auto;
+    height: 430px;
+    box-shadow: 0 0 178px #9b9b9b;
+    border: 1px solid #d1d1d1;
+    background: #f2f2f2;
+}
+
+.login-left {
+    /* background: #0070CD; */
+    background: url('./../images/left.png');
+    float: left;
+    width: 60%;
+    padding: 2 5px 30px 0;
+    height: 100%;
+    position: relative;
+    /* border-right: 1px solid #ddd; */
+    overflow: hidden;
+    background-size: cover;
+}
+
+.login-right {
+    float: left;
+    width: 48%;
+    padding: 45px 30px 0;
+    height: 100%;
+    position: absolute;
+    top:0;
+    right: 0;
+    bottom: 0;
+}
+
+.form-signin,
+.form-reset-password {
+    padding: 0 30px 0 0;
+    overflow: auto;
+    height: 410px;
+}
+
+.lbox {
+    width: 100%;
+    display: block;
+}
+
+.clogo {
+    /* width: 200px; */
+    margin: 50px 120px;
+        display: block;
+    /* text-align: center; */
+    font-size: 40px;
+    color: #424242;
+    z-index: 1;
+    position: relative;
+}
+
+.llogo {
+    width: 115px;
+    position: absolute;
+    bottom: 10px;
+    right: 90px;
+}
+
+.lbox p {
+    margin: 320px auto auto;
+    color: #424242;
+    font-size: 12px;
+    text-align: right;
+}
+
+.form-signin-heading {
+    padding-bottom: 30px;
+    text-align: center;
+    color: #0070CD;
+    margin: 0;
+}
+
+.lang_label {
+    position: initial !important;
+    display: inline-block;
+    margin-right: 5px;
+}
+
+select {
+    width: 70px !important;
+    display: inline-block !important;
+}
+
+/* form starting stylings ------------------------------- */
+
+.login .group {
+    position: relative;
+    margin-bottom: 55px;
+}
+
+.login input {
+    padding: 5px;
+    display: block;
+    width: 100%;
+    border: none;
+    border-bottom: 1px solid #0070CD;
+    background-color: transparent;
+}
+
+.login input:focus {
+    outline: none;
+}
+
+/* LABEL ======================================= */
+
+.login label {
+    color: #999;
+    /* font-size: 18px; */
+    font-weight: normal;
+    position: absolute;
+    pointer-events: none;
+    left: 5px;
+    top: 15px;
+    transition: 0.2s ease all;
+    -moz-transition: 0.2s ease all;
+    -webkit-transition: 0.2s ease all;
+}
+
+/* active state */
+
+.login input:focus~label,
+.login input:valid~label {
+    top: -20px;
+    font-size: 14px;
+    color: #5264AE;
+}
+
+/* active state */
+
+.login input:focus~.highlight {
+    -webkit-animation: inputHighlighter 0.3s ease;
+    -moz-animation: inputHighlighter 0.3s ease;
+    animation: inputHighlighter 0.3s ease;
+}
+
+/* ANIMATIONS ================ */
+
+@-webkit-keyframes inputHighlighter {
+    from {
+        background: #5264AE;
+    }
+
+    to {
+        width: 0;
+        background: transparent;
+    }
+}
+
+@-moz-keyframes inputHighlighter {
+    from {
+        background: #5264AE;
+    }
+
+    to {
+        width: 0;
+        background: transparent;
+    }
+}
+
+@keyframes inputHighlighter {
+    from {
+        background: #5264AE;
+    }
+
+    to {
+        width: 0;
+        background: transparent;
+    }
+}
+
+.login button {
+    border-color: #0070CD;
+    color: #0070CD;
+    font-size: 18px;
+}
+
+.login button:hover,
+.login button:active,
+.login button:focus {
+    background-color: #0070CD !important;
+    color: #ffffff !important;
+}
+
+.forgotPass {
+    color: #55729c;
+    margin-top: 25px;
+    display: block;
+}
+
+.form-reset-password input {
+    padding: 8px 8px 8px 5px;
+}
+
+.form-reset-password label {
+    top: 10px;
+}
+
+.form-reset-password .group {
+    margin-bottom: 40px;
+}
+
+.header {
+    height: 200px;
+    background: #425464;
+}
+
+.footer {
+    height: 50px;
+    background: #425464;
+}
+
+@media only screen and (max-width: 900px) {
+
+    .login,
+    .login-container {
+        width: 100%;
+    }
+}
+
+@media only screen and (max-width: 768px) {
+    .login {
+        top: 150px;
+    }
+
+    .login-left,
+    .login-right {
+        width: 100%;
+        float: none;
+    }
+
+    .form-signin,
+    .form-reset-password {
+        height: 100%;
+        display: initial;
+    }
+}
+
+/* width */
+
+::-webkit-scrollbar {
+    width: 5px;
+}
+
+/* Track */
+
+::-webkit-scrollbar-track {
+    box-shadow: inset 0 0 5px grey;
+    border-radius: 2px;
+}
+
+/* Handle */
+
+::-webkit-scrollbar-thumb {
+    background: #444;
+    border-radius: 2px;
+}
+
+/* Handle on hover */
+
+::-webkit-scrollbar-thumb:hover {
+    background: #333333;
+}
+
+.alert {
+    display: none;
+}
+
+.alert {
+    z-index: 9999;
+    position: fixed;
+    top: 10px;
+    width: auto;
+    left: 50%;
+    transform: translateX(-50%);
+}
+
+#triangle-topleft {
+    clip-path: polygon(0 0, 0% 100%, 100% 0);
+    background: #C4161C;
+    width: 100%;
+    height: 430px;
+}

BIN
content_quality_tool_public/static/images/45.jpg


BIN
content_quality_tool_public/static/images/left.png


BIN
content_quality_tool_public/static/images/logo.png


+ 827 - 0
content_quality_tool_public/templates/get-data.html

@@ -0,0 +1,827 @@
+{% load static %}
+<!DOCTYPE html>
+<html lang="en"> <!--begin::Head-->
+
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <title>Dashboard</title><!--begin::Primary Meta Tags-->
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="title" content="AdminLTE | Dashboard v2">
+    <meta name="author" content="ColorlibHQ">
+    <meta name="description"
+        content="AdminLTE is a Free Bootstrap 5 Admin Dashboard, 30 example pages using Vanilla JS.">
+    <meta name="keywords"
+        content="bootstrap 5, bootstrap, bootstrap 5 admin dashboard, bootstrap 5 dashboard, bootstrap 5 charts, bootstrap 5 calendar, bootstrap 5 datepicker, bootstrap 5 tables, bootstrap 5 datatable, vanilla js datatable, colorlibhq, colorlibhq dashboard, colorlibhq admin dashboard">
+    <!--end::Primary Meta Tags--><!--begin::Fonts-->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource/source-sans-3@5.0.12/index.css"
+        integrity="sha256-tXJfXfp6Ewt1ilPzLDtQnJV4hclT9XuaZUKyUvmyr+Q=" crossorigin="anonymous">
+    <!--end::Fonts--><!--begin::Third Party Plugin(OverlayScrollbars)-->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.3.0/styles/overlayscrollbars.min.css"
+        integrity="sha256-dSokZseQNT08wYEWiz5iLI8QPlKxG+TswNRD8k35cpg=" crossorigin="anonymous">
+    <!--end::Third Party Plugin(OverlayScrollbars)--><!--begin::Third Party Plugin(Bootstrap Icons)-->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.min.css"
+        integrity="sha256-Qsx5lrStHZyR9REqhUF8iQt73X06c8LGIUPzpOhwRrI=" crossorigin="anonymous">
+    <!--end::Third Party Plugin(Bootstrap Icons)--><!--begin::Required Plugin(AdminLTE)-->
+    <link rel="stylesheet" href="{% static './dist/css/adminlte.css' %}"><!--end::Required Plugin(AdminLTE)--><!-- apexcharts -->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts@3.37.1/dist/apexcharts.css"
+        integrity="sha256-4MX+61mt9NVvvuPjUWdUdyfZfxSB1/Rf9WtqRHgG5S0=" crossorigin="anonymous">
+    <link rel="stylesheet" href="{% static 'dist/WOW-master/css/libs/animate.css' %}">
+    <link rel="stylesheet" href="{% static 'dist/css/custom.css' %}">
+</head>
+
+<body class="layout-fixed sidebar-expand-lg sidebar-mini app-loaded sidebar-collapse"> <!--begin::App Wrapper-->
+    <div class="app-wrapper"> <!--begin::Header-->
+        <nav class="app-header navbar navbar-expand bg-body"> <!--begin::Container-->
+            <div class="container-fluid"> <!--begin::Start Navbar Links-->
+                <ul class="navbar-nav">
+                    <li class="nav-item"> <a class="nav-link" data-lte-toggle="sidebar" href="#" role="button"> <i
+                                class="bi bi-list"></i> </a> </li>
+                    <li class="nav-item d-none d-md-block"> <a  href="{% url 'file-upload' %}" class="nav-link">Home</a> </li>
+                    <!-- <li class="nav-item d-none d-md-block"> <a href="#" class="nav-link">Contact</a> </li> -->
+                </ul> <!--end::Start Navbar Links--> <!--begin::End Navbar Links-->
+                <ul class="navbar-nav ms-auto"> <!--begin::Navbar Search-->
+                    <!-- <li class="nav-item"> <a class="nav-link" data-widget="navbar-search" href="search.html"
+                            role="button"> <i class="bi bi-search"></i> </a> </li> 
+
+                    <li class="nav-item dropdown"> <a class="nav-link" data-bs-toggle="dropdown" href="#"> <i
+                                class="bi bi-bell-fill"></i> <span class="navbar-badge badge text-bg-warning">15</span>
+                        </a>
+                        <div class="dropdown-menu dropdown-menu-lg dropdown-menu-end"> <span
+                                class="dropdown-item dropdown-header">3 Notifications</span>
+                            <div class="dropdown-divider"></div> <a href="#" class="dropdown-item"> <i
+                                    class="bi bi-people-fill me-2"></i> filename_22_09_2024.xml is ready for review.
+                                <span class="float-end text-secondary fs-7">1 hours</span> </a>
+                            <div class="dropdown-divider"></div> <a href="#" class="dropdown-item"> <i
+                                    class="bi bi-people-fill me-2"></i> filename_22_09_2024.xml is uploaded
+                                successfully.
+                                <span class="float-end text-secondary fs-7">12 hours</span> </a>
+                            <div class="dropdown-divider"></div> <a href="#" class="dropdown-item"> <i
+                                    class="bi bi-file-earmark-fill me-2"></i> filename_12_09_2024.xml is uploaded
+                                successfully.
+                                <span class="float-end text-secondary fs-7">2 days</span> </a>
+                            <div class="dropdown-divider"></div> <a href="#" class="dropdown-item dropdown-footer">
+                                See All Notifications
+                            </a>
+                        </div>
+                    </li>  -->
+                    <li class="nav-item"> <a class="nav-link" href="#" data-lte-toggle="fullscreen"> <i
+                                data-lte-icon="maximize" class="bi bi-arrows-fullscreen"></i> <i
+                                data-lte-icon="minimize" class="bi bi-fullscreen-exit" style="display: none;"></i> </a>
+                    </li> <!--end::Fullscreen Toggle--> <!--begin::User Menu Dropdown-->
+                    <li class="nav-item dropdown user-menu"> <a href="#" class="nav-link dropdown-toggle"
+                            data-bs-toggle="dropdown"> <img src="{% static './dist/img/user2-160x160.jpg' %}"
+                                class="user-image rounded-circle shadow" alt="User Image"> <span
+                                class="d-none d-md-inline">Arun Devar</span> </a>
+                        <ul class="dropdown-menu dropdown-menu-lg dropdown-menu-end"> <!--begin::User Image-->
+                            <li class="user-header text-bg-secondary"> <img src="{% static './dist/img/user2-160x160.jpg' %}"
+                                    class="rounded-circle shadow" alt="User Image">
+                                <p>
+                                    Arun Devar - Senior Manager
+                                    <small>Since Nov. 2023</small>
+                                </p>
+                            </li> <!--end::User Image--> <!--begin::Menu Body-->
+
+                            <li class="user-footer"> <a href="#" class="btn btn-default btn-flat">Profile</a> <a
+                                    href="{% url 'logout' %}" class="btn btn-default btn-flat float-end">Sign out</a> </li>
+                            <!--end::Menu Footer-->
+                        </ul>
+                    </li> <!--end::User Menu Dropdown-->
+                </ul> <!--end::End Navbar Links-->
+            </div> <!--end::Container-->
+        </nav> <!--end::Header--> <!--begin::Sidebar-->
+        <aside class="app-sidebar shadow"> <!--begin::Sidebar Brand-->
+            <div class="sidebar-brand"> <!--begin::Brand Link--> <a href="{% url 'file-upload' %}" class="brand-link">
+                    <!--begin::Brand Image--> <img src="{% static './dist/img/logo-mini.png' %}" alt="Lumina Datamatics"
+                        class="brand-image logo-mini"> <!--end::Brand Image--> <!--begin::Brand Text--> <span
+                        class="brand-text fw-light"><img style="position:relative; left: -40px;"
+                            src="{% static './dist/img/logo.png' %}" alt="Lumina Datamatics" class="brand-image"></span>
+                    <!--end::Brand Text--> </a>
+            </div> <!--end::Sidebar Brand--> <!--begin::Sidebar Wrapper-->
+            <div class="sidebar-wrapper">
+                <nav class="mt-2"> <!--begin::Sidebar Menu-->
+                    <ul class="nav sidebar-menu flex-column" data-lte-toggle="treeview" role="menu"
+                        data-accordion="false">
+
+                        <li class="nav-item"> <a href="{% url 'file-upload' %}" class="nav-link"> <i
+                                    class="nav-icon bi bi-upload"></i>
+                                <p>Upload</p>
+                            </a> </li>
+                        <li class="nav-item"> <a href="{% url 'tool-check' %}" class="nav-link active"> <i
+                                    class="nav-icon bi bi-house"></i>
+                                <p>Home</p>
+                            </a> </li>    
+                        
+
+                    </ul> <!--end::Sidebar Menu-->
+                </nav>
+            </div> <!--end::Sidebar Wrapper-->
+        </aside> <!--end::Sidebar--> <!--begin::App Main-->
+        <main class="app-main"> <!--begin::App Content Header-->
+            <div class="app-content-header"> <!--begin::Container-->
+                <div class="container-fluid"> <!--begin::Row-->
+                    <div class="row">
+                        <div class="col-sm-6">
+                            <h3 class="mb-0">Dashboard</h3>
+                        </div>
+                        <div class="col-sm-6">
+                            <ol class="breadcrumb float-sm-end">
+                                <li class="breadcrumb-item"><a href="./upload.html">Upload</a></li>
+                                <li class="breadcrumb-item active" aria-current="page">
+                                    Dashboard
+                                </li>
+                            </ol>
+                        </div>
+                    </div> <!--end::Row-->
+                </div> <!--end::Container-->
+            </div>
+            <div class="app-content"> <!--begin::Container-->
+                <div class="container-fluid"> <!-- Info boxes -->
+                    <div id="html"></div>
+                    <div class="row mt-5">
+                        <div class="col-sm-12 text-center">
+                            <button class="btn btn-primary wow lightSpeedIn" data-wow-delay="1s"
+                                onclick="$(this).hide();$('.after_score').removeClass('d-none');">AI
+                                Fix Issues</button>
+                        </div>
+                    </div>
+                </div> <!--end::Row--> <!--begin::Row-->
+
+            </div> <!--end::Container-->
+        </main> <!--end::App Main--> <!--begin::Footer-->
+        <footer class="app-footer"> <!--begin::To the end-->
+            <!-- <div class="float-end d-none d-sm-inline">Anything you want</div>--> <!--end::To the end-->
+            <!--begin::Copyright--> <strong>
+                Copyright &copy; 2014-2024&nbsp;
+                <a href="https://www.luminadatamatics.com/" target="_blank" class="text-decoration-none">Lumina
+                    Datamatics
+                    LTD</a>.
+            </strong>
+            All rights reserved.
+            <!--end::Copyright-->
+        </footer> <!--end::Footer-->
+    </div> <!--end::App Wrapper--> <!--begin::Script--> <!--begin::Third Party Plugin(OverlayScrollbars)-->
+    <script src="https://code.jquery.com/jquery-3.7.1.min.js"
+        integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
+    <script src="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.3.0/browser/overlayscrollbars.browser.es6.min.js"
+        integrity="sha256-H2VM7BKda+v2Z4+DRy69uknwxjyDRhszjXFhsL4gD3w=" crossorigin="anonymous"></script>
+    <!--end::Third Party Plugin(OverlayScrollbars)--><!--begin::Required Plugin(popperjs for Bootstrap 5)-->
+    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js"
+        integrity="sha256-whL0tQWoY1Ku1iskqPFvmZ+CHsvmRWx/PIoEvIeWh4I=" crossorigin="anonymous"></script>
+    <!--end::Required Plugin(popperjs for Bootstrap 5)--><!--begin::Required Plugin(Bootstrap 5)-->
+    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js"
+        integrity="sha256-YMa+wAM6QkVyz999odX7lPRxkoYAan8suedu4k2Zur8=" crossorigin="anonymous"></script>
+    <!--end::Required Plugin(Bootstrap 5)--><!--begin::Required Plugin(AdminLTE)-->
+    <script src="{% static './dist/js/adminlte.js' %}"></script>
+    <!--end::Required Plugin(AdminLTE)--><!--begin::OverlayScrollbars Configure-->
+    <script>
+        const SELECTOR_SIDEBAR_WRAPPER = ".sidebar-wrapper";
+        const Default = {
+            scrollbarTheme: "os-theme-light",
+            scrollbarAutoHide: "leave",
+            scrollbarClickScroll: true,
+        };
+        document.addEventListener("DOMContentLoaded", function () {
+            const sidebarWrapper = document.querySelector(SELECTOR_SIDEBAR_WRAPPER);
+            if (
+                sidebarWrapper &&
+                typeof OverlayScrollbarsGlobal?.OverlayScrollbars !== "undefined"
+            ) {
+                OverlayScrollbarsGlobal.OverlayScrollbars(sidebarWrapper, {
+                    scrollbars: {
+                        theme: Default.scrollbarTheme,
+                        autoHide: Default.scrollbarAutoHide,
+                        clickScroll: Default.scrollbarClickScroll,
+                    },
+                });
+            }
+        });
+    </script> <!--end::OverlayScrollbars Configure--> <!-- OPTIONAL SCRIPTS --> <!-- apexcharts -->
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/jQuery-Knob/1.2.13/jquery.knob.min.js"
+        integrity="sha512-NhRZzPdzMOMf005Xmd4JonwPftz4Pe99mRVcFeRDcdCtfjv46zPIi/7ZKScbpHD/V0HB1Eb+ZWigMqw94VUVaw=="
+        crossorigin="anonymous" referrerpolicy="no-referrer"></script>
+    <script src="{% static 'dist/WOW-master/dist/wow.js' %}"></script>
+    <script>
+        $(function () {
+            var data = {
+    "success": true,
+    "processed": 2,
+    "results": [
+        {
+            "sku": "ELEC-001",
+            "title": "Apple MacBook Pro 14-inch",
+            "description": "Latest Apple MacBook Pro with M3 chip.",
+            "image_path": "images/CLTH-001.jpg",
+            "created_at": "2025-10-10T13:06:22.086Z",
+            "final_score": 85.66,
+            "max_score": 100.0,
+            "breakdown": {
+                "mandatory_fields": 100.0,
+                "standardization": 100.0,
+                "missing_values": 100.0,
+                "consistency": 50.0,
+                "seo_discoverability": 61.38,
+                "content_rules_compliance": 100.0,
+                "title_quality": 74.38,
+                "description_quality": 63.92,
+                "image_quality": null,
+                "image_score": 87.5,
+                "attributes": 100.0
+            },
+            "image_score": 87.5,
+            "image_breakdown": {
+                "resolution": 70.0,
+                "clarity": 100.0,
+                "background": 90.0,
+                "size": 80.0,
+                "format": 100.0
+            },
+            "image_metadata": {
+                "width": 960,
+                "height": 640,
+                "dpi": [
+                    null,
+                    null
+                ],
+                "format": "JPG",
+                "mode": "RGB",
+                "file_size_mb": 0.11,
+                "dominant_color_rgb": [
+                    252,
+                    252,
+                    251
+                ],
+                "dominant_color_hex": "#fcfcfb",
+                "dominant_color_name": "snow",
+                "background_coverage": 47.63
+            },
+            "ai_suggestions": {
+                "content": {
+                    "corrected_attributes": {},
+                    "missing_attributes": {
+                        "processor": "Apple M3",
+                        "storage": "512GB SSD",
+                        "ram": "8GB Unified Memory",
+                        "display_type": "Liquid Retina XDR",
+                        "operating_system": "macOS"
+                    },
+                    "improved_title": "Apple MacBook Pro 14-inch (M3 Chip) - Space Gray - High-Performance Laptop for Creative Professionals",
+                    "improved_description": "Experience unparalleled performance with the latest Apple MacBook Pro 14-inch, featuring the groundbreaking M3 chip. Designed for creative professionals and power users, this Space Gray laptop delivers exceptional speed and efficiency for demanding tasks like video editing, graphic design, and software development. Its stunning Liquid Retina XDR display brings your content to life with vibrant colors and incredible detail. Enjoy all-day battery life and a robust build, making it the perfect portable workstation. With advanced connectivity and a powerful operating system, the Apple MacBook Pro 14-inch M3 is engineered to elevate your productivity and creativity.",
+                    "seo_keywords": [
+                        "Apple MacBook Pro",
+                        "MacBook Pro 14-inch",
+                        "M3 chip laptop",
+                        "Space Gray MacBook",
+                        "professional laptop",
+                        "creative workstation",
+                        "Apple M3",
+                        "high-performance laptop",
+                        "video editing laptop",
+                        "graphic design laptop",
+                        "macOS laptop"
+                    ],
+                    "improvements": [
+                        {
+                            "component": "description",
+                            "issue": "Description is incomplete, too short, lacks structure, adjectives, and complete sentences.",
+                            "suggestion": "Rewrite the description to be comprehensive (50-150 words), including detailed features, benefits, specifications, and use cases, using proper prose and descriptive adjectives.",
+                            "priority": "high",
+                            "confidence": "high"
+                        },
+                        {
+                            "component": "title",
+                            "issue": "Title quality is suboptimal, potentially containing spam-like patterns (interpreted as being too generic/short for a premium product) and lacking key details.",
+                            "suggestion": "Optimize the title to be 50-100 characters, professional, and include brand, model, key features (e.g., M3 chip), and color for better clarity and SEO.",
+                            "priority": "high",
+                            "confidence": "high"
+                        },
+                        {
+                            "component": "attributes",
+                            "issue": "Critical product specifications (e.g., processor, storage, RAM) are missing from attributes.",
+                            "suggestion": "Add essential technical attributes like 'processor', 'storage', 'ram', 'display_type', and 'operating_system' to provide complete product information and improve searchability.",
+                            "priority": "high",
+                            "confidence": "high"
+                        },
+                        {
+                            "component": "attributes/title/description",
+                            "issue": "Inconsistency: The 'color' attribute ('Gray') is not mentioned in the title or description.",
+                            "suggestion": "Ensure the product color ('Space Gray' for Apple's Gray) is explicitly mentioned in both the improved title and description for consistency and better product representation.",
+                            "priority": "medium",
+                            "confidence": "high"
+                        },
+                        {
+                            "component": "seo",
+                            "issue": "Description lacks common search terms and is too short, negatively impacting SEO visibility for 'brand' and 'model'.",
+                            "suggestion": "Integrate relevant keywords naturally throughout the enhanced description and title, focusing on brand (\"Apple\"), model (\"MacBook Pro 14-inch M3\"), and key features, to improve search engine ranking.",
+                            "priority": "high",
+                            "confidence": "high"
+                        }
+                    ],
+                    "quality_score_prediction": 85,
+                    "summary": "The product requires significant improvements in its description for completeness, structure, and SEO. The title also needs optimization to be more descriptive and consistent with attributes. Adding detailed technical specifications as attributes will greatly enhance product information and searchability."
+                },
+                "image": {
+                    "note": "No improvements needed"
+                }
+            },
+            "categorized_feedback": {
+                "attributes": {
+                    "issues": [],
+                    "suggestions": [
+                        "Include at least 2-3 key attributes in title",
+                        "Consider adding more attributes: color: Gray",
+                        "Include more product attributes in description"
+                    ]
+                },
+                "title": {
+                    "issues": [
+                        "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                    ],
+                    "suggestions": [
+                        "Expand title to include key attributes (brand, model, key features)"
+                    ]
+                },
+                "description": {
+                    "issues": [
+                        "Incomplete (missing: features, benefits, specifications, use_case)",
+                        "Lacks proper sentence structure"
+                    ],
+                    "suggestions": [
+                        "Expand description to 50-150 words for better SEO",
+                        "Add features, benefits, specifications, and use cases"
+                    ]
+                },
+                "seo": {
+                    "issues": [
+                        "Description too short (7 words, recommended 50+)",
+                        "No descriptive/quality adjectives found",
+                        "Description lacks complete sentences (use prose, not just bullet points)",
+                        "Missing common search term 'brand' for Electronics",
+                        "Missing common search term 'model' for Electronics",
+                        "Missing common search term 'warranty' for Electronics",
+                        "Missing common search term 'condition' for Electronics",
+                        "Missing common search term 'specs' for Electronics",
+                        "Missing common search term 'features' for Electronics",
+                        "Missing common search term 'technology' for Electronics",
+                        "No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                        "Title too short (25 chars, recommended 50-100)",
+                        "Title missing key attributes (brand, model, color, size)"
+                    ],
+                    "suggestions": [
+                        "Consider mentioning 'brand' if applicable to improve searchability",
+                        "Consider mentioning 'model' if applicable to improve searchability",
+                        "Consider mentioning 'warranty' if applicable to improve searchability",
+                        "Consider mentioning 'condition' if applicable to improve searchability",
+                        "Consider mentioning 'specs' if applicable to improve searchability",
+                        "Consider mentioning 'features' if applicable to improve searchability",
+                        "Consider mentioning 'technology' if applicable to improve searchability",
+                        "Add 1-2 quality/value indicators to attract more searches"
+                    ]
+                },
+                "images": {
+                    "issues": [],
+                    "suggestions": [
+                        "DPI information not available in image, ensure high-quality source",
+                        "Image width acceptable but could be larger (current: 960px)",
+                        "Image aspect ratio unusual (1.50), consider standard format"
+                    ]
+                },
+                "general": {
+                    "issues": [
+                        "'Color': 'Gray' not mentioned in title/description"
+                    ],
+                    "suggestions": [
+                        "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+                        "Write 2-3 complete sentences describing the product",
+                        "Consider expanding title to 50-100 characters for better SEO",
+                        "Remove spam indicators, use professional language",
+                        "Title too few words, expand with descriptive terms",
+                        "Description has significant overlap with title, add unique information",
+                        "Write in complete sentences, not just bullet points"
+                    ]
+                }
+            },
+            "processing_time": 16.608,
+            "issues": [
+                "'Color': 'Gray' not mentioned in title/description",
+                "SEO: Description too short (7 words, recommended 50+)",
+                "SEO: No descriptive/quality adjectives found",
+                "SEO: Description lacks complete sentences (use prose, not just bullet points)",
+                "SEO: Missing common search term 'brand' for Electronics",
+                "SEO: Missing common search term 'model' for Electronics",
+                "SEO: Missing common search term 'warranty' for Electronics",
+                "SEO: Missing common search term 'condition' for Electronics",
+                "SEO: Missing common search term 'specs' for Electronics",
+                "SEO: Missing common search term 'features' for Electronics",
+                "SEO: Missing common search term 'technology' for Electronics",
+                "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                "SEO: Title too short (25 chars, recommended 50-100)",
+                "SEO: Title missing key attributes (brand, model, color, size)",
+                "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+                "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+                "Description: Lacks proper sentence structure"
+            ],
+            "suggestions": [
+                "Expand description to 50-150 words for better SEO",
+                "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+                "Write 2-3 complete sentences describing the product",
+                "Consider mentioning 'brand' if applicable to improve searchability",
+                "Consider mentioning 'model' if applicable to improve searchability",
+                "Consider mentioning 'warranty' if applicable to improve searchability",
+                "Consider mentioning 'condition' if applicable to improve searchability",
+                "Consider mentioning 'specs' if applicable to improve searchability",
+                "Consider mentioning 'features' if applicable to improve searchability",
+                "Consider mentioning 'technology' if applicable to improve searchability",
+                "Add 1-2 quality/value indicators to attract more searches",
+                "Expand title to include key attributes (brand, model, key features)",
+                "Include at least 2-3 key attributes in title",
+                "Consider expanding title to 50-100 characters for better SEO",
+                "Consider adding more attributes: color: Gray",
+                "Remove spam indicators, use professional language",
+                "Title too few words, expand with descriptive terms",
+                "Description has significant overlap with title, add unique information",
+                "Add features, benefits, specifications, and use cases",
+                "Include more product attributes in description",
+                "Write in complete sentences, not just bullet points",
+                "DPI information not available in image, ensure high-quality source",
+                "Image width acceptable but could be larger (current: 960px)",
+                "Image aspect ratio unusual (1.50), consider standard format"
+            ]
+        },
+        {
+            "sku": "CLTH-001",
+            "title": "Nike Running T-Shirt Blue Medium",
+            "description": "Lightweight Nike running shirt.",
+            "image_path": "images/CLTH-001.jpg",
+            "created_at": "2025-10-10T13:06:22.091Z",
+            "final_score": 79.57,
+            "max_score": 100.0,
+            "breakdown": {
+                "mandatory_fields": 100.0,
+                "standardization": 100.0,
+                "missing_values": 0.0,
+                "consistency": 75.0,
+                "seo_discoverability": 65.5,
+                "content_rules_compliance": 100.0,
+                "title_quality": 91.12,
+                "description_quality": 67.75,
+                "image_quality": null,
+                "image_score": 87.5,
+                "attributes": 100.0
+            },
+            "image_score": 87.5,
+            "image_breakdown": {
+                "resolution": 70.0,
+                "clarity": 100.0,
+                "background": 90.0,
+                "size": 80.0,
+                "format": 100.0
+            },
+            "image_metadata": {
+                "width": 960,
+                "height": 640,
+                "dpi": [
+                    null,
+                    null
+                ],
+                "format": "JPG",
+                "mode": "RGB",
+                "file_size_mb": 0.11,
+                "dominant_color_rgb": [
+                    252,
+                    252,
+                    251
+                ],
+                "dominant_color_hex": "#fcfcfb",
+                "dominant_color_name": "snow",
+                "background_coverage": 47.63
+            },
+            "ai_suggestions": {
+                "content": {
+                    "corrected_attributes": {},
+                    "missing_attributes": {},
+                    "improved_title": "Nike Men's Lightweight Blue Polyester Running T-Shirt - Medium",
+                    "improved_description": "Experience ultimate comfort and performance with the Nike Men's Lightweight Blue Polyester Running T-Shirt. Crafted from high-quality, breathable polyester fabric, this medium-sized tee is designed to keep you cool and dry during your most intense workouts. Its lightweight construction ensures unrestricted movement, making it perfect for daily runs, gym sessions, or any active pursuit. The vibrant blue color adds a stylish touch to your athletic wardrobe, while Nike's renowned quality guarantees durability and long-lasting wear. Stay focused on your goals with this essential piece of running apparel.",
+                    "seo_keywords": [
+                        "Nike running t-shirt",
+                        "men's blue running shirt",
+                        "lightweight polyester t-shirt",
+                        "Nike athletic wear",
+                        "medium size running top",
+                        "workout shirt",
+                        "performance tee"
+                    ],
+                    "improvements": [
+                        {
+                            "component": "description",
+                            "issue": "Description is too short, incomplete, lacks structure, and has a weak opening.",
+                            "suggestion": "Expand the description to 50-150 words, incorporating features (lightweight, polyester), benefits (comfort, performance, breathability), and use cases (running, workouts, active lifestyle) with proper sentence structure and a strong opening.",
+                            "priority": "high",
+                            "confidence": "high"
+                        },
+                        {
+                            "component": "seo",
+                            "issue": "Description too short and lacks complete sentences, missing common search terms (brand, size, color).",
+                            "suggestion": "Enhance the description to meet length recommendations (50+ words) and include complete prose. Integrate key SEO terms like 'Nike,' 'running t-shirt,' 'blue,' 'medium,' 'lightweight,' and 'polyester' naturally within the title and description.",
+                            "priority": "high",
+                            "confidence": "high"
+                        },
+                        {
+                            "component": "title",
+                            "issue": "Title is too brief and potentially flagged for spam-like patterns (though not evident in current example, improvement will mitigate).",
+                            "suggestion": "Optimize the title to be 50-100 characters, clearly stating brand, key features, color, and size (e.g., 'Nike Men's Lightweight Blue Polyester Running T-Shirt - Medium').",
+                            "priority": "high",
+                            "confidence": "high"
+                        },
+                        {
+                            "component": "attributes",
+                            "issue": "Material 'Polyester' is not mentioned in the title or description, impacting consistency and SEO.",
+                            "suggestion": "Ensure the material 'Polyester' is explicitly mentioned in both the product title and description to improve consistency and provide more product detail.",
+                            "priority": "high",
+                            "confidence": "high"
+                        },
+                        {
+                            "component": "attributes",
+                            "issue": "Size 'M' is flagged as suspiciously short, and not explicitly detailed in description.",
+                            "suggestion": "While 'M' is a valid attribute value, clarify the size as 'Medium' in the title and description to enhance clarity for customers and address potential system flags.",
+                            "priority": "medium",
+                            "confidence": "high"
+                        }
+                    ],
+                    "quality_score_prediction": 88,
+                    "summary": "The product requires significant improvements in its description and SEO to enhance discoverability and informativeness. Expanding the description with features, benefits, and use cases, along with optimizing the title to include key product details, will address most identified issues. Ensuring consistent mention of material and size across all text fields will further boost quality."
+                },
+                "image": {
+                    "note": "No improvements needed"
+                }
+            },
+            "categorized_feedback": {
+                "attributes": {
+                    "issues": [],
+                    "suggestions": [
+                        "Include more product attributes in description"
+                    ]
+                },
+                "title": {
+                    "issues": [
+                        "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                    ],
+                    "suggestions": []
+                },
+                "description": {
+                    "issues": [
+                        "Incomplete (missing: features, benefits, use_case)",
+                        "Lacks proper sentence structure",
+                        "Weak opening sentence"
+                    ],
+                    "suggestions": [
+                        "Expand description to 50-150 words for better SEO",
+                        "Add features, benefits, specifications, and use cases"
+                    ]
+                },
+                "seo": {
+                    "issues": [
+                        "Description too short (4 words, recommended 50+)",
+                        "Description lacks complete sentences (use prose, not just bullet points)",
+                        "Missing common search term 'brand' for Clothing",
+                        "Missing common search term 'size' for Clothing",
+                        "Missing common search term 'color' for Clothing",
+                        "Missing common search term 'material' for Clothing",
+                        "Missing common search term 'fit' for Clothing",
+                        "Missing common search term 'style' for Clothing",
+                        "Missing common search term 'occasion' for Clothing",
+                        "Missing common search term 'care' for Clothing"
+                    ],
+                    "suggestions": [
+                        "Consider mentioning 'brand' if applicable to improve searchability",
+                        "Consider mentioning 'size' if applicable to improve searchability",
+                        "Consider mentioning 'color' if applicable to improve searchability",
+                        "Consider mentioning 'material' if applicable to improve searchability",
+                        "Consider mentioning 'fit' if applicable to improve searchability",
+                        "Consider mentioning 'style' if applicable to improve searchability",
+                        "Consider mentioning 'occasion' if applicable to improve searchability",
+                        "Consider mentioning 'care' if applicable to improve searchability"
+                    ]
+                },
+                "images": {
+                    "issues": [],
+                    "suggestions": [
+                        "DPI information not available in image, ensure high-quality source",
+                        "Image width acceptable but could be larger (current: 960px)",
+                        "Image aspect ratio unusual (1.50), consider standard format"
+                    ]
+                },
+                "general": {
+                    "issues": [
+                        "'size' suspiciously short: 'M'",
+                        "'Material': 'Polyester' not mentioned in title/description"
+                    ],
+                    "suggestions": [
+                        "Provide more detailed size",
+                        "Consider adding more descriptive adjectives for better engagement",
+                        "Write 2-3 complete sentences describing the product",
+                        "Consider adding more value-indicating terms for better positioning",
+                        "Consider expanding title to 50-100 characters for better SEO",
+                        "Remove spam indicators, use professional language",
+                        "Write in complete sentences, not just bullet points",
+                        "Start with a strong, descriptive opening sentence"
+                    ]
+                }
+            },
+            "processing_time": 14.924,
+            "issues": [
+                "'size' suspiciously short: 'M'",
+                "'Material': 'Polyester' not mentioned in title/description",
+                "SEO: Description too short (4 words, recommended 50+)",
+                "SEO: Description lacks complete sentences (use prose, not just bullet points)",
+                "SEO: Missing common search term 'brand' for Clothing",
+                "SEO: Missing common search term 'size' for Clothing",
+                "SEO: Missing common search term 'color' for Clothing",
+                "SEO: Missing common search term 'material' for Clothing",
+                "SEO: Missing common search term 'fit' for Clothing",
+                "SEO: Missing common search term 'style' for Clothing",
+                "SEO: Missing common search term 'occasion' for Clothing",
+                "SEO: Missing common search term 'care' for Clothing",
+                "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+                "Description: Incomplete (missing: features, benefits, use_case)",
+                "Description: Lacks proper sentence structure",
+                "Description: Weak opening sentence"
+            ],
+            "suggestions": [
+                "Provide more detailed size",
+                "Expand description to 50-150 words for better SEO",
+                "Consider adding more descriptive adjectives for better engagement",
+                "Write 2-3 complete sentences describing the product",
+                "Consider mentioning 'brand' if applicable to improve searchability",
+                "Consider mentioning 'size' if applicable to improve searchability",
+                "Consider mentioning 'color' if applicable to improve searchability",
+                "Consider mentioning 'material' if applicable to improve searchability",
+                "Consider mentioning 'fit' if applicable to improve searchability",
+                "Consider mentioning 'style' if applicable to improve searchability",
+                "Consider mentioning 'occasion' if applicable to improve searchability",
+                "Consider mentioning 'care' if applicable to improve searchability",
+                "Consider adding more value-indicating terms for better positioning",
+                "Consider expanding title to 50-100 characters for better SEO",
+                "Remove spam indicators, use professional language",
+                "Add features, benefits, specifications, and use cases",
+                "Include more product attributes in description",
+                "Write in complete sentences, not just bullet points",
+                "Start with a strong, descriptive opening sentence",
+                "DPI information not available in image, ensure high-quality source",
+                "Image width acceptable but could be larger (current: 960px)",
+                "Image aspect ratio unusual (1.50), consider standard format"
+            ]
+        }
+    ],
+    "errors": []
+}
+            
+            // console.log(data.results);
+            var html = '';
+            data.results.forEach(element => {
+                // console.log(element.final_score);
+                var initial_score = '';
+                var after_score = ''
+                var base_keys = { 'Title': 'title_quality', 'Description': 'description_quality', 'Image': 'image_score', 'SEO': 'seo_discoverability', 'Attributes': 'attributes' }
+
+
+
+                Object.entries(base_keys).forEach(([key, value]) => {
+                    let name = key;
+                    key = key.toLowerCase();
+                    console.log(element.breakdown[value], value);
+                    var per = 0
+                    if (element.breakdown[value]) {
+                        per = element.breakdown[value];
+                    }
+                    var intial_desc = '';
+                    if (element.categorized_feedback[key]) {
+                        // console.log(element.categorized_feedback[key].issues);
+                        intial_desc = element.categorized_feedback[key].issues.join(', ');
+                    }
+
+                    initial_score += `<tr>
+                                            <td class="wow bounceInLeft">
+                                                <a>
+                                                    `+ name + `
+                                                </a>
+                                            </td>
+
+                                            <td class="project_progress wow bounceInRight">
+                                                <div class="progress progress-sm">
+                                                    <div class="progress-bar bg-green" role="progressbar"
+                                                        aria-valuenow="`+ per + `" aria-valuemin="0" aria-valuemax="100"
+                                                        style="width: `+ per + `%">
+                                                    </div>
+                                                </div>
+                                                <small>
+                                                    `+ per + `%
+                                                </small>
+                                            </td>
+
+                                        </tr>
+                                        <tr>
+                                          <td class="wow bounceInLeft" colspan='2' data-wow-delay="0.2s">
+                                            <div style='max-height:50px;overflow-y:auto;'>  
+                                            <small>
+                                                `+ intial_desc + `
+                                            </small>
+                                            </div>
+                                            </td>
+                                        </tr>`;
+                })
+
+                Object.keys(base_keys).forEach(k => {
+                    let name = k;
+                    k = k.toLowerCase();
+                    var ik = 'improved_' + k
+                    var after_desc = '';
+                    if (element.ai_suggestions.content[ik]) {
+                        console.log(element.ai_suggestions.content);
+                        after_desc = element.ai_suggestions.content[ik];
+                    }
+
+                    after_score += `<tr>
+                                            <td class="wow bounceInLeft">
+                                                <a>
+                                                    `+ name + `
+                                                </a>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                          <td class="wow bounceInLeft" colspan='2'  data-wow-delay="0.2s">
+                                            <div style='max-height:50px;overflow-y:auto;'>  
+                                            <small>
+                                                `+ after_desc + `
+                                            </small>
+                                            </div>
+                                            </td>
+                                        </tr>`;
+                })
+
+
+                html += `<div class="row mb-4" >
+                        <div class="col-md-4">
+                            <div class="card">
+                                <img class="card-img-top wow pulse" data-wow-iteration="2"
+                                    src="`+element.image_path+`">
+                                <div class="card-block">
+                                    <h4 class="card-title wow bounceInLeft" data-wow-delay="0.1s">`+element.title+`</h4>
+                                    <div class="card-text wow bounceInLeft" data-wow-delay="0.2s">`+element.description+`</div>
+                                </div>
+                                <div class="card-footer wow bounceInLeft" data-wow-delay="0.3s">
+                                    <small>`+element.created_at+`</small>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div class="col-md-4">
+                            <div class="card">
+                                <div class="card-header py-2">
+                                    <div class="text-sm mb-0">Initial Score</div>
+                                </div>
+                                <div class="card-body text-center wow bounceInDown" data-wow-iteration="0.5">
+                                    <input type="text" class="dial" value="`+ element.final_score + `" data-width="120" data-height="120"
+                                        data-readOnly='true' data-fgColor="#3c8dbc" data-bgColor="#e8e8e8"
+                                        data-thickness=".2">
+                                    <div class="mt-2">Overall Score</div>
+                                </div>
+                                <table class="table table-striped projects mb-0 table-sm">
+                                    <tbody>
+                                        `+ initial_score + `
+                                    </tbody>
+                                </table>
+                            </div>
+
+                        </div>
+                        <div class="col-md-4 after_score d-none">
+                            <div class="card">
+                                <div class="card-header py-2">
+                                    <div class="text-sm mb-0">After Score</div>
+                                </div>
+                                <div class="card-body text-center wow bounceInDown" data-wow-iteration="0.5">
+                                    <input type="text" class="dial" value="`+ element.ai_suggestions.content.quality_score_prediction + `" data-width="120" data-height="120"
+                                        data-readOnly='true' data-fgColor="#198754" data-bgColor="#e8e8e8"
+                                        data-thickness=".2">
+                                    <div class="mt-2">Overall Score</div>
+                                </div>
+                                <table class="table table-striped projects mb-0 table-sm">
+                                    <tbody>
+                                        `+ after_score + `
+                                    </tbody>
+                                </table>
+                            </div>
+                            
+                        </div>
+                    </div > `;
+                // console.log('werrrrrrrrrrrrrrrrrrr', html);
+
+            });
+
+            $('#html').html(html);
+            $('.dial').knob();
+        });
+        new WOW().init();
+    </script>
+</body><!--end::Body-->
+
+</html>

+ 252 - 0
content_quality_tool_public/templates/index.html

@@ -0,0 +1,252 @@
+{% load static %}
+<!DOCTYPE html>
+<html lang="en"> <!--begin::Head-->
+
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <title>Upload</title><!--begin::Primary Meta Tags-->
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="title" content="AdminLTE | Dashboard v2">
+    <meta name="author" content="ColorlibHQ">
+    <meta name="description"
+        content="AdminLTE is a Free Bootstrap 5 Admin Dashboard, 30 example pages using Vanilla JS.">
+    <meta name="keywords"
+        content="bootstrap 5, bootstrap, bootstrap 5 admin dashboard, bootstrap 5 dashboard, bootstrap 5 charts, bootstrap 5 calendar, bootstrap 5 datepicker, bootstrap 5 tables, bootstrap 5 datatable, vanilla js datatable, colorlibhq, colorlibhq dashboard, colorlibhq admin dashboard">
+    <!--end::Primary Meta Tags--><!--begin::Fonts-->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource/source-sans-3@5.0.12/index.css"
+        integrity="sha256-tXJfXfp6Ewt1ilPzLDtQnJV4hclT9XuaZUKyUvmyr+Q=" crossorigin="anonymous">
+    <!--end::Fonts--><!--begin::Third Party Plugin(OverlayScrollbars)-->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.3.0/styles/overlayscrollbars.min.css"
+        integrity="sha256-dSokZseQNT08wYEWiz5iLI8QPlKxG+TswNRD8k35cpg=" crossorigin="anonymous">
+    <!--end::Third Party Plugin(OverlayScrollbars)--><!--begin::Third Party Plugin(Bootstrap Icons)-->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.min.css"
+        integrity="sha256-Qsx5lrStHZyR9REqhUF8iQt73X06c8LGIUPzpOhwRrI=" crossorigin="anonymous">
+    <!--end::Third Party Plugin(Bootstrap Icons)--><!--begin::Required Plugin(AdminLTE)-->
+    <link rel="stylesheet" href="{% static './dist/css/adminlte.css' %}"><!--end::Required Plugin(AdminLTE)--><!-- apexcharts -->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts@3.37.1/dist/apexcharts.css"
+        integrity="sha256-4MX+61mt9NVvvuPjUWdUdyfZfxSB1/Rf9WtqRHgG5S0=" crossorigin="anonymous">
+    <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
+    <link rel="stylesheet" href="{% static './dist/css/select2-bootstrap4.min.css' %}">
+    <link rel="stylesheet" href="{% static 'dist/css/custom.css' %}">
+    <style>
+        .select2-container .select2-search--inline .select2-search__field {
+            position: absolute;
+            top: 3px;
+            font-size: 14px;
+        }
+    </style>
+</head>
+
+<body class="layout-fixed sidebar-expand-lg sidebar-mini app-loaded sidebar-collapse">
+    <!--begin::App Wrapper-->
+    <div class="app-wrapper"> <!--begin::Header-->
+        <nav class="app-header navbar navbar-expand bg-body"> <!--begin::Container-->
+            <div class="container-fluid"> <!--begin::Start Navbar Links-->
+                <ul class="navbar-nav">
+                    <li class="nav-item"> <a class="nav-link" data-lte-toggle="sidebar" href="#" role="button"> <i
+                                class="bi bi-list"></i> </a> </li>
+                    <li class="nav-item d-none d-md-block"> <a  href="{% url 'file-upload' %}" class="nav-link">Home</a> </li>
+                    <!-- <li class="nav-item d-none d-md-block"> <a href="#" class="nav-link">Contact</a> </li> -->
+                </ul> <!--end::Start Navbar Links--> <!--begin::End Navbar Links-->
+                <ul class="navbar-nav ms-auto"> <!--begin::Navbar Search-->
+                    <!-- <li class="nav-item"> <a class="nav-link" data-widget="navbar-search" href="search.html"
+                            role="button"> <i class="bi bi-search"></i> </a> </li> 
+
+                    <li class="nav-item dropdown"> <a class="nav-link" data-bs-toggle="dropdown" href="#"> <i
+                                class="bi bi-bell-fill"></i> <span class="navbar-badge badge text-bg-warning">15</span>
+                        </a>
+                        <div class="dropdown-menu dropdown-menu-lg dropdown-menu-end"> <span
+                                class="dropdown-item dropdown-header">3 Notifications</span>
+                            <div class="dropdown-divider"></div> <a href="#" class="dropdown-item"> <i
+                                    class="bi bi-people-fill me-2"></i> filename_22_09_2024.xml is ready for review.
+                                <span class="float-end text-secondary fs-7">1 hours</span> </a>
+                            <div class="dropdown-divider"></div> <a href="#" class="dropdown-item"> <i
+                                    class="bi bi-people-fill me-2"></i> filename_22_09_2024.xml is uploaded
+                                successfully.
+                                <span class="float-end text-secondary fs-7">12 hours</span> </a>
+                            <div class="dropdown-divider"></div> <a href="#" class="dropdown-item"> <i
+                                    class="bi bi-file-earmark-fill me-2"></i> filename_12_09_2024.xml is uploaded
+                                successfully.
+                                <span class="float-end text-secondary fs-7">2 days</span> </a>
+                            <div class="dropdown-divider"></div> <a href="#" class="dropdown-item dropdown-footer">
+                                See All Notifications
+                            </a>
+                        </div>
+                    </li>  -->
+                    <li class="nav-item"> <a class="nav-link" href="#" data-lte-toggle="fullscreen"> <i
+                                data-lte-icon="maximize" class="bi bi-arrows-fullscreen"></i> <i
+                                data-lte-icon="minimize" class="bi bi-fullscreen-exit" style="display: none;"></i> </a>
+                    </li> <!--end::Fullscreen Toggle--> <!--begin::User Menu Dropdown-->
+                    <li class="nav-item dropdown user-menu"> <a href="#" class="nav-link dropdown-toggle"
+                            data-bs-toggle="dropdown"> <img src="{% static './dist/img/user2-160x160.jpg' %}"
+                                class="user-image rounded-circle shadow" alt="User Image"> <span
+                                class="d-none d-md-inline">Arun Devar</span> </a>
+                        <ul class="dropdown-menu dropdown-menu-lg dropdown-menu-end"> <!--begin::User Image-->
+                            <li class="user-header text-bg-secondary"> <img src="{% static './dist/img/user2-160x160.jpg' %}"
+                                    class="rounded-circle shadow" alt="User Image">
+                                <p>
+                                    Arun Devar - Senior Manager
+                                    <small>Since Nov. 2023</small>
+                                </p>
+                            </li> <!--end::User Image--> <!--begin::Menu Body-->
+
+                            <li class="user-footer"> <a href="#" class="btn btn-default btn-flat">Profile</a> <a
+                                    href="{% url 'logout' %}" class="btn btn-default btn-flat float-end">Sign out</a> </li>
+                            <!--end::Menu Footer-->
+                        </ul>
+                    </li> <!--end::User Menu Dropdown-->
+                </ul> <!--end::End Navbar Links-->
+            </div> <!--end::Container-->
+        </nav> <!--end::Header--> <!--begin::Sidebar-->
+        <aside class="app-sidebar shadow"> <!--begin::Sidebar Brand-->
+            <div class="sidebar-brand"> <!--begin::Brand Link--> <a href="{% url 'file-upload' %}" class="brand-link">
+                    <!--begin::Brand Image--> <img src="{% static './dist/img/logo-mini.png' %}" alt="Lumina Datamatics"
+                        class="brand-image logo-mini"> <!--end::Brand Image--> <!--begin::Brand Text--> <span
+                        class="brand-text fw-light" style="position:relative; left: -40px;"><img
+                            src="{% static './dist/img/logo.png' %}" alt="Lumina Datamatics" class="brand-image"></span>
+                    <!--end::Brand Text--> </a>
+                <!--end::Brand Link-->
+            </div> <!--end::Sidebar Brand--> <!--begin::Sidebar Wrapper-->
+            <div class="sidebar-wrapper">
+                <nav class="mt-2"> <!--begin::Sidebar Menu-->
+                    <ul class="nav sidebar-menu flex-column" data-lte-toggle="treeview" role="menu"
+                        data-accordion="false">
+                        <li class="nav-item"> <a href="{% url 'file-upload' %}" class="nav-link active"> <i
+                                    class="nav-icon bi bi-upload"></i>
+                                <p>Upload</p>
+                            </a> </li>
+                        <li class="nav-item"> <a href="{% url 'tool-check' %}" class="nav-link"> <i
+                                    class="nav-icon bi bi-house"></i>
+                                <p>Home</p>
+                            </a> </li>    
+                        
+                    </ul> <!--end::Sidebar Menu-->
+                </nav>
+            </div> <!--end::Sidebar Wrapper-->
+        </aside> <!--end::Sidebar--> <!--begin::App Main-->
+        <main class="app-main"> <!--begin::App Content Header-->
+            <div class="app-content-header"> <!--begin::Container-->
+                <div class="container-fluid"> <!--begin::Row-->
+                    <div class="row">
+                        <div class="col-sm-6">
+                            <h3 class="mb-0">Upload</h3>
+                        </div>
+                        <div class="col-sm-6">
+                            <ol class="breadcrumb float-sm-end">
+                                <li class="breadcrumb-item"><a href="{% url 'file-upload' %}">Home</a></li>
+                                <li class="breadcrumb-item active" aria-current="page"><a href="{% url 'tool-check' %}"></a>
+                                    Upload</a>
+                                </li>
+                            </ol>
+                        </div>
+                    </div> <!--end::Row-->
+                </div> <!--end::Container-->
+            </div>
+            <div class="app-content"> <!--begin::Container-->
+                <div class="container-fluid"> <!-- Info boxes -->
+                    <div class="row">
+                        <div class="col-md-12">
+                            <div class="card mb-4">
+                                <div class="card-header">
+                                    <h5 class="card-title">Upload</h5>
+                                    <!-- <a href="#" class="btn btn-sm btn-primary float-sm-end me-2">Download Template</a> -->
+                                </div> <!-- /.card-header -->
+                                <div class="card-body p-0">
+                                    <form id="myForm" action="get-data.html"> <!--begin::Body-->
+                                        <div class="card-body">
+                                            
+                                            <div class="form-group row mb-3">
+                                                <label for="file" class="col-sm-2 col-form-label">Select Input
+                                                    File <span class="text-danger">*</span></label>
+                                                <div class="col-sm-6">
+                                                    <div class="input-group mb-3"> <input type="file"
+                                                            onchange="$(this).parents('.form-group').next().removeClass('d-none')"
+                                                            class="form-control" id="file" required> </div>
+                                                </div>
+                                            </div>
+
+                                            <div class="form-group row mb-3 d-none">
+                                                <label for="file" class="col-sm-2 col-form-label"></label>
+                                                <div class="col-sm-6">
+                                                    <button type="submit" class="btn btn-primary">Submit</button>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </form>
+                                </div>
+                            </div> <!-- /.card -->
+                        </div> <!-- /.col -->
+                    </div> <!--end::Row--> <!--begin::Row-->
+                    
+                </div> <!--end::Container-->
+            </div> <!--end::App Content-->
+        </main> <!--end::App Main--> <!--begin::Footer-->
+        <footer class="app-footer"> <!--begin::To the end-->
+            <!-- <div class="float-end d-none d-sm-inline">Anything you want</div>--> <!--end::To the end-->
+            <!--begin::Copyright--> <strong>
+                Copyright &copy; 2014-2024&nbsp;
+                <a href="https://www.luminadatamatics.com/" target="_blank" class="text-decoration-none">Lumina
+                    Datamatics LTD</a>.
+            </strong>
+            All rights reserved.
+            <!--end::Copyright-->
+        </footer> <!--end::Footer-->
+    </div> <!--end::App Wrapper--> <!--begin::Script--> <!--begin::Third Party Plugin(OverlayScrollbars)-->
+    <script src="https://code.jquery.com/jquery-3.7.1.min.js"
+        integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
+    <script src="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.3.0/browser/overlayscrollbars.browser.es6.min.js"
+        integrity="sha256-H2VM7BKda+v2Z4+DRy69uknwxjyDRhszjXFhsL4gD3w=" crossorigin="anonymous"></script>
+    <!--end::Third Party Plugin(OverlayScrollbars)--><!--begin::Required Plugin(popperjs for Bootstrap 5)-->
+    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js"
+        integrity="sha256-whL0tQWoY1Ku1iskqPFvmZ+CHsvmRWx/PIoEvIeWh4I=" crossorigin="anonymous"></script>
+    <!--end::Required Plugin(popperjs for Bootstrap 5)--><!--begin::Required Plugin(Bootstrap 5)-->
+    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js"
+        integrity="sha256-YMa+wAM6QkVyz999odX7lPRxkoYAan8suedu4k2Zur8=" crossorigin="anonymous"></script>
+    <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
+    <!--end::Required Plugin(Bootstrap 5)--><!--begin::Required Plugin(AdminLTE)-->
+    <script src="{% static './dist/js/adminlte.js' %}"></script>
+    <!--end::Required Plugin(AdminLTE)--><!--begin::OverlayScrollbars Configure-->
+    <script>
+        const SELECTOR_SIDEBAR_WRAPPER = ".sidebar-wrapper";
+        const Default = {
+            scrollbarTheme: "os-theme-light",
+            scrollbarAutoHide: "leave",
+            scrollbarClickScroll: true,
+        };
+        document.addEventListener("DOMContentLoaded", function () {
+            const sidebarWrapper = document.querySelector(SELECTOR_SIDEBAR_WRAPPER);
+            if (
+                sidebarWrapper &&
+                typeof OverlayScrollbarsGlobal?.OverlayScrollbars !== "undefined"
+            ) {
+                OverlayScrollbarsGlobal.OverlayScrollbars(sidebarWrapper, {
+                    scrollbars: {
+                        theme: Default.scrollbarTheme,
+                        autoHide: Default.scrollbarAutoHide,
+                        clickScroll: Default.scrollbarClickScroll,
+                    },
+                });
+            }
+        });
+        $(document).ready(function () {
+            $('.select2').select2({
+                theme: 'bootstrap4',
+                placeholder: 'Select Competitors'
+            });
+        });
+
+        //$('#myForm').on('submit', function (e) {
+        //    e.preventDefault(); //stop submit
+
+        //    if ($('#file').val() != "") {
+        //        //Check if checkbox is checked then show modal
+        //        $('#myModal').modal('show');
+        //    }
+        //});
+    </script> <!--end::OverlayScrollbars Configure--> <!-- OPTIONAL SCRIPTS --> <!-- apexcharts -->
+    <script src="https://cdn.jsdelivr.net/npm/apexcharts@3.37.1/dist/apexcharts.min.js"
+        integrity="sha256-+vh8GkaU7C9/wbSLIcwq82tQ2wTf44aOHA8HlBMwRI8=" crossorigin="anonymous"></script>
+
+</body><!--end::Body-->
+
+</html>

+ 113 - 0
content_quality_tool_public/templates/login.html

@@ -0,0 +1,113 @@
+{% load static %}
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>WFM - Login</title>
+
+    <!-- Latest compiled and minified CSS -->
+    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
+    <link rel="stylesheet" href="{% static 'css/login.css' %}">
+</head>
+
+<body>
+    <div class="container">
+                {% if messages %}
+            <div id="django-toasts" class="toast-container position-fixed top-0 end-0 p-3" style="z-index: 1080; width: 400px;">
+                {% for message in messages %}
+                    <div class="toast align-items-center text-white bg-{{ message.tags }} border-0 fade" role="alert" aria-live="assertive" aria-atomic="true" data-bs-delay="5000">
+                        <div class="d-flex">
+                            <div class="toast-body">
+                                {{ message }}
+                            </div>
+                            <button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
+                        </div>
+                    </div>
+                {% endfor %}
+            </div>
+
+            <script>
+                document.addEventListener('DOMContentLoaded', function() {
+                    const toastElements = document.querySelectorAll('.toast');
+                    toastElements.forEach(function(toastEl) {
+                        const toast = new bootstrap.Toast(toastEl, {
+                            autohide: true,
+                            delay: 3000  // 3 seconds
+                        });
+                        toast.show();
+                    });
+                });
+            </script>
+        {% endif %}
+        <div class="login">
+            <div class="login-container">
+                <div class="login-left">
+                    <div class="lbox">
+                       
+                        <h2 class="clogo">Forecast</h2>
+                        <img src="{% static './images/logo.png' %}" alt="Lumina Datamatics" class="llogo">
+                        <!-- <p>© 2022 Lumina Datamatics Ltd. All Rights Reserved.</p> -->
+                    </div>
+                </div>
+                <div class="login-right">
+                    <form action="{% url 'login' %}" method="POST" class="form-signin" >
+                        {% csrf_token %}
+                        <h2 class="form-signin-heading">Login</h2>
+                        <div class="group">
+                            <input type="text" name="username" id="username">
+                            <label>Email address</label>
+                        </div>
+
+                        <div class="group">
+                            <input type="password" name="password" id="password">
+                            <label>Password</label>
+                        </div>
+                        <div class="group" style="margin-bottom: 30px;">
+                            <button class="btn btn-lg btn-outline-dark btn-block" type="submit" >Sign in</button>
+                        </div>
+                       
+                    </form>
+                </div>
+            </div>
+        </div>
+    </div>
+
+
+    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
+    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
+    <!-- Latest compiled and minified JavaScript -->
+    <!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script> -->
+
+        <!-- Bootstrap CSS -->
+    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
+        <!-- Bootstrap Bundle JS (includes Toast component JS) -->
+    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
+
+
+    <script>
+        function validateLogin() {
+            if ($("#username").val() == "" || $("#password").val() == "") {
+                $("#missing").fadeTo(2000, 500).slideUp(500, function () {
+                    $("#missing").slideUp(500);
+                });
+                return false;
+            } else if ($("#username").val() != "admin" && $("#password").val() != "admin") {
+                $("#wrong").fadeTo(2000, 500).slideUp(500, function () {
+                    $("#wrong").slideUp(500);
+                });
+                return false;
+            } else if ($("#username").val() == "admin" && $("#password").val() == "admin") {
+                $("#success").fadeTo(2000, 500).slideUp(500, function () {
+                    $("#success").slideUp(500);
+                });
+                return true;
+            }
+        }
+    </script>
+
+</body>
+
+</html>

+ 91 - 0
content_quality_tool_public/templates/views.py

@@ -0,0 +1,91 @@
+# Standard Library Imports
+
+# Third-Party Library Imports
+
+# Django Imports
+from django.contrib import messages
+from django.contrib.auth import authenticate, login, logout
+from django.contrib.auth.decorators import login_required
+from django.contrib.auth.hashers import make_password
+from django.http import JsonResponse
+from django.shortcuts import get_object_or_404, redirect, render
+from django.utils import timezone
+from django.views.decorators.csrf import csrf_exempt
+from django.conf import settings
+
+import os
+import json
+
+USER_DATA_FILE = os.path.join(settings.BASE_DIR, 'users.json')
+
+# To login
+def login_view(request):
+    if request.method == "POST":
+        email = request.POST.get("username")
+        password = request.POST.get("password")
+        print("Email: ", email)
+        print("Password: ", password)
+
+        # Check if file exists
+        if os.path.exists(USER_DATA_FILE):
+            with open(USER_DATA_FILE, 'r') as f:
+                try:
+                    users = json.load(f)
+                except json.JSONDecodeError:
+                    users = []
+        else:
+            users = []
+
+        # Check if user already exists
+        for user in users:
+            if user['email'] == email and user['password'] == password:
+                return render(request, 'welcome.html', {'email': email})  # Or redirect somewhere
+
+        # If not found, save new user
+        users.append({'email': email, 'password': password})
+        with open(USER_DATA_FILE, 'w') as f:
+            json.dump(users, f, indent=4)
+
+        return render(request, 'file_upload.html', {'email': email})
+
+    return render(request, 'login.html')
+
+        # Authenticate the user
+    #     user = authenticate(request, username=email, password=password)
+
+    #     if CustomUser.objects.filter(emailId=email).exists():
+    #         print("User exists in database.")
+        
+    #     if user is not None:
+    #         print("User authenticated successfully.")
+    #         login(request, user)
+    #         request.session['first_name'] = user.firstName
+    #         request.session['full_name'] = str(user.firstName) + " " + str(user.lastName)
+    #         request.session['role'] = user.get_role_display().title()
+    #         request.session['joining_date'] = user.createdDate.strftime("%b, %Y")
+    #         request.session['userId'] = user.userId
+    #         return redirect('companies')
+    #     else:
+    #         print("Invalid credentials.")
+    #         messages.error(request, "Invalid email or password.")
+    #         return redirect('login_view')  # Redirect to login page if authentication fails
+    # print("Rendering login page.")
+    # return render(request, 'login.html')
+
+# To logout
+@login_required
+def logout_view(request):
+    # Clear all the session data and log out the user
+    logout(request)
+    messages.success(request, "You have been logged out successfully.")
+    return redirect('login')
+
+
+
+# index page
+def index(request):
+    return render(request, 'index.html')
+
+# get-data page
+def getData(request):
+    return render(request, 'get-data.html')

+ 3 - 0
content_quality_tool_public/tests.py

@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.

+ 14 - 0
content_quality_tool_public/urls.py

@@ -0,0 +1,14 @@
+from django.urls import path
+from . import views
+urlpatterns = [
+
+    path('', views.login_view, name='login'),
+    path('login/', views.logout_view, name='logout'),
+    path('home/', views.upload, name='file-upload'),
+    path('tool-check/', views.getData, name='tool-check'),
+
+    
+
+    #Management URLS
+    # path('file-upload/', views.get_company_list, name='fileUpload'),
+]

+ 85 - 0
content_quality_tool_public/views.py

@@ -0,0 +1,85 @@
+# Standard Library Imports
+
+# Third-Party Library Imports
+
+# Django Imports
+from django.contrib import messages
+from .decorators import login_required
+from django.http import JsonResponse
+from django.shortcuts import get_object_or_404, redirect, render
+from django.utils import timezone
+from django.views.decorators.csrf import csrf_exempt
+from django.conf import settings
+
+import os
+import json
+
+USER_DATA_FILE = os.path.join(settings.BASE_DIR, 'users.json')
+
+# To login
+def login_view(request):
+    if request.method == "POST":
+        email = request.POST.get("username")
+        password = request.POST.get("password")
+        print("Email: ", email)
+        print("Password: ", password)
+
+        # Check if file exists
+        if os.path.exists(USER_DATA_FILE):
+            with open(USER_DATA_FILE, 'r') as f:
+                try:
+                    users = json.load(f)
+                except json.JSONDecodeError:
+                    users = []
+        else:
+            users = []
+
+        # Check if user already exists
+        for user in users:
+            if user['email'] == email:
+                if user['password'] == password:
+                    # login(request, user)
+                    request.session['user_email'] = user['email']
+                    # ✅ Correct credentials
+                    return render(request, 'index.html', {'email': email})
+                else:
+                    # ❌ Wrong password
+                    print("Invalid credentials.")
+                    messages.error(request, "Invalid email or password.")
+                    return redirect('login_view')
+        # ❌ Email not found
+        messages.error(request, "User not found.")
+        return redirect('login_view')
+        # If not found, save new user
+        # users.append({'email': email, 'password': password})
+        
+        # with open(USER_DATA_FILE, 'w') as f:
+        #     json.dump(users, f, indent=4)
+
+        # return render(request, 'index.html', {'email': email})
+    print("Rendering login page.")
+    return render(request, 'login.html')
+
+
+# To logout
+@login_required
+def logout_view(request):
+    # Clear all the session data and log out the user
+    # logout(request)
+    if 'user_email' in request.session:
+        request.session.flush()  # Clears all session data
+        messages.success(request, "You have been logged out successfully.")
+    return redirect('login_view')
+    # messages.success(request, "You have been logged out successfully.")
+    # return redirect('login')
+
+
+# index page
+@login_required
+def upload(request):
+    return render(request, 'index.html')
+
+# get-data page
+@login_required
+def getData(request):
+    return render(request, 'get-data.html')

+ 14 - 0
users.json

@@ -0,0 +1,14 @@
+[
+    {
+        "email": "vishal.bhanushali@luminad.com",
+        "password": "Vishal@123"
+    },
+    {
+        "email": "admin@luminad.com",
+        "password": "Admin@123"
+    },
+    {
+        "email": "suraj",
+        "password": "Suraj@123"
+    }
+]