diff --git a/apply_initial_migrations.sh b/apply_initial_migrations.sh index e875517f..7a49b226 100755 --- a/apply_initial_migrations.sh +++ b/apply_initial_migrations.sh @@ -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 diff --git a/inventory/forms.py b/inventory/forms.py index 6019c38c..cd1fa83d 100644 --- a/inventory/forms.py +++ b/inventory/forms.py @@ -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( diff --git a/inventory/management/commands/set_custom_permissions.py b/inventory/management/commands/set_custom_permissions.py index 91d7a577..4fffa995 100644 --- a/inventory/management/commands/set_custom_permissions.py +++ b/inventory/management/commands/set_custom_permissions.py @@ -47,3 +47,4 @@ class Command(BaseCommand): codename="can_approve_estimatemodel", content_type=ContentType.objects.get_for_model(EstimateModel), ) + diff --git a/inventory/management/commands/tenhal_plan.py b/inventory/management/commands/tenhal_plan.py index b376d94d..baa95ab7 100644 --- a/inventory/management/commands/tenhal_plan.py +++ b/inventory/management/commands/tenhal_plan.py @@ -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 diff --git a/inventory/signals.py b/inventory/signals.py index 6371b9a2..99b70213 100644 --- a/inventory/signals.py +++ b/inventory/signals.py @@ -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 diff --git a/inventory/urls.py b/inventory/urls.py index b1f29988..edc968a1 100644 --- a/inventory/urls.py +++ b/inventory/urls.py @@ -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 ####################################################### diff --git a/inventory/views.py b/inventory/views.py index e2868a58..e764eab1 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -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: diff --git a/templates/inventory/car_detail.html b/templates/inventory/car_detail.html index fea46887..48a09b87 100644 --- a/templates/inventory/car_detail.html +++ b/templates/inventory/car_detail.html @@ -238,7 +238,6 @@ class="btn btn-phoenix-primary btn-sm mt-1 me-3 mb-3">{% trans "Edit" %} - {% comment %} {% trans "Sell to another dealer"|capfirst %}