Compare commits
11 Commits
15ce2951ea
...
d130e38f88
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d130e38f88 | ||
|
|
62143d7898 | ||
|
|
0d4390bc04 | ||
|
|
b2df77b3df | ||
|
|
8b146b36af | ||
|
|
373a1636b2 | ||
|
|
ba800f3dcc | ||
|
|
896ff69c40 | ||
|
|
5cdefc41ce | ||
|
|
fb2b0dcd2c | ||
| 460ad3ad74 |
@ -6,6 +6,8 @@ const moment = require('moment');
|
||||
const { json } = require('body-parser');
|
||||
const path = require('path');
|
||||
const {Storage} = require('@google-cloud/storage');
|
||||
const fs = require('fs');
|
||||
const https = require('https');
|
||||
// var global = require('global');
|
||||
// global.arr = [ CreditAddressDetail , CreditBorrowerAndGuarantorDetails , CreditBusinessAndPersonalBankingDetails, BusinessAsset , ClientDetail , Covid19Questions , EmployeeStrength , CreditExistingLoanObligation , FamilyMemberInvolvedInBusiness , CreditFinalRemarks , CreditFinancialAnalysis , CreditFinancialInformation , CreditFuturePlans , CreditGeneralBusinessInformation , CreditGeneralInformation , CreditKeyProductBusinessContribution , CreditKeyShareholder , CreditLoanDetail , OverallPlanOfAction , PortFolioHealth , ProductAndProcess , CreditProfile , SizeAndGeographicalResearch , StockDetail , SupplierDetail , TotalOverallDebit , ValidationPoint , CreditManager , Photograph ]
|
||||
|
||||
@ -42,7 +44,7 @@ exports.PullCreditPdData = async (req, res) => {
|
||||
}
|
||||
console.log(completed_date);
|
||||
// create creditGeneralInormationData
|
||||
Object.assign(obj, { ref_no: tempData.pdid , product : tempData.product , case_no : tempData.caseno , credit_pd_type : req.body.credit_pd_type , completed_date : completed_date , applicant_id :req.body.lender_applicant_id , location : req.body.start_location});
|
||||
Object.assign(obj, { ref_no: tempData.pdid ,name:tempData.name, product : tempData.product , case_no : tempData.caseno , credit_pd_type : req.body.credit_pd_type , completed_date : completed_date , applicant_id :req.body.lender_applicant_id , location : req.body.start_location});
|
||||
|
||||
await CreditGeneralInformation.create(obj)
|
||||
.then((successData)=>{logMsg.info("GeneralInformation insert success ,PdId= "+successData.dataValues.pd_id);})
|
||||
@ -89,9 +91,10 @@ exports.PullCreditPdData = async (req, res) => {
|
||||
|
||||
if (temp_array.length > 0)
|
||||
{
|
||||
temp_array.forEach(async(element) => {
|
||||
temp_array.forEach(async(element,i) => {
|
||||
if (OverallKey == "Borrower & Guarantor Details" && element.entity_type.toLowerCase() != "individual") { console.log(element.borrower_type.toLowerCase()); Object.assign(element,{borrower_age : element.numbers_of_years_business_running}); delete element.numbers_of_years_business_running; }
|
||||
Object.assign(element , {pd_id : PDID.dataValues.pd_id , ref_no : req.body.pdid} ); Object.assign(element ,obj );
|
||||
await Object.assign(element , {pd_id : PDID.dataValues.pd_id , ref_no : req.body.pdid , display_order : i+1} );
|
||||
await Object.assign(element ,obj );
|
||||
var index = table_name[0].table_name;
|
||||
var tableName = arr[index];
|
||||
console.log(tableName);
|
||||
@ -257,22 +260,22 @@ exports.GetCreditPdData = async (req, res) =>
|
||||
CreditGeneralInformation.findAll({ where : { applicant_id : req.query.losid,is_active : 1},
|
||||
include : [
|
||||
{model: CreditAddressDetail },
|
||||
{model : CreditBorrowerAndGuarantorDetails },
|
||||
{model: CreditKeyShareholder },
|
||||
{model : CreditBorrowerAndGuarantorDetails ,separate: true, order: [['display_order', 'ASC']] },
|
||||
{model: CreditKeyShareholder ,separate: true, order: [['display_order', 'ASC']] },
|
||||
{model: FamilyMemberInvolvedInBusiness },
|
||||
{model: CreditGeneralBusinessInformation },
|
||||
{model: EmployeeStrength },
|
||||
{model: CreditFinancialInformation },
|
||||
{model: CreditFinancialInformation ,separate: true, order: [['display_order', 'ASC']] },
|
||||
{model: SupplierDetail },
|
||||
{model: ClientDetail },
|
||||
{model: StockDetail },
|
||||
{model: StockDetail ,separate: true, order: [['display_order', 'ASC']]},
|
||||
{model: CreditFuturePlans },
|
||||
{model: CreditBusinessAndPersonalBankingDetails },
|
||||
{model: CreditExistingLoanObligation },
|
||||
{model: CreditBusinessAndPersonalBankingDetails,separate: true, order: [['display_order', 'ASC']] },
|
||||
{model: CreditExistingLoanObligation ,separate: true, order: [['display_order', 'ASC']] },
|
||||
{model : CreditManager },
|
||||
{model: CreditFinalRemarks },
|
||||
{model: BusinessAsset },
|
||||
{model: CreditKeyProductBusinessContribution },
|
||||
{model: BusinessAsset ,separate: true, order: [['display_order', 'ASC']] },
|
||||
{model: CreditKeyProductBusinessContribution ,separate: true, order: [['display_order', 'ASC']] },
|
||||
{model: Photograph },
|
||||
{model: CreditLoanDetail },
|
||||
]
|
||||
@ -428,6 +431,139 @@ exports.ReInsertImageData = async (req, res) =>
|
||||
|
||||
|
||||
|
||||
exports.readLogFileName = async (req , res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
folderName = req;
|
||||
const logFilePath = 'storage/log';
|
||||
|
||||
const fileNames = fs.readdirSync(logFilePath);
|
||||
// Remove the first element (0th index)
|
||||
const [, ...data] = fileNames;
|
||||
return data;
|
||||
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
|
||||
exports.readLogFile = async (req , res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
folderName = req.body.folder;
|
||||
fileName = req.body.file;
|
||||
const logFilePath = 'storage/log/'+fileName;
|
||||
|
||||
fs.readFile(logFilePath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
res.status(500).send({'status':404,'message': err.message || "Error reading log file." ,'data': "No data"});
|
||||
}
|
||||
res.send({'status':200 , message:"Success." ,'data': data});
|
||||
});
|
||||
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
|
||||
exports.viewLandingPage = async (req , res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
moduleName = [ { "module":"CREDIT PD","folder":"smc_cet_creditpd_backend"} ];
|
||||
img = []
|
||||
for(const [index,val] of moduleName.entries())
|
||||
{
|
||||
fileName = await this.readLogFileName(val.folder);
|
||||
for (let i = 0; i < fileName.length; i++)
|
||||
{
|
||||
filePath = 'storage/log/'+fileName[i];
|
||||
const logData = fs.readFileSync(filePath);
|
||||
// Convert the file content to Base64
|
||||
const base64Data = logData.toString('base64');
|
||||
// Create Base64 URL from Base64 data
|
||||
const base64Url = `data:application/octet-stream;base64,${encodeURIComponent(base64Data)}`;
|
||||
img.push(base64Url)
|
||||
}
|
||||
moduleName[index] = await Object.assign(val,{'file':fileName , 'img':img});
|
||||
};
|
||||
res.render( 'module' , { 'data' : moduleName } ,function (err, html ) {
|
||||
res.send(html)
|
||||
})
|
||||
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
|
||||
exports.deleteLogFile = async (req , res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
folderName = req.body.folder;
|
||||
fileName = req.body.file;
|
||||
|
||||
// folderName = 'smc_cet_creditpd_backend';
|
||||
// fileName = 'msg.log.2023-07-10';
|
||||
const logFilePath = 'storage/log/'+fileName;
|
||||
fs.unlink(logFilePath, (err) => {
|
||||
if (err) {
|
||||
console.error(`Error deleting file: ${err}`);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('File deleted successfully.');
|
||||
res.send({'status':200 , message:"Success." ,'data': 'No data'});
|
||||
});
|
||||
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
|
||||
exports.callSineedgeApi = (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
request('http://www.google.com', function (error, response, body) {
|
||||
res = this.PullSalesPdData(body);
|
||||
if(res.status == 200){
|
||||
res.send({'status':200 , message:"Success." ,'data': Msg});
|
||||
}
|
||||
else{
|
||||
res.send({'status':404 , message:"Failed." ,'data': "No data"});
|
||||
}
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
}); } //end of try catch
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@ -36,7 +36,9 @@ module.exports = (sequelize, DataTypes) => {
|
||||
business_owner_name_master: { type: DataTypes.STRING },
|
||||
business_years_master: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
display_order: { type: DataTypes.INTEGER },
|
||||
business_monthly_rented_amt_master: { type: DataTypes.STRING }
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -18,6 +18,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
relationship_to: { type: DataTypes.STRING },
|
||||
relationship: { type: DataTypes.STRING },
|
||||
common_remarks: { type: DataTypes.STRING },
|
||||
person_met: { type: DataTypes.STRING },
|
||||
display_order: { type: DataTypes.INTEGER },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
|
||||
|
||||
@ -13,7 +13,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
cc_limit: { type: DataTypes.STRING },
|
||||
common_remarks: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
display_order: { type: DataTypes.INTEGER }
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -18,7 +18,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
elapsed_tenure_months: { type: DataTypes.STRING },
|
||||
common_remarks: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
display_order: { type: DataTypes.INTEGER }
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -38,7 +38,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
no_of_financial_years: { type: DataTypes.INTEGER },
|
||||
common_remarks: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
display_order: { type: DataTypes.INTEGER }
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -26,6 +26,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
pd_visit_date: { type: DataTypes.STRING },
|
||||
credit_pd_type: { type: DataTypes.INTEGER },
|
||||
completed_date: { type: DataTypes.DATE },
|
||||
agency_id: { type: DataTypes.STRING },
|
||||
agency_name: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
},
|
||||
|
||||
@ -16,6 +16,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
name_of_the_company: { type: DataTypes.STRING }, // new
|
||||
display_order: { type: DataTypes.INTEGER }
|
||||
|
||||
|
||||
},
|
||||
|
||||
@ -19,6 +19,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
name_of_the_company: { type: DataTypes.STRING }, // new
|
||||
display_order: { type: DataTypes.INTEGER }
|
||||
|
||||
|
||||
},
|
||||
|
||||
@ -21,7 +21,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
estimated_uom_master: { type: DataTypes.STRING },
|
||||
name_of_the_company: { type: DataTypes.STRING }, // new
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
display_order: { type: DataTypes.INTEGER }
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -240,6 +240,15 @@ router.get("/DownloadPdReport", CreditPdController.DownloadPdReport);
|
||||
// router.get('/testGetCreditPdData',CreditPdController.testGetCreditPdData)
|
||||
|
||||
|
||||
router.get("/getfilename", CreditPdController.readLogFileName);
|
||||
|
||||
router.post("/readlogs", CreditPdController.readLogFile);
|
||||
|
||||
router.get("/view", CreditPdController.viewLandingPage);
|
||||
|
||||
router.post("/deletelog", CreditPdController.deleteLogFile);
|
||||
|
||||
|
||||
|
||||
// routes started here
|
||||
app.use('/api', router);
|
||||
|
||||
@ -92,10 +92,8 @@ async function ARRAY(Array , GenInfoObj , OverallKey) {
|
||||
if (typeof Value === "object" && ( Value !== null )) {
|
||||
Obj = await OBJECT( element, Key , Value );
|
||||
Object.assign(ArrayObj, Obj )
|
||||
if (OverallKey == "Borrower & Guarantor Details" && Key == "borrower_name" && ( element.borrower_type == "Main Applicant" || element.entity_type !== "Individual") ) { Object.assign(GenInfoObj,{name : element.borrower_name}); }
|
||||
} else {
|
||||
Object.assign(ArrayObj,{ [Key] : Value })
|
||||
if (OverallKey == "Borrower & Guarantor Details" && Key == "borrower_name" && ( element.borrower_type == "Main Applicant" || element.entity_type !== "Individual") ) { Object.assign(GenInfoObj,{name : element.borrower_name}); }
|
||||
}
|
||||
if (OverallKey == "Borrower & Guarantor Details" && Key == "numbers_of_years_business_running" )
|
||||
{
|
||||
|
||||
346
app/views/module.ejs
Normal file
346
app/views/module.ejs
Normal file
@ -0,0 +1,346 @@
|
||||
<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">×</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>
|
||||
98
package-lock.json
generated
98
package-lock.json
generated
@ -741,7 +741,6 @@
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^2.0.1"
|
||||
}
|
||||
@ -1119,7 +1118,6 @@
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
@ -1128,14 +1126,12 @@
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
@ -1227,7 +1223,6 @@
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
@ -1581,6 +1576,14 @@
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||
},
|
||||
"ejs": {
|
||||
"version": "3.1.9",
|
||||
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz",
|
||||
"integrity": "sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==",
|
||||
"requires": {
|
||||
"jake": "^10.8.5"
|
||||
}
|
||||
},
|
||||
"emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
@ -1782,6 +1785,32 @@
|
||||
"moment": "^2.29.1"
|
||||
}
|
||||
},
|
||||
"filelist": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
|
||||
"integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==",
|
||||
"requires": {
|
||||
"minimatch": "^5.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"brace-expansion": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
|
||||
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
|
||||
"requires": {
|
||||
"brace-expansion": "^2.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"fill-range": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
@ -1855,6 +1884,11 @@
|
||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
||||
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
|
||||
},
|
||||
"fs": {
|
||||
"version": "0.0.1-security",
|
||||
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
||||
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
|
||||
},
|
||||
"fs-constants": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||
@ -2125,6 +2159,11 @@
|
||||
"integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==",
|
||||
"dev": true
|
||||
},
|
||||
"http": {
|
||||
"version": "0.0.1-security",
|
||||
"resolved": "https://registry.npmjs.org/http/-/http-0.0.1-security.tgz",
|
||||
"integrity": "sha512-RnDvP10Ty9FxqOtPZuxtebw1j4L/WiqNMDtuc1YMH1XQm5TgDRaR1G9u8upL6KD1bXHSp9eSXo/ED+8Q7FAr+g=="
|
||||
},
|
||||
"http-cache-semantics": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
||||
@ -2185,6 +2224,11 @@
|
||||
"sshpk": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/https/-/https-1.0.0.tgz",
|
||||
"integrity": "sha512-4EC57ddXrkaF0x83Oj8sM6SLQHAWXw90Skqu2M4AEWENZ3F02dFJE/GARA8igO79tcgYqGrD7ae4f5L3um2lgg=="
|
||||
},
|
||||
"https-proxy-agent": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
|
||||
@ -2402,6 +2446,24 @@
|
||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
||||
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
|
||||
},
|
||||
"jake": {
|
||||
"version": "10.8.7",
|
||||
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz",
|
||||
"integrity": "sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==",
|
||||
"requires": {
|
||||
"async": "^3.2.3",
|
||||
"chalk": "^4.0.2",
|
||||
"filelist": "^1.0.4",
|
||||
"minimatch": "^3.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
@ -3086,6 +3148,15 @@
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
|
||||
},
|
||||
"path": {
|
||||
"version": "0.12.7",
|
||||
"resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
|
||||
"integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==",
|
||||
"requires": {
|
||||
"process": "^0.11.1",
|
||||
"util": "^0.10.3"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
@ -4058,6 +4129,21 @@
|
||||
"prepend-http": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"util": {
|
||||
"version": "0.10.4",
|
||||
"resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
|
||||
"integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
|
||||
"requires": {
|
||||
"inherits": "2.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
|
||||
@ -9,26 +9,31 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@google-cloud/storage": "^6.9.3",
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"date-and-time": "^2.3.1",
|
||||
"dateformat": "^5.0.3",
|
||||
"dotenv": "^10.0.0",
|
||||
"ejs": "^3.1.9",
|
||||
"express": "^4.17.1",
|
||||
"fs": "0.0.1-security",
|
||||
"global": "^4.4.0",
|
||||
"http": "0.0.1-security",
|
||||
"https": "^1.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"log4js": "^6.3.0",
|
||||
"moment": "^2.29.3",
|
||||
"mssql": "^7.2.0",
|
||||
"multer": "^1.4.4",
|
||||
"parse": "^3.4.2",
|
||||
"path": "^0.12.7",
|
||||
"request": "^2.88.2",
|
||||
"sequelize": "^6.6.5",
|
||||
"swagger-jsdoc": "^6.1.0",
|
||||
"swagger-ui-express": "^4.1.6",
|
||||
"winston": "^3.3.3",
|
||||
"winston-daily-rotate-file": "^4.5.5",
|
||||
"@google-cloud/storage": "^6.9.3"
|
||||
"winston-daily-rotate-file": "^4.5.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^2.0.12"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
require('dotenv').config();
|
||||
const express = require('express')
|
||||
const app = express()
|
||||
const app = express();
|
||||
const path = require('path');
|
||||
// Enable CORS for all routes
|
||||
const cors = require('cors');
|
||||
app.use(cors());
|
||||
@ -13,6 +14,9 @@ app.use(function(req, res, next) {
|
||||
})
|
||||
const {logMsg} = require('./app/services/logger.js');
|
||||
|
||||
app.set('views', path.join(__dirname, 'app\\views'));
|
||||
app.set('view engine', 'ejs');
|
||||
|
||||
const swaggerJsdoc = require('swagger-jsdoc');
|
||||
const swaggerUi = require('swagger-ui-express');
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user