def dashboard(request): context = initialize_context(request) token = get_token(request) # Get user dept info and get charts based on this info dept = get_dept(request) group_type = get_group_type(dept) # Get current date & time curr_datetime = (datetime.datetime.now()).replace(tzinfo=pytz.utc) current_date_str = curr_datetime.strftime("%a, %b %d, %Y") context['groupName'] = group_type context['currentDate'] = current_date_str if group_type != 'Misc Group': if group_type == 'Executive Management': context['finance'] = finance_dashboard context['manufacturing'] = manufacturing_dashboard context['retail'] = retail_dashboard context['salesmarketing'] = salesmarketing_dashboard return render(request, 'core/mgmt_dashboard.html', context) else: dept_dashboard = get_dashboard(dept) context['dashtitle1'] = dept_dashboard[0] context['dashtitle2'] = dept_dashboard[1] context['dashtitle3'] = dept_dashboard[2] context['rangeset1'] = dept_dashboard[3] context['rangeset2'] = dept_dashboard[4] context['rangeset3'] = dept_dashboard[5] context['gauge1'] = dept_dashboard[6] context['gauge2'] = dept_dashboard[7] context['gauge3'] = dept_dashboard[8] context['borderStyle'] = dept_dashboard[9] context['textStyle'] = dept_dashboard[10] return render(request, 'core/dashboard.html', context)
def misc(request): context = initialize_context(request) token = get_token(request) dept = get_dept(request) group_type = get_group_type(dept) context['groupName'] = group_type return render(request, 'core/misc_charts.html', context)
def team(request): context = initialize_context(request) token = get_token(request) dept = get_dept(request) group_id = get_group_id(dept) team = get_team_members(token, group_id) context['team'] = team['value'] context['groupName'] = get_group_type(dept) return render(request, 'core/team.html', context)
def salesmarketing(request): context = initialize_context(request) token = get_token(request) dept = get_dept(request) group_type = get_group_type(dept) context['groupName'] = group_type context['plot1'] = salesmarketing_charts[0] context['plot2'] = salesmarketing_charts[1] context['plot3'] = salesmarketing_charts[2] return render(request, 'core/salesmarketing_charts.html', context)
def manufacturing(request): context = initialize_context(request) token = get_token(request) dept = get_dept(request) group_type = get_group_type(dept) context['groupName'] = group_type context['plot1'] = manufacturing_charts[0] context['plot2'] = manufacturing_charts[1] context['plot3'] = manufacturing_charts[2] context['plot4'] = manufacturing_charts[3] return render(request, 'core/manufacturing_charts.html', context)
def retail(request): context = initialize_context(request) token = get_token(request) dept = get_dept(request) group_type = get_group_type(dept) context['groupName'] = group_type context['plot1'] = retail_charts[0] context['plot2'] = retail_charts[1] context['plot3'] = retail_charts[2] context['plot4'] = retail_charts[3] context['plot5'] = retail_charts[4] context['plot6'] = retail_charts[5] context['plot7'] = retail_charts[6] context['plot8'] = retail_charts[7] context['plot9'] = retail_charts[8] context['plot10'] = retail_charts[9] context['plot11'] = retail_charts[10] context['plot12'] = retail_charts[11] context['plot13'] = retail_charts[12] context['plot14'] = retail_charts[13] return render(request, 'core/retail_charts.html', context)