Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
authentication_classes = [JWTAuthentication]
permission_classes = [IsAuthenticated]
def get(self,request):
if request.user.role != "agent" and request.user.role != 'team leader':
dashboard_dict = {}
users = User.objects.filter(Q(role="admin") | Q(role="sub admin") | Q(role="executive")| Q(role="team leader"))
total_user = users.count()
active_user = users.filter(is_active=True).count()
inactive_user = users.filter(is_active=False).count()
deleted_user = users.filter(is_deleted =True).count()
agents = User.objects.filter(role="agent")
total_agent = agents.count()
active_agent = agents.filter(is_active=True).count()
inactive_agent = agents.filter(is_active=False).count()
deleted_agent = agents.filter(is_deleted =True).count()
verified_agent = agents.filter(is_verified = "verified").count()
customers = Customer.objects.all()
total_customer = customers.count()
active_customer = customers.filter(payment_status="completed").count()
pending_customer = customers.filter(payment_status="pending").count()
failed_customer = customers.filter(payment_status="failed").count()
inactive_customer = customers.filter(is_active = False).count()
deleted_customer = customers.filter(is_deleted=True).count()
tag_stock = FastagInventory.objects.all()
total_fastag = tag_stock.count()
assigned_to_agents = tag_stock.filter(customer_id__isnull=True, vehicle_id__isnull=True,agent_id__isnull=False).count()
assigned_to_customers = tag_stock.filter(customer_id__isnull=False, vehicle_id__isnull=False).count()
replaced_tags = tag_stock.filter(customer_id__isnull=False, vehicle_id__isnull=False,agent_id__isnull=False,is_deleted=True).count()
fresh_tags = tag_stock.filter(is_requested = False, agent_id__isnull=True,customer_id__isnull=True, vehicle_id__isnull=True).count()
vehicles = Vehicle.objects.all()
total_vehicles_count = vehicles.count()
commercial_vehicles_count = vehicles.filter(is_commercial_vehicle = True).count()
non_commercial_vehicles_count = vehicles.filter(is_commercial_vehicle = False).count()
kycs = KYC.objects.all()
total_kycs_count = kycs.count()
success_kycs_count = kycs.filter(is_verified = 'completed').count()
failure_kycs_count = kycs.filter(is_verified = 'failed').count()
pending_kycs_count = kycs.filter(is_verified = 'pending').count()
queries = Query.objects.all()
total_queries_count = queries.count()
success_queries_count = queries.filter(status = 'resolved').count()
failure_queries_count = queries.filter(status = 'rejected').count()
pending_queries_count = queries.filter(status = 'pending').count()
ongoing_queries_count = queries.filter(status = 'ongoing').count()
topups = TopupRequest.objects.all()
total_topups_count = topups.count()
success_topups_count = topups.filter(status = 'completed').count()
failure_topups_count = topups.filter(status = 'failed').count()
pending_topups_count = topups.filter(status = 'pending').count()
orders = Order.objects.all()
total_orders_count = orders.count()
success_orders_count = orders.filter(order_status = 'completed').count()
failure_orders_count = orders.filter(order_status = 'rejected').count()
pending_orders_count = orders.filter(order_status = 'pending').count()
bank_mappings = MappingRequest.objects.all()
total_bank_mappings_count = bank_mappings.count()
success_bank_mappings_count = bank_mappings.filter(approval_status = 'approved').count()
failure_bank_mappings_count = bank_mappings.filter(approval_status = 'rejected').count()
pending_bank_mappings_count = bank_mappings.filter(approval_status = 'pending').count()
remappings = ReMappingRequest.objects.all()
total_remappings_count = remappings.count()
success_remappings_count = remappings.filter(approval_status = 'approved').count()
failure_remappings_count = remappings.filter(approval_status = 'rejected').count()
pending_remappings_count = remappings.filter(approval_status = 'pending').count()
tag_requests = TagRequest.objects.all()
total_tag_requests_count = tag_requests.count()
success_tag_requests_count = tag_requests.filter(approval_status = 'approved').count()
failure_tag_requests_count = tag_requests.filter(approval_status = 'rejected').count()
pending_tag_requests_count = tag_requests.filter(approval_status = 'pending').count()
tag_replacements = TagReplacement.objects.all()
total_tag_replacements_count = tag_replacements.count()
success_tag_replacements_count = tag_replacements.filter(approval_status = 'approved').count()
failure_tag_replacements_count = tag_replacements.filter(approval_status = 'failed').count()
pending_tag_replacements_count = tag_replacements.filter(approval_status = 'pending').count()
wallet_additions = WalletAddRequest.objects.all()
total_wallet_additions_count = wallet_additions.count()
success_wallet_additions_count = wallet_additions.filter(status = 'completed').count()
failure_wallet_additions_count = wallet_additions.filter(status = 'failed').count()
transactions = Transaction.objects.all()
total_transactions_count = transactions.count()
success_transactions_count = transactions.filter(transaction_status = 'completed').count()
failure_transactions_count = transactions.filter(transaction_status = 'failed').count()
pending_transactions_count = transactions.filter(transaction_status = 'on hold').count()
dashboard_dict['user'] = {'total_user':total_user,'active_user':active_user,'inactive_user':inactive_user,'deleted_user':deleted_user}
dashboard_dict['agent'] = {'total_agent':total_agent,'active_agent':active_agent,'inactive_agent':inactive_agent,'deleted_agent':deleted_agent,'verified_agent':verified_agent}
dashboard_dict['customer'] = {'total_customer':total_customer,'active_customer':active_customer,'pending_customer':pending_customer,'failed_customer':failed_customer,'deleted_customer':deleted_customer,'inactive_customer':inactive_customer}
dashboard_dict['tags'] = {'total_fastag':total_fastag,'assigned_to_agents':assigned_to_agents,'fresh_tags':fresh_tags,'assigned_to_customers':assigned_to_customers,'replaced_tags':replaced_tags}
dashboard_dict['vehicles'] = {'total_vehicles':total_vehicles_count,'commercial_vehicles_count':commercial_vehicles_count,'non_commercial_vehicles_count':non_commercial_vehicles_count}
dashboard_dict['kycs'] = {'total_kycs':total_kycs_count,'pending_kycs_count':pending_kycs_count,'success_kycs_count':success_kycs_count,
'failure_kycs_count':failure_kycs_count}
dashboard_dict['queries'] = {'total_queries':total_queries_count,'pending_queries_count':pending_queries_count,'success_queries_count':success_queries_count,
'failure_queries_count':failure_queries_count,
'ongoing_queries_count':ongoing_queries_count,}
dashboard_dict['topups'] = {'total_topups':total_topups_count,'pending_topups_count':pending_topups_count,'success_topups_count':success_topups_count,
'failure_topups_count':failure_topups_count,}
dashboard_dict['orders'] = {'total_orders':total_orders_count,'pending_orders_count':pending_orders_count,'success_orders_count':success_orders_count,
'failure_orders_count':failure_orders_count,}
dashboard_dict['bank_mappings'] = {'total_bank_mappings':total_bank_mappings_count,'pending_bank_mappings_count':pending_bank_mappings_count,'success_bank_mappings_count':success_bank_mappings_count,
'failure_bank_mappings_count':failure_bank_mappings_count,}
dashboard_dict['remappings'] = {'total_remappings':total_remappings_count,'pending_remappings_count':pending_remappings_count,'success_remappings_count':success_remappings_count,
'failure_remappings_count':failure_remappings_count,}
dashboard_dict['tag_requests'] = {'total_tag_requests':total_tag_requests_count,'pending_tag_requests_count':pending_tag_requests_count,'success_tag_requests_count':success_tag_requests_count,
'failure_tag_requests_count':failure_tag_requests_count,}
dashboard_dict['tag_replacements'] = {'total_tag_replacements':total_tag_replacements_count,'pending_tag_replacements_count':pending_tag_replacements_count,'success_tag_replacements_count':success_tag_replacements_count,
'failure_tag_replacements_count':failure_tag_replacements_count,}
dashboard_dict['wallet_additions'] = {'total_wallet_additions':total_wallet_additions_count,'success_wallet_additions_count':success_wallet_additions_count,
'failure_wallet_additions_count':failure_wallet_additions_count,}
dashboard_dict['transactions'] = {'total_transactions':total_transactions_count,'success_transactions_count':success_transactions_count,
'pending_transactions_count':pending_transactions_count,
'failure_transactions_count':failure_transactions_count,}
return Response({'data':dashboard_dict})
if request.user.role == 'team leader':
dashboard_dict = {}
# users = User.objects.filter(Q(role="admin") | Q(role="sub admin") | Q(role="executive")| Q(role="team leader"))
# total_user = users.count()
# active_user = users.filter(is_active=True).count()
# inactive_user = users.filter(is_active=False).count()
# deleted_user = users.filter(is_deleted =True).count()
agents = User.objects.filter(role="agent",tl_id = request.user.id)
agents_id_list = []
for agent in agents:
agents_id_list.append(agent.id)
total_agent = agents.count()
active_agent = agents.filter(is_active=True).count()
inactive_agent = agents.filter(is_active=False).count()
deleted_agent = agents.filter(is_deleted =True).count()
verified_agent = agents.filter(is_verified = "verified").count()
customers = Customer.objects.filter(created_by__in = agents_id_list)
total_customer = customers.count()
active_customer = customers.filter(payment_status="completed").count()
pending_customer = customers.filter(payment_status="pending").count()
failed_customer = customers.filter(payment_status="failed").count()
inactive_customer = customers.filter(is_active = False).count()
deleted_customer = customers.filter(is_deleted=True).count()
tag_stock = FastagInventory.objects.filter(agent_id__in = agents_id_list,agent_id__isnull = False)
total_fastag = tag_stock.count()
# assigned_to_agents = tag_stock.filter(customer_id__isnull=True, vehicle_id__isnull=True,agent_id__isnull=False).count()
assigned_to_customers = tag_stock.filter(customer_id__isnull=False, vehicle_id__isnull=False).count()
replaced_tags = tag_stock.filter(customer_id__isnull=False, vehicle_id__isnull=False,is_deleted=True).count()
fresh_tags = tag_stock.filter(is_requested = False,customer_id__isnull=True, vehicle_id__isnull=True).count()
customers_id_list = []
for customer in customers:
customers_id_list.append(customer.id)
vehicles = Vehicle.objects.filter(customer_id__in = customers_id_list)
total_vehicles_count = vehicles.count()
commercial_vehicles_count = vehicles.filter(is_commercial_vehicle = True).count()
non_commercial_vehicles_count = vehicles.filter(is_commercial_vehicle = False).count()
kycs = KYC.objects.filter(created_by__in = agents_id_list)
total_kycs_count = kycs.count()
success_kycs_count = kycs.filter(is_verified = 'completed').count()
failure_kycs_count = kycs.filter(is_verified = 'failed').count()
pending_kycs_count = kycs.filter(is_verified = 'pending').count()
queries = Query.objects.filter(created_by__in = agents_id_list)
total_queries_count = queries.count()
success_queries_count = queries.filter(status = 'resolved').count()
failure_queries_count = queries.filter(status = 'rejected').count()
pending_queries_count = queries.filter(status = 'pending').count()
ongoing_queries_count = queries.filter(status = 'ongoing').count()
topups = TopupRequest.objects.filter(created_by__in = agents_id_list)
total_topups_count = topups.count()
success_topups_count = topups.filter(status = 'completed').count()
failure_topups_count = topups.filter(status = 'failed').count()
pending_topups_count = topups.filter(status = 'pending').count()
orders = Order.objects.filter(created_by__in = agents_id_list)
total_orders_count = orders.count()
success_orders_count = orders.filter(order_status = 'completed').count()
failure_orders_count = orders.filter(order_status = 'rejected').count()
pending_orders_count = orders.filter(order_status = 'pending').count()
bank_mappings = MappingRequest.objects.filter(created_by__in = agents_id_list)
total_bank_mappings_count = bank_mappings.count()
success_bank_mappings_count = bank_mappings.filter(approval_status = 'approved').count()
failure_bank_mappings_count = bank_mappings.filter(approval_status = 'rejected').count()
pending_bank_mappings_count = bank_mappings.filter(approval_status = 'pending').count()
remappings = ReMappingRequest.objects.filter(created_by__in = agents_id_list)
total_remappings_count = remappings.count()
success_remappings_count = remappings.filter(approval_status = 'approved').count()
failure_remappings_count = remappings.filter(approval_status = 'rejected').count()
pending_remappings_count = remappings.filter(approval_status = 'pending').count()
tag_requests = TagRequest.objects.filter(created_by__in = agents_id_list)
total_tag_requests_count = tag_requests.count()
success_tag_requests_count = tag_requests.filter(approval_status = 'approved').count()
failure_tag_requests_count = tag_requests.filter(approval_status = 'rejected').count()
pending_tag_requests_count = tag_requests.filter(approval_status = 'pending').count()
tag_replacements = TagReplacement.objects.filter(created_by__in = agents_id_list)
total_tag_replacements_count = tag_replacements.count()
success_tag_replacements_count = tag_replacements.filter(approval_status = 'approved').count()
failure_tag_replacements_count = tag_replacements.filter(approval_status = 'failed').count()
pending_tag_replacements_count = tag_replacements.filter(approval_status = 'pending').count()
wallet_additions = WalletAddRequest.objects.filter(created_by__in = agents_id_list)
total_wallet_additions_count = wallet_additions.count()
success_wallet_additions_count = wallet_additions.filter(status = 'completed').count()
failure_wallet_additions_count = wallet_additions.filter(status = 'failed').count()
transactions = Transaction.objects.filter(created_by__in = agents_id_list)
total_transactions_count = transactions.count()
success_transactions_count = transactions.filter(transaction_status = 'completed').count()
failure_transactions_count = transactions.filter(transaction_status = 'failed').count()
pending_transactions_count = transactions.filter(transaction_status = 'on hold').count()
# dashboard_dict['user'] = {'total_user':total_user,'active_user':active_user,'inactive_user':inactive_user,'deleted_user':deleted_user}
dashboard_dict['agent'] = {'total_agent':total_agent,'active_agent':active_agent,'inactive_agent':inactive_agent,'deleted_agent':deleted_agent,'verified_agent':verified_agent}
dashboard_dict['customer'] = {'total_customer':total_customer,'active_customer':active_customer,'pending_customer':pending_customer,'failed_customer':failed_customer,'deleted_customer':deleted_customer,'inactive_customer':inactive_customer}
dashboard_dict['tags'] = {'total_fastag':total_fastag,'fresh_tags':fresh_tags,'assigned_to_customers':assigned_to_customers,'replaced_tags':replaced_tags}
dashboard_dict['vehicles'] = {'total_vehicles':total_vehicles_count,'commercial_vehicles_count':commercial_vehicles_count,'non_commercial_vehicles_count':non_commercial_vehicles_count}
dashboard_dict['kycs'] = {'total_kycs':total_kycs_count,'pending_kycs_count':pending_kycs_count,'success_kycs_count':success_kycs_count,
'failure_kycs_count':failure_kycs_count}
dashboard_dict['queries'] = {'total_queries':total_queries_count,'pending_queries_count':pending_queries_count,'success_queries_count':success_queries_count,
'failure_queries_count':failure_queries_count,
'ongoing_queries_count':ongoing_queries_count,}
dashboard_dict['topups'] = {'total_topups':total_topups_count,'pending_topups_count':pending_topups_count,'success_topups_count':success_topups_count,
'failure_topups_count':failure_topups_count,}
dashboard_dict['orders'] = {'total_orders':total_orders_count,'pending_orders_count':pending_orders_count,'success_orders_count':success_orders_count,
'failure_orders_count':failure_orders_count,}
dashboard_dict['bank_mappings'] = {'total_bank_mappings':total_bank_mappings_count,'pending_bank_mappings_count':pending_bank_mappings_count,'success_bank_mappings_count':success_bank_mappings_count,
'failure_bank_mappings_count':failure_bank_mappings_count,}
dashboard_dict['remappings'] = {'total_remappings':total_remappings_count,'pending_remappings_count':pending_remappings_count,'success_remappings_count':success_remappings_count,
'failure_remappings_count':failure_remappings_count,}
dashboard_dict['tag_requests'] = {'total_tag_requests':total_tag_requests_count,'pending_tag_requests_count':pending_tag_requests_count,'success_tag_requests_count':success_tag_requests_count,
'failure_tag_requests_count':failure_tag_requests_count,}
dashboard_dict['tag_replacements'] = {'total_tag_replacements':total_tag_replacements_count,'pending_tag_replacements_count':pending_tag_replacements_count,'success_tag_replacements_count':success_tag_replacements_count,
'failure_tag_replacements_count':failure_tag_replacements_count,}
dashboard_dict['wallet_additions'] = {'total_wallet_additions':total_wallet_additions_count,'success_wallet_additions_count':success_wallet_additions_count,
'failure_wallet_additions_count':failure_wallet_additions_count,}
dashboard_dict['transactions'] = {'total_transactions':total_transactions_count,'success_transactions_count':success_transactions_count,
'pending_transactions_count':pending_transactions_count,
'failure_transactions_count':failure_transactions_count,}
return Response({'data':dashboard_dict})
return Response({'msg':'you are not authorized for this servies'}, status=status.HTTP_401_UNAUTHORIZED)
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team