banners clean up
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
|
||||
var bannerList = {
|
||||
"pending": {
|
||||
"banner": {
|
||||
"image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-start.jpg",
|
||||
"icon": "bannerimage.icon",
|
||||
"style": "style1",
|
||||
"text": "Ready to Start ?",
|
||||
"description": "Waiting for you to get started",
|
||||
"action": "pending",
|
||||
"status": "0"
|
||||
}
|
||||
},
|
||||
"current": {
|
||||
"banner": {
|
||||
"image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-active.jpg",
|
||||
"icon": "bannerimage.icon",
|
||||
"style": "style2",
|
||||
"text": "Current Activities",
|
||||
"description": "Your currently active task",
|
||||
"action": "mytask",
|
||||
"status": "0"
|
||||
}
|
||||
},
|
||||
"suggested": {
|
||||
"banner": {
|
||||
"image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-suggested.jpg",
|
||||
"icon": "bannerimage.icon",
|
||||
"style": "style2",
|
||||
"text": "Waiting for Parent",
|
||||
"description": "Waiting for parent to get started",
|
||||
"action": "parentwaiting",
|
||||
"status": "0"
|
||||
}
|
||||
},
|
||||
"recommend": {
|
||||
"banner": {
|
||||
"image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-recommend.jpg",
|
||||
"icon": "bannerimage.icon",
|
||||
"style": "style3",
|
||||
"text": "Recommend to Parent",
|
||||
"description": "Send to parent to approve",
|
||||
"action": "familymarket",
|
||||
"status": "0"
|
||||
}
|
||||
},
|
||||
"pastdue": {
|
||||
"banner": {
|
||||
"image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-pastdue.jpg",
|
||||
"icon": "bannerimage.icon",
|
||||
"style": "style5",
|
||||
"text": "Past Due",
|
||||
"description": "Ask for more time if past due",
|
||||
"action": "pastdue",
|
||||
"status": "0"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = bannerList;
|
||||
@@ -65,3 +65,14 @@ var stats = {
|
||||
},
|
||||
};
|
||||
module.exports = stats;
|
||||
|
||||
|
||||
// RecoCheckFamilyLogin : function (req, res, next) {},
|
||||
// RecoCheckFamilyCount : function (req, res, next) {},
|
||||
// RecoCheckCoupons : function (req, res, next) {},
|
||||
// RecoCheckTaskDue : function (req, res, next) {},
|
||||
// RecoCheckTaskReview : function (req, res, next) {},
|
||||
// RecoCheckBlog : function (req, res, next) {},
|
||||
// RecoOffersInterest : function (req, res, next) {},
|
||||
// RecoReferAFreind : function (req, res, next) {},
|
||||
// RecoPendingInterestCount : function (req, res, next) {},
|
||||
+6
-146
@@ -4,6 +4,7 @@ const request = require('request');
|
||||
const db = require('../app/db')
|
||||
const logger = require('../app/logger');
|
||||
const stats = require('../funct/stats');
|
||||
const bannerList = require('../funct/bannerarray');
|
||||
|
||||
var banners = {
|
||||
getfamilybanners: function (req, res, next) {
|
||||
@@ -22,7 +23,7 @@ var banners = {
|
||||
let Qstring2 ="";
|
||||
let QextraString ="";
|
||||
|
||||
|
||||
let bannerArray = bannerList;
|
||||
// WHO IS THIS
|
||||
let client_id = 0 ;
|
||||
Qstring = "SELECT id AS client_id FROM members WHERE uid::text = '"+data.uid+"'::text AND id = " + data.member_id;
|
||||
@@ -42,153 +43,21 @@ var banners = {
|
||||
bannerArray.current.banner.status = stats.checkActiveJobs(reqClinet);
|
||||
bannerArray.pastdue.banner.status = stats.checkPastDueJobs(reqClinet);
|
||||
bannerArray.pending.banner.status = stats.checkPendingOffer(reqClinet);
|
||||
bannerArray.recommend.banner.status = 100;
|
||||
bannerArray.suggested.banner.status = 10;
|
||||
|
||||
|
||||
let resultItem ={
|
||||
"result": bannerArray,
|
||||
"total_record": 4
|
||||
}
|
||||
next(null, resultItem ); // pass control to the next handler
|
||||
|
||||
// we must have client_id to contibnue
|
||||
// var reqClinet = {
|
||||
// "uid": req.body.uid,
|
||||
// "client_id": req.body.member_id,
|
||||
// };
|
||||
|
||||
// this.RecoCheckActive=( reqClinet,r2,r3)=>{
|
||||
//
|
||||
// }
|
||||
/*
|
||||
Qstring1 = "SELECT count(id) AS total_active_jobs FROM members_jobs_contract " +
|
||||
" WHERE client_id = "+client_id+" AND status =1 AND delivery_date > now() ";
|
||||
logger.info(Qstring1);
|
||||
db.query(Qstring1, function (err, result) {
|
||||
try {
|
||||
if (err) throw err;
|
||||
total_active_client_job=0;
|
||||
total_active_client_job = result.rows[0]["total_active_jobs"];
|
||||
logger.info("total_active_client_job** ==> ",total_active_client_job);
|
||||
if (total_active_client_job) bannerArray.current.banner.status = 1;
|
||||
} catch (e) {
|
||||
logger.info("Error on Active Jobs =>", e.message);
|
||||
}
|
||||
});
|
||||
logger.info("total_active_client_job ==> ",total_active_client_job);
|
||||
|
||||
|
||||
Qstring2 = " SELECT count(id) AS total_past_due FROM members_jobs_contract " +
|
||||
" WHERE client_id = "+client_id+" AND status =1 AND delivery_date < now() ";
|
||||
logger.info(Qstring2);
|
||||
db.query(Qstring2, function (err, result) {
|
||||
try {
|
||||
if (err) throw err;
|
||||
total_past_client_due=0;
|
||||
total_past_client_due = result.rows[0]["total_past_due"];
|
||||
if (total_past_client_due) bannerArray.pastdue.banner.status = 1;
|
||||
} catch (e) {
|
||||
logger.info("Error on past due =>", e.message);
|
||||
}
|
||||
});
|
||||
|
||||
logger.info("total_past_client_due ==> ",total_past_client_due);
|
||||
|
||||
bannerArray.current.banner.status = 1;
|
||||
|
||||
if( total_past_client_due >=0 &&
|
||||
total_active_client_job >=0 ){
|
||||
logger.info("RETURN ABOUT TO ==> ************** ");
|
||||
let resultItem ={
|
||||
"result": bannerArray,
|
||||
"total_record": 4
|
||||
}
|
||||
next(null, resultItem ); // pass control to the next handler
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
// end of we have client id
|
||||
} catch (e) {
|
||||
logger.info("Error on Client Id =>", e.message);
|
||||
}
|
||||
});
|
||||
logger.info("client_id ==> ",client_id);
|
||||
//***********
|
||||
|
||||
// next(null, {
|
||||
// "result": [],
|
||||
// "total_record": 0
|
||||
// } ); // pass control to the next handler
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// logger.info(" bannerArray.pending ==> ", bannerArray["pending"]);
|
||||
|
||||
// bannerCards.push({"pending" : bannerArray.pending });
|
||||
//bannerCards.push(bannerArray.current);
|
||||
|
||||
|
||||
var bannerArray = {
|
||||
"pending": {
|
||||
"banner": {
|
||||
"image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-start.jpg",
|
||||
"icon": "bannerimage.icon",
|
||||
"style": "style1",
|
||||
"text": "Ready to Start ?",
|
||||
"description": "Waiting for you to get started",
|
||||
"action": "pending",
|
||||
"status": "0"
|
||||
}
|
||||
},
|
||||
"current": {
|
||||
"banner": {
|
||||
"image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-active.jpg",
|
||||
"icon": "bannerimage.icon",
|
||||
"style": "style2",
|
||||
"text": "Current Activities",
|
||||
"description": "Your currently active task",
|
||||
"action": "mytask",
|
||||
"status": "0"
|
||||
}
|
||||
},
|
||||
"suggested": {
|
||||
"banner": {
|
||||
"image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-suggested.jpg",
|
||||
"icon": "bannerimage.icon",
|
||||
"style": "style2",
|
||||
"text": "Waiting for Parent",
|
||||
"description": "Waiting for parent to get started",
|
||||
"action": "parentwaiting",
|
||||
"status": "0"
|
||||
}
|
||||
},
|
||||
"recommend": {
|
||||
"banner": {
|
||||
"image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-recommend.jpg",
|
||||
"icon": "bannerimage.icon",
|
||||
"style": "style3",
|
||||
"text": "Recommend to Parent",
|
||||
"description": "Send to parent to approve",
|
||||
"action": "familymarket",
|
||||
"status": "0"
|
||||
}
|
||||
},
|
||||
"pastdue": {
|
||||
"banner": {
|
||||
"image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-pastdue.jpg",
|
||||
"icon": "bannerimage.icon",
|
||||
"style": "style5",
|
||||
"text": "Past Due",
|
||||
"description": "Ask for more time if past due",
|
||||
"action": "pastdue",
|
||||
"status": "0"
|
||||
}
|
||||
}
|
||||
};
|
||||
//logger.info("client_id ==> ",client_id);
|
||||
},
|
||||
homebanners: function (req, res, next) {
|
||||
var result=[];
|
||||
@@ -362,14 +231,5 @@ var banners = {
|
||||
logger.info("total_active_client_job ==> ",total_active_client_job);
|
||||
|
||||
},
|
||||
RecoCheckFamilyLogin : function (req, res, next) {},
|
||||
RecoCheckFamilyCount : function (req, res, next) {},
|
||||
RecoCheckCoupons : function (req, res, next) {},
|
||||
RecoCheckTaskDue : function (req, res, next) {},
|
||||
RecoCheckTaskReview : function (req, res, next) {},
|
||||
RecoCheckBlog : function (req, res, next) {},
|
||||
RecoOffersInterest : function (req, res, next) {},
|
||||
RecoReferAFreind : function (req, res, next) {},
|
||||
RecoPendingInterestCount : function (req, res, next) {},
|
||||
};
|
||||
module.exports = banners;
|
||||
|
||||
Reference in New Issue
Block a user