Sindbad~EG File Manager
from flask import Flask, request, Blueprint, jsonify, redirect, url_for,flash, render_template,session,Response,jsonify,json,render_template_string
from random import randint
from .. import Cryptography,Auth,RouteGroup,Helper,Custom
from core.model.ConfAppModel import ConfAppModel
from core.model.OfflineRegistrationModel import OfflineRegistrationModel
from core.model.UserModel import UserModel
from core.model.BadgeModel import BadgeModel
import xmltodict
import datetime
from core.library.email import EMAIL
import math
from datetime import timedelta,date,datetime
from flask import session, app
from os import listdir
import io
import csv
import ast
import requests,mandrill,json,math
import base64
import flask
from num2words import num2words
import webbrowser
import os #use for new instance of chrome
import urllib.parse
from ast import literal_eval
from dateutil.relativedelta import relativedelta
app = Blueprint('confapp', __name__)
# conf setting start
# author : santhosh
# date : 2023-04-25 04:00 pm
# @app.route('/<int:conf_id>/<conf_key>/bo_confrence_setting', methods = ["GET", "POST"])
# @RouteGroup.conf_required
# def BoConfrenceSetting(conf_id,conf_key):
# conf = Auth.getConf(conf_id,conf_key)
# setting_val = ConfAppModel().get_setting_value()
# return render_template('conferenceapp/conf_setting.html',conf=conf,setting_val=setting_val)
# @app.route('/conf_app_home', methods = ["GET", "POST"])
# def ConfAppHome():
# return render_template('conferenceapp/conf_app_home.html')
# @app.route('/<int:conf_id>/<conf_key>/conference_index', methods = ["GET", "POST"])
# @RouteGroup.conf_required
# def ConferenceIndex(conf_id,conf_key):
# conf = Auth.getConf(conf_id,conf_key)
# conference_data = ConfAppModel().get_conference()
# return render_template('conferenceapp/conference_index.html',conf=conf,conference_data=conference_data)
# @app.route('/<int:conf_id>/<conf_key>/societty_index', methods = ["GET", "POST"])
# @RouteGroup.conf_required
# def SocietyIndex(conf_id,conf_key):
# conf = Auth.getConf(conf_id,conf_key)
# # society_id = conf['society_id']
# society_data = ConfAppModel().get_society_data()
# return render_template('conferenceapp/society_index.html',conf=conf,society_data=society_data)
# @app.route("<int:conf_id>/<conf_key>/back" , methods=['GET','POST'])
# def Back(conf_id,conf_key):
# conf = Auth.getConf(conf_id,conf_key)
# return redirect(url_for('confapp.BoConfrenceSetting',conf_id=conf_id,conf_key=conf_key))
@app.route('/active_conference_list', methods = ["GET", "POST"])
def ActiveConferenceList():
conf_id = None
active_conf_count = 0
now = datetime.now()
curr_dt = now.strftime("%d-%m-%Y %H:%M:%S")
curr_date = now.strftime("%Y-%m-%d")
next_day = now + timedelta(days=1)
next_date = next_day.strftime("%Y-%m-%d")
tariff_intimations = ConfAppModel().get_tariff_intimations(curr_date,next_date,conf_id)
if tariff_intimations :
active_conf_count = len(tariff_intimations)
return render_template('conferenceapp/conf_setting.html',active_conf_count=active_conf_count,tariff_intimations=tariff_intimations)
@app.route('/active_conference_list_mail', methods = ["GET", "POST"])
def ActiveConferenceListMail():
now = datetime.now()
curr_dt = now.strftime("%d-%m-%Y %H:%M:%S")
old_date = datetime.now()+timedelta(-2)
curr_date = now.strftime("%Y-%m-%d")
old_date = old_date.strftime("%Y-%m-%d")
active_conf_count = 0
active_conf_data = None
in_active_conf_count = 0
current_tm = datetime.now()
# current_tm = "2024-01-13 06:10:02"
# current_tm = datetime.strptime(current_tm, "%Y-%m-%d %H:%M:%S")
if (current_tm.hour == 5 and current_tm.minute > 45) or (current_tm.hour == 6 and current_tm.minute < 25):
# if (current_tm.hour == 14 and current_tm.minute > 45) or (current_tm.hour == 15 and current_tm.minute < 55):
# curr_date = '2024-01-13'
# old_date = '2024-01-06'
active_conf_data = ConfAppModel().get_setting_value(curr_date,old_date)
# Surgical strike start
if str(curr_date) <= '2024-01-14' :
surgical_strike_data = ConfAppModel().get_surgical_strike_data(curr_date,old_date)
if surgical_strike_data['conf_id']:
active_conf_data.append(surgical_strike_data)
else:
pass
# Surgical strike end
if active_conf_data :
for index,value in enumerate(active_conf_data):
day_different = value["day_different"] or 0
if day_different and day_different > 0 :
active_conf_count = active_conf_count + 1
else :
in_active_conf_count = in_active_conf_count + 1
# active_conf_count = len(active_conf_data)
trigger_mail_data = ConfAppModel().activeConfMailIdList()
if trigger_mail_data :
for index , value in enumerate(trigger_mail_data) :
email = value["email"]
full_name = value["full_name"]
subject = "Active Conference List - " + curr_dt
html1 = render_template('conferenceapp/active_conference_list_mail.html',conference_data=active_conf_data,active_conf_count=active_conf_count,int=int,in_active_conf_count=in_active_conf_count)
# return html1
# break
# email = "ganesan@numerotec.com"
EMAIL.allconfcountsendMail(subject,html1,email)
# break
return "Mail successfully sent"
# for r in trigger_mail_data :
else:
return "Email-id does not exist."
return render_template('conferenceapp/active_conference_list_mail.html',conference_data=active_conf_data,active_conf_count=active_conf_count)
else:
return render_template('conferenceapp/active_conference_list_mail.html',conference_data=active_conf_data,active_conf_count=active_conf_count)
else:
return "Time not match"
@app.route('/view_active_conference_list_mail', methods = ["GET", "POST"])
def ViewActiveConferenceListMail():
now = datetime.now()
curr_dt = now.strftime("%d-%m-%Y %H:%M:%S")
old_date = datetime.now()+timedelta(-2)
curr_date = now.strftime("%Y-%m-%d")
old_date = old_date.strftime("%Y-%m-%d")
active_conf_count = 0
active_conf_data = None
in_active_conf_count = 0
current_tm = datetime.now()
active_conf_data = ConfAppModel().get_setting_value(curr_date,old_date)
# Surgical strike start
# if str(curr_date) <= '2024-01-14' :
# surgical_strike_data = ConfAppModel().get_surgical_strike_data(curr_date,old_date)
# if surgical_strike_data['conf_id']:
# active_conf_data.append(surgical_strike_data)
# else:
# pass
# Surgical strike end
if active_conf_data :
for index,value in enumerate(active_conf_data):
day_different = value["day_different"] or 0
if day_different and day_different > 0 :
active_conf_count = active_conf_count + 1
else :
in_active_conf_count = in_active_conf_count + 1
subject = "Active Conference List - " + curr_dt
html1 = render_template('conferenceapp/active_conference_list_mail.html',conference_data=active_conf_data,active_conf_count=active_conf_count,int=int,in_active_conf_count=in_active_conf_count)
return html1
else:
return "no data"
return render_template('conferenceapp/active_conference_list_mail.html',conference_data=active_conf_data,active_conf_count=active_conf_count,int=int)
@app.route('/conf_app_home', methods = ["GET", "POST"])
def ConfAppHome():
return render_template('conferenceapp/conf_app_home.html')
@app.route('/conference_index', methods = ["GET", "POST"])
def ConferenceIndex():
# conference_data = ConfAppModel().get_conference()
conference_data = ConfAppModel().get_conf_index()
return render_template('conferenceapp/conference_index.html',conference_data=conference_data)
@app.route('/societty_index', methods = ["GET", "POST"])
def SocietyIndex():
society_data = ConfAppModel().get_society_data()
return render_template('conferenceapp/society_index.html',society_data=society_data)
@app.route("/back", methods=['GET','POST'])
def Back():
return redirect(url_for('confapp.ActiveConferenceList'))
@app.route("/back_to_home", methods=['GET','POST'])
def BackToHome():
return redirect(url_for('confapp.ConfAppHome'))
#start portal access report
@app.route('/portal_access_report', methods = ["GET", "POST"])
def PortalAccessReport():
now = datetime.now()
current_dt = now.strftime("%Y-%m-%d")
conference_data = ConfAppModel().get_conference()
return render_template('conferenceapp/portal_access_report.html',conference_data=conference_data,current_dt=current_dt)
@app.route('/portal_access_report_index_page', methods = ["GET"])
def PortalAccessReportIndexPage():
now = datetime.now()
current_dt = now.strftime("%Y-%m-%d")
start_date = request.values.get('start_date') or None
end_date = request.values.get('end_date') or None
conf_id = request.values.get('conf_id') or None
access_report_data = ConfAppModel().get_portal_access_data(start_date,end_date,conf_id)
for index,value in enumerate(access_report_data):
if index == 0:
datewise_and_confwise = value
if index == 1:
count_datewise = value
html_data = render_template('conferenceapp/portal_access_report_index.html',datewise_and_confwise=datewise_and_confwise,count_datewise=count_datewise)
data = {"html_data":html_data,"status" : 1 , "msg" : "success" }
return json.dumps(data,default=str)
#end portal access report
#conf setting end
@app.route('/delegate_detail', methods = ["GET", "POST"])
def DelegateDetail():
get_conference = ConfAppModel().get_conference()
html_data = render_template('conferenceapp/delegate_details.html',get_conference=get_conference)
return html_data
@app.route('/delegate_detail_ajax', methods = ["GET", "POST"])
def DelegateDetailAjax():
search_data = request.values.get('search_data') or None
search_del_mem = request.values.get('search_del_mem') or None
conf_id = request.values.get('conf_id') or None
get_del_details = ConfAppModel().get_delegate_dataConfApps(search_data,search_del_mem,conf_id)
for index,value in enumerate(get_del_details):
if index == 0:
users = value
if index == 1:
delegates = value
if index == 2:
delegate_addons = value
if index == 3:
user_payment = value
html_data = render_template('conferenceapp/delegate_details_table.html',users=users,delegates=delegates,delegate_addons=delegate_addons,user_payment=user_payment)
data = {"html_data":html_data,"status" : 1 , "msg" : "success" }
return json.dumps(data,default=str)
@app.route('/delegate_detail_get_unique_id', methods = ["GET", "POST"])
def DelegateDetailGetUniqueId():
now = datetime.now()
curr_dt = now.strftime("%Y-%m-%d %H:%M:%S")
pg_data = None
conf_id = request.values.get('conf_id') or None
unique_id = request.values.get('unique_id') or None
form_name = request.values.get('form_name') or None
is_show = request.values.get('is_show') or None
generate_by_data = ConfAppModel().get_is_admin(conf_id)
status = 402
msg = ""
incompleted_delegate_data_uid = ConfAppModel().get_incompleted_delegate_data_by_unique_id(conf_id,unique_id)
for index,value in enumerate(incompleted_delegate_data_uid):
if index == 0:
incom_del_data = value
if value:
del_data = value[0]
else:
del_data = None
if index == 1:
del_conf_data = value[0]
if incom_del_data :
am_id = incom_del_data[0]["am_id"]
unique_id = incom_del_data[0]["unique_id"]
created_at = incom_del_data[0]["created_at"]
amount = incom_del_data[0]["amount"]
api_payment_id = incom_del_data[0]["api_payment_id"]
if created_at :
from_date_1 = created_at - timedelta(days=2)
to_date = created_at + timedelta(days=2)
from_date = from_date_1.strftime("%Y-%m-%d %H:%M:%S")
to_date = to_date.strftime("%Y-%m-%d %H:%M:%S")
else :
from_date = now - timedelta(days=2)
to_date = curr_dt
# PAYUMONEY BLOCK
if int(conf_id) in [10,32,37,38,26,48]:
url_1 = "https://conf-payments.numerotech.com/payumoney_trans.php?am_id="+str(am_id)+"&unique_id="+unique_id+"&from_date="+from_date+"&to_date="+to_date+""
response = requests.get(url_1)
response = response.text
# response = response.replace('\\' ,"")
# result = response[1:-1]
result = response
res = json.loads(result)
# return str(res)
if res:
result_status = res["status"]
result_msg = res["msg"]
result_data = res["Transaction_details"]
payment_data = result_data
if result_status == 1:
for index,value in enumerate(payment_data):
unique_id_pg = value["udf2"]
if unique_id_pg and unique_id_pg == unique_id :
status_pg = value["status"]
if status_pg == "null" or not status_pg :
status_pg = value["action"]
# print(status_pg)
amount_pg = value["amount"]
created_at_pg = value["addedon"]
payment_id_pg = value["id"]
mode_pg = value["mode"]
name_pg = value["firstname"]
email_pg = value["email"]
mobile_pg = value["phone"]
if status_pg and status_pg == "SUCCESS":
status_pg = "success"
else:
status_pg = status_pg
pg_data = {"payment_id_pg" : payment_id_pg,"name_pg" : name_pg , "email_pg" :email_pg, "mobile_pg" : mobile_pg,"mode_pg":mode_pg,"created_at_pg":created_at_pg,"amount_pg":amount_pg,"status_pg":status_pg,"unique_id_pg":unique_id_pg}
msg = "success"
status = 1
# data_status = 1
break
else :
status = 3
msg = "Records does not match."
else :
status = 4
msg = result_msg
# https://conf-payments.numerotech.com/payumoney_trans.php?am_id=35unique_id=VRSIDEL23_20230505140841&from_date=2023-06-07%2010:00:00&to_date=2023-06-11%2010:00:00
else:
msg = "Record Not Found"
status = 2
html_data = render_template('conferenceapp/incomplete_table_value.html',form_name=form_name,incom_del_data=incom_del_data ,pg_data=pg_data,del_conf_data=del_conf_data,unique_id=unique_id,del_data=del_data,generate_by_data=generate_by_data,is_show = is_show)
data = {"html_data":html_data,"status" : status , "msg" : msg }
return json.dumps(data,default=str)
# Air play block start here --------------
if int(conf_id) in [36]:
try:
response = requests.post(url="https://iapkarnataka.org/airpay_php/airpay_trans_info.php?unique_id="+unique_id+"")
res = response.text
xpars = xmltodict.parse(res)
if xpars:
result_1 = xpars["RESPONSE"]
result_data = result_1["TRANSACTION"]
payment_data = result_data
unique_id_pg = payment_data["TRANSACTIONID"]
if unique_id_pg == unique_id:
amount_pg = payment_data["AMOUNT"]
name_pg = payment_data["CUSTOMER"]
email_pg = payment_data["CUSTOMEREMAIL"]
status_pg = payment_data["TRANSACTIONPAYMENTSTATUS"]
created_at_pg = payment_data["TRANSACTIONTIME"]
# created_at_pg = created_at_pg.strftime("%Y-%m-%d %H:%M:%S")
created_at_pg = datetime.strptime(created_at_pg, '%d-%m-%Y %H:%M:%S') if created_at_pg else created_at_pg
payment_id_pg = payment_data["APTRANSACTIONID"]
mode_pg = payment_data["CHMOD"]
name_pg = payment_data["CUSTOMER"]
email_pg = payment_data["CUSTOMEREMAIL"]
mobile_pg = payment_data["CUSTOMERPHONE"]
if status_pg and status_pg == "success":
status_pg = "success"
else:
status_pg = status_pg
if mode_pg and mode_pg == "pg":
mode_pg = payment_data["CARDTYPE"]
if mode_pg and mode_pg == "netbank":
mode_pg = "NB"
else:
mode_pg= mode_pg
pg_data = {"payment_id_pg" : payment_id_pg,"name_pg" : name_pg , "email_pg" :email_pg, "mobile_pg" : mobile_pg,"mode_pg":mode_pg,"created_at_pg":created_at_pg,"amount_pg":amount_pg,"status_pg":status_pg,"unique_id_pg":unique_id_pg}
msg = "success"
status = 1
# data_status = 1
else:
status = 3
msg = "Records does not match."
else :
status = 3
msg = "Records does not match."
html_data = render_template('conferenceapp/incomplete_table_value.html',form_name=form_name,incom_del_data=incom_del_data ,pg_data=pg_data,del_conf_data=del_conf_data,unique_id=unique_id,del_data=del_data,generate_by_data=generate_by_data,is_show = is_show)
data = {"html_data":html_data,"status" : status , "msg" : msg }
return json.dumps(data,default=str)
except Exception as e:
print(str(e))
# Air play block end here ---------------------------------
# Razorpay block ------------------------------------------
if int(conf_id) in [29 ,28]:
if int(conf_id) == 29: #ipgs block php api
# unique_id = "IPGSDEL23_20230603123220"
am_id = 39
url_1 = "https://ipgs.org.in/ipgs_payments/trans_info_4.php?am_id="+str(am_id)+"&unique_id="+unique_id+"&from_date="+from_date+"&to_date="+to_date+""
elif int(conf_id) == 28 : #EMINDIA block Python api
# unique_id = "EMINDIA23_20230620000916"
am_id = 37
url_1 = "https://emindia23payments.abhinavamedtech.in/payment_api/emindia23_api?am_id="+str(am_id)+"&unique_id="+unique_id+"&from_date="+from_date+"&to_date="+to_date+""
# http://emindia23payments.abhinavamedtech.in/emindia23_api?unique_id=EMINDIA23_20230620000916&from_date=2023-05021%2010:00:00&to_date=2023-06-21%2022:00:00
response = requests.get(url_1)
response = response.text
result = response
res = json.loads(result)
if res :
result_status = res["status"]
result_msg = res["msg"]
if result_status == 1 :
payment_data = res["data"]
unique_id_pg = payment_data["unique_id"]
if unique_id_pg and unique_id_pg == unique_id :
payment_id_pg = payment_data["api_payment_id"]
name_pg = ""
email_pg = payment_data["email"]
mobile_pg = payment_data["mobile"]
amount_pg = payment_data["amount"]
created_at_pg = payment_data["created_at"]
mode_pg = payment_data["pg_method"]
status_pg = payment_data["status"]
if amount_pg :
amount_pg = int(amount_pg)/100
pg_data = {"payment_id_pg" : payment_id_pg,"name_pg" : name_pg , "email_pg" :email_pg, "mobile_pg" : mobile_pg,"mode_pg":mode_pg,"created_at_pg":created_at_pg,"amount_pg":amount_pg,"status_pg":status_pg,"unique_id_pg":unique_id_pg}
msg = "success"
status = 1
else:
status = 3
msg = "Records does not match."
else:
msg = "Record Not Found"
status = 2
else:
status = 4
msg = result_msg
# TNOA ATOM PAYMENT GATEWAY
if int(conf_id) in [17,39]:
created_at = created_at.strftime("%Y-%m-%d")
url = "https://payment.atomtech.in/paynetz/vfts?merchantid=391691&merchanttxnid="+unique_id+"&amt="+str(amount)+"&tdate="+created_at+""
data = requests.get(url)
xpars = xmltodict.parse(data.text)
result_data = json.dumps(xpars,default=str)
if result_data:
payment_data_1 = ast.literal_eval(result_data)
payment_data = payment_data_1["VerifyOutput"]
payment_id_pg = payment_data["@atomtxnId"]
unique_id_pg = payment_data["@MerchantTxnID"]
status_pg = payment_data["@VERIFIED"]
amount_pg = payment_data["@AMT"]
created_at_pg = payment_data["@TxnDate"]
mode_pg = payment_data["@discriminator"]
if status_pg and status_pg == "SUCCESS":
status_pg = "success"
else:
status_pg = status_pg
pg_data = {"payment_id_pg" : payment_id_pg,"name_pg" : " " , "email_pg " :" ", "mobile_pg" : " ","mode_pg":mode_pg,"created_at_pg":created_at_pg,"amount_pg":amount_pg,"status_pg":status_pg,"unique_id_pg":unique_id_pg}
msg = "success"
status = 1
else:
status = 3
msg = "Records does not match."
html_data = render_template('conferenceapp/incomplete_table_value.html',form_name=form_name,incom_del_data=incom_del_data ,pg_data=pg_data,del_conf_data=del_conf_data,unique_id=unique_id,del_data=del_data,generate_by_data=generate_by_data,is_show = is_show)
data = {"html_data":html_data,"status" : 1 , "msg" : "success" }
return json.dumps(data,default=str)
# KSOS CCAVENUE PAYMENT GATEWAY
if api_payment_id and len(api_payment_id) > 2 :
params_1 = "order_no="+unique_id+"&reference_no="+api_payment_id
else :
params_1 = "order_no="+unique_id+""
if int(conf_id) in [27,20,19,21]:
# unique_id = 'KSOSDEL23_20230620192239'
if conf_id and int(conf_id) == 27:
url = "https://ksos.in/paymentapi_del/status_api_new_ksos_del.php?"+params_1+""
elif conf_id and int(conf_id) == 19:
url = "https://tnasi.com/paymentapi/status_api_new_tnasi23.php?"+params_1+""
elif conf_id and int(conf_id) == 21:
url = "https://indouksurgicon2023.com/indouk_payments/status_api_new_indouk23.php?"+params_1+""
else:
url = "https://iages24payments.iageschennai.com/status_api_new_iages24.php?"+params_1+""
response_1 = requests.get(url)
response_1 = response_1.text
if response_1 :
response_data = ast.literal_eval(response_1)
response_data = response_data["Order_Status_Result"]
api_data_status = response_data["status"]
if int(api_data_status) == 0 :
pg_fullname = response_data["order_bill_name"]
pg_unique_id = response_data["order_no"]
pg_email = response_data["order_bill_email"]
pg_mobile = response_data["order_bill_tel"]
pg_amount = response_data["order_amt"]
pg_status = response_data["order_status"]
pg_payment_id = response_data["reference_no"]
pg_created_at = response_data["order_status_date_time"]
pg_mode = response_data["order_card_name"]
if pg_mode and pg_mode in ['RuPay','Visa','Master Card']:
pg_mode = "DC"
if pg_status and pg_status == "Shipped":
pg_status = "success"
else:
pg_status = pg_status
pg_data = {"payment_id_pg" : pg_payment_id,"name_pg" : pg_fullname , "email_pg" :pg_email, "mobile_pg" : pg_mobile,"mode_pg":pg_mode,"created_at_pg":pg_created_at,"amount_pg":pg_amount,"status_pg":pg_status,"unique_id_pg":pg_unique_id}
status = 1
msg = "success"
html_data = render_template('conferenceapp/incomplete_table_value.html',form_name=form_name,incom_del_data=incom_del_data ,pg_data=pg_data,del_conf_data=del_conf_data,unique_id=unique_id,del_data=del_data,generate_by_data=generate_by_data,is_show = is_show)
data = {"html_data":html_data,"status" : status , "msg" : msg }
return json.dumps(data,default=str)
else :
status = 4
msg = "No record found. "
else:
status = 3
msg = "Records does not match."
else :
status = 4
msg = "Record Not Found"
html_data = render_template('conferenceapp/incomplete_table_value.html',form_name=form_name,incom_del_data=incom_del_data ,pg_data=pg_data,del_conf_data=del_conf_data,unique_id=unique_id,del_data=del_data,generate_by_data=generate_by_data,is_show = is_show)
data = {"html_data":html_data,"status" : status , "msg" : msg }
return json.dumps(data,default=str)
html_data = render_template('conferenceapp/incomplete_table_value.html',form_name=form_name,incom_del_data=incom_del_data ,pg_data=pg_data,del_conf_data=del_conf_data,unique_id=unique_id,del_data=del_data,generate_by_data=generate_by_data,is_show = is_show)
data = {"html_data":html_data,"status" : 1 , "msg" : "success" }
return json.dumps(data,default=str)
@app.route('/<int:conf_id>/<conf_key>/conf_payment_server_response', methods = ["GET", "POST"])
def ConfPaymentServerResponse(conf_id,conf_key):
conf = ConfAppModel().get_conf_conf_app(conf_id,conf_key)
status = request.values.get('status') or None
unique_id = request.values.get('unique_id') or None
payment_method = request.values.get('payment_method') or None
delegate_id = request.values.get('delegate_id') or None
payment_id = request.values.get('payment_id') or None
receipt_mail = request.values.get('receipt_mail') or None
confimation_mail = request.values.get('confimation_mail') or None
generate_by = request.values.get('generate_by') or None
form_name = request.values.get('form_name') or None
# test generate
# status = "success"
# unique_id = "VRSIDEL23_20230618130525"
# # payment_method = "PAYMENT GATEWAY"
# payment_method = "UPI"
# delegate_id = 14003
# test 2
# status = "success"
# unique_id = "VRSIDEL23_20230616182936"
# payment_method = "UPI"
# delegate_id = 14495
# payment_id = 95977897473476478645
now = datetime.now()
current_dt_2 = now.strftime("%Y-%m-%d %H:%M:%S")
dt_string = request.values.get('create_at') or current_dt_2
getData = OfflineRegistrationModel().OR_freegetDataforPayments(unique_id,conf_id)
badge_table = conf['del_table_name']
# return "get data in call payment route"
if getData :
getData_1 = getData[0]
email = getData_1['email']
mobile = getData_1['mobile']
delegate_ids = getData_1['delegate_ids']
# role = getData_1['role'] or None
range_1 = getData_1['range_1'] or 1
delegate_ids = delegate_ids.split(',')
data = {'status' : status,'updated_at' :dt_string,'paid_at' :dt_string,'payment_method':'PAYMENT GATEWAY','payment_method_from_gateway':payment_method,'api_payment_id':payment_id,'utr_number':payment_id}
data_1 = {"generate_by":generate_by,'updated_at' :dt_string,'registered_on':dt_string}
update_and_get_data = ConfAppModel().updatePayment(delegate_id,unique_id,data,data_1,dt_string) # update payment status in your table
if update_and_get_data == "updated" and (status =="success" or status =="SUCCESS") :
u = OfflineRegistrationModel()
if len(delegate_ids) > 0 :
roles = []
for index,value in enumerate(getData) :
# del_id_1 = delegate_ids[index]
range_1 = value["range_1"]
role = value["role"]
roles.append(role)
roles = list(dict.fromkeys(roles))
i = 0
for role in roles:
generatedDelegates = OfflineRegistrationModel().OR_BOdelegate_no_generate(unique_id,conf_id,role)
i = i+ 1
flash("Payment successful.","successMsg")
if generatedDelegates:
receipt_mail_sent = 0
for delegate in generatedDelegates:
delegate_id = delegate['delegate_id']
delegate_no = delegate['delegate_no']
# Code testing start
if len(delegate_ids) == 1:
if confimation_mail == "confimation_mail" and receipt_mail == "receipt_mail":
successMsg = ConfConfirmationAndReceiptDelegagteMail(conf_id,conf_key,delegate_id,unique_id,None,1,email)
flash(successMsg,"successMsg")
else:
receipt_datas = OfflineRegistrationModel().OR_BOreceipt_no_generate_and_get(unique_id,conf_id)
successMsg = ConfConfirmationAndReceiptDelegagteMail(conf_id,conf_key,delegate_id,unique_id,None,0,email)
if confimation_mail == "confimation_mail":
ConfConfirmationDelegateMail(conf_id,conf_key,delegate_id,delegate,1,None)
else:
pass
receipt_datas = OfflineRegistrationModel().OR_BOreceipt_no_generate_and_get(unique_id,conf_id)
if receipt_mail == "receipt_mail" and receipt_mail_sent == 0:
receipt_mail_sent = 1
if receipt_datas:
# flash("An amount of Rs.{} has been made towards {} registration. The receipt has been email to {}.\nA delegate registration confirmation email has been sent to the email id of the delegate(s). Receipt no. {} .Delegate no(s). {}".format(amount,conf_name,email,receipt_no,delegate_nos),"successMsg")
ConfReceiptDelegagteMail(conf_id,conf_key,unique_id,receipt_datas[0],1,None)
else:
ConfReceiptDelegagteMail(conf_id,conf_key,unique_id,receipt_datas[0],0,None)
else:
ConfReceiptDelegagteMail(conf_id,conf_key,unique_id,None,0,None)
else:
if confimation_mail == "confimation_mail":
successMsg = ConfConfirmationDelegateMail(conf_id,conf_key,delegate_id,delegate,1,None)
else:
pass
receipt_datas = OfflineRegistrationModel().OR_BOreceipt_no_generate_and_get(unique_id,conf_id)
if receipt_mail == "receipt_mail" and receipt_mail_sent == 0:
receipt_mail_sent = 1
if receipt_datas:
# flash("An amount of Rs.{} has been made towards {} registration. The receipt has been email to {}.\nA delegate registration confirmation email has been sent to the email id of the delegate(s). Receipt no. {} .Delegate no(s). {}".format(amount,conf_name,email,receipt_no,delegate_nos),"successMsg")
ConfReceiptDelegagteMail(conf_id,conf_key,unique_id,receipt_datas[0],1,None)
else:
ConfReceiptDelegagteMail(conf_id,conf_key,unique_id,receipt_datas[0],0,None)
else:
ConfReceiptDelegagteMail(conf_id,conf_key,unique_id,None,0,None)
session["showSuccessMsg"] = 0
else:
flash("An attempt to make the payment has failed. Please try again to make the payment. For any assistance, please click here to send an email to support","Payerror")
if form_name == 'pending_form':
return redirect (url_for('userss.SearchPendingDelegateRecord'))
else :
return redirect (url_for('confapp.DelegateDetail'))
# badge_data = MoveDelegateDataToBadge(conf_id,conf_key)
# if badge_table:
# update_badge_data = OfflineRegistrationModel().OR_update_delegates_in_dele_badge(delegate_no,conf_id,badge_table)
# incompleted_template = (user_id,conf_id,conf_key)
# data={
# 'msg':'Registered Completed',
# 'incompleted_template':incompleted_template
# }
# return jsonify(data)
@app.route('/bo_receipt_delegate_mail/<int:conf_id>/<conf_key>/<delegate_id>', methods = ["GET", "POST"])
def ConfReceiptDelegagteMail(conf_id,conf_key,unique_id,receipt_data,is_send,email):
conf = ConfAppModel().get_conf_conf_app(conf_id,conf_key)
if conf :
now = datetime.now()
dt_string = now.strftime('%Y-%m-%d %H:%M:%S')
template_name = "receipt_mail"
mailData = ConfAppModel().get_mail_template(template_name,conf_id)
if receipt_data is None :
receipt_datas = OfflineRegistrationModel().OR_BOreceipt_no_generate_and_get(unique_id,conf_id)
if receipt_datas:
receipt_data = receipt_datas[0]
if receipt_data:
if email:
email = email
else:
email = receipt_data['email']
receipt_no = receipt_data['receipt_no']
amount = receipt_data['amount']
conf_name = receipt_data['conf_name']
delegate_nos = receipt_data['delegate_nos']
delegate_id = receipt_data['delegate_ids']
if str(amount) == "0.00":
amount = "Free"
else:
amount = int(amount)
amount = f"{amount:,}"
amount_with_commas = amount
amount_for_convertion = int(receipt_data['amount'])
amount_in_words = Helper.amountTowords(amount_for_convertion)
amount_in_words = amount_in_words.title()
if amount == "Free" :
amount = amount
else:
amount = "Rs."+amount+"/-"
update_data = {
'amount_with_commas':amount_with_commas,
'amount_in_words':amount_in_words
}
receipt_data.update(update_data)
sub_data = {
'receipt_no':str(receipt_no),'amount':str(amount)
}
subject = Helper.merge_tags(mailData['subject'],sub_data)
m_data = {
'mail_content': mailData['mail_content'],'receipt_data': receipt_data,'conf': conf
}
mail_content = Helper.convert_html_for_mail_screen(m_data)
badge_print_url = "https://conference.numerotech.com/"+str(conf_id)+"/"+conf_key+"/delegate_batch_print_from_reg?del_nos="+delegate_nos
btn_link = '<a href="'+badge_print_url+'" target="_blank" ><i class ="fa fa-print fa-1x"></i> <span aria-hidden="true" title="Print Badge">Print Badge</span></a>'
if conf_id in [8]:
btn_link = btn_link
else:
btn_link = ""
confimation_mail_link = "/free_confirmation_delegate_mail/"+str(conf_id)+"/"+str(conf_key)+"/"+str(delegate_id)
delegate_nos = '<a href="'+confimation_mail_link+'" target="_blank" >'+str(delegate_nos)+'</a>'
if int(session.get('showSuccessMsg',0)) == 0:
session["showSuccessMsg"] = 1
if conf_id == 17 and amount_for_convertion in [500,1000,1500,2000]:
flash("An amount of {} inclusive of GST has been made towards WET & DRY lab registration.<br/>The receipt has been emailed to {}.<br/><br/> Receipt no. {}".format(amount,email,receipt_no),"successMsg")
else:
flash("An amount of {} has been made towards {} registration. The receipt has been email to {}.\nA delegate registration confirmation email has been sent to the email id of the delegate(s). Receipt no. {} .Delegate no(s). {} ".format(amount,conf_name,email,receipt_no,delegate_nos),"successMsg")
html = render_template('conferenceapp/email/receipt_email_v1.html',mail_content=mail_content,conf=conf)
if is_send == 1:
if conf['is_email_enable'] == 1:
data_1 = EMAIL.MailTemplateSendMail(subject,html,email,mailData,conf)
data_1 = json.loads(data_1)
update_data = {
'delegate_id' : str(delegate_id),
'conf_id' : str(conf_id),
'created_at' : str(dt_string)
}
data_1.update(update_data)
OfflineRegistrationModel().insert_mandrill_logs(data_1)
if conf['backup_email_2']:
EMAIL.MailTemplateSendMail(subject,html,conf['backup_email_2'],mailData,conf)
return html
else:
return "<h1>Invalid URL </h1>"
@app.route('/conf_confirmation_and_receipt_delegate_mail/<int:conf_id>/<conf_key>/<delegate_id>/<unique_id>', methods = ["GET", "POST"])
def ConfConfirmationAndReceiptDelegagteMail(conf_id,conf_key,delegate_id,unique_id,receipt_data,is_send,email=None):
conf = OfflineRegistrationModel().OR_get_confUserModel(conf_id,conf_key)
if conf:
now = datetime.now()
dt_string = now.strftime('%Y-%m-%d %H:%M:%S')
del_table_name = None
otp_1 = None
if conf :
del_table_name = conf["del_table_name"]
if receipt_data is None :
receipt_datas = OfflineRegistrationModel().OR_BOreceipt_no_generate_and_get(unique_id,conf_id)
if receipt_datas:
receipt_data = receipt_datas[0]
if receipt_data:
receipt_no = receipt_data['receipt_no']
r_amount = receipt_data['amount']
conf_name = receipt_data['conf_name']
delegate_nos = receipt_data['delegate_nos']
is_kit = receipt_data['d_is_kit']
company_name = receipt_data['d_company_name']
if str(r_amount) == "0.00":
r_amount = "Free"
else:
r_amount = int(r_amount)
r_amount = f"{r_amount:,}"
amount_with_commas = r_amount
amount_fOR_convertion = int(receipt_data['amount'])
amount_in_words = Helper.amountTowords(amount_fOR_convertion)
amount_in_words = amount_in_words.title()
if r_amount == "Free" :
r_amount = r_amount
else:
r_amount = "Rs."+r_amount+"/-"
delegate = None
if delegate is None:
delegates = OfflineRegistrationModel().OR_usp_del_get_delegates_by_delegate_id(delegate_id)
if delegates:
delegate = delegates[0]
if delegate:
if email:
email = email
else:
email = delegate['email']
# email = delegate['email']
# parent_email = delegate['parent_email']
delegate_no = delegate['delegate_no']
c_amount = delegate['total_amount']
prefix = delegate["prefix"]
conf_name = delegate['conf_name']
if prefix:
name = delegate["prefix"] +" "+ delegate["full_name"]
else:
name = delegate["full_name"]
########### Ganesan Nov 25 ,2022
# add kit counter for session map
# del_table_name = conf["del_table_name"]
# if del_table_name :
# kc_del_sess_tab = conf["kc_del_session_table_name"]
# fc_del_sess_tab = conf["fc_del_session_table_name"]
# if is_kit and int(is_kit) > 0 :
# session_table = "kc_sessions"
# del_ses_table = kc_del_sess_tab
# else :
# session_table = "fc_sessions"
# del_ses_table = fc_del_sess_tab
# del_id_int = int(delegate_no)
# insert_session = OfflineRegistrationModel().OR_sessionMapSpotReg(conf_id,del_id_int,session_table,del_ses_table,fc_del_sess_tab)
badge_print_url = "https://conference.numerotech.com/"+str(conf_id)+"/"+str(conf_key)+"/delegate_batch_print_from_reg?del_nos="+str(delegate_nos)+"&is_kit="+str(is_kit)
btn_link = '<a href="'+badge_print_url+'" target="_blank" > <i class ="fa fa-print fa-1x"></i> <span aria-hidden="true" title="Print Badge">Print Badge</span></a>'
if conf_id in [8,18,22]:
btn_link = btn_link
else:
btn_link = ""
if del_table_name and conf_id == 12 :
otp_1 = OfflineRegistrationModel().OR_getOTPforConfirmationMail(delegate_no,conf_id,del_table_name)
else :
pass
if otp_1 :
otp = otp_1["otp"]
else:
otp = None
confimation_mail_link = "/free_confirmation_delegate_mail/"+str(conf_id)+"/"+str(conf_key)+"/"+str(delegate_id)
delegate_no = '<a href="'+confimation_mail_link+'" target="_blank" >'+str(delegate_no)+'</a>'
success_msg = "An amount of {} has been made towards {} registration. The receipt has been email to {}.\nA delegate registration confirmation email has been sent to the email id of the delegate(s). Receipt no. {} .Delegate no(s). {} ".format(r_amount,conf_name,email,receipt_no,delegate_no)
subject = "Confirmation and Receipt Mail for Delegate Registration."
html = render_template('conferenceapp/email/confirmation_and_receipt_mail.html',delegate=delegate,delegate_id=delegate_id,receipt_data=receipt_data,conf_id=conf_id,conf_key=conf_key ,amount_in_words=amount_in_words,amount_with_commas=amount_with_commas,conf=conf,otp=otp)
if is_send == 1:
if conf['is_email_enable'] == 1:
# EMAIL.sendMail(subject,html,email,conf)
data_1 = EMAIL.SendMailDuplicate(subject,html,email,conf)
data_1 = json.loads(data_1)
update_data = {
'delegate_id' : str(delegate_id),
'conf_id' : str(conf_id),
'created_at' : str(dt_string)
}
data_1.update(update_data)
OfflineRegistrationModel().insert_mandrill_logs(data_1)
return success_msg
else:
return success_msg
else:
return success_msg
return html
else:
return "<h1>Invalid URL </h1>"
@app.route('/bo_confirmation_delegate_mail/<int:conf_id>/<conf_key>/<delegate_id>', methods = ["GET", "POST"])
def BoConfirmationDelegateMailURL(conf_id,conf_key,delegate_id):
return BoConfirmationDelegateMail(conf_id,conf_key,delegate_id)
def ConfConfirmationDelegateMail(conf_id,conf_key,delegate_id,delegate=None,is_send=None,email=None):
conf = ConfAppModel().get_conf_conf_app(conf_id,conf_key)
now = datetime.now()
dt_string = now.strftime('%Y-%m-%d %H:%M:%S')
template_name = "confirmation_mail"
mailData = ConfAppModel().get_mail_template(template_name,conf_id)
if delegate is None:
delegates = OfflineRegistrationModel().OR_usp_del_get_delegates_by_delegate_id(delegate_id)
if delegates:
delegate = delegates[0]
if delegate:
if email:
email = email
else:
email = delegate['email']
parent_email = delegate['parent_email']
# parent_email = 'karthiashokan23@gmail.com'
delegate_no = delegate['delegate_no']
amount = delegate['total_amount']
prefix = delegate["prefix"]
conf_name = delegate['conf_name']
if prefix:
name = delegate["prefix"] +" "+ delegate["full_name"]
else:
name = delegate["full_name"]
if str(amount) == "0.00":
amount = "Free"
else:
amount = "Rs."+str(amount)
if conf['is_gen_number'] :
sub_data = {
'delegate_no':str(ref_no)
}
else :
sub_data = {
'delegate_no':str(delegate_no)
}
subject = Helper.merge_tags(mailData['subject'],sub_data)
m_data = {
'mail_content' : mailData['mail_content'],
'delegate' : delegate,
'conf' : conf
}
mail_content = Helper.convert_html_for_mail_screen(m_data)
html = render_template('conferenceapp/email/confirmation_mail_v1.html',mail_content=mail_content,conf=conf)
tricon_subject = "Book your Accommodation for TRICON now!"
tricon_tnoa_23_html = render_template('conferenceapp/email/tricon_tnoa_23_accommodation_mail.html',conf=conf)
if is_send == 1:
if conf['is_email_enable'] == 1:
data_1 = EMAIL.MailTemplateSendMail(subject,html,email,mailData,conf)
data_1 = json.loads(data_1)
update_data = {
'delegate_id' : str(delegate_id),
'conf_id' : str(conf_id),
'created_at' : str(dt_string)
}
data_1.update(update_data)
OfflineRegistrationModel().insert_mandrill_logs(data_1)
if conf['backup_email_2']:
EMAIL.MailTemplateSendMail(subject,html,conf['backup_email_2'],mailData,conf)
if email != parent_email:
if conf['is_email_enable'] == 1:
data_1 = EMAIL.MailTemplateSendMail(subject,html,parent_email,mailData,conf)
data_1 = json.loads(data_1)
update_data = {
'delegate_id' : str(delegate_id),
'conf_id' : str(conf_id),
'created_at' : str(dt_string)
}
data_1.update(update_data)
OfflineRegistrationModel().insert_mandrill_logs(data_1)
if conf_id == 17:
EMAIL.sendMail(tricon_subject,tricon_tnoa_23_html,email,conf)
else:
return html
else :
return None
# 7a34cae50dc44d15800f908f139f0247 drlakshmioph@gmail.com
@app.route('/search_mail',methods = ["GET", "POST"])
def SearchMail():
# Usage
# api_key = "3rql7lHFpPcoHnNAWYQTFQ"
# email = "karthick@numerotec.com"
# message_id = "0ed9f6b95ed74f6094039fcced537780"
api_key = request.values.get('api_key',0)
email = request.values.get('email',0)
message_id = request.values.get('msg_id',0)
response = get_message_content(api_key, message_id)
if response :
html_data =response["html"]
html_data = render_template_string(html_data)
return html_data
return "-------"
def get_message_content(api_key, message_id):
url = "https://mandrillapp.com/api/1.0/messages/content.json"
payload = {
"key": api_key,
"id": message_id
}
response = requests.post(url, data=json.dumps(payload))
return response.json()
def search_messages(api_key, email):
url = "https://mandrillapp.com/api/1.0/messages/search.json"
payload = {
"key": api_key,
"query": f"recipient:{email}"
}
response = requests.post(url, data=json.dumps(payload))
return response.json()
# addon update v1
@app.route('/<int:conf_id>/<conf_key>/change_conf_date', methods = ["GET", "POST"])
def BoGetConfrenceData(conf_id,conf_key):
get_conf_value = ConfAppModel().get_confrence_data(conf_id,conf_key)
if get_conf_value:
get_addons_value = ConfAppModel().get_addon_data(conf_id)
for index,value in enumerate(get_addons_value):
if index == 1:
addon_data = value
if index == 0:
addon_null_data = value
return render_template('conferenceapp/conference_details.html',conf=get_conf_value,get_conf_value=get_conf_value,addon_data=addon_data,addon_null_data=addon_null_data)
else:
return "<h1>Invalid URL </h1>"
@app.route('<int:conf_id>/<conf_key>/bo_reg_datails', methods = ["GET", "POST"])
def Boregdetails(conf_id,conf_key):
now = datetime.now()
curr_dt = now.strftime("%Y-%m-%d %H:%M:%S")
conf = ConfAppModel().get_conf_conf_app(conf_id,conf_key)
get_conf_value = ConfAppModel().get_confrence_data(conf_id,conf_key)
team_members = ConfAppModel().bo_get_numerotec_team_members(conf_id)
template_name = "reg_update_date"
mailData = ConfAppModel().get_mail_template(template_name,conf_id)
reg_start_on = request.values.get('reg_start_on',None )
reg_end_on = request.values.get('reg_end_on', None )
send_mail = request.values.get('send_mail', None)
data = {
'reg_start_on' : reg_start_on,
'reg_end_on' : reg_end_on,
'updated_at' : curr_dt
}
updated_reg_data = ConfAppModel().update_conference_data(conf_id,data,curr_dt)
sub_data = {'conf_name' : conf['conf_name']}
subject = Helper.merge_tags(mailData['subject'],sub_data)
data = {
'mail_content' : mailData['mail_content'],
'conf_name':conf['conf_name'],
'updated_reg_data':updated_reg_data
}
mail_content = Helper.convert_html_for_mail_screen(data)
html = render_template('conferenceapp/conference_data_update_mail.html',mail_content=mail_content,conf=conf)
# return html
if send_mail == "1" :
if team_members:
for i in team_members :
email = i['email']
EMAIL.allconfcountsendMail(subject,html,email)
data_1 = {"status" : 1 , "msg" : "Updated Mail Sent Successfully"}
else:
# pass
data_1 = {"status" : 2 , "msg" : "Updated Mail Not Send"}
else:
if updated_reg_data:
data_1 = {"status" : 1 , "msg" : "Updated Successfully"}
else :
data_1 = {"status" : 2 , "msg" : "Updated Failed"}
return json.dumps(data_1 ,default=str)
@app.route('<int:conf_id>/<conf_key>/bo_conf_datails', methods = ["GET", "POST"])
def BoConfdetails(conf_id,conf_key):
now = datetime.now()
curr_dt = now.strftime("%Y-%m-%d %H:%M:%S")
conf = ConfAppModel().get_conf_conf_app(conf_id,conf_key)
get_conf_value = ConfAppModel().get_confrence_data(conf_id,conf_key)
team_members = ConfAppModel().bo_get_numerotec_team_members(conf_id)
template_name = "conference_update_date"
mailData = ConfAppModel().get_mail_template(template_name,conf_id)
conf_start_time = request.values.get('conf_start_time',None )
conf_end_time = request.values.get('conf_end_time', None )
send_mail = request.values.get('send_mail') or 0
data = {
'conf_start_time' : conf_start_time,
'conf_end_time' : conf_end_time,
'updated_at' : curr_dt
}
updated_conf_data = ConfAppModel().update_conference_data(conf_id,data,curr_dt)
sub_data = {'conf_name' : conf['conf_name']}
subject = Helper.merge_tags(mailData['subject'],sub_data)
data = {
'mail_content' : mailData['mail_content'],
'conf_name':conf['conf_name'],
'updated_conf_data':updated_conf_data
}
mail_content = Helper.convert_html_for_mail_screen(data)
html = render_template('conferenceapp/conference_data_update_mail.html',mail_content=mail_content,conf=conf)
# return html
if send_mail == "1" :
if team_members:
for i in team_members :
email = i['email']
EMAIL.allconfcountsendMail(subject,html,email)
data_1 = {"status" : 1 , "msg" : "Updated Mail Sent Successfully"}
else:
# pass
data_1 = {"status" : 2 , "msg" : "Updated Mail Not Send"}
else:
if updated_conf_data:
data_1 = {"status" : 1 , "msg" : "Updated Successfully"}
else :
data_1 = {"status" : 2 , "msg" : "Updated Failed"}
return json.dumps(data_1 ,default=str)
@app.route('<int:conf_id>/<conf_key>/update_addon', methods = ["GET", "POST"])
def BoUpdatedAddon(conf_id,conf_key):
template_name = "addon_update_date"
mailData = ConfAppModel().get_mail_template(template_name,conf_id)
now = datetime.now()
curr_dt = now.strftime("%Y-%m-%d %H:%M:%S")
conf = ConfAppModel().get_conf_conf_app(conf_id,conf_key)
addon_id = request.values.get("addon_id")
start_by = request.values.get('start_by',None )
end_by = request.values.get('end_by', None )
if addon_id:
team_members = ConfAppModel().bo_get_numerotec_team_members(conf_id)
send_mail = request.values.get('send_mail') or 0
data_1 = {'start_by':start_by,'end_by':end_by,'updated_at':curr_dt }
addon_data = ConfAppModel().update_addon_data(conf_id,addon_id,data_1,curr_dt)
sub_data = {'conf_name' : conf['conf_name']}
subject = Helper.merge_tags(mailData['subject'],sub_data)
data = {
'mail_content' : mailData['mail_content'],
'conf_name':conf['conf_name'],
'addons_data':addon_data
}
mail_content = Helper.convert_html_for_mail_screen(data)
html = render_template('conferenceapp/conference_data_update_mail.html',mail_content=mail_content,conf=conf)
if send_mail == "1" :
if team_members:
for i in team_members :
email = i['email']
EMAIL.allconfcountsendMail(subject,html,email)
data_1 = {"status" : 1 , "msg" : "Updated Mail Sent Successfully"}
else:
# pass
data_1 = {"status" : 2 , "msg" : "Updated Mail Not Send"}
else:
if addon_data:
data_1 = {"status" : 1 , "msg" : "Updated Successfully"}
else :
data_1 = {"status" : 2 , "msg" : "Updated Failed"}
else:
data_1 = {"status" : 2 , "msg" : "Updated Failed"}
return json.dumps(data_1 ,default=str)
@app.route('<int:conf_id>/<conf_key>/bulk_update_addon', methods = ["GET", "POST"])
def BoBulkUpdatedAddon(conf_id,conf_key):
now = datetime.now()
updated_at = now.strftime("%Y-%m-%d %H:%M:%S")
conf = ConfAppModel().get_conf_conf_app(conf_id,conf_key)
addon_id = request.values.getlist('addon_reg',None )
template_name = "addon_update_date"
mailData = ConfAppModel().get_mail_template(template_name,conf_id)
team_members = ConfAppModel().bo_get_numerotec_team_members(conf_id)
send_mail = request.values.get('send_mail_addon') or 0
lst = []
addon_reg_type_changes = []
for i in addon_id:
# if i and "_" in i :
# replace_value = i.replace("_", " ").replace("aaaa", "(").replace("bbbb", ")").replace("cccc", "/").replace("dddd","+").replace("eeee","%").replace("ffff",".")
# else :
replace_value = i
if request.values.get("addon_change_"+i,0) == '1' :
addon_reg_type_changes.append(replace_value)
data = {}
data["start_by"] = request.values["start_by_"+i] or None
data["end_by"] = request.values["end_by_"+i] or None
data["updated_at"] = updated_at
data["addon_id"] = replace_value
lst.append(data)
if len(lst) != 0:
if len(addon_reg_type_changes) != 0:
bulk_update_data = ConfAppModel().update_bulk_addon_data(conf_id,addon_reg_type_changes,lst,updated_at)
sub_data = {'conf_name' : conf['conf_name']}
subject = Helper.merge_tags(mailData['subject'],sub_data)
data = {
'mail_content' : mailData['mail_content'],
'conf_name':conf['conf_name'],
'addons_data':bulk_update_data
}
mail_content = Helper.convert_html_for_mail_screen(data)
html = render_template('conferenceapp/conference_data_update_mail.html',mail_content=mail_content,conf=conf)
try:
if send_mail == "1" :
if team_members:
for i in team_members :
email = i['email']
EMAIL.allconfcountsendMail(subject,html,email)
flash('Updated Mail Sent Successfully.',"successMsg")
else:
# pass
data_1 = {"status" : 2 , "msg" : "Updated Mail Not Send"}
else:
pass
flash('Successfully Updated.',"successMsg")
except Exception as e:
pass
else:
pass
else:
flash('Please make any changes.',"errorMsg")
return redirect (url_for('confapp.ViewTariff',conf_id=conf_id,conf_key=conf_key))
# end addon update
@app.route('/search_trigger_mails',methods =["GET","POST"])
def SearchTriggerMails():
conf_data = ConfAppModel().get_conference_data()
society_data = ConfAppModel().getSocietydata()
return render_template('conferenceapp/search_trigger_mails.html',society_data=society_data,conf_data=conf_data)
@app.route('/post_search_trigger_mail_in_conf_id',methods=["GET","POST"])
def PostSearchTriggerMailInConfId():
search = request.values.get('search')or None
conf_id = request.values.get('conf_id')or None
trigger_data = ConfAppModel().search_trigger_mails_data(search,conf_id)
html_data = render_template('conferenceapp/trigger_mail_conf_table.html',trigger_data=trigger_data)
data = {"html_data" : html_data,"msg" : "success","status" : 1}
return json.dumps(data,default = str)
@app.route('/post_search_trigger_email_in_society_id',methods=["GET","POST"])
def PostSearchTriggerEmailInSocietyId():
search = request.values.get('search')or None
society_id = request.values.get('society_id')or None
user_data = ConfAppModel().search_user_mail_data(search,society_id)
if user_data:
is_add_new_trigger=0
else:
is_add_new_trigger=1
html_data = render_template('conferenceapp/trigger_mail_society_table.html',user_data=user_data,is_add_new_trigger=is_add_new_trigger)
data = {"html_data" : html_data,"msg" : "success","status" : 1}
return json.dumps(data,default = str)
@app.route('/insert_trigger_mails',methods=["GET","POST"])
def InsertTriggerMails():
conf_id = request.values.get('conf_id') or None
report_id = request.values.get('report_id') or None
trigger_data = ConfAppModel().view_trigger_data(report_id)
conf_data = ConfAppModel().get_conference_data()
return render_template('conferenceapp/trigger_mail_form.html',trigger_data=trigger_data,conf_data=conf_data,conf_id=conf_id,int=int)
@app.route('/show_trigger_mails_users',methods=["GET","POST"])
def ShowTriggerMailsUsers():
user_id = request.values.get('user_id')
conf_data = ConfAppModel().get_conference_data()
user_data = ConfAppModel().get_users_data(user_id)
return render_template('conferenceapp/trigger_mail_users_form.html',user_data=user_data,conf_data=conf_data)
@app.route('/insert_trigger_mails_in_users',methods=["GET","POST"])
def InsertTriggerMailsInUsers():
now = datetime.now()
current_dt = now.strftime("%Y-%m-%d %H:%M:%S")
society_id = request.values.get('society_id') or 0
conf_id = request.values.get('conf_id') or 0
full_name = request.values.get('full_name') or None
email = request.values.get('email') or None
mobile = request.values.get('mobile') or None
is_active = request.values.get('is_active'or None)
is_separate_mail = request.values.get('is_separate_mail'or None)
is_consolidate_mail = request.values.get('is_consolidate_mail'or None)
active_conf_list_mail = request.values.get('active_conf_list_mail'or None)
data={
'society_id' : society_id,
'conf_id' : conf_id,
'full_name' : full_name,
'email' : email,
'mobile' : mobile,
'is_active' : is_active,
'is_separate_mail' : is_separate_mail,
'is_consolidate_mail' : is_consolidate_mail,
'active_conf_list_mail' : active_conf_list_mail,
'is_del' : 1,
'app_type_id' : 2,
'created_at' : [current_dt]
}
insert_user_data = ConfAppModel().insert_trigger_data(data)
flash('Inserted Successfully.','successMsg')
return redirect (url_for('confapp.SearchTriggerMails'))
@app.route('/insert_new_trigger_data',methods=["GET","POST"])
def InsertNewTriggerData():
conf_data = ConfAppModel().get_conference_data()
return render_template('conferenceapp/trigger_mail_add_new_data.html',conf_data=conf_data)
@app.route('/post_trigger_mail',methods=["POST"])
def PostTriggerMail():
now = datetime.now()
current_dt = now.strftime("%Y-%m-%d %H:%M:%S")
conf_id = request.values.get('conf_id'or None)
full_name = request.values.get('full_name'or None)
email = request.values.get('email'or None)
mobile = request.values.get('mobile'or None)
is_active = request.values.get('is_active'or None)
is_separate_mail = request.values.get('is_separate_mail'or None)
is_consolidate_mail = request.values.get('is_consolidate_mail'or None)
active_conf_list_mail = request.values.get('active_conf_list_mail'or None)
data ={
'conf_id' : conf_id,
'full_name' : full_name,
'email' : email,
'mobile' : mobile,
'full_name' : full_name,
'is_active' : is_active,
'is_separate_mail' : is_separate_mail,
'is_separate_mail' : is_separate_mail,
'is_consolidate_mail' : is_consolidate_mail,
'active_conf_list_mail' : active_conf_list_mail,
'is_del' : 1,
'app_type_id' : 2,
'created_at' : [current_dt]
}
insert_trigger_data = ConfAppModel().insert_trigger_data(data)
flash('Inserted Successfully.','successMsg')
return redirect (url_for('confapp.SearchTriggerMails'))
@app.route('/select_trigger_mail/<int:report_id>',methods =["GET","POST"])
def SelectTrigger_mail(report_id):
trigger_data = ConfAppModel().view_trigger_data(report_id)
return render_template('conferenceapp/trigger_mail_form.html',trigger_data=trigger_data)
@app.route('/update_trigger_mail',methods=["GET","POST"])
def UpdateTriggerMail():
now = datetime.now()
current_dt = now.strftime("%Y-%m-%d %H:%M:%S")
try:
is_active = request.values.get('is_active') or 0
is_separate_mail = request.values.get('is_separate_mail') or 0
is_consolidate_mail = request.values.get('is_consolidate_mail') or 0
active_conf_list_mail = request.values.get('active_conf_list_mail') or 0
report_id = request.values.get('report_id')
data ={
'is_active' : is_active,
'is_separate_mail' : is_separate_mail,
'is_consolidate_mail' : is_consolidate_mail,
'active_conf_list_mail' : active_conf_list_mail,
'updated_at' : current_dt
}
update_trigger_mail_data = ConfAppModel().update_trigger_mail(report_id,data)
if update_trigger_mail_data == "success" :
data = {"msg" : "Successfully updated" , "status" :1 }
else :
data = {"msg" : update_trigger_mail_data , "status" :2 }
json_data= json.dumps(data,default=str)
return json_data
except Exception as e:
data = {"msg" : str(e) , "status" :401 }
json_data= json.dumps(data,default=str)
return json_data
return json.dumps(data,default = str)
# OTP Modal
@app.route('/get_otp_pin', methods = ["GET", "POST"])
def GetOtpPin():
user_id = request.values.get('user_id') or None
conf_id = request.values.get('conf_id') or None
email = request.values.get('email') or None
get_otp_pin_details = ConfAppModel().get_otp_pin_details(user_id,conf_id,email)
if get_otp_pin_details:
html_data = render_template('conferenceapp/delegate_otp_details_table.html',otp_data=get_otp_pin_details)
api_key = get_otp_pin_details['api_key'] or 0
message_id = get_otp_pin_details['msg_id'] or 0
data = {"otp_data":html_data,"msg_id":message_id,"api_key":api_key,"email":email,"status" : 1 , "msg" : "success" }
else:
html_data = render_template('conferenceapp/delegate_otp_details_table.html',otp_data=get_otp_pin_details)
api_key = None
message_id = None
data = {"otp_data":html_data,"msg_id":message_id,"api_key":api_key,"email":email,"status" : 2 , "msg" : "failure" }
return json.dumps(data,default=str)
# OTP Modal
# view tariff ( Started on 22-06-2023 13:28)
@app.route('/<int:conf_id>/<conf_key>/view_tariff', methods = ["GET", "POST"])
def ViewTariff(conf_id,conf_key):
get_conf = ConfAppModel().get_conf_name(conf_id,conf_key)
if get_conf :
addon_name_data = ConfAppModel().get_addon_name(conf_id)
return render_template('conferenceapp/view_tariff.html',get_conf=get_conf,conf_id=conf_id,conf_key=conf_key,addon_name_data=addon_name_data)
else:
return "<h1>Invalid URL </h1>"
@app.route('/<int:conf_id>/<conf_key>/post_tariff', methods = ["GET", "POST"])
def PostTariff(conf_id,conf_key):
conf = ConfAppModel().get_conf_conf_app(conf_id,conf_key)
now = datetime.now()
addon_name = request.values.get('addon_name') or None
get_tariff_data = ConfAppModel().get_tariff_data(conf_id,addon_name)
html_data = render_template('conferenceapp/view_tariff_table.html',conf=conf,tariff_data=get_tariff_data,current_dt=now)
data = {"html_data":html_data,"msg":"Success","status":1}
json_data = json.dumps(data,default=str)
return json_data
# view tariff
# Started on 2023-06-06 10:15 Edit / Update Conference index
@app.route('/<int:conf_id>/<conf_key>/edit_conf_index', methods = ["GET", "POST"])
def EditConfIndex(conf_id,conf_key):
get_conf = BadgeModel().GetConf(conf_id,conf_key)
if get_conf :
conf_data = ConfAppModel().get_conf_data_for_edit(conf_id)
society_app_data = ConfAppModel().get_society_app_data_for_edit(conf_id)
return render_template('conferenceapp/edit_conference.html',conf_data=conf_data,society_app_data=society_app_data,conf_id=conf_id,conf_key=conf_key)
else:
return "<h1>Invalid URL </h1>"
@app.route('/<int:conf_id>/<conf_key>/update_conf',methods=["GET","POST"])
def UpdateConf(conf_id,conf_key):
now = datetime.now()
current_dt = now.strftime("%Y-%m-%d %H:%M:%S")
try:
e_support_email = request.values.get('e_support_email') or None
e_backup_emails = request.values.get('e_backup_emails') or None
pg_appmaster_id = request.values.get('pg_appmaster_id') or None
conf_name = request.values.get('conf_name') or None
conf_name_full_form =request.values.get('conf_name_full_form') or None
conf_title = request.values.get('conf_title')or None
favicon_url = request.values.get('favicon_url')or None
pg_is_test = request.values.get('pg_is_test') or None
payment_api_url = request.values.get('payment_api_url',None) or None
call_payment_url = request.values.get('call_payment_url', None ) or None
mail_header_logo = request.values.get('mail_header_logo') or None
header_logo = request.values.get('header_logo') or None
index_content = request.values.get('index_content') or None
tariff_url = request.values.get('tariff_content') or None
reg_start_on = request.values.get('reg_start_on') or None
reg_end_on = request.values.get('reg_end_on') or None
conf_start_time = request.values.get('conf_start_time') or None
conf_end_time = request.values.get('conf_end_time') or None
user_name = request.values.get('user_name') or None
badge_login_password = request.values.get('badge_login_password') or None
regdesk_pin = request.values.get('regdesk_pin') or None
conf_uuid = request.values.get('conf_uuid',None) or None
is_active = request.values.get('is_active')
pg_details = request.values.get('pg_details') or None
e_from_email = request.values.get('e_from_email') or None
e_reply_name = request.values.get('e_reply_name') or None
e_reply_to = request.values.get('e_reply_to') or None
is_regdesk_open = request.values.get('is_regdesk_open') or 0
system_wise_scan = request.values.get('system_wise_scan') or 0
stylesheet = request.values.get('stylesheet') or None
header_text = request.values.get('header_text') or None
app_url = request.values.get('app_url' ,None) or 'delegate.numerotech.com/'+str(conf_id)+'/'+conf_key
app_url = Helper.leftrightstrip(app_url)
payment_api_url = Helper.leftrightstrip(payment_api_url)
call_payment_url = Helper.leftrightstrip(call_payment_url)
is_gen_number = request.values.get('is_gen_number') or None
google_sheet_link = request.values.get('google_sheet_link') or None
b_ref_prefix = request.values.get('b_ref_prefix') or None
update_data = {'header_text':header_text,'conf_name':conf_name,'favicon_url':favicon_url,'conf_name_full_form':conf_name_full_form,'conf_title':conf_title,'e_support_email':Helper.leftrightstrip(e_support_email),'support_email' : Helper.leftrightstrip(e_support_email),'e_backup_emails':Helper.leftrightstrip(e_backup_emails),'backup_email' :Helper.leftrightstrip(e_backup_emails),'e_from_email':Helper.leftrightstrip(e_from_email),'from_email':Helper.leftrightstrip(e_from_email),'reply_to' :Helper.leftrightstrip(e_reply_to),'e_reply_to':Helper.leftrightstrip(e_reply_to),'e_reply_name':e_reply_name,'pg_appmaster_id':pg_appmaster_id,'pg_is_test':pg_is_test,'mail_header_logo':mail_header_logo,'header_logo':header_logo,'index_content':index_content,'tariff_url':tariff_url,'reg_start_on':reg_start_on,'reg_end_on':reg_end_on,'conf_start_time':conf_start_time,'conf_end_time':conf_end_time,'username':user_name,'badge_login_password':badge_login_password,'regdesk_pin':regdesk_pin,'is_active':is_active,'conf_uuid':conf_uuid,'pg_details':pg_details,'is_regdesk_open' : is_regdesk_open,'system_wise_scan' : system_wise_scan,'stylesheet' : stylesheet,'payment_api_url':payment_api_url,'call_payment_url':call_payment_url,'updated_at':current_dt}
update_conf_data = ConfAppModel().update_conf(conf_id,update_data)
updated_data = ConfAppModel().update_society_application(conf_id,conf_key,payment_api_url,call_payment_url,stylesheet,pg_appmaster_id,pg_is_test,app_url,is_gen_number,google_sheet_link,b_ref_prefix)
if update_conf_data == 'success':
flash("Updated Successfully","EditConfSuccessMsg")
return redirect(url_for('confapp.EditConfIndex',conf_id=conf_id ,conf_key = conf_key))
else:
flash(str(update_conf_data),"EditConfErrorMsg")
return redirect(url_for('confapp.EditConfIndex',conf_id=conf_id ,conf_key = conf_key))
except Exception as e:
flash(str(e) ,"EditConfErrorMsg")
return redirect(url_for('confapp.EditConfIndex',conf_id=conf_id ,conf_key = conf_key))
@app.route('/<int:conf_id>/<conf_key>/generate_conf_uuid', methods = ["GET", "POST"])
def GenerateConfUuid(conf_id,conf_key):
now = datetime.now()
current_dt = now.strftime("%Y-%m-%d %H:%M:%S")
try:
generate_conf_uuid = ConfAppModel().update_generate_conf_uuid(conf_id,current_dt)
if generate_conf_uuid == "success" :
data = {"msg" : "Successfully Generated" , "status" :1 }
else :
data = {"msg" : generate_conf_uuid , "status" :2 }
json_data= json.dumps(data,default=str)
return json_data
except Exception as e:
data = {"msg" : str(e) , "status" :401 }
json_data= json.dumps(data,default=str)
return json_data
return json.dumps(data,default = str)
# Ended on 2023-06-06 03:34 Edit / Update Conference index
# Get all sent mail by Delegate id
# 2023-06-30 14:57:00
@app.route('/get_all_mail_by_delegate_id/<int:conf_id>/<int:delegate_id>', methods = ["GET", "POST"])
def GetAllMailByDelegateid(conf_id,delegate_id):
try:
get_mail_data = ConfAppModel().get_mail_data_by_delegateid(conf_id,delegate_id)
if get_mail_data :
data = {"mail_data" : get_mail_data,"msg" : "success" , "status" :1 }
else :
data = {"msg" : "failure" , "status" :2 }
json_data= json.dumps(data,default=str)
return json_data
except Exception as e:
data = {"msg" : str(e) , "status" :401 }
json_data= json.dumps(data,default=str)
return json_data
return json.dumps(data,default = str)
# 2023-07-05 09:24:00
# To get last delegate no and receipt for all conference
@app.route('/get_all_conf_delegate_no', methods = ["GET", "POST"])
def GetAllConfLastDelegateCount():
try:
conf_max_delno_count = {}
get_conf_db = ConfAppModel().get_conf_id_conf_name()
if get_conf_db :
for item in get_conf_db:
conf_id = item['conf_id']
get_data = ConfAppModel().get_max_delegate_no(conf_id)
conf_max_delno_count[item["conf_id"]] = conf_max_delno_count.get(item['conf_id'],[]) + get_data
html_data = render_template('conferenceapp/show_conf_max_delno.html',get_conf_db=get_conf_db,conf_max_delno_count=conf_max_delno_count)
data = {"html_data" : html_data,"msg" : "success" , "status" :1 }
json_data= json.dumps(data,default=str)
return json_data
except Exception as e:
data = {"msg" : str(e) , "status" :401 }
json_data= json.dumps(data,default=str)
return json_data
return json.dumps(data,default = str)
# start delegate edit and update
@app.route('/edit_delegate',methods=["GET","POST"])
def EditDelegate():
now = datetime.now()
curr_dt = now.strftime("%Y-%m-%d %H:%M:%S")
conf_id = request.values.get('conf_id') or None
get_conf = UserModel().get_conf_by_conf_id(conf_id)
conf_schema = get_conf['conf_schema']
delegate_id = request.values.get('delegate_id') or None
get_delegate = ConfAppModel().get_edit_delegates(conf_id,delegate_id,conf_schema)
state_id = ConfAppModel().conf_get_states()
country_id = ConfAppModel().conf_get_country()
delegate = ConfAppModel().get_delegate(delegate_id,conf_schema)
user_types = ConfAppModel().get_user_types(conf_id)
badge_role = ConfAppModel().get_badge_model_conf(conf_id)
gel_html_data = render_template('conferenceapp/edit_delegates.html',str=str,del_data =get_delegate,states=state_id,countries=country_id,delegate=delegate,user_types=user_types,badge_role=badge_role)
data = {"html_data":gel_html_data,"status" : 1 , "msg" : "success" }
return json.dumps(data,default=str)
@app.route('/update_delegate',methods=["GET","POST"])
def UpdateDelegate():
now = datetime.now()
curr_dt = now.strftime("%Y-%m-%d %H:%M:%S")
conf_id = request.values.get('conf_id',None)
full_name = request.values.get('full_name',None)
delegate_id = request.values.get('delegate_id',None )
email = request.values.get('email', None )
mobile = request.values.get('mobile',None)
dob = request.values.get('dob',None )
gender = request.values.get('gender', None )
city = request.values.get('city',None)
district = request.values.get('district',None )
role = request.values.get('role', None )
membership_no = request.values.get('membership_no',None)
parent_user_id = request.values.get('parent_user_id',None )
mc_number = request.values.get('mc_number', None )
mc_state_id = request.values.get('mc_state_id',None)
state_ids = request.values.get('state_id',None)
reg_type_id = request.values.get('reg_type_id',None )
is_offline = request.values.get('is_offline' ) or 0
registered_on = request.values.get('registered_on',None)
delegate_remarks = request.values.get('delegate_remarks',None)
if registered_on:
registered_on = datetime.strptime(registered_on, "%d-%m-%Y %H:%M:%S")
registered_on = registered_on.strftime("%Y-%m-%d %H:%M:%S")
else:
registered_on=registered_on
if dob:
dob = datetime.strptime(dob, "%d-%m-%Y")
# dob = dob.strftime("%Y-%m-%d")
else:
dob=dob
get_conf = UserModel().get_conf_by_conf_id(conf_id)
conf_schema = get_conf['conf_schema']
get_delegate = ConfAppModel().get_edit_delegates(conf_id,delegate_id,conf_schema)
state_id = ConfAppModel().conf_get_states()
country_id = ConfAppModel().conf_get_country()
delegate = ConfAppModel().get_delegate(delegate_id,conf_schema)
data = {
'email':email,
'full_name':full_name,
'mobile':mobile,
'dob':dob,
'gender':gender,
'city':city,
'district':district,
'role':role,
'membership_no':membership_no,
'parent_user_id':parent_user_id,
'mc_number':mc_number,
'mc_state_id':mc_state_id,
'state_id':state_ids,
'reg_type_id':reg_type_id,
'is_offline':is_offline,
'registered_on':registered_on,
'delegate_remarks':delegate_remarks,
'updated_at':curr_dt
}
update_data = ConfAppModel().update_delegate_detail(conf_id,delegate_id,data,conf_schema)
html_data = render_template('conferenceapp/edit_delegates.html',del_data =get_delegate,update_data=update_data,delegate=delegate,state_id=state_id,country_id=country_id)
data = {"html_data":html_data,"status" : 1 , "msg" : "Updated Successfully" }
return json.dumps(data,default=str)
@app.route('/edit_userpayment',methods=["GET","POST"])
def EditUserPayment():
now = datetime.now()
curr_dt = now.strftime("%Y-%m-%d %H:%M:%S")
conf_id = request.values.get('conf_id') or None
unique_id = request.values.get('unique_id') or None
get_userpayment = ConfAppModel().get_edit_userpayment(conf_id,unique_id)
gel_html_data = render_template('conferenceapp/edit_user_payment.html',up=get_userpayment)
data = {"html_data":gel_html_data,"status" : 1 , "msg" : "success" }
return json.dumps(data,default=str)
@app.route('/update_user_payments',methods=["GET","POST"])
def UpdateUserPayment():
now = datetime.now()
curr_dt = now.strftime("%Y-%m-%d %H:%M:%S")
unique_id = request.values.get('unique_id',None )
payment_id = request.values.get('payment_id',None )
delegate_ids = request.values.get('delegate_ids',None )
conf_id = request.values.get('conf_id',None)
full_name = request.values.get('full_name',None)
email = request.values.get('email', None )
mobile = request.values.get('mobile',None)
amount = request.values.get('amount', None )
status = request.values.get('status',None)
api_payment_id = request.values.get('api_payment_id',None )
receipt_no = request.values.get('receipt_no', None )
payment_for = request.values.get('payment_for',None)
payment_method = request.values.get('payment_method',None )
remarks = request.values.get('remarks', None )
payment_method_from_gateway = request.values.get('payment_method_from_gateway',None)
utr_number = request.values.get('utr_number',None )
is_generate = request.values.get('is_generate', None )
reg_by = request.values.get('reg_by',None)
updated_at = request.values.get('updated_at', None )
paid_at = request.values.get('paid_at',None)
if updated_at:
updated_at = datetime.strptime(updated_at, "%d-%m-%Y %H:%M:%S")
updated_at = updated_at.strftime("%Y-%m-%d %H:%M:%S")
else:
updated_at = curr_dt
if paid_at:
paid_at = datetime.strptime(paid_at, "%d-%m-%Y %H:%M:%S")
paid_at = paid_at.strftime("%Y-%m-%d %H:%M:%S")
else:
paid_at = curr_dt
get_userpayment = ConfAppModel().get_edit_userpayment(conf_id,unique_id)
data = {
'delegate_ids' : delegate_ids,
'full_name' : full_name,
'email' : email,
'mobile' : mobile,
'amount' : amount,
'status' : status,
'api_payment_id': api_payment_id,
'receipt_no' : receipt_no,
'payment_for' : payment_for,
'payment_method': payment_method,
'remarks' : remarks,
'payment_method_from_gateway': payment_method_from_gateway,
'utr_number' : utr_number,
'is_generate' : is_generate,
'reg_by' : reg_by,
'is_generate' : is_generate,
'paid_at' : paid_at,
'updated_at' : updated_at
}
update_data = ConfAppModel().get_update_userpayment(conf_id,payment_id,data)
html_data = render_template('conferenceapp/edit_user_payment.html',update_data=update_data,up=get_userpayment)
data = {"html_data":html_data,"status" : 1 , "msg" : "Updated Successfully" }
return json.dumps(data,default=str)
@app.route('/state', methods = ["GET","POST"])
def State():
country_id = request.values.get('country_id') or 101
data = ConfAppModel().get_states_of_india(country_id)
return json.dumps(data)
# end delegate edit and update
# Created By Ramya on 2023-09-19
# Purpose : To update same details in society_application from conference index
@app.route('/<int:conf_id>/<conf_key>/update_society_application', methods = ["GET", "POST"])
def UpdateSocietyApplication(conf_id,conf_key):
now = datetime.now()
current_dt = now.strftime("%Y-%m-%d %H:%M:%S")
try:
payment_api_url = request.values.get('payment_api_url',None) or None
payment_api_url = Helper.leftrightstrip(payment_api_url)
call_payment_url = request.values.get('call_payment_url', None ) or None
call_payment_url = Helper.leftrightstrip(call_payment_url)
stylesheet = request.values.get('stylesheet',None) or None
pg_appmaster_id = request.values.get('pg_appmaster_id', None ) or None
pg_is_test = request.values.get('pg_is_test') or 0
app_url = request.values.get('app_url') or 'delegate.numerotech.com/'+str(conf_id)+'/'+conf_key
app_url = Helper.leftrightstrip(app_url)
is_gen_number = request.values.get('is_gen_number') or None
google_sheet_link = request.values.get('google_sheet_link') or None
b_ref_prefix = request.values.get('b_ref_prefix') or None
updated_data = ConfAppModel().update_society_application(conf_id,conf_key,payment_api_url,call_payment_url,stylesheet,pg_appmaster_id,pg_is_test,app_url,is_gen_number,google_sheet_link,b_ref_prefix)
if updated_data['msg'] == "success" :
data = {"msg" : "Successfully Updated" , "status" :1 }
else :
data = {"msg" : updated_data['msg'] , "status" :2 }
json_data= json.dumps(data,default=str)
return json_data
except Exception as e:
data = {"msg" : str(e) , "status" :401 }
json_data= json.dumps(data,default=str)
return json_data
return json.dumps(data,default = str)
# conference reminder notification
# created by Aravinth 22.08.2023.10:35
@app.route('/<int:conf_id>/<conf_key>/conf_reminder_notification',methods=["GET","POST"])
def ConfReminderNotification(conf_id,conf_key):
notification_data = ConfAppModel().get_rem_notification_data(conf_id)
all_mail_list = ConfAppModel().get_all_mail_data()
html_data = render_template("conferenceapp/mail_list.html",mail_data = all_mail_list)
html_data_1 = render_template("conferenceapp/conf_reminder_notification_table.html",data = notification_data)
return render_template('conferenceapp/conf_reminder_notification.html',conf_id=conf_id,conf_key=conf_key,data = notification_data,trigger_data=html_data,html_data_1=html_data_1)
@app.route('/<int:conf_id>/<conf_key>/conf_reminder_notification_email_list',methods=["POST"])
def ConfReminderNotificationEmailList(conf_id,conf_key):
emails = []
selected_mail_list = None
all_mail_list = None
map_id = 0
reminder_id = 0
try:
reminder_id = request.values.get("reminder_id") or None
all_mail_list = ConfAppModel().get_all_mail_data()
selected_mail_list = ConfAppModel().get_mail_data(reminder_id)
if selected_mail_list :
emails = selected_mail_list[0]['emails']
if emails :
map_id = selected_mail_list[0]["map_id"] or 0
selected_mail_list = [emails.strip() for emails in emails.split(',')]
html_data = render_template("conferenceapp/mail_list.html",map_id=map_id,reminder_id=reminder_id,all_mail_list = all_mail_list ,selected_mail_list=selected_mail_list)
data = {"html_data" : html_data,"reminder_id":reminder_id,"map_id" : map_id ,"msg" : "success" ,"status" :1}
json_data = json.dumps(data,default =str)
return json_data
except Exception as e:
data = {"html_data" : "","reminder_id":reminder_id,"map_id" : map_id ,"msg" : str(e) , "status" :401 }
json_data = json.dumps(data,default =str)
return json_data
@app.route('/<int:conf_id>/<conf_key>/post_conf_reminder_notification',methods=["POST"])
def PostConfReminderNotification(conf_id,conf_key):
now = datetime.now()
current_dt = now.strftime("%Y-%m-%d %H:%M:%S")
conf_id = request.values.get('conf_id') or None
notification_msg = request.values.get('notification_msg') or None
reminder_date = request.values.get('reminder_date') or None
notes = request.values.get('notes') or None
subject = request.values.get('subject') or None
mail_to_be_sent = request.values.get('mail_to_be_sent') or None
data ={
'conf_id' : conf_id,
'notification_msg' : notification_msg,
'reminder_date' : reminder_date,
'notes' : notes,
'subject' : subject,
'mail_to_be_sent' : mail_to_be_sent,
'created_at' : current_dt
}
insert_reminder_data = ConfAppModel().insert_conf_reminder_data(data)
flash('Inserted Successfully.','successMsg')
return redirect (url_for('confapp.ConfReminderNotification',conf_id=conf_id ,conf_key=conf_key))
@app.route('/<int:conf_id>/<conf_key>/insert_selected_emails', methods = ["GET", "POST"])
def InsertSelectedEmails(conf_id,conf_key):
try:
now = datetime.now()
current_dt = now.strftime("%Y-%m-%d %H:%M:%S")
email_list = request.values.get('selected_mail_ids') or None
reminder_id = request.values.get('reminder_id') or None
map_id = request.values.get('map_id') or 0
map_id = int(map_id) if map_id else map_id
if email_list :
data = { 'emails' : email_list,'reminder_id':reminder_id, 'conf_id' : conf_id}
if map_id and map_id > 0 :
data["updated_at"] = current_dt
msg = "Successfully updated."
else :
data["created_at"] = current_dt
msg = "Successfully saved."
insert_emails_data = ConfAppModel().insert_or_update_emails_data(data,map_id)
notification_data = ConfAppModel().get_rem_notification_data(conf_id)
html_data = render_template('conferenceapp/conf_reminder_notification_table.html',data = notification_data,conf_id=conf_id,conf_key=conf_key)
data = {"html_data" : html_data,"msg" : msg , "status" :1 }
json_data = json.dumps(data,default=str)
else:
data = {"html_data" : "","msg" : "Please select atleast one ...." , "status" :2 }
json_data = json.dumps(data,default=str)
return json_data
except Exception as e:
data = {"msg" : str(e) , "status" :401 }
json_data = json.dumps(data,default=str)
return json_data
return json.dumps(data,default = str)
@app.route('/edit_conf_reminder_notification',methods = ["GET"])
def EditConfReminderNotification():
reminder_id = request.values.get("reminder_id")
reminder_data = ConfAppModel().reminder_notificatin_edit(reminder_id)
data = {'edited_data' :reminder_data,'msg' : 'success' ,'status' : 1}
json_data = json.dumps(data,default=str)
return json.dumps(data,default=str)
@app.route('/<int:conf_id>/<conf_key>/update_reminder_notification',methods = ["GET","POST"])
def UpdateReminderNotification(conf_id,conf_key):
now = datetime.now()
current_dt = now.strftime("%Y-%m-%d %H:%M:%S")
conf_id = request.values.get('conf_id') or None
notification_msg = request.values.get('notification_msg') or None
reminder_date = request.values.get('reminder_date') or None
notes = request.values.get('notes') or None
subject = request.values.get('subject') or None
mail_to_be_sent = request.values.get('mail_to_be_sent') or None
reminder_id = request.values.get('reminder_id') or None
if reminder_id and int(reminder_id) > 0 :
data={
'notification_msg' : notification_msg,'reminder_date' : reminder_date,'notes' : notes,'subject' : subject,
'mail_to_be_sent' : mail_to_be_sent,'updated_at' : current_dt
}
update_and_get_data = ConfAppModel().update_reminder_notification_data(data,reminder_id,conf_id)
html_data = render_template ('conferenceapp/conf_reminder_notification_table.html',data=update_and_get_data)
data = {"html_data" : html_data ,"status" : 1 , "msg" : "Successfully updated."}
else:
data = {"html_data" : "" ,"status" : 2 , "msg" : "Invalid "}
return json.dumps(data,default=str)
@app.route('/<int:conf_id>/<conf_key>/delete_conf_reminder_notification',methods = ['POST', 'GET'])
def DeleteConfReminderNotification(conf_id,conf_key):
try:
reminder_id = request.values.get('reminder_id') or None
conf_id = request.values.get('conf_id') or None
delete_and_get_data = ConfAppModel().delete_reminder_notification(reminder_id,conf_id)
html_data = render_template("conferenceapp/conf_reminder_notification_table.html", data = delete_and_get_data,conf_id=conf_id)
data = {"deleted_data" : html_data,"msg" : "Deleted Successfully", "status" :1}
return json.dumps(data,default=str)
except Exception as e:
data = {"deleted_data" : "","msg" : str(e), "status" :401}
return json.dumps(data,default=str)
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists