projectb/dashboard.html
2023-11-07 17:59:52 +05:30

444 lines
12 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Project-B</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Favicon -->
<link rel="icon" type="image/png" sizes="56x56" href="assets/images/fav-icon/v.png">
<!-- bootstrap CSS -->
<link rel="stylesheet" href="./assets/css/bootstrap.min.css" type="text/css" media="all" />
<!-- carousel CSS -->
<link rel="stylesheet" href="assets/css/owl.carousel.min.css" type="text/css" media="all"/>
<!-- nivo-slider CSS -->
<link rel="stylesheet" href="assets/css/nivo-slider.css" type="text/css" media="all" />
<!-- animate CSS -->
<link rel="stylesheet" href="assets/css/animate.css" type="text/css" media="all" />
<!-- animated-text CSS -->
<link rel="stylesheet" href="assets/css/animated-text.css" type="text/css" media="all" />
<!-- font-awesome CSS -->
<link rel="stylesheet" href="assets/css/all.min.css" type="text/css" media="all" />
<!-- font-flaticon CSS -->
<link rel="stylesheet" href="assets/css/flaticon.css" type="text/css" media="all" />
<!-- theme-default CSS -->
<link rel="stylesheet" href="assets/css/theme-default.css" type="text/css" media="all" />
<!-- meanmenu CSS -->
<link rel="stylesheet" href="assets/css/meanmenu.min.css" type="text/css" media="all" />
<link rel="stylesheet" href="assets/css/font-awesome.min.css" type="text/css" media="all" />
<!-- Main Style CSS -->
<link rel="stylesheet" href="style.css" type="text/css" media="all" />
<!-- transitions CSS -->
<link rel="stylesheet" href="assets/css/owl.transitions.css" type="text/css" media="all" />
<!-- venobox CSS -->
<link rel="stylesheet" href="venobox/venobox.css" type="text/css" media="all" />
<!-- widget CSS -->
<link rel="stylesheet" href="assets/css/widget.css" type="text/css" media="all" />
<!-- responsive CSS -->
<link rel="stylesheet" href="assets/css/responsive.css" type="text/css" media="all" />
<!-- modernizr js -->
<script src="assets/js/vendor/modernizr-3.5.0.min.js"></script>
<link rel="stylesheet" href="./assets/css/titillium.css" type="text/css">
<!-- <link href='https://fonts.googleapis.com/css?family=Titillium+Web:400,600' rel='stylesheet' type='text/css'> -->
<link rel="stylesheet" href="./node_modules/bootstrap-icons/font/bootstrap-icons.css">
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css"> -->
<style>
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
/* Style for the Choose File button */
.file-input {
background-color: #533dfd;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
}
/* Style for the Submit button */
.submit-button {
background-color: #2ecc71;
color: #fff;
border: none;
padding: 10px 20px;
height: 55px;
border-radius: 5px;
cursor: pointer;
}
body {
background-image: url('assets/images/bg1-1.png');
background-size: cover; /* Adjust as needed */
background-repeat: no-repeat;
background-attachment: fixed;
background-color: #00000073;
}
h1.title{
font-size: 20px;
margin-top: 100px;
text-align: center;
font-weight: 500;
}
.landing-icons{
width: 100%;
text-align: right;
margin-bottom: -32px;
margin-left: -16px;
}
.list-box {
/* width: 85%; */
margin-left: 23px;
/* margin-top: 10%; */
padding-bottom: 75px;
margin-top: 35px;
color: #1d3557
}
.main-header {
position: fixed!important;
top: 0!important;
width: 100%!important;
background-color: #fff!important;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1)!important;
z-index: 999!important;
border-bottom: 2px solid #A8DADC !important;
}
.nav-menu {
margin-top: -9px!important;
}
.logo-d{
width: 150px!important;
padding-top: 10px !important;
}
.heder-menu ul li a {
font-weight: 400 !important;
color: #1d3557 !important;
}
.heder-menu ul li a:hover {
filter: invert(23%) sepia(67%) saturate(2476%) hue-rotate(335deg) brightness(89%) contrast(89%);
}
.resent-post-single-box {
border-bottom: 1px solid #E8E8E8 !important;
padding-top: 10px !important;
}
.landing-icons a {
margin-right: 25px;
}
/* .icons i {
background-color: transparent;
border: none;
border-radius: 50%;
width: 80px;
height: 80px;
padding: 10px;
}
.icons i:hover {
box-shadow: 0 0 10px rgba(0, 0, 0, 0);
background-color: #e4d3f8b4;
} */
.icons img:hover{
filter: invert(3%) sepia(5%) saturate(5916%) hue-rotate(172deg) brightness(103%) contrast(98%);
}
</style>
</head>
<body>
<!-- loder -->
<div class="loader-wrapper">
<div class="loader"></div>
<div class="loder-section left-section"></div>
<div class="loder-section right-section"></div>
</div>
<!-- main-header -->
<div class="main-header">
<div class="container">
<div class="col-lg-12">
<div class="nav-menu">
<div class="header-logo">
<a href="dashboard.html" ><img class="logo-d" src="assets/images/project-b-logo.png" alt=""></a>
</div>
<div class="heder-menu">
<ul>
<li><a href="addform.html"><img class="addPageMenu" src="assets/images/new.svg" alt="">New</a></li>
<li><a href="#" id="myBtn"><img class="addPageMenu" src="assets/images/open.svg" alt="">Open</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<h1 class="title">Question Papers</h1>
<div class="container">
<div class="sideber-box list-box">
<div class="sideber-content">
<div class="sideber-title">
</div>
</div>
<div id="list"></div>
</div>
</div>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content" style="width: 600px; height: 200px;">
<span class="close" style="margin-left: 530px;">&times;</span>
<span style="margin-top: -13px; font-size: 18px;color: black;font-weight: 500;">Select File To Upload:</span>
<div class = "modal_form_box">
<input type="file" id="fileInput" accept="application/xml,text/xml" onchange="validateFile(this)" style="margin-top: 15px; border: 3px solid #EEECFE;">
</div>
<div class="modal_form_button" style="margin-top: 5px; margin-left: 0px;">
<button onclick="uploadFile()">Upload</button><span id="Message" style="color: rgb(243, 21, 21);"></span>
</div>
</div>
</div>
<div class="copy-right-area">
<div class="copy-left">
<span style="color: #1D3557;">© 2023 Project-B. All rights reserved.</span>
</div>
</div>
<!-- jquery js -->
<script src="./node_modules/jquery/dist/jquery.min.js" onload="window.$ = window.jQuery = module.exports;"></script>
<!-- bootstrap js -->
<script src="assets/js/bootstrap.min.js"></script>
<!-- carousel js -->
<script src="assets/js/owl.carousel.min.js"></script>
<!-- counterup js -->
<script src="assets/js/jquery.counterup.min.js"></script>
<!-- waypoints js -->
<script src="assets/js/waypoints.min.js"></script>
<!-- wow js -->
<script src="assets/js/wow.js"></script>
<!-- imagesloaded js -->
<script src="assets/js/imagesloaded.pkgd.min.js"></script>
<!-- venobox js -->
<script src="venobox/venobox.js"></script>
<!-- ajax mail js -->
<!-- <script src="assets/js/ajax-mail.js"></script> -->
<!-- animated-text js -->
<script src="assets/js/animated-text.js"></script>
<!-- venobox min js -->
<script src="venobox/venobox.min.js"></script>
<!-- isotope js -->
<script src="assets/js/isotope.pkgd.min.js"></script>
<!-- jquery nivo slider pack js -->
<script src="assets/js/jquery.nivo.slider.pack.js"></script>
<!-- jquery meanmenu js -->
<script src="assets/js/jquery.meanmenu.js"></script>
<script src="assets/js/popper.min.js"></script>
<!-- jquery scrollup js -->
<script src="assets/js/jquery.scrollUp.js"></script>
<!-- theme js -->
<script src="assets/js/theme.js"></script>
<script src="assets/js/jquery.barfiller.js"></script>
<script src="index.js"></script>
<!-- jquery js -->
<script>
const Swal = require('sweetalert2');
function uploadFile() {
console.log("file upload");
const fileInput = document.getElementById('fileInput');
const selectedFile = fileInput.files[0];
console.log(selectedFile)
fileupload(selectedFile)
}
var msgDiv = document.getElementById('Message');
var modal = document.getElementById('myModal');
var fileInput = document.getElementById('fileInput');
require('dotenv').config();
//XmlPath get from .env
const xmlPathenv=process.env.XML_FILE_PATH;
const xmlPath = path.join(__dirname,xmlPathenv);
function fileupload(filePaths) {
console.log('File path:', filePaths);
// Handle the selected folder path here
// You can specify the destination folder path where you want to copy/move the files
const destinationFolderPath = `${xmlPath}`;
// Use fs to copy or move the file
const fileName =filePaths.name;
var getfilepath =filePaths.path;
console.log(getfilepath)
const sourceStream = fs.createReadStream(getfilepath);
console.log(sourceStream)
const destinationStream = fs.createWriteStream(path.join(destinationFolderPath, fileName));
sourceStream.pipe(destinationStream);
sourceStream.on('end', () => {
console.log('File Uploaded successfully');
modal.style.display = 'none';
fileInput.value = "";
Swal.fire({
title: 'File Uploaded Successfully',
icon: 'success',
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {
location.reload();
}
});
});
sourceStream.on('error', (err) => {
console.error('File Upload error:', err);
modal.style.display = 'none';
fileInput.value = "";
Swal.fire('<i class="fa fa-ban" style="color:red"></i>File Upload error:', err)
});
}
</script>
<script>
// Get the modal
var modal = document.getElementById("myModal");
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
//Function for validate the File Type is only XML
function validateFile(input) {
const file = input.files[0];
const allowedExtensions = ["xml"];
const fileExtension = file.name.split(".").pop().toLowerCase();
if (!allowedExtensions.includes(fileExtension)) {
alert('Invalid file type. Only xml files are allowed.')
input.value = "";
return;
}
}
// Function to download a file by filename
function downloadFile(filename) {
const fileURL = `${xmlPath}${filename}`;
console.log(fileURL)
// Create a hidden anchor element to trigger the download
const a = document.createElement('a');
a.style.display = 'none';
a.href = fileURL;
a.download = filename;
// Append the anchor to the body and click it to trigger the download
document.body.appendChild(a);
a.click();
// Remove the anchor element
document.body.removeChild(a);
}
</script>
</body>
</html>