From 8f74d549088cfc2108075040f09cc769c612f4dc Mon Sep 17 00:00:00 2001 From: sriramv Date: Tue, 4 Jul 2023 10:53:54 +0530 Subject: [PATCH] gwm-ApplicantID --- app/controllers/creditpd.controller.js | 21 ++++----- app/controllers/test.controller.js | 60 +++++++++----------------- 2 files changed, 31 insertions(+), 50 deletions(-) diff --git a/app/controllers/creditpd.controller.js b/app/controllers/creditpd.controller.js index 8fb8127..cd71308 100644 --- a/app/controllers/creditpd.controller.js +++ b/app/controllers/creditpd.controller.js @@ -241,11 +241,12 @@ exports.GetCreditPdData = async (req, res) => try { - applicantDetails = await Credit_PdHelper.MainApplicantDetails(req.query.losid); - MainApplicantDetails = JSON.parse(applicantDetails); - if(MainApplicantDetails.status == 200) - { - CreditGeneralInformation.findAll({ where : { name : MainApplicantDetails.data.name,is_active : 1}, + + // applicantDetails = await Credit_PdHelper.MainApplicantDetails(req.query.losid); + // MainApplicantDetails = JSON.parse(applicantDetails); + // if(MainApplicantDetails.status == 200) + // { + CreditGeneralInformation.findAll({ where : { applicant_id : req.query.losid,is_active : 1}, include : [ {model: CreditAddressDetail }, {model: CreditFuturePlans }, {model : CreditBorrowerAndGuarantorDetails }, @@ -289,11 +290,11 @@ exports.GetCreditPdData = async (req, res) => } }) - } - else - { - res.send({'status':404,'message':"failed",'data':"No data"}); - } + // } + // else + // { + // res.send({'status':404,'message':"failed",'data':"No data"}); + // } } catch(err) { res.status(500).send({'status':404, diff --git a/app/controllers/test.controller.js b/app/controllers/test.controller.js index 8bb753d..9dd20e6 100644 --- a/app/controllers/test.controller.js +++ b/app/controllers/test.controller.js @@ -47,51 +47,31 @@ exports.test = (req, res) => // SupplierDetail.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); // }).catch(err=>{logMsg.info("GeneralInformation Deletion failed ,PdId(ref_no)= "+req.body.pdid+ " ERR =" + err); }); const moment = require('moment'); - console.log("hai"); - array = [ - "09:00 am", - "09:30 am", - "10:00 am", - "10:30 am", - "11:00 am", - "11:30 am", - "12:00 pm", - "12:30 pm", - "01:00 pm", - "01:00 pm", - "01:30 pm", - "02:00 pm", - "02:30 pm", - "03:00 pm", - "03:30 pm", - "04:00 pm", - "04:30 pm", - "05:00 pm", - "05:30 pm", - "06:00 pm", - "06:30 pm", - "07:00 pm", - "07:30 pm", - "08:00 pm", - "08:30 pm", - "09:00 pm", - ]; - let index = array.indexOf("02:30 pm"); - console.log(index) - // const firstSlt = new Date("Wed Apr 12 2023 12:15:00 GMT+0530"); - // const lastSlt = new Date("Wed Apr 12 2023 12:45:00 GMT+0530"); - const firstSlt = "11:30 am"; - // const filteredTimes = array.filter(time => time.length > 4; ); - filteredTimes = array.filter(function(item) { - return array.indexOf(item) > index; - }); + array = [ + { + "serviceID": 4, + "active": 1 + }, + { + "serviceID": 5, + "active": 1 + } + ] + + value = 4; + result = array.filter((item) => item.serviceID !== value); + // let index = array.indexOf({"serviceID": value ,"active": 1}); + // console.log(index) + //removeByAttr(array, 'serviceID', value); + //array[index].remove(); + result = array.filter((item) => item.serviceID !== value); // dt = new Date(); // time = new moment(dt); // time.toString() // time = time.add(interval,'m'); - console.log(filteredTimes); - res.send({'status':200 , message:"Success." , 'rslt' : filteredTimes}); + + res.send({'status':200 , message:"Success." , 'rslt' : result}); } catch(err) { res.status(500).send({'status':404, message: err.message || "Some error occurred while inserting statements." ,'data': "No data"