diff --git a/optmanagementprod/kol_databases.py b/optmanagementprod/kol_databases.py index 9aaa217..b09ef46 100644 --- a/optmanagementprod/kol_databases.py +++ b/optmanagementprod/kol_databases.py @@ -7,19 +7,22 @@ db_configs = [ 'user': 'snehalatha', 'password': 'paSsWord@#654', 'host': 'konectar-readreplica-rds.konectar.io', - 'database': 'kolm_lite_cardio' + 'database': 'kolm_lite_cardio', + 'instance':'cardio' }, { 'user': 'snehalatha', 'password': 'paSsWord@#654', 'host': 'konectar-readreplica-rds.konectar.io', - 'database': 'kolm_lite_veterinary' + 'database': 'kolm_lite_veterinary', + 'instance':'veterinary' }, { 'user': 'snehalatha', 'password': 'paSsWord@#654', 'host': 'konectar-readreplica-rds.konectar.io', - 'database': 'kolm_lite_oralhealth' + 'database': 'kolm_lite_oralhealth', + 'instance':'oralhealth' } ] @@ -35,7 +38,7 @@ def fetch_records(config): if connection.is_connected(): cursor = connection.cursor(dictionary=True) - cursor.execute("SELECT 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 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.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;") records = cursor.fetchall() return records diff --git a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json index ae415ac..b83e151 100644 --- a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json +++ b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json @@ -16,7 +16,8 @@ "status", "cs_assigned_poc", "optin_type", - "data_processed_date" + "data_processed_date", + "instance" ], "fields": [ { @@ -77,12 +78,17 @@ "fieldname": "data_processed_date", "fieldtype": "Data", "label": "Data Processed Date" + }, + { + "fieldname": "instance", + "fieldtype": "Data", + "label": "Instance" } ], "index_web_pages_for_search": 1, "is_virtual": 1, "links": [], - "modified": "2024-06-18 15:07:09.935741", + "modified": "2024-06-19 17:59:49.749353", "modified_by": "Administrator", "module": "Opt management production", "name": "optlistprod", diff --git a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py index 46fda5b..53f5757 100644 --- a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py +++ b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py @@ -27,7 +27,8 @@ class optlistprod(Document): "client_poc" : str(client["user_name"]), "optin_received_date" : optinReceived(str(client["project_details"]),"Opt-in Received"), "optin_approved_date" : optinReceived(str(client["project_details"]),"Opt-in Approved"), - "status" : optinStatus(str(client["project_details"])), + "status" : str(client["status"]), + "instance" : str(client["instance"]), } ) @@ -117,7 +118,8 @@ def getValues(): "client_poc" : str(client["user_name"]), "optin_received_date" : optinReceived(str(client["project_details"]),"Opt-in Received"), "optin_approved_date" : optinReceived(str(client["project_details"]),"Opt-in Approved"), - "status" : optinStatus(str(client["project_details"])), + "status" : str(client["status"]), + "instance" : str(client["instance"]), } for client in records ] diff --git a/optmanagementprod/www/optanalystauth.html b/optmanagementprod/www/optanalystauth.html new file mode 100644 index 0000000..ab92606 --- /dev/null +++ b/optmanagementprod/www/optanalystauth.html @@ -0,0 +1,61 @@ + + + + OPT IN ANALYST + + + + + + + +{% block content %} +
+

Opt In Data

+

{{ frappe.session.user }}

+ +
+ + + +
+
+ +{% endblock %} + + +{% block script %} + + + + + + +{% endblock %} + + \ No newline at end of file diff --git a/optmanagementprod/www/optanalystview.html b/optmanagementprod/www/optanalystview.html index 246992b..7b63d9a 100644 --- a/optmanagementprod/www/optanalystview.html +++ b/optmanagementprod/www/optanalystview.html @@ -36,7 +36,8 @@ 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } -/* .tabulator .tabulator-header .tabulator-col {background-color: #2b9af3;} */ +/* //background-color: #2b9af3; */ +.tabulator .tabulator-header .tabulator-col { color: black;} @@ -73,35 +74,55 @@ {% endblock %} diff --git a/optmanagementprod/www/optanalystview.py b/optmanagementprod/www/optanalystview.py index e530869..0f0bcb5 100644 --- a/optmanagementprod/www/optanalystview.py +++ b/optmanagementprod/www/optanalystview.py @@ -13,9 +13,9 @@ def fetch_data(): "client_name" : str(client["client_name"]), "client_poc" : str(client["client_poc"]), "optin_received_date" : str(client["optin_received_date"]), - "optin_approved_date" : str(client["optin_approved_date"]), + "optin_approved_date" : "empty" if not str(client["optin_approved_date"]) else str(client["optin_approved_date"]), "status" : str(client["status"]), - + "instance" : str(client["instance"]), } diff --git a/optmanagementprod/www/optanlaystauth.py b/optmanagementprod/www/optanlaystauth.py new file mode 100644 index 0000000..a525e2a --- /dev/null +++ b/optmanagementprod/www/optanlaystauth.py @@ -0,0 +1,12 @@ +import frappe + + + +@frappe.whitelist(allow_guest=True) +def isUserLoggedIn(): + is_subscribed = False + if frappe.session.user == "Guest": + is_subscribed = is_subscribed + return is_subscribed + else: + return True \ No newline at end of file