first commit
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,13 +5,28 @@ from django.utils import timezone
|
||||
from django.contrib.auth import views as auth_views
|
||||
from Base.Metrics.Dashboard import (
|
||||
get_sum_of_professional,
|
||||
get_sum_of_stone,
|
||||
get_sum_of_service,
|
||||
get_sum_of_professional_detail,
|
||||
get_sum_payment_method_service,
|
||||
get_sum_of_product
|
||||
get_sum_of_product,
|
||||
)
|
||||
from Base.Metrics.DashboardAdmin import get_total_bank,get_total_prof
|
||||
from Base.Metrics.DashboardAdmin import (
|
||||
get_total_bank,
|
||||
get_total_prof,
|
||||
get_sum_of_stone,
|
||||
get_total_firm,
|
||||
get_total_expense,
|
||||
get_total_expense_prof,
|
||||
get_total_credit_prof,
|
||||
)
|
||||
from Base.Metrics.DashboardProf import (
|
||||
get_total_serv,
|
||||
get_sum_expense,
|
||||
get_sum_credit,
|
||||
get_total_money,
|
||||
)
|
||||
from Base.models import Professional
|
||||
from Movement.models import Calendar
|
||||
|
||||
def Home(request):
|
||||
context = { 'ok':' Tudo ok', }
|
||||
@@ -21,12 +36,11 @@ class Login(auth_views.LoginView):
|
||||
template_name = 'Login/Login.html'
|
||||
|
||||
class Dashboard(LoginRequiredMixin, TemplateView):
|
||||
template_name = 'Login/Dashboard/index.html'
|
||||
template_name = 'Dashboards/Dashboard/index.html'
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
Day = timezone.localtime(timezone.now())
|
||||
context['Professional'] = get_sum_of_professional.metric(Day)
|
||||
context['Stone'] = get_sum_of_stone.metric(Day)
|
||||
context['Service'] = get_sum_of_service.metric(Day)
|
||||
context['Sum_of_professional_detail'] = get_sum_of_professional_detail.metric(Day)
|
||||
context['Sum_payment_method_service'] = get_sum_payment_method_service.metric(Day)
|
||||
@@ -34,9 +48,36 @@ class Dashboard(LoginRequiredMixin, TemplateView):
|
||||
return context
|
||||
|
||||
class DashboardAdmin(LoginRequiredMixin, TemplateView):
|
||||
template_name = 'Login/DashboardAdmin/index.html'
|
||||
template_name = 'Dashboards/DashboardAdmin/index.html'
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['total_bank'] = get_total_bank.metric()
|
||||
context['total_prof'] = get_total_prof.metric()
|
||||
context['total_firm'] = get_total_firm.metric()
|
||||
# context['total_prof'] = get_total_prof.metric()
|
||||
context['total_expense'] = get_total_expense.metric()
|
||||
context['Stone'] = get_sum_of_stone.metric()
|
||||
# context['total_expense_prof'] = get_total_expense_prof.metric()
|
||||
# context['total_credit_prof'] = get_total_credit_prof.metric()
|
||||
return context
|
||||
|
||||
class DashboardProf(LoginRequiredMixin, TemplateView):
|
||||
template_name = 'Dashboards/DashboardProf/index.html'
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
if self.request.GET.get('Prof'):
|
||||
total_serv = get_total_serv.metric(self.request.GET.get('Prof'))
|
||||
sum_expense = get_sum_expense.metric(self.request.GET.get('Prof'))
|
||||
sum_credit = get_sum_credit.metric(self.request.GET.get('Prof'))
|
||||
sum_money = get_total_money.metric(self.request.GET.get('Prof'))
|
||||
else:
|
||||
total_serv = Calendar.objects.none()
|
||||
sum_expense = Calendar.objects.none()
|
||||
sum_credit = Calendar.objects.none()
|
||||
sum_money = Calendar.objects.none()
|
||||
|
||||
context['Total_serv'] = total_serv
|
||||
context['Expense'] = sum_expense
|
||||
context['Credit'] = sum_credit
|
||||
context['Money'] = sum_money
|
||||
context['Professionals'] = Professional.objects.all()
|
||||
return context
|
||||
Reference in New Issue
Block a user