smc_cet_credit_policy_backend/app/views/module.ejs
2023-07-20 13:25:42 +05:30

346 lines
9.6 KiB
Plaintext

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<style>
body {
background: #f3f3f3;
padding: 30px 20px;
}
/* Dashboard Cards */
.dashboard-cards {
position: relative;
padding-bottom: 50px;
margin: 0 !important;
}
.dashboard-cards .card {
background: #ffffff;
display: inline-block;
-webkit-perspective: 1000;
perspective: 1000;
z-index: 20;
padding: 0 !important;
margin: 5px 5px 10px 5px;
position: relative;
text-align: left;
-webkit-transition: all 0.3s 0s ease-in;
transition: all 0.3s 0s ease-in;
z-index: 1;
/* width: calc(33.33333333% - 10px); */
cursor: pointer;
transition: all 0.3s ease;
}
.dashboard-cards .card:hover {
box-shadow: 0 15px 10px -10px rgba(31, 31, 31, 0.5);
transition: all 0.3s ease;
}
.dashboard-cards .card .card-title {
background: #ffffff;
padding: 20px 15px;
position: relative;
z-index: 0;
}
.dashboard-cards .card .card-title h2 {
font-size: 24px;
letter-spacing: -0.05em;
margin: 0;
padding: 0;
}
.dashboard-cards .card .card-title h2 small {
display: block;
font-size: 14px;
margin-top: 8px;
letter-spacing: -0.025em;
}
.dashboard-cards .card .card-description {
position: relative;
font-size: 14px;
border-top: 1px solid #ddd;
padding: 10px 15px 0 15px;
}
.dashboard-cards .card .card-actions {
box-shadow: 0 2px 0px 0 rgba(0, 0, 0, 0.075);
padding: 10px;
text-align: center;
}
.dashboard-cards .card .card-flap {
background: #d9d9d9;
position: absolute;
width: 100%;
-webkit-transform-origin: top;
transform-origin: top;
/* -webkit-transform: rotateX(-90deg);
transform: rotateX(-90deg); */
}
.dashboard-cards .card .flap1 {
-webkit-transition: all 0.3s 0.3s ease-out;
transition: all 0.3s 0.3s ease-out;
z-index: -1;
}
.dashboard-cards .card .flap2 {
-webkit-transition: all 0.3s 0s ease-out;
transition: all 0.3s 0s ease-out;
z-index: -2;
}
.dashboard-cards.showing .card {
cursor: pointer;
opacity: 0.6;
-webkit-transform: scale(0.88);
transform: scale(0.88);
}
.dashboard-cards .no-touch .dashboard-cards.showing .card:hover {
opacity: 0.94;
-webkit-transform: scale(0.92);
transform: scale(0.92);
}
.dashboard-cards .card.d-card-show {
opacity: 1 !important;
-webkit-transform: scale(1) !important;
transform: scale(1) !important;
}
.dashboard-cards .card.d-card-show .card-flap {
background: #ffffff;
-webkit-transform: rotateX(0deg);
transform: rotateX(0deg);
}
.dashboard-cards .card.d-card-show .flap1 {
-webkit-transition: all 0.3s 0s ease-out;
transition: all 0.3s 0s ease-out;
}
.dashboard-cards .card.d-card-show .flap2 {
-webkit-transition: all 0.3s 0.2s ease-out;
transition: all 0.3s 0.2s ease-out;
}
.dashboard-cards .card .task-count {
width: 40px;
height: 40px;
position: absolute;
top: 14px;
right: 10px;
background: #ecf0f1;
text-align: center;
line-height: 40px;
border-radius: 100%;
color: #333333;
font-weight: 600;
transition: all .2s ease;
}
/* Task List */
.dashboard-cards .task-list {
padding: 0 !important;
}
.dashboard-cards .task-list li {
padding: 10px 0;
padding-left: 10px;
margin: 3px 0;
list-style-type: none;
border-bottom: 1px solid #e9ebed;
border-left: 3px solid #f36525;
transition: all .2s ease;
}
.dashboard-cards .task-list li:hover {
background: #ecf0f1;
transition: all .2s ease;
}
.dashboard-cards .task-list li span {
float: right;
color: #f36525;
margin-right: 5px;
}
.dashboard-cards.showing .card.d-card-show .task-count {
color: #ffffff;
background: #f36525;
transition: all .2s ease;
}
.dashboard-cards .card-actions .btn {
color: #333;
}
.dashboard-cards .card-actions .btn:hover {
color: #f36525;
}
.fileName{
display: inline-block;
}
.delete,.download{
float: right;
margin-top: 5px;
margin-right: 1rem;
}
.download{
font-size: 25px;
margin-top: 10px;
}
</style>
<body>
<div class='row dashboard-cards'>
<% for (let i = 0; i < data.length; i++) { %>
<div class='card col-md-2'></div>
<div class='card col-md-8'>
<div class='card-title'>
<h2>
LOGS
<!-- <small>You have 14 pending tasks</small> -->
</h2>
<div class='task-count'>
<%= data[i].file.length %>
</div>
</div>
<div class='card-flap flap1'>
<% for (let j = 0; j < data[i].file.length; j++) { %>
<div class='card-description'>
<ul class='task-list'>
<li id="<%= data[i].file[j]+'|'+data[i].folder %>" class="fileName">
<%= data[i].file[j] %>
</li>
<button type="button" id="<%= data[i].file[j]+'|'+data[i].folder %>" class="btn btn-danger delete">Delete</button>
<a onclick="downloadImage('<%= data[i].img[j] %>' , '<%= data[i].file[j] %>')"><i class="fa fa-download download"></i></a>
</ul>
</div>
<% } %>
<div class='card-flap flap2'>
<div class='card-actions'>
<a class='btn' href='#'>Close</a>
</div>
</div>
</div>
</div>
<div class='card col-md-2'></div>
<% } %>
</div>
<!-- Modal btn -->
<button type="button" style="display: none;" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Large Modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body" style="white-space: pre-wrap;">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</body>
<script>
$(document).ready(function () {
var zindex = 10;
$("div.card").click(function (e) {
e.preventDefault();
var isShowing = false;
if ($(this).hasClass("d-card-show")) {
isShowing = true;
}
if ($("div.dashboard-cards").hasClass("showing")) {
// a card is already in view
$("div.card.d-card-show").removeClass("d-card-show");
if (isShowing) {
// this card was showing - reset the grid
$("div.dashboard-cards").removeClass("showing");
} else {
// this card isn't showing - get in with it
$(this).css({ zIndex: zindex }).addClass("d-card-show");
}
zindex++;
} else {
// no dashboard-cards in view
$("div.dashboard-cards").addClass("showing");
$(this).css({ zIndex: zindex }).addClass("d-card-show");
zindex++;
}
});
});
$(".fileName").click(function(){
data = $(this).attr('id').split("|");
var getUrl = window.location;
path_name = getUrl.pathname.slice(0,-4)+'readlogs';
$.ajax({
type: "post",
url: path_name,
data: {'file' : data[0] , 'folder' : data[1]},
success: function(response) {
$('.modal-title').html(data[0]);
$('.modal-body').html(response.data);
$('#myModal').modal('show');
},
error: function(jqXHR, textStatus, err) {
alert('text status '+textStatus+', err '+err)
}
});
});
$(".delete").click(function(){
data = $(this).attr('id').split("|");
var getUrl = window.location;
path_name = getUrl.pathname.slice(0,-4)+'deletelog';
alert(path_name)
$.ajax({
type: "post",
url: path_name,
data: {'file' : data[0] , 'folder' : data[1]},
success: function(response) {
console.log(response);
location.reload();
},
error: function(jqXHR, textStatus, err) {
alert('text status '+textStatus+', err '+err)
}
});
});
function downloadImage(data,fileName)
{
const base64Image = data; // Replace this with your actual Base64 image data
const downloadLink = document.createElement('a');
downloadLink.href = base64Image;
downloadLink.download = fileName; // Replace with the desired file name and extension
downloadLink.click();
}
</script>
</html>