ini cmt : suseendhiran
This commit is contained in:
parent
a8ab6f9163
commit
c7e0be4172
53
.gitignore
vendored
53
.gitignore
vendored
@ -1,50 +1,3 @@
|
|||||||
# These are some examples of commonly ignored file patterns.
|
/node_modules
|
||||||
# You should customize this list as applicable to your project.
|
/storage
|
||||||
# Learn more about .gitignore:
|
.env
|
||||||
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
|
|
||||||
|
|
||||||
# Node artifact files
|
|
||||||
node_modules/
|
|
||||||
dist/
|
|
||||||
|
|
||||||
# Compiled Java class files
|
|
||||||
*.class
|
|
||||||
|
|
||||||
# Compiled Python bytecode
|
|
||||||
*.py[cod]
|
|
||||||
|
|
||||||
# Log files
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# Package files
|
|
||||||
*.jar
|
|
||||||
|
|
||||||
# Maven
|
|
||||||
target/
|
|
||||||
dist/
|
|
||||||
|
|
||||||
# JetBrains IDE
|
|
||||||
.idea/
|
|
||||||
|
|
||||||
# Unit test reports
|
|
||||||
TEST*.xml
|
|
||||||
|
|
||||||
# Generated by MacOS
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# Generated by Windows
|
|
||||||
Thumbs.db
|
|
||||||
|
|
||||||
# Applications
|
|
||||||
*.app
|
|
||||||
*.exe
|
|
||||||
*.war
|
|
||||||
|
|
||||||
# Large media files
|
|
||||||
*.mp4
|
|
||||||
*.tiff
|
|
||||||
*.avi
|
|
||||||
*.flv
|
|
||||||
*.mov
|
|
||||||
*.wmv
|
|
||||||
|
|
||||||
|
|||||||
16
app/config/db.config.js
Normal file
16
app/config/db.config.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
require('dotenv').config();
|
||||||
|
|
||||||
|
const { logMsg } = require('../services/logger');
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
"development": {
|
||||||
|
"username": process.env.USER_NAME,
|
||||||
|
"password": process.env.PASSWORD,
|
||||||
|
"database": process.env.DATABASE,
|
||||||
|
"port": process.env.PORT,
|
||||||
|
"host": process.env.HOST,
|
||||||
|
"dialect": "mssql",
|
||||||
|
"logging": (message) =>(logMsg.info(message))
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
235
app/controllers/test.controller.js
Normal file
235
app/controllers/test.controller.js
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
const { sequelize,Test} = require('../models')
|
||||||
|
const { logMsg } = require('../services/logger.js');
|
||||||
|
const { GoogleSpreadsheet } = require('google-spreadsheet');
|
||||||
|
const fs = require('fs');
|
||||||
|
require('dotenv').config();
|
||||||
|
let dropdown = [];
|
||||||
|
let column_name;
|
||||||
|
let doc;
|
||||||
|
let CREDENTIALS;
|
||||||
|
const tempData = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exports.Welcome = (req, res) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const Msg = "Welcome....!";
|
||||||
|
console.log(Msg);
|
||||||
|
logMsg.info("Api Call Success");
|
||||||
|
res.send({'status':200 , message:"Success." ,'data': Msg});
|
||||||
|
|
||||||
|
} 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.loginPage = async (req, res ) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
res.render( 'login' ,function (err, html ) { res.send(html) })
|
||||||
|
} catch(err) {
|
||||||
|
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||||
|
} //end of try catch
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exports.getRow = async (req, res) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// console.log(req.query.email);
|
||||||
|
email = "ajay@gmail.com"
|
||||||
|
// arr for ejs
|
||||||
|
const empData = [];
|
||||||
|
await doc.loadInfo();
|
||||||
|
// Index of the sheet
|
||||||
|
let sheet = doc.sheetsByIndex[0];
|
||||||
|
// Get all the rows
|
||||||
|
let rows = await sheet.getRows();
|
||||||
|
|
||||||
|
// dropdown array for each dropdown column
|
||||||
|
category = []; age_Category = [];
|
||||||
|
basthi = []; varga = [];
|
||||||
|
milan_shaka = []; poruppu = [];
|
||||||
|
blood_group = []; ganavesh_2w_4w_basg = [];
|
||||||
|
new_index = 0;
|
||||||
|
|
||||||
|
category.push('');
|
||||||
|
age_Category.push('');
|
||||||
|
basthi.push('');
|
||||||
|
varga.push('');
|
||||||
|
milan_shaka.push('');
|
||||||
|
poruppu.push('');
|
||||||
|
blood_group.push('');
|
||||||
|
ganavesh_2w_4w_basg.push('')
|
||||||
|
|
||||||
|
for (let index = 0; index < rows.length; index++) {
|
||||||
|
const row = rows[index];
|
||||||
|
category.push(row['Çategory']);
|
||||||
|
age_Category.push(row['Age Category']);
|
||||||
|
basthi.push(row['Basthi']);
|
||||||
|
varga.push(row['Varga']);
|
||||||
|
milan_shaka.push(row['Milan / Shaka']);
|
||||||
|
poruppu.push(row['Poruppu']);
|
||||||
|
blood_group.push(row['Blood Group']);
|
||||||
|
ganavesh_2w_4w_basg.push(row['Ganavesh']);
|
||||||
|
if (index == rows.length-1) {
|
||||||
|
new_index = Number(row['Sl.']) + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
dropdown =
|
||||||
|
{
|
||||||
|
"category": [...new Set(category)],
|
||||||
|
"age_Category" : [...new Set(age_Category)],
|
||||||
|
"basthi" : [...new Set(basthi)],
|
||||||
|
"varga" : [...new Set(varga)],
|
||||||
|
"milan_shaka" : [...new Set(milan_shaka)],
|
||||||
|
"poruppu" : [...new Set(poruppu)],
|
||||||
|
"blood_group" : [...new Set(blood_group)],
|
||||||
|
"ganavesh_2w_4w_basg" : ganavesh_2w_4w_basg,
|
||||||
|
"new_index" : new_index
|
||||||
|
}
|
||||||
|
for (let index = 0; index < rows.length; index++) {
|
||||||
|
const row = rows[index];
|
||||||
|
// get sheet column name for dynamic insertion
|
||||||
|
if(index == 0){ column_name = row._sheet.headerValues; }
|
||||||
|
if (row.email == email) {
|
||||||
|
// store login person data from sheet because get person id that is used to match other person manager_id
|
||||||
|
var obj = {}
|
||||||
|
for (let i = 0; i < column_name.length; i++){
|
||||||
|
// get email position in dynamic array
|
||||||
|
Object.assign( obj , { [column_name[i]] : row[column_name[i]] });
|
||||||
|
}
|
||||||
|
tempData.push(obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
for (let index = 0; index < rows.length; index++) {
|
||||||
|
const row = rows[index];
|
||||||
|
if (row.email == email || row.Gatnayak == tempData[0]['email'] ) {
|
||||||
|
var obj = {}
|
||||||
|
for (let i = 0; i < column_name.length; i++){
|
||||||
|
// get email position in dynamic array
|
||||||
|
Object.assign( obj , { [column_name[i]] : row[column_name[i]] });
|
||||||
|
}
|
||||||
|
empData.push(obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
res.render( 'displaydata' , { "data" : empData , "dropdown" : dropdown} , function (err, html ) { res.send(html) });
|
||||||
|
} catch(err) {
|
||||||
|
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||||
|
} //end of try catch
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.addRow = async (req, res) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
newData = req.body.data;
|
||||||
|
const empData = [];
|
||||||
|
// key value mapping
|
||||||
|
var obj = {}
|
||||||
|
for (let i = 0; i < column_name.length; i++){
|
||||||
|
// get email position in dynamic array
|
||||||
|
Object.assign( obj , { [column_name[i]] : newData[i] });
|
||||||
|
}
|
||||||
|
let rows = [obj];
|
||||||
|
// load the documents info
|
||||||
|
await doc.loadInfo();
|
||||||
|
// Index of the sheet
|
||||||
|
let sheet = doc.sheetsByIndex[0];
|
||||||
|
for (let index = 0; index < rows.length; index++) {
|
||||||
|
const row = rows[index];
|
||||||
|
await sheet.addRow(row);
|
||||||
|
}
|
||||||
|
if (rows[0].Gatnayak == tempData[0]['Sl.'] ) { res.send({'status':200 , message:"Success." ,'data': "success" , 'statusCode' : 1 }); }
|
||||||
|
else{ res.send({'status':200 , message:"Success." ,'data': "success", 'statusCode' : 0 }); }
|
||||||
|
} 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.updateRow = async (req, res ) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Olddata = req.body.Old;
|
||||||
|
Newdata = req.body.New;
|
||||||
|
Old = {}; New = {};
|
||||||
|
column_name.forEach(async(element , index) => {
|
||||||
|
Object.assign( Old , { [element] : Olddata[index]});
|
||||||
|
Object.assign( New , { [element] : Newdata[index]});
|
||||||
|
});
|
||||||
|
arrKeys = [ ];
|
||||||
|
arrKeys = Object.keys(Old)
|
||||||
|
var updateVal = [];
|
||||||
|
for (let i = 0; i < arrKeys.length ; i++) {
|
||||||
|
if (Old[arrKeys[i]] != New[arrKeys[i]]) {
|
||||||
|
obj = { "keyValue" : arrKeys[i] , oldValue : Old[arrKeys[i]] , newValue : New[arrKeys[i]] };
|
||||||
|
updateVal.push(obj)
|
||||||
|
obj = { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(updateVal);
|
||||||
|
// load the documents info
|
||||||
|
await doc.loadInfo();
|
||||||
|
// Index of the sheet
|
||||||
|
let sheet = doc.sheetsByIndex[0];
|
||||||
|
let rows = await sheet.getRows();
|
||||||
|
updateVal.forEach(async(element) => {
|
||||||
|
for (let index = 0; index < rows.length; index++) {
|
||||||
|
const row = rows[index];
|
||||||
|
if (element.keyValue != "Sl.") {
|
||||||
|
if (row[element.keyValue] === element.oldValue) {
|
||||||
|
rows[index][element.keyValue] = element.newValue;
|
||||||
|
await rows[index].save();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
res.send({'status':200 , message:"Success." ,'data': "Msg"})
|
||||||
|
} catch(err) {
|
||||||
|
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||||
|
} //end of try catch
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(async function ( req , res ) {
|
||||||
|
// spreadsheet key is the long id in the sheets URL
|
||||||
|
const RESPONSES_SHEET_ID = process.env.RESPONSES_SHEET_ID;
|
||||||
|
// Create a new document
|
||||||
|
doc = new GoogleSpreadsheet(RESPONSES_SHEET_ID);
|
||||||
|
// use service account creds
|
||||||
|
await doc.useServiceAccountAuth({ client_email: process.env.CLIENT_EMAIL , private_key: process.env.PRIVATE_KEY });
|
||||||
|
// load the documents info
|
||||||
|
await doc.loadInfo();
|
||||||
|
// Index of the sheet
|
||||||
|
let sheet = doc.sheetsByIndex[0];
|
||||||
|
// Get all the rows
|
||||||
|
let rows = await sheet.getRows();
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
31
app/models/Test.js
Normal file
31
app/models/Test.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class Test extends Model {
|
||||||
|
/**
|
||||||
|
* Helper method for defining associations.
|
||||||
|
* This method is not a part of Sequelize lifecycle.
|
||||||
|
* The `models/index` file will call this method automatically.
|
||||||
|
*/
|
||||||
|
// define association here
|
||||||
|
// static associate({ Financials }) {
|
||||||
|
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
Test.init(
|
||||||
|
{
|
||||||
|
losid: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'test',
|
||||||
|
modelName: 'Test',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return Test
|
||||||
|
}
|
||||||
39
app/models/index.js
Normal file
39
app/models/index.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const Sequelize = require('sequelize');
|
||||||
|
const basename = path.basename(__filename);
|
||||||
|
const env = process.env.NODE_ENV || 'development';
|
||||||
|
const config = require(__dirname + '/../config/db.config.js')[env];
|
||||||
|
//console.log(env);
|
||||||
|
//console.log(config);
|
||||||
|
const db = {};
|
||||||
|
|
||||||
|
let sequelize;
|
||||||
|
if (config.use_env_variable) {
|
||||||
|
sequelize = new Sequelize(process.env[config.use_env_variable], config);
|
||||||
|
} else {
|
||||||
|
sequelize = new Sequelize(config.database, config.username, config.password, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs
|
||||||
|
.readdirSync(__dirname)
|
||||||
|
.filter(file => {
|
||||||
|
return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js');
|
||||||
|
})
|
||||||
|
.forEach(file => {
|
||||||
|
const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes);
|
||||||
|
db[model.name] = model;
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.keys(db).forEach(modelName => {
|
||||||
|
if (db[modelName].associate) {
|
||||||
|
db[modelName].associate(db);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
db.sequelize = sequelize;
|
||||||
|
db.Sequelize = Sequelize;
|
||||||
|
|
||||||
|
module.exports = db;
|
||||||
36
app/routes/routes.js
Normal file
36
app/routes/routes.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
module.exports = app => {
|
||||||
|
const request = require("request");
|
||||||
|
const cors=require('cors');
|
||||||
|
const Mycontroller = require("../controllers/test.controller.js");
|
||||||
|
const { logMsg } = require('../services/logger.js');
|
||||||
|
var router = require("express").Router();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/demo:
|
||||||
|
* get:
|
||||||
|
* summary: Demo Api
|
||||||
|
* description: Welcome Message
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: success
|
||||||
|
*/
|
||||||
|
router.get("/demo", Mycontroller.Welcome);
|
||||||
|
|
||||||
|
router.get("/loginPage", Mycontroller.loginPage);
|
||||||
|
|
||||||
|
router.get("/getRow", Mycontroller.getRow);
|
||||||
|
|
||||||
|
router.post("/addRow", Mycontroller.addRow);
|
||||||
|
|
||||||
|
router.post("/updateRow", Mycontroller.updateRow);
|
||||||
|
|
||||||
|
// routes started here
|
||||||
|
app.use('/api', router);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
27
app/services/logger.js
Normal file
27
app/services/logger.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* Configurations of logger.
|
||||||
|
*/
|
||||||
|
var winston = require('winston');
|
||||||
|
require('winston-daily-rotate-file');
|
||||||
|
|
||||||
|
var transport = new winston.transports.DailyRotateFile({
|
||||||
|
filename: 'storage/log/msg.log',
|
||||||
|
datePattern: 'YYYY-MM-DD',
|
||||||
|
zippedArchive: true,
|
||||||
|
maxSize: '20m',
|
||||||
|
maxFiles: '14d'
|
||||||
|
});
|
||||||
|
|
||||||
|
transport.on('rotate', function(oldFilename, newFilename) {
|
||||||
|
// do something fun
|
||||||
|
});
|
||||||
|
|
||||||
|
const logger = winston.createLogger({
|
||||||
|
transports: [
|
||||||
|
transport
|
||||||
|
]
|
||||||
|
});
|
||||||
|
module.exports = {
|
||||||
|
'logMsg': logger,
|
||||||
|
};
|
||||||
|
|
||||||
965
app/views/displaydata.ejs
Normal file
965
app/views/displaydata.ejs
Normal file
@ -0,0 +1,965 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
|
||||||
|
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||||
|
|
||||||
|
<!-- icon -->
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/js/bootstrap.min.js"></script>
|
||||||
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.min.css" rel="stylesheet"/>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round|Open+Sans">
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
/* Smartphones (portrait and landscape) ----------- */
|
||||||
|
@media only screen and (max-width : 992px){
|
||||||
|
body{
|
||||||
|
background-color: #FFFFF7;
|
||||||
|
}
|
||||||
|
.header{
|
||||||
|
top: 0%;
|
||||||
|
background-color: #435d7d;
|
||||||
|
width: 100%;
|
||||||
|
height: 150px;
|
||||||
|
position: sticky;
|
||||||
|
z-index:100
|
||||||
|
}
|
||||||
|
p{
|
||||||
|
padding-top: 30px;
|
||||||
|
padding-left: 30px;
|
||||||
|
}
|
||||||
|
#myInput{
|
||||||
|
margin-left: 10px;
|
||||||
|
width: 55%;
|
||||||
|
height: 70px;
|
||||||
|
border-top-left-radius: 50px;
|
||||||
|
border-bottom-left-radius: 50px;
|
||||||
|
font-size: 40px;
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
padding-left: 25px;
|
||||||
|
}
|
||||||
|
.search-panel{
|
||||||
|
top: 30px;
|
||||||
|
margin-left: 566px;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
#search_param{
|
||||||
|
width: 180px;
|
||||||
|
height: 69px;
|
||||||
|
border-top-right-radius: 50px;
|
||||||
|
border-bottom-right-radius: 50px;
|
||||||
|
border-color: 2px solid #000;
|
||||||
|
font-size: 30px;
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
}
|
||||||
|
#material{
|
||||||
|
top: 32px;
|
||||||
|
font-size: 70px;
|
||||||
|
margin-left:85%;
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #435d7d;
|
||||||
|
border-color: #435d7d;
|
||||||
|
/* position the two buttons next to each other */
|
||||||
|
display:inline-block;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
/* Force table to not be like tables anymore */
|
||||||
|
table{
|
||||||
|
width: 90%;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
table ,thead, tbody , th, td, tr {
|
||||||
|
display: block;
|
||||||
|
font-size: 35px;
|
||||||
|
padding-top: auto;
|
||||||
|
}
|
||||||
|
/* Hide table headers (but not display: none;, for accessibility) */
|
||||||
|
thead tr {
|
||||||
|
position: absolute;
|
||||||
|
top: -9999px;
|
||||||
|
left: -9999px;
|
||||||
|
}
|
||||||
|
tr { margin: 0 0 1rem 0; }
|
||||||
|
/* tbody{
|
||||||
|
width: 70%;
|
||||||
|
} */
|
||||||
|
/* no */
|
||||||
|
td:nth-of-type(1){
|
||||||
|
margin-top: 40px;
|
||||||
|
height:100px;
|
||||||
|
width:100px;
|
||||||
|
border-radius: 50px;
|
||||||
|
/* background-color: #435d7d; */
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
text-align:center;
|
||||||
|
padding-top: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
/* position the two buttons next to each other */
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
/* catogary */
|
||||||
|
td:nth-of-type(3)::before {
|
||||||
|
content: "( ";
|
||||||
|
}
|
||||||
|
td:nth-of-type(3)::after {
|
||||||
|
content: " )";
|
||||||
|
}
|
||||||
|
td:nth-of-type(3) {
|
||||||
|
margin-top: -20px;
|
||||||
|
margin-left: 0px;
|
||||||
|
font-weight: bold;
|
||||||
|
/* position next to each other */
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
/* name */
|
||||||
|
td:nth-of-type(2) {
|
||||||
|
margin-top: -20px;
|
||||||
|
margin-left: 35px;
|
||||||
|
font-weight: bold;
|
||||||
|
/* position next to each other */
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
/* mobile no */
|
||||||
|
td:nth-of-type(5) {
|
||||||
|
margin-top: -50px;
|
||||||
|
margin-left: 140px;
|
||||||
|
}
|
||||||
|
/* Phone */
|
||||||
|
td:nth-of-type(23){
|
||||||
|
font-size: 50px;
|
||||||
|
margin-top: -85px;
|
||||||
|
margin-left: 90%;
|
||||||
|
}
|
||||||
|
.form-control{
|
||||||
|
font-size: 40px;
|
||||||
|
font-weight: bold;
|
||||||
|
height: 60px;
|
||||||
|
border-color: #000;
|
||||||
|
}
|
||||||
|
.btn-default , .material-icons {
|
||||||
|
font-size: 40px;
|
||||||
|
}
|
||||||
|
.select {
|
||||||
|
font-size: 35px;
|
||||||
|
height: 60px;
|
||||||
|
width: 100%;
|
||||||
|
color: #000;
|
||||||
|
border-color:#000;
|
||||||
|
}
|
||||||
|
option{
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000;
|
||||||
|
border-color: 2px solid #000;
|
||||||
|
border-bottom: 2px solid #000;
|
||||||
|
}
|
||||||
|
/* css for model */
|
||||||
|
/* Model CSS */
|
||||||
|
form {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0em;
|
||||||
|
}
|
||||||
|
.modal { padding: 0 !important; }
|
||||||
|
.modal .modal-dialog {
|
||||||
|
width: 100%;
|
||||||
|
max-width: none;
|
||||||
|
height: auto;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.modal .modal-content {
|
||||||
|
height: auto;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
.modal {
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.fade {
|
||||||
|
transition: opacity .15s linear;
|
||||||
|
}
|
||||||
|
*, ::after, ::before {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.modal-open{
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.modal-header{
|
||||||
|
top: 0%;
|
||||||
|
background-color: #435d7d;
|
||||||
|
width: 100%;
|
||||||
|
height: 150px;
|
||||||
|
position: sticky;
|
||||||
|
z-index:100
|
||||||
|
}
|
||||||
|
.modal-footer{
|
||||||
|
bottom: 530px;
|
||||||
|
position: sticky;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
.modal-body{
|
||||||
|
color: #566787;
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
font-size: 35px;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.5;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.add{
|
||||||
|
margin-top: 10px;
|
||||||
|
font-size: 50px;
|
||||||
|
float: right;
|
||||||
|
padding-right: 25px;
|
||||||
|
}
|
||||||
|
.back{
|
||||||
|
margin-top: 10px;
|
||||||
|
font-size: 50px;
|
||||||
|
float: left;
|
||||||
|
padding-left: 25px;
|
||||||
|
}
|
||||||
|
.modal-title {
|
||||||
|
margin-top: 10px;
|
||||||
|
color: #FFFFF7;
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
font-size: 50px;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
select , option {
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
background: #fff;
|
||||||
|
border-color: #ddd;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
.select{
|
||||||
|
padding-left: 25px;
|
||||||
|
width: 95%;
|
||||||
|
margin-left: 25px;
|
||||||
|
}
|
||||||
|
label{ padding-left: 25px; }
|
||||||
|
.form-check-label{ margin-left: 30px; }
|
||||||
|
input[type="radio"] {
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-left: 25px;
|
||||||
|
-ms-transform: scale(1.9); /* IE 9 */
|
||||||
|
-webkit-transform: scale(1.9); /* Chrome, Safari, Opera */
|
||||||
|
transform: scale(1.9);
|
||||||
|
}
|
||||||
|
.input{
|
||||||
|
display: block;
|
||||||
|
/* padding-left: 25px; */
|
||||||
|
width: 95%;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
border-bottom: 2px solid #435d7d;
|
||||||
|
}
|
||||||
|
.dropdown-item{
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Medium Devices, Desktops ....................................................... */
|
||||||
|
@media only screen and (min-width : 992px) {
|
||||||
|
.header{
|
||||||
|
width: 100%;
|
||||||
|
height: 80px;
|
||||||
|
background-color: #435d7d;
|
||||||
|
}
|
||||||
|
p{
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-left: 30px;
|
||||||
|
font-size: 3em;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
}
|
||||||
|
#material{
|
||||||
|
top: 17px;
|
||||||
|
font-size: 40px;
|
||||||
|
border-radius: 20px;
|
||||||
|
margin-left: 340px;
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #435d7d;
|
||||||
|
border-color: #435d7d;
|
||||||
|
/* position the two buttons next to each other */
|
||||||
|
display:inline-block;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
#emp {
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 70%;
|
||||||
|
margin-top: 70px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
#emp td, #emp th {
|
||||||
|
border-top: 2px solid #ddd;;
|
||||||
|
border-bottom: 2px solid #ddd;
|
||||||
|
/* border-left: 2px solid #ddd;
|
||||||
|
border-right: 2px solid #ddd; */
|
||||||
|
padding: 8px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
#emp tbody:nth-child(odd) {
|
||||||
|
background-color: #ddd;
|
||||||
|
}
|
||||||
|
#emp tr:nth-child(even){background-color: #f2f2f2;}
|
||||||
|
#emp tr:hover {background-color: #ddd;}
|
||||||
|
#emp th {
|
||||||
|
padding-top: 12px;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #435d7d;
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
}
|
||||||
|
#emp td{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
/* Model CSS */
|
||||||
|
form {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0em;
|
||||||
|
}
|
||||||
|
.modal .modal-content {
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.modal-content {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
pointer-events: auto;
|
||||||
|
background-color: #fff;
|
||||||
|
background-clip: padding-box;
|
||||||
|
border: 1px solid rgba(0,0,0,.2);
|
||||||
|
border-radius: 0.3rem;
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
.modal-dialog {
|
||||||
|
position: relative;
|
||||||
|
width: auto;
|
||||||
|
margin: 0.5rem;
|
||||||
|
}
|
||||||
|
element.style {
|
||||||
|
display: block;
|
||||||
|
padding-left: 17px;
|
||||||
|
}
|
||||||
|
.modal-open .modal {
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.modal {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 35%;
|
||||||
|
z-index: 1050;
|
||||||
|
display: none;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
.fade {
|
||||||
|
transition: opacity .15s linear;
|
||||||
|
}
|
||||||
|
*, ::after, ::before {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.modal-body , .modal-header {
|
||||||
|
color: #566787;
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
font-size: 17px;
|
||||||
|
margin: 0;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.5;
|
||||||
|
text-align: left;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.form-control {
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 2.5;
|
||||||
|
text-align: left;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
font-weight: 400;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
font-size: 20px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
.close{
|
||||||
|
font-size: 30px;
|
||||||
|
color: #566787;
|
||||||
|
}
|
||||||
|
.modal-title {
|
||||||
|
color: #566787;
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
font-size: 35px;
|
||||||
|
}
|
||||||
|
select , option {
|
||||||
|
height: 33px;
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-family: 'Varela Round', sans-serif;
|
||||||
|
background: #fff;
|
||||||
|
border-color: #ddd;
|
||||||
|
color: #566787;
|
||||||
|
}
|
||||||
|
.view{
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
.form-check-label{
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<body>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
<input class="form-control" id="myInput" type="text" placeholder="Search..">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="input-group-btn search-panel">
|
||||||
|
<select name="search_param" id="search_param" class="btn btn-default dropdown-toggle" style="background-color: #ffffff;" data-toggle="dropdown">
|
||||||
|
<option class="dropdown-item" value="Default">Default</option>
|
||||||
|
<option class="dropdown-item" value="Name">Name</option>
|
||||||
|
<option class="dropdown-item" value="Mobile">Mobile</option>
|
||||||
|
<option class="dropdown-item" value="Catogary">Catogary</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a id="new" class="new-button" title="add new" data-toggle="modal" data-target="#add-new-form"><i class="material-icons" id="material"></i></a>
|
||||||
|
</div>
|
||||||
|
<table id="emp">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Sl.</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Çategory</th>
|
||||||
|
<th hidden>Age Category</th>
|
||||||
|
<th>ContactNo</th>
|
||||||
|
<th hidden>Address</th>
|
||||||
|
<th hidden>Reference</th>
|
||||||
|
<th hidden>Basthi</th>
|
||||||
|
<th hidden>Varga</th>
|
||||||
|
<th hidden>Milan / Shaka</th>
|
||||||
|
<th hidden>Poruppu</th>
|
||||||
|
<th hidden>Ganavesh</th>
|
||||||
|
<th hidden>DOB</th>
|
||||||
|
<th hidden>Blood Group</th>
|
||||||
|
<th hidden>2W</th>
|
||||||
|
<th hidden>4W</th>
|
||||||
|
<th hidden>Pada Sanchalan 2022</th>
|
||||||
|
<th hidden>Bagh Sanghik</th>
|
||||||
|
<th hidden>Year</th>
|
||||||
|
<th hidden>Gurupooja 2021</th>
|
||||||
|
<th hidden>Gatnayak</th>
|
||||||
|
<th hidden>Email</th>
|
||||||
|
<th>Phone</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<% data.forEach(function(emp , index ) { %>
|
||||||
|
<tbody id="myTable" class="update" data-toggle="modal" data-target="#edit">
|
||||||
|
<tr>
|
||||||
|
<td><%=emp['Sl.'] %></td>
|
||||||
|
<td><%=emp.Name %></td>
|
||||||
|
<td><%=emp['Çategory'] %></td>
|
||||||
|
<td hidden><%=emp['Age Category'] %></td>
|
||||||
|
<td><%=emp.ContactNo %></td>
|
||||||
|
<td hidden><%=emp.Address %></td>
|
||||||
|
<td hidden><%=emp.Reference %></td>
|
||||||
|
<td hidden><%=emp.Basthi %></td>
|
||||||
|
<td hidden><%=emp.Varga %></td>
|
||||||
|
<td hidden><%=emp['Milan / Shaka'] %></td>
|
||||||
|
<td hidden><%=emp.Poruppu %></td>
|
||||||
|
<td hidden><%=emp.Ganavesh %></td>
|
||||||
|
<td hidden><%=emp.DOB %></td>
|
||||||
|
<td hidden><%=emp['Blood Group'] %></td>
|
||||||
|
<td hidden><%=emp['2W'] %></td>
|
||||||
|
<td hidden><%=emp['4W'] %></td>
|
||||||
|
<td hidden><%=emp['Pada Sanchalan 2022'] %></td>
|
||||||
|
<td hidden><%=emp['Bagh Sanghik'] %></td>
|
||||||
|
<td hidden><%=emp.Year %></td>
|
||||||
|
<td hidden><%=emp['Gurupooja 2021'] %></td>
|
||||||
|
<td hidden><%=emp.Gatnayak %></td>
|
||||||
|
<td hidden><%=emp.email %></td>
|
||||||
|
<td id="last"><a href="tel:<%=emp.ContactNo %>"><i class="fa fa-phone" style="color: green;"></i></a></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<% }) %>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Edit and update model -->
|
||||||
|
<div id="edit" class="modal fade" aria-modal="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form>
|
||||||
|
<div class="modal-header">
|
||||||
|
<a class="back" data-dismiss="modal" aria-hidden="true"><i id="back" class="fa fa-arrow-circle-left" style="color: #FFFFF7;"></i></a>
|
||||||
|
<h4 class="modal-title">Edit</h4>
|
||||||
|
<a id="up" class="add" data-dismiss="modal"><i class="fa fa-save" style="color: #FFFFF7;"></i></a>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" hidden>
|
||||||
|
<label>Sl.</label>
|
||||||
|
<input id="0" type="text" class="input" name="Sl.">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Name</label>
|
||||||
|
<input id="1" type="text" class="input" name="name">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Category</label>
|
||||||
|
<select id="2" type="text" class="input" name="Çategory">
|
||||||
|
<% dropdown.category.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Age Category</label>
|
||||||
|
<select id="3" type="text" class="input" name="Age Category">
|
||||||
|
<% dropdown.age_Category.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Contact No</label>
|
||||||
|
<input id="4" type="text" class="input" name="ContactNo">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Address</label>
|
||||||
|
<input id="5" type="text" class="input" name="Address">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Reference</label>
|
||||||
|
<input id="6" type="text" class="input" name="Reference">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Basthi</label>
|
||||||
|
<select id="7" type="text" class="input" name="Basthi">
|
||||||
|
<% dropdown.basthi.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Varga</label>
|
||||||
|
<select id="8" type="text" class="input" name="Varga">
|
||||||
|
<% dropdown.varga.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Milan/Shaka</label>
|
||||||
|
<select id="9" type="text" class="input" name="Milan / Shaka">
|
||||||
|
<% dropdown.milan_shaka.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Poruppu</label>
|
||||||
|
<select id="10" type="text" class="input" name="Poruppu">
|
||||||
|
<% dropdown.poruppu.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Ganavesh</label>
|
||||||
|
<select id="11" type="text" class="input" name="Ganavesh">
|
||||||
|
<% dropdown.ganavesh_2w_4w_basg.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>DOB</label>
|
||||||
|
<input id="12" type="text" class="input" name="DOB">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Blood Group</label>
|
||||||
|
<select id="13" type="text" class="input" name="Blood Group">
|
||||||
|
<% dropdown.blood_group.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>2W</label>
|
||||||
|
<select id="14" type="text" class="input" name="2W">
|
||||||
|
<% dropdown.ganavesh_2w_4w_basg.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>4W</label>
|
||||||
|
<select id="15" type="text" class="input" name="4W">
|
||||||
|
<% dropdown.ganavesh_2w_4w_basg.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Pada Sanchalan 2022</label>
|
||||||
|
<input id="16" type="text" class="input" name="Pada Sanchalan 2022">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Bagh Sanghik</label>
|
||||||
|
<select id="17" type="text" class="input" name="Bagh Sanghik">
|
||||||
|
<% dropdown.ganavesh_2w_4w_basg.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Year</label>
|
||||||
|
<input id="18" type="text" class="input" name="Year">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Gurupooja 2021</label>
|
||||||
|
<input id="19" type="text" class="input" name="Gurupooja 2021">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Gatnayak</label>
|
||||||
|
<input id="20" type="text" class="input" name="Gatnayak">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Email</label>
|
||||||
|
<input id="21" type="text" class="input" name="email">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Add new data model -->
|
||||||
|
<div id="add-new-form" class="modal fade" aria-modal="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form name="contact-form">
|
||||||
|
<div class="modal-header">
|
||||||
|
<a class="back" data-dismiss="modal" aria-hidden="true"><i class="fa fa-arrow-circle-left" style="color: #FFFFF7;"></i></a>
|
||||||
|
<h4 class="modal-title">Add</h4>
|
||||||
|
<a id="add-new" class="add" data-dismiss="modal"><i class="fa fa-save" style="color: #FFFFF7;"></i></a>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" hidden>
|
||||||
|
<label>Sl.</label>
|
||||||
|
<input id="new0" type="text" class="input" name="Sl." value="<%= dropdown.new_index %>">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Name</label>
|
||||||
|
<input id="new1" type="text" class="input" name="name">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Category</label>
|
||||||
|
<select id="new2" type="text" class="input" name="Çategory">
|
||||||
|
<% dropdown.category.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Age Category</label>
|
||||||
|
<select id="new3" type="text" class="input" name="Age Category">
|
||||||
|
<% dropdown.age_Category.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Contact No</label>
|
||||||
|
<input id="new4" type="text" class="input" name="ContactNo">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Address</label>
|
||||||
|
<input id="new5" type="text" class="input" name="Address">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Reference</label>
|
||||||
|
<input id="new6" type="text" class="input" name="Reference">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Basthi</label>
|
||||||
|
<select id="new7" type="text" class="input" name="Basthi">
|
||||||
|
<% dropdown.basthi.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Varga</label>
|
||||||
|
<select id="new8" type="text" class="input" name="Varga">
|
||||||
|
<% dropdown.varga.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Milan/Shaka</label>
|
||||||
|
<select id="new9" type="text" class="input" name="Milan / Shaka">
|
||||||
|
<% dropdown.milan_shaka.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Poruppu</label>
|
||||||
|
<select id="new10" type="text" class="input" name="Poruppu">
|
||||||
|
<% dropdown.poruppu.forEach(function(data , index ) { %>
|
||||||
|
<option class="dropdown-item" value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Ganavesh</label>
|
||||||
|
<select id="new11" type="text" class="input" name="Ganavesh">
|
||||||
|
<option class="dropdown-item" value=''></option>
|
||||||
|
<option class="dropdown-item" value='Y'>Y</option>
|
||||||
|
<option class="dropdown-item" value='N'>N</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>DOB</label>
|
||||||
|
<input id="new12" type="text" class="input" name="DOB">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Blood Group</label>
|
||||||
|
<select id="new13" type="text" class="input" name="Blood Group">
|
||||||
|
<% dropdown.blood_group.forEach(function(data , index ) { %>
|
||||||
|
<option value="<%=data %>"><%=data %></option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>2W</label>
|
||||||
|
<select id="new14" type="text" class="input" name="2W">
|
||||||
|
<option class="dropdown-item" value=''></option>
|
||||||
|
<option class="dropdown-item" value='Y'>Y</option>
|
||||||
|
<option class="dropdown-item" value='N'>N</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>4W</label>
|
||||||
|
<select id="new15" type="text" class="input" name="4W">
|
||||||
|
<option class="dropdown-item" value=''></option>
|
||||||
|
<option class="dropdown-item" value='Y'>Y</option>
|
||||||
|
<option class="dropdown-item" value='N'>N</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Pada Sanchalan 2022</label>
|
||||||
|
<input id="new16" type="text" class="input" name="Pada Sanchalan 2022">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Bagh Sanghik</label>
|
||||||
|
<select id="new17" type="text" class="input" name="Bagh Sanghik">
|
||||||
|
<option class="dropdown-item" value=''></option>
|
||||||
|
<option class="dropdown-item" value='Y'>Y</option>
|
||||||
|
<option class="dropdown-item" value='N'>N</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Year</label>
|
||||||
|
<input id="new18" type="text" class="input" name="Year">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Gurupooja 2021</label>
|
||||||
|
<input id="new19" type="text" class="input" name="Gurupooja 2021">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Gatnayak</label>
|
||||||
|
<input id="new20" type="text" class="input" name="Gatnayak">
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<label>Email</label>
|
||||||
|
<input id="new21" type="text" class="input" name="email">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let oldValue = [];let newValue = [];let pos = [];
|
||||||
|
|
||||||
|
// SI dynamic background-color
|
||||||
|
$(document).ready(function()
|
||||||
|
{
|
||||||
|
var colorArray = ["#435d7d" , "Green" , "DarkViolet" , "DarkRed" , "Brown" , "DarkOrange" , "DarkGrey" , "DodgerBlue" , "DarkSeaGreen" , "SlateBlue" ];
|
||||||
|
$('tbody').children("tr").each(function(index){
|
||||||
|
// apply color dynamically
|
||||||
|
$(this).find("td:nth-of-type(1)").css("background", colorArray[index % 10]);
|
||||||
|
// get first letter from name
|
||||||
|
var header = $(this).find('td:nth-of-type(2)').text()
|
||||||
|
$(this).find("td:nth-of-type(1)").html([header.charAt(0)]);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
// close the update form when ever we click the call icon
|
||||||
|
$(document).on("click", "#last", function(){
|
||||||
|
$('#back').click();
|
||||||
|
})
|
||||||
|
|
||||||
|
// Add new data in sheet
|
||||||
|
$(document).on("click", "#add-new", function(){
|
||||||
|
for (let i = 0; i < 20; i++) {
|
||||||
|
newValue.push($(`#new${i}`).val())
|
||||||
|
}
|
||||||
|
// add data in googlesheet using ajax
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/api/addRow",
|
||||||
|
data: { data : newValue },
|
||||||
|
success: function(response) {
|
||||||
|
if (response.status == 200 && response.statusCode == 1) {
|
||||||
|
// Get the first form with the name
|
||||||
|
// Usually the form name is not repeated
|
||||||
|
// but duplicate names are possible in HTML
|
||||||
|
// Therefore to work around the issue, enforce the correct index
|
||||||
|
var frm = document.getElementsByName('contact-form')[0];
|
||||||
|
frm.submit(); // Submit the form
|
||||||
|
frm.reset(); // Reset all form data
|
||||||
|
return false; // Prevent page refresh
|
||||||
|
alert("Data added successfully");
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
else if(response.status == 200 && response.statusCode == 0){
|
||||||
|
// Get the first form with the name
|
||||||
|
// Usually the form name is not repeated
|
||||||
|
// but duplicate names are possible in HTML
|
||||||
|
// Therefore to work around the issue, enforce the correct index
|
||||||
|
var frm = document.getElementsByName('contact-form')[0];
|
||||||
|
frm.submit(); // Submit the form
|
||||||
|
frm.reset(); // Reset all form data
|
||||||
|
return false; // Prevent page refresh
|
||||||
|
alert("Data added successfully");
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(jqXHR, textStatus, err) {
|
||||||
|
alert('text status '+textStatus+', err '+err)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// clear arr
|
||||||
|
newValue = [];
|
||||||
|
})
|
||||||
|
|
||||||
|
// Update g-sheet data
|
||||||
|
//after change/update click submit button this function will update the data in g-sheet
|
||||||
|
$(document).on("click", "#up", function(){
|
||||||
|
|
||||||
|
for (let i = 0; i < oldValue.length; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
newValue.push($(`#${i}`).val())
|
||||||
|
// update first letter from name
|
||||||
|
var header = $('#1').val();
|
||||||
|
// remove sl and update name first-letter
|
||||||
|
pos[0].find(`td:nth-child(${i+1})`).html([header.charAt(0)]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
newValue.push($(`#${i}`).val())
|
||||||
|
pos[0].find(`td:nth-child(${i+1})`).html($(`#${i}`).val());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update data in googlesheet using ajax
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/api/updateRow",
|
||||||
|
data: { Old : oldValue , New : newValue },
|
||||||
|
success: function(response) {
|
||||||
|
if (response.status == 200) { alert("updated") }
|
||||||
|
},
|
||||||
|
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
||||||
|
});
|
||||||
|
// clear arr
|
||||||
|
pos = []; oldValue = []; newValue = [];
|
||||||
|
});
|
||||||
|
//click edit form icon fetch relevent id data from g-sheet then displayed it to the relevent field in form
|
||||||
|
$(document).on("click", ".update", function(){
|
||||||
|
pos.push($(this).children("tr"));
|
||||||
|
$(this).children("tr").find("td:not(:last-child)").each(function(index){
|
||||||
|
oldValue.push($(this).text());
|
||||||
|
$(`#${index}`).val($(this).text());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Filter and Search
|
||||||
|
$(document).ready(function(){
|
||||||
|
$("#myInput").on("keyup", function() {
|
||||||
|
var value = $(this).val().toLowerCase();
|
||||||
|
if ( $('#search_param option:selected').text() == 'Default') {
|
||||||
|
$("#myTable tr").filter(function() {
|
||||||
|
$(this).toggle($(this).find("td:nth-child(2) , td:nth-child(5)").text().toLowerCase().indexOf(value) > -1)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ( $('#search_param option:selected').text() == 'Name') {
|
||||||
|
$("#myTable tr").filter(function() {
|
||||||
|
$(this).toggle($(this).find("td:nth-child(2)").text().toLowerCase().indexOf(value) > -1)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ( $('#search_param option:selected').text() == 'Mobile') {
|
||||||
|
$("#myTable tr").filter(function() {
|
||||||
|
$(this).toggle($(this).find("td:nth-child(5)").text().toLowerCase().indexOf(value) > -1)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ( $('#search_param option:selected').text() == 'Catogary') {
|
||||||
|
$("#myTable tr").filter(function() {
|
||||||
|
$(this).toggle($(this).find("td:nth-child(3)").text().toLowerCase().indexOf(value) > -1)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
138
app/views/login.ejs
Normal file
138
app/views/login.ejs
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
|
||||||
|
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||||
|
<script src="https://accounts.google.com/gsi/client" async defer></script>
|
||||||
|
<!------ Include the above in your HEAD tag ---------->
|
||||||
|
<script>
|
||||||
|
function handleCredentialResponse(response) {
|
||||||
|
const responsePayload = JSON.parse(atob(response.credential.split('.')[1]));
|
||||||
|
// window.location.replace(`http://localhost:8080/api/getRow?email=${responsePayload.email}`);
|
||||||
|
window.location = `http://localhost:8080/api/getRow?email=${responsePayload.email}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = function () {
|
||||||
|
google.accounts.id.initialize({
|
||||||
|
client_id: "1000433489727-n24pbvsdo5799elkaar78u0pgrcjmjv2.apps.googleusercontent.com",
|
||||||
|
callback: handleCredentialResponse
|
||||||
|
});
|
||||||
|
google.accounts.id.renderButton(document.getElementById("buttonDiv"),
|
||||||
|
{ type: "outline", locale: "the new locale" , theme: "filled_blue",
|
||||||
|
size: "large", shape: "rectangular",
|
||||||
|
width: "400",
|
||||||
|
logo_alignment: "left"})
|
||||||
|
google.accounts.id.prompt(); // also display the One Tap dialog
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
/* Medium Devices, Desktops */
|
||||||
|
@media only screen and (min-width : 992px) {
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
display: block;
|
||||||
|
width: 200px;
|
||||||
|
margin: 30px auto;
|
||||||
|
box-shadow: 0 5px 10px -7px #333333;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.form {
|
||||||
|
background-color: #ffffff;
|
||||||
|
width: 500px;
|
||||||
|
height: 600px;
|
||||||
|
margin: 50px auto 10px auto;
|
||||||
|
padding: 30px;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 2px 10px -3px #333;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
h3{
|
||||||
|
margin-top: 70px;
|
||||||
|
}
|
||||||
|
#buttonDiv{
|
||||||
|
margin-top: 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Smartphones (portrait and landscape) ----------- */
|
||||||
|
@media only screen and (max-width : 992px){
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #263238;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
display: block;
|
||||||
|
width: 140px;
|
||||||
|
margin: 180px auto;
|
||||||
|
box-shadow: 0 5px 10px -7px #333333;
|
||||||
|
border-radius: 100px;
|
||||||
|
}
|
||||||
|
.form {
|
||||||
|
background-color: #455a64;
|
||||||
|
width: 100%;
|
||||||
|
height: 1100px;
|
||||||
|
margin: 0px auto 10px auto;
|
||||||
|
padding: 30px;
|
||||||
|
/* border-radius: 8px; */
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 2px 10px -3px #333;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
h3{
|
||||||
|
top: 510px;
|
||||||
|
position: absolute;
|
||||||
|
font-size: 4em;
|
||||||
|
color:#fffff7;
|
||||||
|
padding: 25px;
|
||||||
|
}
|
||||||
|
#buttonDiv{
|
||||||
|
top: 150px;
|
||||||
|
margin-left: 49%;
|
||||||
|
transform: scale(2.5);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
p{
|
||||||
|
margin-top: 130px;
|
||||||
|
text-align: center;
|
||||||
|
color: #fffff7;
|
||||||
|
font-size: 4em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<body>
|
||||||
|
<div class="form">
|
||||||
|
<img src="http://www.androidpolice.com/wp-content/themes/ap2/ap_resize/ap_resize.php?src=http%3A%2F%2Fwww.androidpolice.com%2Fwp-content%2Fuploads%2F2015%2F10%2Fnexus2cee_Search-Thumb-150x150.png&w=150&h=150&zc=3">
|
||||||
|
<h3>Welcome back! Please sign in</h3>
|
||||||
|
<div id="buttonDiv"></div>
|
||||||
|
</div>
|
||||||
|
<p>......</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
110
credit.js
Normal file
110
credit.js
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
const { sequelize, Test, CreditGeneralInformation, SizeAndGeographicalResearch, CreditProfile, ProductAndProcess, PortFolioHealth, TotalOverallDebit, OverallPlanOfAction, ValidationPoint, CreditLoanDetail, CreditFinalRemarks, CreditGeneralBusinessInformation, CreditKeyProductBusinessContribution, EmployeeStrength, CreditBusinessAndPersonalBankingDetails, CreditFinancialInformation, SupplierDetail, ClientDetail, CreditFuturePlans, CreditExistingLoanObligation, FamilyMemberInvolvedInBusiness, CreditManager, CreditBorrowerAndGuarantorDetails, CreditFinancialAnalysis, CreditAddressDetail, CreditKeyShareholder, Covid19Questions, StockDetail, BusinessAsset, CreditFilterTable, Photograph } = require('../models')
|
||||||
|
const request = require('request');
|
||||||
|
const moment = require('moment');
|
||||||
|
const { logMsg } = require('../services/logger.js');
|
||||||
|
const Credit_PdHelper = require('../services/CreditPdHelper.js');
|
||||||
|
|
||||||
|
|
||||||
|
exports.PullCredit = async (req, res) => {
|
||||||
|
|
||||||
|
try {
|
||||||
|
const 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 ] ;
|
||||||
|
const tempData = JSON.parse(JSON.stringify(req.body.data));
|
||||||
|
obj = {};
|
||||||
|
GenInfoObj = {};
|
||||||
|
temp_array = [];
|
||||||
|
// create creditGeneralInormationData
|
||||||
|
Object.assign(obj, { ref_no: req.body.pdid , product :req.body.product , case_no :req.body.caseno});
|
||||||
|
PDID = await CreditGeneralInformation.create(obj)
|
||||||
|
logMsg.info("GeneralInformation insert success ,PdId= "+PDID.dataValues.pd_id);
|
||||||
|
for (var [OverallKey, OverallValue] of Object.entries(tempData)) {
|
||||||
|
table_name = await CreditFilterTable.findAll({ raw: true, attributes: [ 'table_name'], where : { section : OverallKey , is_active : 1 } , group: ['table_name']})
|
||||||
|
obj = { };
|
||||||
|
temp_array.length = 0 ;
|
||||||
|
for (var [ObjectKey, ObjectValue] of Object.entries(OverallValue)) {
|
||||||
|
if (Array.isArray(OverallValue[ObjectKey]) == true)
|
||||||
|
{
|
||||||
|
temp_array = await Credit_PdHelper.ARRAY( OverallValue[ObjectKey] , GenInfoObj , OverallKey )
|
||||||
|
}
|
||||||
|
else if (typeof OverallValue[ObjectKey] === "object" && ( OverallValue[ObjectKey] !== null ))
|
||||||
|
{
|
||||||
|
delete OverallValue[ObjectKey].display_data; delete OverallValue.display_data;
|
||||||
|
obj = await Credit_PdHelper.OBJECT( OverallValue, ObjectKey , OverallValue[ObjectKey] )
|
||||||
|
}
|
||||||
|
else if (moment(OverallValue[ObjectKey], "DD-MM-YYYY", true).isValid() == true || moment(OverallValue[ObjectKey], "DD/MM/YYYY hh:mm:ss A", true).isValid() == true )
|
||||||
|
{
|
||||||
|
date = await Credit_PdHelper.DATE( OverallValue[ObjectKey] );
|
||||||
|
Object.assign(obj, { [ObjectKey]: date });
|
||||||
|
if (OverallKey == "Officer Details") { Object.assign(GenInfoObj,{[ObjectKey] : date}) };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Object.assign(obj, { [ObjectKey]: ObjectValue });
|
||||||
|
if (OverallKey == "Borrower & Guarantor Details" && ObjectKey == "common_remarks") { Object.assign(GenInfoObj,{remarks : ObjectValue}) };
|
||||||
|
if (OverallKey == "Loan details" && ObjectKey == "loan_amount") { Object.assign(GenInfoObj,{loan_amount : ObjectValue}) };
|
||||||
|
if (OverallKey == "Officer Details") { Object.assign(GenInfoObj,{[ObjectKey] : ObjectValue}) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// DB Insertion
|
||||||
|
if (OverallKey == "Officer Details") { await CreditGeneralInformation.update(GenInfoObj , { where : { pd_id : PDID.dataValues.pd_id , is_active : 1}}); logMsg.info("CreditGeneralInformation update success ,PdId= "+PDID.dataValues.pd_id); }
|
||||||
|
if (temp_array.length > 0)
|
||||||
|
{
|
||||||
|
temp_array.forEach(async(element) => {
|
||||||
|
Object.assign(element , {pd_id : PDID.dataValues.pd_id} ); Object.assign(element ,obj );
|
||||||
|
var index = table_name[0].table_name; var tableName = arr[index]
|
||||||
|
await tableName.create(element); logMsg.info(OverallKey+" insert success ,PdId= "+PDID.dataValues.pd_id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Object.assign(obj , {pd_id : PDID.dataValues.pd_id} );
|
||||||
|
var index = table_name[0].table_name; var tableName = arr[index]
|
||||||
|
tableName.create(obj);logMsg.info(OverallKey+" insert success ,PdId= "+PDID.dataValues.pd_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res.send({'status':200,'message':"success"});
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
res.send({ 'status': 404, message: err.message || "Some error occurred while retrieving data.", 'data': "No data" });
|
||||||
|
} //end of try catch
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exports.getTable = async (req, res) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var resData = await CreditGeneralInformation.findOne({ where : { pd_id : req.query.pd_id ,is_active : 1},
|
||||||
|
include : [
|
||||||
|
{model: CreditAddressDetail }, {model: CreditFuturePlans },
|
||||||
|
{model : CreditBorrowerAndGuarantorDetails },
|
||||||
|
{model: CreditBusinessAndPersonalBankingDetails }, {model: BusinessAsset },
|
||||||
|
{model: CreditFinancialInformation }, {model: CreditKeyShareholder },
|
||||||
|
{model: CreditKeyProductBusinessContribution }, {model: EmployeeStrength },
|
||||||
|
{model: ClientDetail }, {model: StockDetail },
|
||||||
|
{model: CreditExistingLoanObligation }, {model: FamilyMemberInvolvedInBusiness },
|
||||||
|
{model : CreditManager }, {model: Photograph },
|
||||||
|
{model: CreditFinalRemarks }, {model: CreditLoanDetail },
|
||||||
|
{model: CreditGeneralBusinessInformation }, {model: SupplierDetail }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
res.send({'status':200,'message':"success",'data':resData});
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
res.status(500).send({'status':404,
|
||||||
|
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
9166
package-lock.json
generated
Normal file
9166
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
37
package.json
Normal file
37
package.json
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"name": "smc_cet_creditpd_backend",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "server.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "nodemon server.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"body-parser": "^1.19.0",
|
||||||
|
"bootstrap": "^5.2.3",
|
||||||
|
"bootstrap-icons": "^1.10.2",
|
||||||
|
"cors": "^2.8.5",
|
||||||
|
"dotenv": "^10.0.0",
|
||||||
|
"ejs": "^3.1.8",
|
||||||
|
"express": "^4.17.1",
|
||||||
|
"google-auth-library": "^8.6.0",
|
||||||
|
"google-spreadsheet": "^3.3.0",
|
||||||
|
"log4js": "^6.3.0",
|
||||||
|
"mssql": "^7.2.0",
|
||||||
|
"passport": "^0.6.0",
|
||||||
|
"passport-local": "^1.0.0",
|
||||||
|
"passport-openidconnect": "^0.1.1",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"nodemon": "^2.0.12"
|
||||||
|
}
|
||||||
|
}
|
||||||
69
server.js
Normal file
69
server.js
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
require('dotenv').config();
|
||||||
|
const express = require('express')
|
||||||
|
const path = require('path');
|
||||||
|
const app = express()
|
||||||
|
|
||||||
|
app.set('views', path.join(__dirname, 'app\\views'));
|
||||||
|
app.set('view engine', 'ejs');
|
||||||
|
|
||||||
|
|
||||||
|
//it is used to clear cache
|
||||||
|
app.use(function(req, res, next) {
|
||||||
|
res.set("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0")
|
||||||
|
res.set("Pragma", "no-cache")
|
||||||
|
res.set("Expires", 0)
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
const {logMsg} = require('./app/services/logger.js');
|
||||||
|
|
||||||
|
const swaggerJsdoc = require('swagger-jsdoc');
|
||||||
|
const swaggerUi = require('swagger-ui-express');
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
definition: {
|
||||||
|
openapi: '3.0.0',
|
||||||
|
info: {
|
||||||
|
title: 'Smc_cet_financials',
|
||||||
|
version: '1.0.0',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
apis: ['./app/routes/routes.js'], // files containing annotations as above
|
||||||
|
};
|
||||||
|
|
||||||
|
const swaggerDocument = swaggerJsdoc(options);
|
||||||
|
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @openapi
|
||||||
|
* /:
|
||||||
|
* get:
|
||||||
|
* description: Welcome to swagger-jsdoc!
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Returns a mysterious string.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
app.get("/", (req, res) => {
|
||||||
|
res.json({ message: "Welcome to the application." });
|
||||||
|
logMsg.info("Server Sent A Welcome to the application!");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
app.use(express.json())
|
||||||
|
app.use(express.urlencoded({ extended: true }));
|
||||||
|
|
||||||
|
|
||||||
|
require("./app/routes/routes.js")(app);
|
||||||
|
|
||||||
|
const PORT_NUMBER = process.env.SERVER_PORT
|
||||||
|
app.listen({ port: PORT_NUMBER }, async () => {
|
||||||
|
console.log('Server up on http://localhost:8080')
|
||||||
|
|
||||||
|
//await sequelize.authenticate()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user