added country,user name ,data processed date
This commit is contained in:
parent
522e6c5c7d
commit
a9429d8bfc
|
@ -38,7 +38,7 @@ def fetch_records(config):
|
||||||
if connection.is_connected():
|
if connection.is_connected():
|
||||||
|
|
||||||
cursor = connection.cursor(dictionary=True)
|
cursor = connection.cursor(dictionary=True)
|
||||||
cursor.execute(f"SELECT '{ config['instance'] }' as instance, kols.npi_num,kols.id,CONCAT_WS(' ',kols.first_name,kols.middle_name,kols.last_name) as kol_name, GROUP_CONCAT(DISTINCT projects.name) as project_name, clients.name as client_name,CONCAT(client_users.first_name,client_users.last_name) as user_name, GROUP_CONCAT(DISTINCT log_activities.transaction_name,':',date(log_activities.created_on)) as project_details,case when user_kols.opt_in_out_status = 3 then 'Opted Out' when user_kols.opt_in_out_status = 4 then 'Opted In' else '' end as status FROM kols left join user_kols on user_kols.kol_id = kols.id inner join opt_inout_statuses on opt_inout_statuses.id = user_kols.opt_in_out_status left join log_activities on log_activities.miscellaneous1 = user_kols.kol_id left join client_users on client_users.id = user_kols.user_id left join clients on client_users.client_id = clients.id left join project_kols on project_kols.kol_id = user_kols.kol_id left join projects on projects.id = project_kols.project_id where log_activities.module ='opt_in_out' and log_activities.transaction_name in ('New','Opt-in Requested','Opt-out','Opt-in Approved','Opt-in Expired','Opt-in Received','Opt-in') group by kols.id;")
|
cursor.execute(f"SELECT '{ config['instance'] }' as instance, kols.npi_num,kols.id,CONCAT_WS(' ',kols.first_name,kols.middle_name,kols.last_name) as kol_name, projects.name as project_name, clients.name as client_name,CONCAT(client_users.first_name,' ',client_users.last_name) as user_name, GROUP_CONCAT(DISTINCT log_activities.transaction_name,':',date(log_activities.created_on)) as project_details,case when user_kols.opt_in_out_status = 3 then 'Opted Out' when user_kols.opt_in_out_status = 4 then 'Opted In' else '' end as status , date(kols.data_updated) as data_processed_date,countries.Country as user_country,CONCAT(poc.first_name,' ',poc.last_name) as client_poc FROM kols left join user_kols on user_kols.kol_id = kols.id left join countries on countries.CountryId = kols.country_id inner join opt_inout_statuses on opt_inout_statuses.id = user_kols.opt_in_out_status left join log_activities on log_activities.miscellaneous1 = user_kols.kol_id left join client_users on client_users.id = user_kols.user_id left join clients on client_users.client_id = clients.id left join client_users as poc on poc.id = clients.created_by left join project_clients on project_clients.client_id = clients.id left join projects on project_clients.project_id = projects.id where log_activities.module ='opt_in_out' and log_activities.transaction_name in ('New','Opt-in Requested','Opt-out','Opt-in Approved','Opt-in Expired','Opt-in Received','Opt-in') group by kols.id;")
|
||||||
records = cursor.fetchall()
|
records = cursor.fetchall()
|
||||||
return records
|
return records
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,12 @@
|
||||||
"optin_received_date",
|
"optin_received_date",
|
||||||
"optin_approved_date",
|
"optin_approved_date",
|
||||||
"status",
|
"status",
|
||||||
"cs_assigned_poc",
|
"user_name",
|
||||||
"optin_type",
|
"optin_type",
|
||||||
"data_processed_date",
|
"data_processed_date",
|
||||||
"instance",
|
"instance",
|
||||||
"npi_id"
|
"npi_id",
|
||||||
|
"country"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
|
@ -65,11 +66,6 @@
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Status"
|
"label": "Status"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "cs_assigned_poc",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"label": "CS Assigned POC"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "optin_type",
|
"fieldname": "optin_type",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
|
@ -89,12 +85,22 @@
|
||||||
"fieldname": "npi_id",
|
"fieldname": "npi_id",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Npi ID"
|
"label": "Npi ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "user_name",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "User Name"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "country",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Country"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_virtual": 1,
|
"is_virtual": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-06-20 15:03:39.506553",
|
"modified": "2024-06-27 12:26:42.877560",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Opt management production",
|
"module": "Opt management production",
|
||||||
"name": "optlistprod",
|
"name": "optlistprod",
|
||||||
|
|
|
@ -24,10 +24,13 @@ class optlistprod(Document):
|
||||||
"kol_name" : str(client["kol_name"]),
|
"kol_name" : str(client["kol_name"]),
|
||||||
"project_name" : str(client["project_name"]),
|
"project_name" : str(client["project_name"]),
|
||||||
"client_name" : str(client["client_name"]),
|
"client_name" : str(client["client_name"]),
|
||||||
"client_poc" : str(client["user_name"]),
|
"client_poc" : str(client["client_poc"]),
|
||||||
"status" : str(client["status"]),
|
"status" : str(client["status"]),
|
||||||
"instance" : str(client["instance"]),
|
"instance" : str(client["instance"]),
|
||||||
"npi_id": str(client["npi_num"]),
|
"npi_id": str(client["npi_num"]),
|
||||||
|
"data_processed_date": str(client["data_processed_date"]),
|
||||||
|
"country": str(client["user_country"]),
|
||||||
|
"user_name": str(client["user_name"]),
|
||||||
"optin_received_date" : optinReceived(str(client["project_details"]),"Opt-in Received"),
|
"optin_received_date" : optinReceived(str(client["project_details"]),"Opt-in Received"),
|
||||||
"optin_approved_date" : optinReceived(str(client["project_details"]),"Opt-in Approved"),
|
"optin_approved_date" : optinReceived(str(client["project_details"]),"Opt-in Approved"),
|
||||||
|
|
||||||
|
@ -117,10 +120,13 @@ def getValues():
|
||||||
"kol_name" : str(client["kol_name"]),
|
"kol_name" : str(client["kol_name"]),
|
||||||
"project_name" : str(client["project_name"]),
|
"project_name" : str(client["project_name"]),
|
||||||
"client_name" : str(client["client_name"]),
|
"client_name" : str(client["client_name"]),
|
||||||
"client_poc" : str(client["user_name"]),
|
"client_poc" : str(client["client_poc"]),
|
||||||
"status" : str(client["status"]),
|
"status" : str(client["status"]),
|
||||||
"instance" : str(client["instance"]),
|
"instance" : str(client["instance"]),
|
||||||
"npi_id": str(client["npi_num"]),
|
"npi_id": str(client["npi_num"]),
|
||||||
|
"data_processed_date": str(client["data_processed_date"]),
|
||||||
|
"country": str(client["user_country"]),
|
||||||
|
"user_name": str(client["user_name"]),
|
||||||
"optin_received_date" : optinReceived(str(client["project_details"]),"Opt-in Received"),
|
"optin_received_date" : optinReceived(str(client["project_details"]),"Opt-in Received"),
|
||||||
"optin_approved_date" : optinReceived(str(client["project_details"]),"Opt-in Approved"),
|
"optin_approved_date" : optinReceived(str(client["project_details"]),"Opt-in Approved"),
|
||||||
|
|
||||||
|
|
|
@ -118,8 +118,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
for(var rec in data)
|
for(var rec in data)
|
||||||
{
|
{
|
||||||
tableData.push({
|
tableData.push({
|
||||||
kol_id:rec.kol_id, kol_name:rec["kol_name"],project_name: rec["project_name"], client_name:rec["client_name"], client_poc:rec["client_poc"],optin_received_date:rec["optin_received_date"],optin_approved_date:rec["optin_approved_date"],status:rec["status"],instance:rec["instance"],npi_id:rec["npi_id"]
|
kol_id:rec.kol_id, kol_name:rec["kol_name"],project_name: rec["project_name"], client_name:rec["client_name"], client_poc:rec["client_poc"],optin_received_date:rec["optin_received_date"],optin_approved_date:rec["optin_approved_date"],status:rec["status"],instance:rec["instance"],npi_id:rec["npi_id"],user_name:rec["user_name"],country:rec["country"],data_processed_date:rec["data_processed_date"]
|
||||||
// cs_Assigned_poc:rec["cs_Assigned_poc"],optin_type:rec["optin_type"],data_processed_date:rec["data_processed_date"]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// console.log(tableData);
|
// console.log(tableData);
|
||||||
|
@ -144,18 +143,24 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
paginationCounter: "rows",
|
paginationCounter: "rows",
|
||||||
columns:[ // Define table columns
|
columns:[ // Define table columns
|
||||||
{title:"Instance", field:"instance",headerFilterPlaceholder: "Search", headerFilter: true,width:100},
|
{title:"Instance", field:"instance",headerFilterPlaceholder: "Search", headerFilter: true,width:100},
|
||||||
{title:"Client Name", field:"client_name",headerFilterPlaceholder: "Search", headerFilter: true,tooltip:true},
|
{title:"NPI", field:"npi_id",headerFilterPlaceholder: "Search", headerFilter: true,width:100},
|
||||||
{title:"NPI ID", field:"npi_id",headerFilterPlaceholder: "Search", headerFilter: true,width:100},
|
|
||||||
{title:"KOL ID", field:"kol_id",headerFilterPlaceholder: "Search", headerFilter: true,width:100},
|
{title:"KOL ID", field:"kol_id",headerFilterPlaceholder: "Search", headerFilter: true,width:100},
|
||||||
{title:"KOL Name", field:"kol_name",headerFilterPlaceholder: "Search", headerFilter: true,},
|
{title:"KOL Name", field:"kol_name",headerFilterPlaceholder: "Search", headerFilter: true,},
|
||||||
{title:"Status", field:"status",headerFilterPlaceholder: "Search", headerFilter: true,},
|
{title:"Country", field:"country",headerFilterPlaceholder: "Search", headerFilter: true,},
|
||||||
|
{title:"Project Name", field:"project_name",headerFilterPlaceholder: "Search", headerFilter: true,width:250,tooltip:true},
|
||||||
|
{title:"Client Name", field:"client_name",headerFilterPlaceholder: "Search", headerFilter: true,tooltip:true},
|
||||||
|
|
||||||
|
|
||||||
|
{title:"Client User Name", field:"user_name",headerFilterPlaceholder: "Search", headerFilter: true,},
|
||||||
{title:"Requested Date", field:"optin_received_date",headerFilterPlaceholder: "Search", headerFilter: true,},
|
{title:"Requested Date", field:"optin_received_date",headerFilterPlaceholder: "Search", headerFilter: true,},
|
||||||
{title:"Approved Date", field:"optin_approved_date",headerFilterPlaceholder: "Search", headerFilter: true,},
|
{title:"Approved Date", field:"optin_approved_date",headerFilterPlaceholder: "Search", headerFilter: true,},
|
||||||
{title:"Project Name", field:"project_name",headerFilterPlaceholder: "Search", headerFilter: true,width:250,tooltip:true},
|
|
||||||
|
{title:"Data Processed Date", field:"data_processed_date",headerFilterPlaceholder: "Search", headerFilter: true},
|
||||||
|
{title:"Status", field:"status",headerFilterPlaceholder: "Search", headerFilter: true,},
|
||||||
|
|
||||||
{title:"Client POC", field:"client_poc",headerFilterPlaceholder: "Search", headerFilter: true,},
|
{title:"Client POC", field:"client_poc",headerFilterPlaceholder: "Search", headerFilter: true,},
|
||||||
// {title:"CS Assigned POC", field:"cs_assigned_poc",headerFilterPlaceholder: "Search", headerFilter: true,},
|
|
||||||
// {title:"Opt-In Type", field:"optin_type",headerFilterPlaceholder: "Search", headerFilter: true,},
|
|
||||||
// {title:"Data Processed Date", field:"data_processed_date",headerFilterPlaceholder: "Search", headerFilter: true}
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
document.getElementById("download-csv").addEventListener("click", function(){
|
document.getElementById("download-csv").addEventListener("click", function(){
|
||||||
|
|
|
@ -17,6 +17,8 @@ def fetch_data():
|
||||||
"status" : str(client["status"]),
|
"status" : str(client["status"]),
|
||||||
"instance" : str(client["instance"]),
|
"instance" : str(client["instance"]),
|
||||||
"npi_id": str(client["npi_id"]),
|
"npi_id": str(client["npi_id"]),
|
||||||
|
"country" : str(client["country"]),
|
||||||
|
"data_processed_date" : str(client["data_processed_date"]),
|
||||||
|
"user_name": str(client["user_name"]),
|
||||||
}
|
}
|
||||||
for client in records]
|
for client in records]
|
||||||
|
|
Loading…
Reference in New Issue