test stage
This commit is contained in:
parent
f51ce25790
commit
f4f0e842b8
@ -12,12 +12,9 @@ find ./haikalbot -type d -iname "__pycache__"|xargs rm -rf
|
||||
echo "Apply Base Migrate"
|
||||
python3 manage.py migrate
|
||||
|
||||
|
||||
echo "Apply makemigrations"
|
||||
python3 manage.py makemigrations
|
||||
|
||||
echo "Apply Appointment Migratinos"
|
||||
python3 manage.py makemigrations appointment
|
||||
|
||||
echo "Apply Final Migrate"
|
||||
python3 manage.py migrate
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ from django.core.cache import cache
|
||||
from datetime import datetime
|
||||
from luhnchecker.luhn import Luhn
|
||||
from django.contrib.auth.models import Permission
|
||||
from appointment.models import Service
|
||||
# from appointment.models import Service
|
||||
from django.core.validators import MinLengthValidator
|
||||
from django import forms
|
||||
from plans.models import PlanPricing
|
||||
@ -121,12 +121,12 @@ class StaffForm(forms.ModelForm):
|
||||
widget=forms.EmailInput(attrs={"class": "form-control form-control-sm"}),
|
||||
)
|
||||
|
||||
service_offered = forms.ModelMultipleChoiceField(
|
||||
label=_("Services Offered"),
|
||||
widget=forms.CheckboxSelectMultiple(attrs={"class": "form-check-input"}),
|
||||
queryset=Service.objects.all(),
|
||||
required=False,
|
||||
)
|
||||
# service_offered = forms.ModelMultipleChoiceField(
|
||||
# label=_("Services Offered"),
|
||||
# widget=forms.CheckboxSelectMultiple(attrs={"class": "form-check-input"}),
|
||||
# # queryset=Service.objects.all(),
|
||||
# required=False,
|
||||
# )
|
||||
# phone_number = SaudiPhoneNumberField(
|
||||
# required=False,
|
||||
# widget=forms.TextInput(
|
||||
|
||||
@ -47,3 +47,4 @@ class Command(BaseCommand):
|
||||
codename="can_approve_estimatemodel",
|
||||
content_type=ContentType.objects.get_for_model(EstimateModel),
|
||||
)
|
||||
|
||||
|
||||
@ -43,31 +43,31 @@ class Command(BaseCommand):
|
||||
)
|
||||
|
||||
# Assign quotas to plans
|
||||
PlanQuota.objects.create(plan=basic_plan, quota=users_quota, value=4)
|
||||
PlanQuota.objects.create(plan=basic_plan, quota=cars_quota, value=4)
|
||||
PlanQuota.objects.create(plan=basic_plan, quota=users_quota, value=99999)
|
||||
PlanQuota.objects.create(plan=basic_plan, quota=cars_quota, value=99999)
|
||||
|
||||
PlanQuota.objects.create(plan=pro_plan, quota=users_quota, value=5)
|
||||
PlanQuota.objects.create(plan=pro_plan, quota=cars_quota, value=5)
|
||||
PlanQuota.objects.create(plan=pro_plan, quota=users_quota, value=99999)
|
||||
PlanQuota.objects.create(plan=pro_plan, quota=cars_quota, value=99999)
|
||||
|
||||
PlanQuota.objects.create(plan=enterprise_plan, quota=users_quota, value=10)
|
||||
PlanQuota.objects.create(plan=enterprise_plan, quota=cars_quota, value=10)
|
||||
PlanQuota.objects.create(plan=enterprise_plan, quota=users_quota, value=99999)
|
||||
PlanQuota.objects.create(plan=enterprise_plan, quota=cars_quota, value=99999)
|
||||
|
||||
# PlanQuota.objects.create(plan=pro_plan, quota=project_quota, value=50)
|
||||
# PlanQuota.objects.create(plan=pro_plan, quota=storage_quota, value=100)
|
||||
|
||||
# Define pricing
|
||||
basic_pricing = Pricing.objects.create(name="Monthly", period=30)
|
||||
pro_pricing = Pricing.objects.create(name="Monthly", period=30)
|
||||
enterprise_pricing = Pricing.objects.create(name="Monthly", period=30)
|
||||
basic_pricing = Pricing.objects.create(name="3 Months", period=90)
|
||||
pro_pricing = Pricing.objects.create(name="6 Months", period=180)
|
||||
enterprise_pricing = Pricing.objects.create(name="1 Year", period=365)
|
||||
|
||||
PlanPricing.objects.create(
|
||||
plan=basic_plan, pricing=basic_pricing, price=Decimal("9.99")
|
||||
plan=basic_plan, pricing=basic_pricing, price=Decimal("2500.00")
|
||||
)
|
||||
PlanPricing.objects.create(
|
||||
plan=pro_plan, pricing=pro_pricing, price=Decimal("19.99")
|
||||
plan=pro_plan, pricing=pro_pricing, price=Decimal("4500.00")
|
||||
)
|
||||
PlanPricing.objects.create(
|
||||
plan=enterprise_plan, pricing=enterprise_pricing, price=Decimal("29.99")
|
||||
plan=enterprise_plan, pricing=enterprise_pricing, price=Decimal("8500.00")
|
||||
)
|
||||
|
||||
# # Create quotas
|
||||
|
||||
@ -5,7 +5,7 @@ from django.urls import reverse
|
||||
from django.contrib.auth.models import Group
|
||||
from django.db.models.signals import post_save, post_delete
|
||||
from django.dispatch import receiver
|
||||
from appointment.models import Service
|
||||
# from appointment.models import Service
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
@ -276,7 +276,7 @@ urlpatterns = [
|
||||
),
|
||||
# #######################
|
||||
# #######################
|
||||
path("crm/calender/", views.EmployeeCalendarView.as_view(), name="calendar_list"),
|
||||
# path("crm/calender/", views.EmployeeCalendarView.as_view(), name="calendar_list"),
|
||||
#######################################################
|
||||
# Vendor URLs
|
||||
#######################################################
|
||||
|
||||
@ -196,7 +196,7 @@ from django_ledger.views.mixins import (
|
||||
from . import models, forms, tables
|
||||
from django_tables2 import SingleTableView
|
||||
from django_tables2.export.views import ExportMixin
|
||||
from appointment.models import Appointment, AppointmentRequest, Service, StaffMember
|
||||
# from appointment.models import Appointment, AppointmentRequest, Service, StaffMember
|
||||
from .services import (
|
||||
decodevin,
|
||||
get_make,
|
||||
@ -3734,7 +3734,6 @@ class UserUpdateView(
|
||||
# self.object.staff_member.services_offered.add(service)
|
||||
|
||||
staff = form.save(commit=False)
|
||||
print(form.cleaned_data)
|
||||
# staff.name = form.cleaned_data["name"]
|
||||
staff.arabic_name = form.cleaned_data["arabic_name"]
|
||||
staff.phone_number = form.cleaned_data["phone_number"]
|
||||
@ -9012,40 +9011,40 @@ class PnLAPIView(DjangoLedgerSecurityMixIn, EntityUnitMixIn, View):
|
||||
return JsonResponse({"message": _("Unauthorized")}, status=401)
|
||||
|
||||
|
||||
class EmployeeCalendarView(LoginRequiredMixin, ListView):
|
||||
"""
|
||||
Provides a view for displaying the employee's calendar in a list format.
|
||||
# class EmployeeCalendarView(LoginRequiredMixin, ListView):
|
||||
# """
|
||||
# Provides a view for displaying the employee's calendar in a list format.
|
||||
|
||||
Displays a list of appointments for logged-in users. This view ensures that
|
||||
only appointments relevant to the logged-in user as a dealer or staff member
|
||||
are displayed. Supports search functionality to filter displayed appointments
|
||||
based on provided query parameters.
|
||||
# Displays a list of appointments for logged-in users. This view ensures that
|
||||
# only appointments relevant to the logged-in user as a dealer or staff member
|
||||
# are displayed. Supports search functionality to filter displayed appointments
|
||||
# based on provided query parameters.
|
||||
|
||||
:ivar template_name: Path to the HTML template used to render the view.
|
||||
:type template_name: str
|
||||
:ivar model: Model object to interact with appointments data.
|
||||
:type model: Appointment
|
||||
:ivar context_object_name: Name of the context variable that contains the
|
||||
list of appointments in the template.
|
||||
:type context_object_name: str
|
||||
"""
|
||||
# :ivar template_name: Path to the HTML template used to render the view.
|
||||
# :type template_name: str
|
||||
# :ivar model: Model object to interact with appointments data.
|
||||
# :type model: Appointment
|
||||
# :ivar context_object_name: Name of the context variable that contains the
|
||||
# list of appointments in the template.
|
||||
# :type context_object_name: str
|
||||
# """
|
||||
|
||||
template_name = "crm/employee_calendar.html"
|
||||
model = Appointment
|
||||
context_object_name = "appointments"
|
||||
# template_name = "crm/employee_calendar.html"
|
||||
# model = Appointment
|
||||
# context_object_name = "appointments"
|
||||
|
||||
def get_queryset(self):
|
||||
query = self.request.GET.get("q")
|
||||
staff = getattr(self.request, "staff", None)
|
||||
if staff:
|
||||
appointments = Appointment.objects.filter(
|
||||
appointment_request__staff_member=staff,
|
||||
ppointment_request__date__gt=timezone.now(),
|
||||
)
|
||||
appointments = Appointment.objects.filter(
|
||||
appointment_request__date__gt=timezone.now()
|
||||
)
|
||||
return apply_search_filters(appointments, query)
|
||||
# def get_queryset(self):
|
||||
# query = self.request.GET.get("q")
|
||||
# staff = getattr(self.request, "staff", None)
|
||||
# if staff:
|
||||
# appointments = Appointment.objects.filter(
|
||||
# appointment_request__staff_member=staff,
|
||||
# ppointment_request__date__gt=timezone.now(),
|
||||
# )
|
||||
# appointments = Appointment.objects.filter(
|
||||
# appointment_request__date__gt=timezone.now()
|
||||
# )
|
||||
# return apply_search_filters(appointments, query)
|
||||
|
||||
|
||||
def apply_search_filters(queryset, query):
|
||||
@ -9809,7 +9808,7 @@ def payment_callback(request, dealer_slug):
|
||||
UserPlan.objects.create(
|
||||
user=order.user,
|
||||
plan=order.plan,
|
||||
expire=datetime.now().date() + timedelta(days=order.get_plan_pricing().pricing.period)
|
||||
expire=datetime.now().date() + timedelta(days=order.get_plan_pricing().pricing.period + 30)
|
||||
)
|
||||
logger.info(f"Created new UserPlan for user {order.user} with plan {order.plan}.")
|
||||
else:
|
||||
|
||||
@ -238,7 +238,6 @@
|
||||
class="btn btn-phoenix-primary btn-sm mt-1 me-3 mb-3">{% trans "Edit" %}
|
||||
<span class="fas fa-solid fa-pencil ms-1"></span>
|
||||
</a>
|
||||
|
||||
{% comment %} <a href="{% url 'transfer' car.slug %}"
|
||||
class="btn btn-phoenix-danger btn-sm">
|
||||
{% trans "Sell to another dealer"|capfirst %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user