everything before new pull
This commit is contained in:
commit
043d885ece
@ -34,9 +34,7 @@ application = ProtocolTypeRouter(
|
||||
URLRouter(
|
||||
[
|
||||
path("sse/notifications/", NotificationSSEApp()),
|
||||
re_path(
|
||||
r"", app
|
||||
),
|
||||
re_path(r"", app),
|
||||
]
|
||||
)
|
||||
),
|
||||
|
||||
@ -35,5 +35,4 @@ urlpatterns += i18n_patterns(
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
urlpatterns += static(settings.STATIC_URL, document_root = settings.STATIC_ROOT)
|
||||
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
|
||||
@ -3,6 +3,7 @@ from django.contrib import admin
|
||||
from . import models
|
||||
from django_ledger import models as ledger_models
|
||||
from django.contrib import messages
|
||||
|
||||
# from django_pdf_actions.actions import export_to_pdf_landscape, export_to_pdf_portrait
|
||||
# from appointment import models as appointment_models
|
||||
from import_export.admin import ExportMixin
|
||||
@ -177,55 +178,52 @@ class CarOptionAdmin(admin.ModelAdmin):
|
||||
# actions = [export_to_pdf_landscape, export_to_pdf_portrait]
|
||||
|
||||
|
||||
|
||||
@admin.register(models.UserRegistration)
|
||||
class UserRegistrationAdmin(admin.ModelAdmin):
|
||||
# Fields to display in the list view
|
||||
list_display = [
|
||||
'name',
|
||||
'arabic_name',
|
||||
'email',
|
||||
'crn',
|
||||
'vrn',
|
||||
'phone_number',
|
||||
'is_created',
|
||||
'created_at',
|
||||
"name",
|
||||
"arabic_name",
|
||||
"email",
|
||||
"crn",
|
||||
"vrn",
|
||||
"phone_number",
|
||||
"is_created",
|
||||
"created_at",
|
||||
]
|
||||
|
||||
# Filters in the right sidebar
|
||||
list_filter = [
|
||||
'is_created',
|
||||
'created_at',
|
||||
"is_created",
|
||||
"created_at",
|
||||
]
|
||||
|
||||
# Searchable fields
|
||||
search_fields = [
|
||||
'name', 'arabic_name', 'email', 'crn', 'vrn', 'phone_number'
|
||||
]
|
||||
search_fields = ["name", "arabic_name", "email", "crn", "vrn", "phone_number"]
|
||||
|
||||
# Read-only fields in detail view
|
||||
readonly_fields = [
|
||||
'created_at', 'updated_at', 'is_created', 'password'
|
||||
]
|
||||
readonly_fields = ["created_at", "updated_at", "is_created", "password"]
|
||||
|
||||
# Organize form layout
|
||||
fieldsets = [
|
||||
('Account Information', {
|
||||
'fields': ('name', 'arabic_name', 'email', 'phone_number')
|
||||
}),
|
||||
('Business Details', {
|
||||
'fields': ('crn', 'vrn', 'address')
|
||||
}),
|
||||
('Status', {
|
||||
'fields': ('is_created', 'password', 'created_at', 'updated_at'),
|
||||
'classes': ('collapse',)
|
||||
}),
|
||||
(
|
||||
"Account Information",
|
||||
{"fields": ("name", "arabic_name", "email", "phone_number")},
|
||||
),
|
||||
("Business Details", {"fields": ("crn", "vrn", "address")}),
|
||||
(
|
||||
"Status",
|
||||
{
|
||||
"fields": ("is_created", "password", "created_at", "updated_at"),
|
||||
"classes": ("collapse",),
|
||||
},
|
||||
),
|
||||
]
|
||||
|
||||
# Custom action to create accounts
|
||||
actions = ['create_dealer_accounts']
|
||||
actions = ["create_dealer_accounts"]
|
||||
|
||||
@admin.action(description='Create dealer account(s) for selected registrations')
|
||||
@admin.action(description="Create dealer account(s) for selected registrations")
|
||||
def create_dealer_accounts(self, request, queryset):
|
||||
created_count = 0
|
||||
already_created_count = 0
|
||||
@ -242,7 +240,7 @@ class UserRegistrationAdmin(admin.ModelAdmin):
|
||||
self.message_user(
|
||||
request,
|
||||
f"Error creating account for {registration.name}: {str(e)}",
|
||||
level=messages.ERROR
|
||||
level=messages.ERROR,
|
||||
)
|
||||
failed_count += 1
|
||||
|
||||
@ -251,17 +249,17 @@ class UserRegistrationAdmin(admin.ModelAdmin):
|
||||
self.message_user(
|
||||
request,
|
||||
f"Successfully created {created_count} account(s).",
|
||||
level=messages.SUCCESS
|
||||
level=messages.SUCCESS,
|
||||
)
|
||||
if already_created_count > 0:
|
||||
self.message_user(
|
||||
request,
|
||||
f"{already_created_count} registration(s) were already created.",
|
||||
level=messages.INFO
|
||||
level=messages.INFO,
|
||||
)
|
||||
if failed_count > 0:
|
||||
self.message_user(
|
||||
request,
|
||||
f"Failed to create {failed_count} account(s). Check logs.",
|
||||
level=messages.ERROR
|
||||
level=messages.ERROR,
|
||||
)
|
||||
@ -2,6 +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 django.core.validators import MinLengthValidator
|
||||
from django import forms
|
||||
@ -57,7 +58,7 @@ from .models import (
|
||||
Tasks,
|
||||
Recall,
|
||||
Ticket,
|
||||
UserRegistration
|
||||
UserRegistration,
|
||||
)
|
||||
from django_ledger import models as ledger_models
|
||||
from django.forms import (
|
||||
@ -364,7 +365,14 @@ class CarForm(
|
||||
"receiving_date",
|
||||
"vendor",
|
||||
]
|
||||
required_fields = ["vin","id_car_make", "id_car_model", "id_car_serie", "id_car_trim", "vendor"]
|
||||
required_fields = [
|
||||
"vin",
|
||||
"id_car_make",
|
||||
"id_car_model",
|
||||
"id_car_serie",
|
||||
"id_car_trim",
|
||||
"vendor",
|
||||
]
|
||||
widgets = {
|
||||
"id_car_make": forms.Select(attrs={"class": "form-select form-select-sm"}),
|
||||
"receiving_date": forms.DateTimeInput(attrs={"type": "datetime-local"}),
|
||||
@ -2123,8 +2131,7 @@ class AdditionalFinancesForm(forms.Form):
|
||||
for field in self.fields.values():
|
||||
if isinstance(field, forms.ModelMultipleChoiceField):
|
||||
field.widget.choices = [
|
||||
(obj.pk, f"{obj.name} - {obj.price:.2f}")
|
||||
for obj in field.queryset
|
||||
(obj.pk, f"{obj.name} - {obj.price:.2f}") for obj in field.queryset
|
||||
]
|
||||
|
||||
|
||||
@ -2141,6 +2148,7 @@ class VatRateForm(forms.ModelForm):
|
||||
model = VatRate
|
||||
fields = ["rate"]
|
||||
|
||||
|
||||
class CustomSetPasswordForm(SetPasswordForm):
|
||||
new_password1 = forms.CharField(
|
||||
label="New Password",
|
||||
@ -2258,13 +2266,21 @@ class TicketResolutionForm(forms.ModelForm):
|
||||
self.fields["status"].choices = [("resolved", "Resolved"), ("closed", "Closed")]
|
||||
|
||||
|
||||
|
||||
class CarDealershipRegistrationForm(forms.ModelForm):
|
||||
# Add additional fields for the registration form
|
||||
|
||||
class Meta:
|
||||
model = UserRegistration
|
||||
fields = ("name","arabic_name", "email","phone_number", "crn", "vrn", "address")
|
||||
fields = (
|
||||
"name",
|
||||
"arabic_name",
|
||||
"email",
|
||||
"phone_number",
|
||||
"crn",
|
||||
"vrn",
|
||||
"address",
|
||||
)
|
||||
|
||||
|
||||
class CarDetailsEstimateCreate(forms.Form):
|
||||
customer = forms.ModelChoiceField(
|
||||
|
||||
@ -18,8 +18,8 @@ def check_create_coa_accounts(task):
|
||||
logger.warning("Account creation task failed, checking status...")
|
||||
|
||||
try:
|
||||
dealer_id = task.kwargs.get('dealer_id',None)
|
||||
coa_slug = task.kwargs.get('coa_slug', None)
|
||||
dealer_id = task.kwargs.get("dealer_id", None)
|
||||
coa_slug = task.kwargs.get("coa_slug", None)
|
||||
logger.info(f"Checking accounts for dealer {dealer_id}")
|
||||
logger.info(f"COA slug: {coa_slug}")
|
||||
if not dealer_id:
|
||||
@ -37,7 +37,9 @@ def check_create_coa_accounts(task):
|
||||
try:
|
||||
coa = entity.get_coa_model_qs().get(slug=coa_slug)
|
||||
except Exception as e:
|
||||
logger.error(f"COA with slug {coa_slug} not found for entity {entity.pk}: {e}")
|
||||
logger.error(
|
||||
f"COA with slug {coa_slug} not found for entity {entity.pk}: {e}"
|
||||
)
|
||||
else:
|
||||
coa = entity.get_default_coa()
|
||||
if not coa:
|
||||
@ -49,7 +51,11 @@ def check_create_coa_accounts(task):
|
||||
|
||||
missing_accounts = []
|
||||
for account_data in get_accounts_data():
|
||||
if not entity.get_all_accounts().filter(coa_model=coa,code=account_data["code"]).exists():
|
||||
if (
|
||||
not entity.get_all_accounts()
|
||||
.filter(coa_model=coa, code=account_data["code"])
|
||||
.exists()
|
||||
):
|
||||
missing_accounts.append(account_data)
|
||||
logger.info(f"Missing account: {account_data['code']}")
|
||||
|
||||
@ -62,6 +68,8 @@ def check_create_coa_accounts(task):
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error in check_create_coa_accounts hook: {e}")
|
||||
|
||||
|
||||
# def check_create_coa_accounts(task):
|
||||
# logger.info("Checking if all accounts are created")
|
||||
# instance = task.kwargs["dealer"]
|
||||
|
||||
@ -8,19 +8,23 @@ from django.core.management.base import BaseCommand
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Deactivates expired user plans"
|
||||
|
||||
def handle(self, *args, **options):
|
||||
users_without_plan = User.objects.filter(
|
||||
is_active=True, userplan=None, dealer__isnull=False, date_joined__lte=timezone.now()-timedelta(days=7)
|
||||
is_active=True,
|
||||
userplan=None,
|
||||
dealer__isnull=False,
|
||||
date_joined__lte=timezone.now() - timedelta(days=7),
|
||||
)
|
||||
|
||||
count = users_without_plan.count()
|
||||
for user in users_without_plan:
|
||||
user.is_active = False
|
||||
user.save()
|
||||
subject = 'Your account has been deactivated'
|
||||
subject = "Your account has been deactivated"
|
||||
message = """
|
||||
Hello {},\n
|
||||
Your account has been deactivated, please contact us at {} if you have any questions.
|
||||
@ -30,7 +34,7 @@ class Command(BaseCommand):
|
||||
""".format(user.dealer.name, settings.DEFAULT_FROM_EMAIL)
|
||||
from_email = settings.DEFAULT_FROM_EMAIL
|
||||
recipient_list = user.email
|
||||
send_email(from_email, recipient_list,subject, message)
|
||||
send_email(from_email, recipient_list, subject, message)
|
||||
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(
|
||||
|
||||
@ -63,7 +63,7 @@ class Command(BaseCommand):
|
||||
|
||||
for plan in expired_plans:
|
||||
# try:
|
||||
if dealer := getattr(plan.user,"dealer", None):
|
||||
if dealer := getattr(plan.user, "dealer", None):
|
||||
dealer.user.is_active = False
|
||||
dealer.user.save()
|
||||
for staff in dealer.get_staff():
|
||||
|
||||
@ -7,16 +7,16 @@ from django_ledger.models import EstimateModel, BillModel, AccountModel, LedgerM
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **kwargs):
|
||||
Permission.objects.get_or_create(
|
||||
name="Can view crm",
|
||||
codename="can_view_crm",
|
||||
content_type=ContentType.objects.get_for_model(Lead),
|
||||
)
|
||||
Permission.objects.get_or_create(
|
||||
name="Can reassign lead",
|
||||
codename="can_reassign_lead",
|
||||
content_type=ContentType.objects.get_for_model(Lead),
|
||||
)
|
||||
# Permission.objects.get_or_create(
|
||||
# name="Can view crm",
|
||||
# codename="can_view_crm",
|
||||
# content_type=ContentType.objects.get_for_model(Lead),
|
||||
# )
|
||||
# Permission.objects.get_or_create(
|
||||
# name="Can reassign lead",
|
||||
# codename="can_reassign_lead",
|
||||
# content_type=ContentType.objects.get_for_model(Lead),
|
||||
# )
|
||||
Permission.objects.get_or_create(
|
||||
name="Can view sales",
|
||||
codename="can_view_sales",
|
||||
@ -47,4 +47,3 @@ class Command(BaseCommand):
|
||||
codename="can_approve_estimatemodel",
|
||||
content_type=ContentType.objects.get_for_model(EstimateModel),
|
||||
)
|
||||
|
||||
|
||||
@ -23,19 +23,19 @@ class Command(BaseCommand):
|
||||
# Note: Deleting plans and quotas should cascade to related objects like PlanQuota and PlanPricing.
|
||||
self.stdout.write(self.style.SUCCESS("Data reset complete."))
|
||||
else:
|
||||
self.stdout.write(self.style.NOTICE("Creating or updating default plans and quotas..."))
|
||||
self.stdout.write(
|
||||
self.style.NOTICE("Creating or updating default plans and quotas...")
|
||||
)
|
||||
|
||||
# Create or get quotas
|
||||
users_quota, created_u = Quota.objects.get_or_create(
|
||||
codename="Users",
|
||||
defaults={"name": "Users", "unit": "number"}
|
||||
codename="Users", defaults={"name": "Users", "unit": "number"}
|
||||
)
|
||||
if created_u:
|
||||
self.stdout.write(self.style.SUCCESS('Created quota: "Users"'))
|
||||
|
||||
cars_quota, created_c = Quota.objects.get_or_create(
|
||||
codename="Cars",
|
||||
defaults={"name": "Cars", "unit": "number"}
|
||||
codename="Cars", defaults={"name": "Cars", "unit": "number"}
|
||||
)
|
||||
if created_c:
|
||||
self.stdout.write(self.style.SUCCESS('Created quota: "Cars"'))
|
||||
@ -43,90 +43,81 @@ class Command(BaseCommand):
|
||||
# Create or get plans
|
||||
basic_plan, created_bp = Plan.objects.get_or_create(
|
||||
name="Basic",
|
||||
defaults={"description": "basic plan", "available": True, "visible": True}
|
||||
defaults={"description": "basic plan", "available": True, "visible": True},
|
||||
)
|
||||
if created_bp:
|
||||
self.stdout.write(self.style.SUCCESS('Created plan: "Basic"'))
|
||||
|
||||
pro_plan, created_pp = Plan.objects.get_or_create(
|
||||
name="Pro",
|
||||
defaults={"description": "Pro plan", "available": True, "visible": True}
|
||||
defaults={"description": "Pro plan", "available": True, "visible": True},
|
||||
)
|
||||
if created_pp:
|
||||
self.stdout.write(self.style.SUCCESS('Created plan: "Pro"'))
|
||||
|
||||
enterprise_plan, created_ep = Plan.objects.get_or_create(
|
||||
name="Enterprise",
|
||||
defaults={"description": "Enterprise plan", "available": True, "visible": True}
|
||||
defaults={
|
||||
"description": "Enterprise plan",
|
||||
"available": True,
|
||||
"visible": True,
|
||||
},
|
||||
)
|
||||
if created_ep:
|
||||
self.stdout.write(self.style.SUCCESS('Created plan: "Enterprise"'))
|
||||
|
||||
# Assign quotas to plans using get_or_create to prevent duplicates
|
||||
PlanQuota.objects.get_or_create(
|
||||
plan=basic_plan,
|
||||
quota=users_quota,
|
||||
defaults={"value": 10000000}
|
||||
plan=basic_plan, quota=users_quota, defaults={"value": 10000000}
|
||||
)
|
||||
PlanQuota.objects.get_or_create(
|
||||
plan=basic_plan,
|
||||
quota=cars_quota,
|
||||
defaults={"value": 10000000}
|
||||
plan=basic_plan, quota=cars_quota, defaults={"value": 10000000}
|
||||
)
|
||||
|
||||
# Pro plan quotas
|
||||
PlanQuota.objects.get_or_create(
|
||||
plan=pro_plan,
|
||||
quota=users_quota,
|
||||
defaults={"value": 10000000}
|
||||
plan=pro_plan, quota=users_quota, defaults={"value": 10000000}
|
||||
)
|
||||
PlanQuota.objects.get_or_create(
|
||||
plan=pro_plan,
|
||||
quota=cars_quota,
|
||||
defaults={"value": 10000000}
|
||||
plan=pro_plan, quota=cars_quota, defaults={"value": 10000000}
|
||||
)
|
||||
|
||||
# Enterprise plan quotas
|
||||
PlanQuota.objects.get_or_create(
|
||||
plan=enterprise_plan,
|
||||
quota=users_quota,
|
||||
defaults={"value": 10000000}
|
||||
plan=enterprise_plan, quota=users_quota, defaults={"value": 10000000}
|
||||
)
|
||||
PlanQuota.objects.get_or_create(
|
||||
plan=enterprise_plan,
|
||||
quota=cars_quota,
|
||||
defaults={"value": 10000000}
|
||||
plan=enterprise_plan, quota=cars_quota, defaults={"value": 10000000}
|
||||
)
|
||||
|
||||
# Create or get pricing
|
||||
basic_pricing, created_bp_p = Pricing.objects.get_or_create(
|
||||
name="3 Months",
|
||||
defaults={"period": 90}
|
||||
name="3 Months", defaults={"period": 90}
|
||||
)
|
||||
pro_pricing, created_pp_p = Pricing.objects.get_or_create(
|
||||
name="6 Months",
|
||||
defaults={"period": 180}
|
||||
name="6 Months", defaults={"period": 180}
|
||||
)
|
||||
enterprise_pricing, created_ep_p = Pricing.objects.get_or_create(
|
||||
name="1 Year",
|
||||
defaults={"period": 365}
|
||||
name="1 Year", defaults={"period": 365}
|
||||
)
|
||||
|
||||
# Assign pricing to plans
|
||||
PlanPricing.objects.get_or_create(
|
||||
plan=basic_plan,
|
||||
pricing=basic_pricing,
|
||||
defaults={"price": Decimal("2997.00")}
|
||||
defaults={"price": Decimal("2997.00")},
|
||||
)
|
||||
PlanPricing.objects.get_or_create(
|
||||
plan=pro_plan,
|
||||
pricing=pro_pricing,
|
||||
defaults={"price": Decimal("5395.00")}
|
||||
plan=pro_plan, pricing=pro_pricing, defaults={"price": Decimal("5395.00")}
|
||||
)
|
||||
PlanPricing.objects.get_or_create(
|
||||
plan=enterprise_plan,
|
||||
pricing=enterprise_pricing,
|
||||
defaults={"price": Decimal("9590.00")}
|
||||
defaults={"price": Decimal("9590.00")},
|
||||
)
|
||||
|
||||
self.stdout.write(self.style.SUCCESS("Subscription plans structure successfully created or updated."))
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(
|
||||
"Subscription plans structure successfully created or updated."
|
||||
)
|
||||
)
|
||||
|
||||
@ -3,12 +3,13 @@ from django.core.management.base import BaseCommand
|
||||
from django.contrib.sites.models import Site
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Update the default site domain'
|
||||
help = "Update the default site domain"
|
||||
|
||||
def handle(self, *args, **options):
|
||||
site = Site.objects.get_current()
|
||||
site.domain = settings.SITE_DOMAIN
|
||||
site.name = settings.SITE_NAME
|
||||
site.save()
|
||||
self.stdout.write(self.style.SUCCESS(f'Site updated to: {site.domain}'))
|
||||
self.stdout.write(self.style.SUCCESS(f"Site updated to: {site.domain}"))
|
||||
|
||||
@ -10,7 +10,7 @@ from django.urls import reverse
|
||||
# from django.utils.text import slugify
|
||||
from slugify import slugify
|
||||
from django.utils import timezone
|
||||
from django.core.validators import MinValueValidator,MaxValueValidator
|
||||
from django.core.validators import MinValueValidator, MaxValueValidator
|
||||
import hashlib
|
||||
from django.db import models
|
||||
from datetime import timedelta
|
||||
@ -57,15 +57,17 @@ from encrypted_model_fields.fields import (
|
||||
EncryptedEmailField,
|
||||
EncryptedTextField,
|
||||
)
|
||||
|
||||
# from plans.models import AbstractPlan
|
||||
# from simple_history.models import HistoricalRecords
|
||||
from plans.models import Invoice
|
||||
|
||||
from django_extensions.db.fields import RandomCharField,AutoSlugField
|
||||
from django_extensions.db.fields import RandomCharField, AutoSlugField
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
|
||||
class Base(models.Model):
|
||||
id = models.UUIDField(
|
||||
unique=True,
|
||||
@ -206,11 +208,8 @@ class VatRate(models.Model):
|
||||
max_digits=5,
|
||||
decimal_places=2,
|
||||
default=Decimal("0.15"),
|
||||
validators=[
|
||||
MinValueValidator(0.0),
|
||||
MaxValueValidator(1.0)
|
||||
],
|
||||
help_text=_("VAT rate as decimal between 0 and 1 (e.g., 0.2 for 20%)")
|
||||
validators=[MinValueValidator(0.0), MaxValueValidator(1.0)],
|
||||
help_text=_("VAT rate as decimal between 0 and 1 (e.g., 0.2 for 20%)"),
|
||||
)
|
||||
is_active = models.BooleanField(default=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
@ -776,7 +775,7 @@ class Car(Base):
|
||||
make = self.id_car_make.name if self.id_car_make else "Unknown Make"
|
||||
model = self.id_car_model.name if self.id_car_model else "Unknown Model"
|
||||
trim = self.id_car_trim.name if self.id_car_trim else "Unknown Trim"
|
||||
vin=self.vin if self.vin else None
|
||||
vin = self.vin if self.vin else None
|
||||
return f"{self.year} - {make} - {model} - {trim}-{vin}"
|
||||
|
||||
@property
|
||||
@ -843,7 +842,7 @@ class Car(Base):
|
||||
def mark_as_sold(self):
|
||||
self.cancel_reservation()
|
||||
self.status = CarStatusChoices.SOLD
|
||||
self.sold_date=timezone.now()
|
||||
self.sold_date = timezone.now()
|
||||
self.save()
|
||||
|
||||
def cancel_reservation(self):
|
||||
@ -904,16 +903,23 @@ class Car(Base):
|
||||
|
||||
def get_active_estimates(self):
|
||||
try:
|
||||
qs = self.item_model.itemtransactionmodel_set.exclude(ce_model__status="canceled")
|
||||
qs = self.item_model.itemtransactionmodel_set.exclude(
|
||||
ce_model__status="canceled"
|
||||
)
|
||||
|
||||
data = []
|
||||
for item in qs:
|
||||
x = ExtraInfo.objects.filter(object_id=item.ce_model.pk,content_type=ContentType.objects.get_for_model(EstimateModel)).first()
|
||||
x = ExtraInfo.objects.filter(
|
||||
object_id=item.ce_model.pk,
|
||||
content_type=ContentType.objects.get_for_model(EstimateModel),
|
||||
).first()
|
||||
if x:
|
||||
data.append(x)
|
||||
return data
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting active estimates for car {self.vin} error: {e}")
|
||||
logger.error(
|
||||
f"Error getting active estimates for car {self.vin} error: {e}"
|
||||
)
|
||||
return []
|
||||
|
||||
@property
|
||||
@ -1389,7 +1395,11 @@ class Dealer(models.Model, LocalizedNameMixin):
|
||||
options={"quality": 80},
|
||||
)
|
||||
entity = models.ForeignKey(
|
||||
EntityModel, on_delete=models.SET_NULL, null=True, blank=True,related_name="dealers"
|
||||
EntityModel,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name="dealers",
|
||||
)
|
||||
joined_at = models.DateTimeField(auto_now_add=True, verbose_name=_("Joined At"))
|
||||
updated_at = models.DateTimeField(auto_now=True, verbose_name=_("Updated At"))
|
||||
@ -1421,6 +1431,7 @@ class Dealer(models.Model, LocalizedNameMixin):
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return None
|
||||
|
||||
@property
|
||||
def is_plan_expired(self):
|
||||
try:
|
||||
@ -1455,6 +1466,7 @@ class Dealer(models.Model, LocalizedNameMixin):
|
||||
|
||||
def get_vendors(self):
|
||||
return VendorModel.objects.filter(entity_model=self.entity)
|
||||
|
||||
def get_staff(self):
|
||||
return Staff.objects.filter(dealer=self)
|
||||
|
||||
@ -1505,7 +1517,9 @@ class Staff(models.Model):
|
||||
first_name = models.CharField(max_length=255, verbose_name=_("First Name"))
|
||||
last_name = models.CharField(max_length=255, verbose_name=_("Last Name"))
|
||||
|
||||
arabic_name = models.CharField(max_length=255, verbose_name=_("Arabic Name"),null=True,blank=True)
|
||||
arabic_name = models.CharField(
|
||||
max_length=255, verbose_name=_("Arabic Name"), null=True, blank=True
|
||||
)
|
||||
phone_number = EncryptedCharField(
|
||||
max_length=255,
|
||||
verbose_name=_("Phone Number"),
|
||||
@ -1794,7 +1808,7 @@ class Customer(models.Model):
|
||||
commit=False,
|
||||
customer_model_kwargs={
|
||||
"customer_name": self.full_name,
|
||||
"address_1": "",#self.address,
|
||||
"address_1": "", # self.address,
|
||||
# "phone": self.phone_number,
|
||||
# "email": self.email,
|
||||
},
|
||||
@ -2120,6 +2134,10 @@ class Lead(models.Model):
|
||||
slug = RandomCharField(length=8, unique=True)
|
||||
|
||||
class Meta:
|
||||
permissions = [
|
||||
("can_view_crm", _("Can view CRM")),
|
||||
("can_reassign_lead", _("Can reassign lead")),
|
||||
]
|
||||
verbose_name = _("Lead")
|
||||
verbose_name_plural = _("Leads")
|
||||
indexes = [
|
||||
@ -2305,10 +2323,14 @@ class Schedule(models.Model):
|
||||
help_text=_("What is the status of this schedule?"),
|
||||
)
|
||||
created_at = models.DateTimeField(
|
||||
auto_now_add=True, verbose_name=_("Created Date"), help_text=_("When was this schedule created?")
|
||||
auto_now_add=True,
|
||||
verbose_name=_("Created Date"),
|
||||
help_text=_("When was this schedule created?"),
|
||||
)
|
||||
updated_at = models.DateTimeField(
|
||||
auto_now=True, verbose_name=_("Updated Date"), help_text=_("When was this schedule last updated?")
|
||||
auto_now=True,
|
||||
verbose_name=_("Updated Date"),
|
||||
help_text=_("When was this schedule last updated?"),
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
@ -2495,13 +2517,12 @@ class Opportunity(models.Model):
|
||||
def __str__(self):
|
||||
try:
|
||||
if self.customer:
|
||||
return (
|
||||
f"Opportunity for {self.customer.first_name} {self.customer.last_name}"
|
||||
)
|
||||
return f"Opportunity for {self.customer.first_name} {self.customer.last_name}"
|
||||
return f"Opportunity for {self.organization.name}"
|
||||
except Exception:
|
||||
return f"Opportunity for car :{self.car}"
|
||||
|
||||
|
||||
class Notes(models.Model):
|
||||
dealer = models.ForeignKey(Dealer, on_delete=models.CASCADE, related_name="notes")
|
||||
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
||||
@ -2765,7 +2786,6 @@ class Vendor(models.Model, LocalizedNameMixin):
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@ -3155,7 +3175,7 @@ class CustomGroup(models.Model):
|
||||
"notes",
|
||||
"tasks",
|
||||
"activity",
|
||||
"additionalservices"
|
||||
"additionalservices",
|
||||
],
|
||||
)
|
||||
self.set_permissions(
|
||||
@ -3272,7 +3292,7 @@ class CustomGroup(models.Model):
|
||||
"payment",
|
||||
"vendor",
|
||||
"additionalservices",
|
||||
'customer'
|
||||
"customer",
|
||||
],
|
||||
other_perms=[
|
||||
"view_car",
|
||||
@ -3340,7 +3360,9 @@ class DealerSettings(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text=_("Cash account to track cash transactions when an invoice is created."),
|
||||
help_text=_(
|
||||
"Cash account to track cash transactions when an invoice is created."
|
||||
),
|
||||
verbose_name=_("Invoice Cash Account"),
|
||||
)
|
||||
invoice_prepaid_account = models.ForeignKey(
|
||||
@ -3349,7 +3371,9 @@ class DealerSettings(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text=_("Prepaid Revenue account to track prepaid revenue when an invoice is created."),
|
||||
help_text=_(
|
||||
"Prepaid Revenue account to track prepaid revenue when an invoice is created."
|
||||
),
|
||||
verbose_name=_("Invoice Prepaid Account"),
|
||||
)
|
||||
invoice_unearned_account = models.ForeignKey(
|
||||
@ -3358,7 +3382,9 @@ class DealerSettings(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text=_("Unearned Revenue account to track unearned revenue when an invoice is created."),
|
||||
help_text=_(
|
||||
"Unearned Revenue account to track unearned revenue when an invoice is created."
|
||||
),
|
||||
verbose_name=_("Invoice Unearned Account"),
|
||||
)
|
||||
invoice_tax_payable_account = models.ForeignKey(
|
||||
@ -3367,7 +3393,9 @@ class DealerSettings(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text=_("Tax Payable account to track tax liabilities when an invoice is created."),
|
||||
help_text=_(
|
||||
"Tax Payable account to track tax liabilities when an invoice is created."
|
||||
),
|
||||
verbose_name=_("Invoice Tax Payable Account"),
|
||||
)
|
||||
invoice_vehicle_sale_account = models.ForeignKey(
|
||||
@ -3376,7 +3404,9 @@ class DealerSettings(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text=_("Vehicle Sales account to track vehicle sales revenue when an invoice is created."),
|
||||
help_text=_(
|
||||
"Vehicle Sales account to track vehicle sales revenue when an invoice is created."
|
||||
),
|
||||
verbose_name=_("Invoice Vehicle Sale Account"),
|
||||
)
|
||||
invoice_additional_services_account = models.ForeignKey(
|
||||
@ -3385,7 +3415,9 @@ class DealerSettings(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text=_("Additional Services account to track additional services revenue when an invoice is created."),
|
||||
help_text=_(
|
||||
"Additional Services account to track additional services revenue when an invoice is created."
|
||||
),
|
||||
verbose_name=_("Invoice Additional Services Account"),
|
||||
)
|
||||
invoice_cost_of_good_sold_account = models.ForeignKey(
|
||||
@ -3394,7 +3426,9 @@ class DealerSettings(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text=_("Cost of Goods Sold account to track the cost of goods sold when an invoice is created."),
|
||||
help_text=_(
|
||||
"Cost of Goods Sold account to track the cost of goods sold when an invoice is created."
|
||||
),
|
||||
verbose_name=_("Invoice Cost of Goods Sold Account"),
|
||||
)
|
||||
|
||||
@ -3404,7 +3438,9 @@ class DealerSettings(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text=_("Inventory account to track the cost of goods sold when an invoice is created."),
|
||||
help_text=_(
|
||||
"Inventory account to track the cost of goods sold when an invoice is created."
|
||||
),
|
||||
verbose_name=_("Invoice Inventory Account"),
|
||||
)
|
||||
|
||||
@ -3423,7 +3459,9 @@ class DealerSettings(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text=_("Prepaid account to track prepaid expenses when a bill is created."),
|
||||
help_text=_(
|
||||
"Prepaid account to track prepaid expenses when a bill is created."
|
||||
),
|
||||
verbose_name=_("Bill Prepaid Account"),
|
||||
)
|
||||
bill_unearned_account = models.ForeignKey(
|
||||
@ -3432,10 +3470,14 @@ class DealerSettings(models.Model):
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text=_("Unearned account to track unearned expenses when a bill is created."),
|
||||
help_text=_(
|
||||
"Unearned account to track unearned expenses when a bill is created."
|
||||
),
|
||||
verbose_name=_("Bill Unearned Account"),
|
||||
)
|
||||
additional_info = models.JSONField(default=dict, null=True, blank=True, help_text=_("Additional information"))
|
||||
additional_info = models.JSONField(
|
||||
default=dict, null=True, blank=True, help_text=_("Additional information")
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return f"Settings for {self.dealer}"
|
||||
@ -3790,7 +3832,10 @@ class Ticket(models.Model):
|
||||
]
|
||||
|
||||
dealer = models.ForeignKey(
|
||||
Dealer, on_delete=models.CASCADE, related_name="tickets", verbose_name=_("Dealer")
|
||||
Dealer,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="tickets",
|
||||
verbose_name=_("Dealer"),
|
||||
)
|
||||
subject = models.CharField(
|
||||
max_length=200, verbose_name=_("Subject"), help_text=_("Short description")
|
||||
@ -3882,7 +3927,6 @@ class CarImage(models.Model):
|
||||
)
|
||||
|
||||
|
||||
|
||||
class UserRegistration(models.Model):
|
||||
name = models.CharField(_("Name"), max_length=255)
|
||||
arabic_name = models.CharField(_("Arabic Name"), max_length=255)
|
||||
@ -3892,15 +3936,24 @@ class UserRegistration(models.Model):
|
||||
verbose_name=_("Phone Number"),
|
||||
validators=[SaudiPhoneNumberValidator()],
|
||||
)
|
||||
crn = models.CharField(_("Commercial Registration Number"), max_length=10, unique=True)
|
||||
crn = models.CharField(
|
||||
_("Commercial Registration Number"), max_length=10, unique=True
|
||||
)
|
||||
vrn = models.CharField(_("Vehicle Registration Number"), max_length=15, unique=True)
|
||||
address = models.TextField(_("Address"))
|
||||
password = models.CharField(_("Password"), max_length=255,null=True,blank=True)
|
||||
password = models.CharField(_("Password"), max_length=255, null=True, blank=True)
|
||||
is_created = models.BooleanField(default=False)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
REQUIRED_FIELDS = ["username", "arabic_name", "crn", "vrn", "address", "phone_number"]
|
||||
REQUIRED_FIELDS = [
|
||||
"username",
|
||||
"arabic_name",
|
||||
"crn",
|
||||
"vrn",
|
||||
"address",
|
||||
"phone_number",
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return self.email
|
||||
@ -3924,7 +3977,7 @@ class UserRegistration(models.Model):
|
||||
phone=self.phone_number,
|
||||
crn=self.crn,
|
||||
vrn=self.vrn,
|
||||
address=self.address
|
||||
address=self.address,
|
||||
)
|
||||
|
||||
if dealer:
|
||||
|
||||
@ -411,6 +411,22 @@ class BasePurchaseOrderActionActionView(
|
||||
f"while performing action '{self.action_name}' on Purchase Order ID: {po_model.pk}. "
|
||||
f"Error: {e}"
|
||||
)
|
||||
except Exception as e:
|
||||
print(
|
||||
f"User {user_username} encountered an exception "
|
||||
f"while performing action '{self.action_name}' on Purchase Order ID: {po_model.pk}. "
|
||||
f"Error: {e}"
|
||||
)
|
||||
logger.warning(
|
||||
f"User {user_username} encountered an exception "
|
||||
f"while performing action '{self.action_name}' on Purchase Order ID: {po_model.pk}. "
|
||||
f"Error: {e}"
|
||||
)
|
||||
messages.add_message(
|
||||
request,
|
||||
message=f"Failed to update PO {po_model.po_number}. {e}",
|
||||
level=messages.ERROR,
|
||||
)
|
||||
return response
|
||||
|
||||
|
||||
@ -1129,6 +1145,7 @@ class ChartOfAccountModelCreateView(ChartOfAccountModelModelBaseViewMixIn, Creat
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
class ChartOfAccountModelUpdateView(ChartOfAccountModelModelBaseViewMixIn, UpdateView):
|
||||
context_object_name = "coa_model"
|
||||
slug_url_kwarg = "coa_slug"
|
||||
|
||||
@ -5,6 +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 django.utils.translation import gettext_lazy as _
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
@ -21,7 +22,7 @@ from django_ledger.models import (
|
||||
EstimateModel,
|
||||
BillModel,
|
||||
ChartOfAccountModel,
|
||||
CustomerModel
|
||||
CustomerModel,
|
||||
)
|
||||
from . import models
|
||||
from django.utils.timezone import now
|
||||
@ -136,7 +137,6 @@ def create_car_location(sender, instance, created, **kwargs):
|
||||
print(f"Failed to create CarLocation for car {instance.vin}: {e}")
|
||||
|
||||
|
||||
|
||||
@receiver(post_save, sender=models.Dealer)
|
||||
def create_ledger_entity(sender, instance, created, **kwargs):
|
||||
if not created:
|
||||
@ -155,20 +155,22 @@ def create_ledger_entity(sender, instance, created, **kwargs):
|
||||
raise Exception("Entity creation failed")
|
||||
|
||||
instance.entity = entity
|
||||
instance.save(update_fields=['entity'])
|
||||
instance.save(update_fields=["entity"])
|
||||
|
||||
# Create default COA
|
||||
entity.create_chart_of_accounts(
|
||||
assign_as_default=True,
|
||||
commit=True,
|
||||
coa_name=f"{entity.name}-COA"
|
||||
assign_as_default=True, commit=True, coa_name=f"{entity.name}-COA"
|
||||
)
|
||||
|
||||
logger.info(f"✅ Setup complete for dealer {instance.id}: entity & COA ready.")
|
||||
logger.info(
|
||||
f"✅ Setup complete for dealer {instance.id}: entity & COA ready."
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"💥 Failed setup for dealer {instance.id}: {e}")
|
||||
# Optional: schedule retry or alert
|
||||
|
||||
|
||||
# Create Entity
|
||||
# @receiver(post_save, sender=models.Dealer)
|
||||
# def create_ledger_entity(sender, instance, created, **kwargs):
|
||||
@ -218,10 +220,10 @@ def create_ledger_entity(sender, instance, created, **kwargs):
|
||||
# dealer=instance,
|
||||
# hook="inventory.hooks.check_create_coa_accounts",
|
||||
# )
|
||||
# async_task('inventory.tasks.check_create_coa_accounts', instance, schedule_type='O', schedule_time=timedelta(seconds=20))
|
||||
# async_task('inventory.tasks.check_create_coa_accounts', instance, schedule_type='O', schedule_time=timedelta(seconds=20))
|
||||
|
||||
# create_settings(instance.pk)
|
||||
# create_accounts_for_make(instance.pk)
|
||||
# create_settings(instance.pk)
|
||||
# create_accounts_for_make(instance.pk)
|
||||
|
||||
|
||||
@receiver(post_save, sender=models.Dealer)
|
||||
@ -998,17 +1000,19 @@ def save_po(sender, instance, created, **kwargs):
|
||||
instance.itemtransactionmodel_set.first().po_model.save()
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
|
||||
@receiver(post_save, sender=PurchaseOrderModel)
|
||||
def create_po_item_upload(sender, instance, created, **kwargs):
|
||||
if instance.po_status == "fulfilled" or instance.po_status == 'approved':
|
||||
if instance.po_status == "fulfilled" or instance.po_status == "approved":
|
||||
for item in instance.get_itemtxs_data()[0]:
|
||||
dealer = models.Dealer.objects.get(entity=instance.entity)
|
||||
if item.bill_model and item.bill_model.is_paid():
|
||||
models.PoItemsUploaded.objects.update_or_create(
|
||||
dealer=dealer, po=instance, item=item,
|
||||
defaults={
|
||||
"status":instance.po_status
|
||||
}
|
||||
dealer=dealer,
|
||||
po=instance,
|
||||
item=item,
|
||||
defaults={"status": instance.po_status},
|
||||
)
|
||||
|
||||
# po_item = models.PoItemsUploaded.objects.get_or_create(
|
||||
@ -1364,7 +1368,9 @@ def handle_car_image(sender, instance, created, **kwargs):
|
||||
# )
|
||||
|
||||
# Check for existing image with same hash
|
||||
existing = os.path.exists(os.path.join(settings.MEDIA_ROOT, "car_images",car.get_hash + ".png"))
|
||||
existing = os.path.exists(
|
||||
os.path.join(settings.MEDIA_ROOT, "car_images", car.get_hash + ".png")
|
||||
)
|
||||
# existing = (
|
||||
# models.CarImage.objects.filter(
|
||||
# image_hash=car.get_hash, image__isnull=False
|
||||
@ -1406,7 +1412,7 @@ def handle_user_registration(sender, instance, created, **kwargs):
|
||||
"""
|
||||
Thank you for registering with us. We will contact you shortly to complete your application.
|
||||
شكرا لمراسلتنا. سوف نتصل بك قريبا لاستكمال طلبك.
|
||||
"""
|
||||
""",
|
||||
)
|
||||
|
||||
if instance.is_created:
|
||||
@ -1430,7 +1436,8 @@ def handle_user_registration(sender, instance, created, **kwargs):
|
||||
يرجى تسجيل الدخول إلى الموقع لاستكمال الملف الشخصي والبدء في استخدام خدماتنا.
|
||||
|
||||
شكرا لاختيارك لنا.
|
||||
""")
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
@receiver(post_save, sender=ChartOfAccountModel)
|
||||
|
||||
@ -12,12 +12,14 @@ from django.db import transaction
|
||||
from django_ledger.io import roles
|
||||
from django_q.tasks import async_task
|
||||
from django.core.mail import send_mail
|
||||
|
||||
# from appointment.models import StaffMember
|
||||
from django.utils.translation import activate
|
||||
from django.core.files.base import ContentFile
|
||||
from django.contrib.auth import get_user_model
|
||||
from allauth.account.models import EmailAddress
|
||||
from django.core.mail import EmailMultiAlternatives
|
||||
|
||||
# from .utils import get_accounts_data, create_account
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
@ -30,7 +32,7 @@ from inventory.models import (
|
||||
CarReservation,
|
||||
CarStatusChoices,
|
||||
CarImage,
|
||||
Car
|
||||
Car,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -63,17 +65,18 @@ def create_settings(pk):
|
||||
)
|
||||
|
||||
|
||||
def create_coa_accounts(dealer_id,**kwargs):
|
||||
def create_coa_accounts(dealer_id, **kwargs):
|
||||
"""
|
||||
Idempotent: Creates only missing default accounts.
|
||||
Safe to retry. Returns True if all done.
|
||||
"""
|
||||
from .models import Dealer
|
||||
from .utils import get_accounts_data, create_account
|
||||
|
||||
try:
|
||||
dealer = Dealer.objects.get(pk=dealer_id)
|
||||
entity = dealer.entity
|
||||
coa_slug = kwargs.get('coa_slug', None)
|
||||
coa_slug = kwargs.get("coa_slug", None)
|
||||
if not entity:
|
||||
logger.error(f"❌ No entity for dealer {dealer_id}")
|
||||
return False
|
||||
@ -82,7 +85,9 @@ def create_coa_accounts(dealer_id,**kwargs):
|
||||
try:
|
||||
coa = entity.get_coa_model_qs().get(slug=coa_slug)
|
||||
except Exception as e:
|
||||
logger.error(f"COA with slug {coa_slug} not found for entity {entity.pk}: {e}")
|
||||
logger.error(
|
||||
f"COA with slug {coa_slug} not found for entity {entity.pk}: {e}"
|
||||
)
|
||||
return False
|
||||
else:
|
||||
coa = entity.get_default_coa()
|
||||
@ -92,10 +97,13 @@ def create_coa_accounts(dealer_id,**kwargs):
|
||||
return False
|
||||
|
||||
# Get missing accounts
|
||||
existing_codes = set(entity.get_all_accounts().filter(coa_model=coa).values_list('code', flat=True))
|
||||
existing_codes = set(
|
||||
entity.get_all_accounts()
|
||||
.filter(coa_model=coa)
|
||||
.values_list("code", flat=True)
|
||||
)
|
||||
accounts_to_create = [
|
||||
acc for acc in get_accounts_data()
|
||||
if acc["code"] not in existing_codes
|
||||
acc for acc in get_accounts_data() if acc["code"] not in existing_codes
|
||||
]
|
||||
|
||||
if not accounts_to_create:
|
||||
@ -122,6 +130,7 @@ def create_coa_accounts(dealer_id,**kwargs):
|
||||
logger.error(f"💥 Task failed for dealer {dealer_id}: {e}")
|
||||
raise # Let Django-Q handle retry if configured
|
||||
|
||||
|
||||
def retry_entity_creation(dealer_id, retry_count=0):
|
||||
"""
|
||||
Retry entity creation if initial attempt failed
|
||||
@ -164,8 +173,10 @@ def retry_entity_creation(dealer_id, retry_count=0):
|
||||
async_task(
|
||||
"inventory.tasks.retry_entity_creation",
|
||||
dealer_id=dealer_id,
|
||||
retry_count=retry_count + 1
|
||||
retry_count=retry_count + 1,
|
||||
)
|
||||
|
||||
|
||||
# def create_coa_accounts(**kwargs):
|
||||
# logger.info("creating all accounts are created")
|
||||
# instance = kwargs.get("dealer")
|
||||
|
||||
@ -13,6 +13,7 @@ from django.db.models import Case, Value, When, IntegerField
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.filter
|
||||
def is_negative(value):
|
||||
"""
|
||||
@ -23,6 +24,7 @@ def is_negative(value):
|
||||
except (ValueError, TypeError):
|
||||
return False
|
||||
|
||||
|
||||
@register.filter
|
||||
def get_percentage(value, total):
|
||||
try:
|
||||
@ -501,8 +503,16 @@ def bill_item_formset_table(context, item_formset):
|
||||
for item in item_formset:
|
||||
if item:
|
||||
print(item.fields["item_model"])
|
||||
item.initial["quantity"] = item.instance.po_quantity if item.instance.po_quantity else item.instance.quantity
|
||||
item.initial["unit_cost"] = item.instance.po_unit_cost if item.instance.po_unit_cost else item.instance.unit_cost
|
||||
item.initial["quantity"] = (
|
||||
item.instance.po_quantity
|
||||
if item.instance.po_quantity
|
||||
else item.instance.quantity
|
||||
)
|
||||
item.initial["unit_cost"] = (
|
||||
item.instance.po_unit_cost
|
||||
if item.instance.po_unit_cost
|
||||
else item.instance.unit_cost
|
||||
)
|
||||
# print(item.instance.po_quantity)
|
||||
# print(item.instance.po_unit_cost)
|
||||
# print(item.instance.po_total_amount)
|
||||
|
||||
@ -2,7 +2,7 @@ from inventory.utils import get_user_type
|
||||
from . import views
|
||||
from django.urls import path
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic import RedirectView,TemplateView
|
||||
from django.views.generic import RedirectView, TemplateView
|
||||
from django_tables2.export.export import TableExport
|
||||
from django.conf.urls import handler403, handler400, handler404, handler500
|
||||
|
||||
@ -10,14 +10,17 @@ urlpatterns = [
|
||||
# main URLs
|
||||
path("", views.WelcomeView, name="welcome"),
|
||||
# path("signup/", views.dealer_signup, name="account_signup"),
|
||||
path('signup/', views.CarDealershipSignUpView.as_view(), name='account_signup'),
|
||||
path('success/', TemplateView.as_view(template_name='account/success.html'), name='registration_success'),
|
||||
path("signup/", views.CarDealershipSignUpView.as_view(), name="account_signup"),
|
||||
path(
|
||||
"success/",
|
||||
TemplateView.as_view(template_name="account/success.html"),
|
||||
name="registration_success",
|
||||
),
|
||||
path("", views.HomeView, name="home"),
|
||||
# path('refund-policy/',views.refund_policy,name='refund_policy'),
|
||||
path("<slug:dealer_slug>/", views.HomeView, name="home"),
|
||||
# Tasks
|
||||
path("legal/", views.terms_and_privacy, name="terms_and_privacy"),
|
||||
|
||||
# path('tasks/<int:task_id>/detail/', views.task_detail, name='task_detail'),
|
||||
# Dashboards
|
||||
# path("user/<int:pk>/settings/", views.UserSettingsView.as_view(), name="user_settings"),
|
||||
@ -44,13 +47,18 @@ urlpatterns = [
|
||||
views.assign_car_makes,
|
||||
name="assign_car_makes",
|
||||
),
|
||||
|
||||
|
||||
#dashboards for manager, dealer, inventory and accounatant
|
||||
path("dashboards/<slug:dealer_slug>/general/", views.general_dashboard,name="general_dashboard"),
|
||||
#dashboard for sales
|
||||
path("dashboards/<slug:dealer_slug>/sales/", views.sales_dashboard, name="sales_dashboard"),
|
||||
|
||||
# dashboards for manager, dealer, inventory and accounatant
|
||||
path(
|
||||
"dashboards/<slug:dealer_slug>/general/",
|
||||
views.general_dashboard,
|
||||
name="general_dashboard",
|
||||
),
|
||||
# dashboard for sales
|
||||
path(
|
||||
"dashboards/<slug:dealer_slug>/sales/",
|
||||
views.sales_dashboard,
|
||||
name="sales_dashboard",
|
||||
),
|
||||
path(
|
||||
"<slug:dealer_slug>/cars/aging-inventory/list",
|
||||
views.aging_inventory_list_view,
|
||||
@ -786,7 +794,11 @@ urlpatterns = [
|
||||
views.EstimateDetailView.as_view(),
|
||||
name="estimate_detail",
|
||||
),
|
||||
path('<slug:dealer_slug>/sales/estimates/print/<uuid:pk>/', views.EstimatePrintView.as_view(), name='estimate_print'),
|
||||
path(
|
||||
"<slug:dealer_slug>/sales/estimates/print/<uuid:pk>/",
|
||||
views.EstimatePrintView.as_view(),
|
||||
name="estimate_print",
|
||||
),
|
||||
path(
|
||||
"<slug:dealer_slug>/sales/estimates/create/",
|
||||
views.create_estimate,
|
||||
@ -943,7 +955,6 @@ urlpatterns = [
|
||||
views.ItemServiceUpdateView.as_view(),
|
||||
name="item_service_update",
|
||||
),
|
||||
|
||||
path(
|
||||
"<slug:dealer_slug>/items/services/<int:pk>/detail/",
|
||||
views.ItemServiceDetailView.as_view(),
|
||||
@ -1112,32 +1123,47 @@ urlpatterns = [
|
||||
name="entity-ic-date",
|
||||
),
|
||||
# Chart of Accounts...
|
||||
path('<slug:dealer_slug>/chart-of-accounts/<slug:entity_slug>/list/',
|
||||
path(
|
||||
"<slug:dealer_slug>/chart-of-accounts/<slug:entity_slug>/list/",
|
||||
views.ChartOfAccountModelListView.as_view(),
|
||||
name='coa-list'),
|
||||
path('<slug:dealer_slug>/chart-of-accounts/<slug:entity_slug>/list/inactive/',
|
||||
name="coa-list",
|
||||
),
|
||||
path(
|
||||
"<slug:dealer_slug>/chart-of-accounts/<slug:entity_slug>/list/inactive/",
|
||||
views.ChartOfAccountModelListView.as_view(inactive=True),
|
||||
name='coa-list-inactive'),
|
||||
path('<slug:dealer_slug>/<slug:entity_slug>/create/',
|
||||
name="coa-list-inactive",
|
||||
),
|
||||
path(
|
||||
"<slug:dealer_slug>/<slug:entity_slug>/create/",
|
||||
views.ChartOfAccountModelCreateView.as_view(),
|
||||
name='coa-create'),
|
||||
path('<slug:dealer_slug>/<slug:entity_slug>/detail/<slug:coa_slug>/',
|
||||
name="coa-create",
|
||||
),
|
||||
path(
|
||||
"<slug:dealer_slug>/<slug:entity_slug>/detail/<slug:coa_slug>/",
|
||||
views.ChartOfAccountModelListView.as_view(),
|
||||
name='coa-detail'),
|
||||
path('<slug:dealer_slug>/<slug:entity_slug>/update/<slug:coa_slug>/',
|
||||
name="coa-detail",
|
||||
),
|
||||
path(
|
||||
"<slug:dealer_slug>/<slug:entity_slug>/update/<slug:coa_slug>/",
|
||||
views.ChartOfAccountModelUpdateView.as_view(),
|
||||
name='coa-update'),
|
||||
|
||||
name="coa-update",
|
||||
),
|
||||
# ACTIONS....
|
||||
path('<slug:dealer_slug>/<slug:entity_slug>/action/<slug:coa_slug>/mark-as-default/',
|
||||
views.CharOfAccountModelActionView.as_view(action_name='mark_as_default'),
|
||||
name='coa-action-mark-as-default'),
|
||||
path('<slug:dealer_slug>/<slug:entity_slug>/action/<slug:coa_slug>/mark-as-active/',
|
||||
views.CharOfAccountModelActionView.as_view(action_name='mark_as_active'),
|
||||
name='coa-action-mark-as-active'),
|
||||
path('<slug:dealer_slug>/<slug:entity_slug>/action/<slug:coa_slug>/mark-as-inactive/',
|
||||
views.CharOfAccountModelActionView.as_view(action_name='mark_as_inactive'),
|
||||
name='coa-action-mark-as-inactive'),
|
||||
path(
|
||||
"<slug:dealer_slug>/<slug:entity_slug>/action/<slug:coa_slug>/mark-as-default/",
|
||||
views.CharOfAccountModelActionView.as_view(action_name="mark_as_default"),
|
||||
name="coa-action-mark-as-default",
|
||||
),
|
||||
path(
|
||||
"<slug:dealer_slug>/<slug:entity_slug>/action/<slug:coa_slug>/mark-as-active/",
|
||||
views.CharOfAccountModelActionView.as_view(action_name="mark_as_active"),
|
||||
name="coa-action-mark-as-active",
|
||||
),
|
||||
path(
|
||||
"<slug:dealer_slug>/<slug:entity_slug>/action/<slug:coa_slug>/mark-as-inactive/",
|
||||
views.CharOfAccountModelActionView.as_view(action_name="mark_as_inactive"),
|
||||
name="coa-action-mark-as-inactive",
|
||||
),
|
||||
# CASH FLOW STATEMENTS...
|
||||
# Entities...
|
||||
path(
|
||||
@ -1313,42 +1339,80 @@ urlpatterns = [
|
||||
views.PurchaseOrderMarkAsVoidView.as_view(),
|
||||
name="po-action-mark-as-void",
|
||||
),
|
||||
|
||||
# reports
|
||||
path(
|
||||
"<slug:dealer_slug>/purchase-report/",
|
||||
views.purchase_report_view,
|
||||
name="po-report",
|
||||
),
|
||||
path('purchase-report/<slug:dealer_slug>/csv/', views.purchase_report_csv_export, name='purchase-report-csv-export'),
|
||||
|
||||
path(
|
||||
"purchase-report/<slug:dealer_slug>/csv/",
|
||||
views.purchase_report_csv_export,
|
||||
name="purchase-report-csv-export",
|
||||
),
|
||||
path(
|
||||
"<slug:dealer_slug>/car-sale-report/",
|
||||
views.car_sale_report_view,
|
||||
name="car-sale-report",
|
||||
),
|
||||
path('<slug:dealer_slug>/car-sale-report/get_filtered_choices/',views.get_filtered_choices,name='get_filtered_choices'),
|
||||
path('car-sale-report/<slug:dealer_slug>/csv/', views.car_sale_report_csv_export, name='car-sale-report-csv-export'),
|
||||
|
||||
path('feature/recall/', views.RecallListView.as_view(), name='recall_list'),
|
||||
path('feature/recall/filter/', views.RecallFilterView, name='recall_filter'),
|
||||
path('feature/recall/<int:pk>/view/', views.RecallDetailView.as_view(), name='recall_detail'),
|
||||
path('feature/recall/create/', views.RecallCreateView.as_view(), name='recall_create'),
|
||||
path('feature/recall/success/', views.RecallSuccessView.as_view(), name='recall_success'),
|
||||
|
||||
path('<slug:dealer_slug>/schedules/calendar/', views.schedule_calendar, name='schedule_calendar'),
|
||||
|
||||
path(
|
||||
"<slug:dealer_slug>/car-sale-report/get_filtered_choices/",
|
||||
views.get_filtered_choices,
|
||||
name="get_filtered_choices",
|
||||
),
|
||||
path(
|
||||
"car-sale-report/<slug:dealer_slug>/csv/",
|
||||
views.car_sale_report_csv_export,
|
||||
name="car-sale-report-csv-export",
|
||||
),
|
||||
path("feature/recall/", views.RecallListView.as_view(), name="recall_list"),
|
||||
path("feature/recall/filter/", views.RecallFilterView, name="recall_filter"),
|
||||
path(
|
||||
"feature/recall/<int:pk>/view/",
|
||||
views.RecallDetailView.as_view(),
|
||||
name="recall_detail",
|
||||
),
|
||||
path(
|
||||
"feature/recall/create/", views.RecallCreateView.as_view(), name="recall_create"
|
||||
),
|
||||
path(
|
||||
"feature/recall/success/",
|
||||
views.RecallSuccessView.as_view(),
|
||||
name="recall_success",
|
||||
),
|
||||
path(
|
||||
"<slug:dealer_slug>/schedules/calendar/",
|
||||
views.schedule_calendar,
|
||||
name="schedule_calendar",
|
||||
),
|
||||
# staff profile
|
||||
path('<slug:dealer_slug>/staff/<slug:slug>detail/', views.StaffDetailView.as_view(), name='staff_detail'),
|
||||
path(
|
||||
"<slug:dealer_slug>/staff/<slug:slug>detail/",
|
||||
views.StaffDetailView.as_view(),
|
||||
name="staff_detail",
|
||||
),
|
||||
# tickets
|
||||
path('help_center/view/', views.help_center, name='help_center'),
|
||||
path('<slug:dealer_slug>/help_center/tickets/', views.ticket_list, name='ticket_list'),
|
||||
path('help_center/tickets/<slug:dealer_slug>/create/', views.create_ticket, name='create_ticket'),
|
||||
path('<slug:dealer_slug>/help_center/tickets/<int:ticket_id>/', views.ticket_detail, name='ticket_detail'),
|
||||
path('help_center/tickets/<int:ticket_id>/update/', views.ticket_update, name='ticket_update'),
|
||||
path("help_center/view/", views.help_center, name="help_center"),
|
||||
path(
|
||||
"<slug:dealer_slug>/help_center/tickets/", views.ticket_list, name="ticket_list"
|
||||
),
|
||||
path(
|
||||
"help_center/tickets/<slug:dealer_slug>/create/",
|
||||
views.create_ticket,
|
||||
name="create_ticket",
|
||||
),
|
||||
path(
|
||||
"<slug:dealer_slug>/help_center/tickets/<int:ticket_id>/",
|
||||
views.ticket_detail,
|
||||
name="ticket_detail",
|
||||
),
|
||||
path(
|
||||
"help_center/tickets/<int:ticket_id>/update/",
|
||||
views.ticket_update,
|
||||
name="ticket_update",
|
||||
),
|
||||
# path('help_center/tickets/<int:ticket_id>/ticket_mark_resolved/', views.ticket_mark_resolved, name='ticket_mark_resolved'),
|
||||
path('payment_results/', views.payment_result, name='payment_result'),
|
||||
|
||||
path("payment_results/", views.payment_result, name="payment_result"),
|
||||
]
|
||||
|
||||
handler404 = "inventory.views.custom_page_not_found_view"
|
||||
|
||||
@ -27,7 +27,7 @@ from django_ledger.models import (
|
||||
VendorModel,
|
||||
AccountModel,
|
||||
EntityModel,
|
||||
ChartOfAccountModel
|
||||
ChartOfAccountModel,
|
||||
)
|
||||
from django.core.files.base import ContentFile
|
||||
from django_ledger.models.items import ItemModel
|
||||
@ -1329,9 +1329,9 @@ def get_finance_data(estimate, dealer):
|
||||
additional_services = car.get_additional_services()
|
||||
discounted_price = Decimal(car.marked_price) - discount
|
||||
vat_amount = discounted_price * vat.rate
|
||||
total_services_amount=additional_services.get("total")
|
||||
total_services_amount = additional_services.get("total")
|
||||
total_services_vat = sum([x[1] for x in additional_services.get("services")])
|
||||
total_services_amount_=additional_services.get("total_")
|
||||
total_services_amount_ = additional_services.get("total_")
|
||||
total_vat = vat_amount + total_services_vat
|
||||
return {
|
||||
"car": car,
|
||||
@ -1342,16 +1342,11 @@ def get_finance_data(estimate, dealer):
|
||||
"discount_amount": discount,
|
||||
"additional_services": additional_services,
|
||||
"final_price": discounted_price + vat_amount,
|
||||
|
||||
|
||||
|
||||
"total_services_vat": total_services_vat,
|
||||
"total_services_amount":total_services_amount,
|
||||
"total_services_amount_":total_services_amount_,
|
||||
|
||||
"total_services_amount": total_services_amount,
|
||||
"total_services_amount_": total_services_amount_,
|
||||
"total_vat": total_vat,
|
||||
"grand_total": discounted_price + total_vat + additional_services.get("total"),
|
||||
|
||||
}
|
||||
|
||||
# totals = self.calculate_totals()
|
||||
@ -1605,24 +1600,38 @@ def _post_sale_and_cogs(invoice, dealer):
|
||||
1) Cash / A-R / VAT / Revenue journal
|
||||
2) COGS / Inventory journal
|
||||
"""
|
||||
entity:EntityModel = invoice.ledger.entity
|
||||
entity: EntityModel = invoice.ledger.entity
|
||||
# calc = CarFinanceCalculator(invoice)
|
||||
data = get_finance_data(invoice, dealer)
|
||||
|
||||
car = data.get("car")
|
||||
|
||||
coa:ChartOfAccountModel = entity.get_default_coa()
|
||||
coa: ChartOfAccountModel = entity.get_default_coa()
|
||||
cash_acc = invoice.cash_account or dealer.settings.invoice_cash_account
|
||||
|
||||
vat_acc = dealer.settings.invoice_tax_payable_account or entity.get_default_coa_accounts().filter(role_default=True, role=roles.LIABILITY_CL_TAXES_PAYABLE).first()
|
||||
vat_acc = (
|
||||
dealer.settings.invoice_tax_payable_account
|
||||
or entity.get_default_coa_accounts()
|
||||
.filter(role_default=True, role=roles.LIABILITY_CL_TAXES_PAYABLE)
|
||||
.first()
|
||||
)
|
||||
|
||||
car_rev = dealer.settings.invoice_vehicle_sale_account or entity.get_default_coa_accounts().filter(role_default=True, role=roles.INCOME_OPERATIONAL).first()
|
||||
car_rev = (
|
||||
dealer.settings.invoice_vehicle_sale_account
|
||||
or entity.get_default_coa_accounts()
|
||||
.filter(role_default=True, role=roles.INCOME_OPERATIONAL)
|
||||
.first()
|
||||
)
|
||||
|
||||
add_rev = dealer.settings.invoice_additional_services_account
|
||||
|
||||
if not add_rev:
|
||||
try:
|
||||
add_rev = entity.get_default_coa_accounts().filter(name="After-Sales Services", active=True).first()
|
||||
add_rev = (
|
||||
entity.get_default_coa_accounts()
|
||||
.filter(name="After-Sales Services", active=True)
|
||||
.first()
|
||||
)
|
||||
if not add_rev:
|
||||
add_rev = coa.create_account(
|
||||
code="4020",
|
||||
@ -1632,16 +1641,28 @@ def _post_sale_and_cogs(invoice, dealer):
|
||||
active=True,
|
||||
)
|
||||
add_rev.role_default = False
|
||||
add_rev.save(update_fields=['role_default'])
|
||||
add_rev.save(update_fields=["role_default"])
|
||||
dealer.settings.invoice_additional_services_account = add_rev
|
||||
dealer.settings.save()
|
||||
except Exception as e:
|
||||
logger.error(f"error find or create additional services account {e}")
|
||||
if car.get_additional_services_amount > 0 and not add_rev:
|
||||
raise Exception("additional services exist but not account found,please create account for the additional services and set as default in the settings")
|
||||
cogs_acc = dealer.settings.invoice_cost_of_good_sold_account or entity.get_default_coa_accounts().filter(role_default=True, role=roles.COGS).first()
|
||||
raise Exception(
|
||||
"additional services exist but not account found,please create account for the additional services and set as default in the settings"
|
||||
)
|
||||
cogs_acc = (
|
||||
dealer.settings.invoice_cost_of_good_sold_account
|
||||
or entity.get_default_coa_accounts()
|
||||
.filter(role_default=True, role=roles.COGS)
|
||||
.first()
|
||||
)
|
||||
|
||||
inv_acc = dealer.settings.invoice_inventory_account or entity.get_default_coa_accounts().filter(role_default=True, role=roles.ASSET_CA_INVENTORY).first()
|
||||
inv_acc = (
|
||||
dealer.settings.invoice_inventory_account
|
||||
or entity.get_default_coa_accounts()
|
||||
.filter(role_default=True, role=roles.ASSET_CA_INVENTORY)
|
||||
.first()
|
||||
)
|
||||
|
||||
net_car_price = Decimal(data["discounted_price"])
|
||||
net_additionals_price = Decimal(data["additional_services"]["total"])
|
||||
@ -1696,11 +1717,12 @@ def _post_sale_and_cogs(invoice, dealer):
|
||||
# tx_type='credit'
|
||||
# )
|
||||
|
||||
|
||||
if car.get_additional_services_amount > 0:
|
||||
# Cr Sales – Additional Services
|
||||
if not add_rev:
|
||||
logger.warning(f"Additional Services account not set for dealer {dealer}. Skipping additional services revenue entry.")
|
||||
logger.warning(
|
||||
f"Additional Services account not set for dealer {dealer}. Skipping additional services revenue entry."
|
||||
)
|
||||
else:
|
||||
TransactionModel.objects.create(
|
||||
journal_entry=je_sale,
|
||||
@ -1938,7 +1960,7 @@ def handle_payment(request, dealer):
|
||||
}
|
||||
|
||||
# Get selected plan from session
|
||||
selected_plan_id = request.session.get('pending_plan_id')
|
||||
selected_plan_id = request.session.get("pending_plan_id")
|
||||
if not selected_plan_id:
|
||||
raise ValueError("No pending plan found in session")
|
||||
from plans.models import PlanPricing
|
||||
@ -1956,7 +1978,8 @@ def handle_payment(request, dealer):
|
||||
"dealer_slug": dealer.slug,
|
||||
}
|
||||
|
||||
payload = json.dumps({
|
||||
payload = json.dumps(
|
||||
{
|
||||
"amount": total,
|
||||
"currency": "SAR",
|
||||
"description": f"Payment for plan {pp.plan.name}",
|
||||
@ -1974,7 +1997,8 @@ def handle_payment(request, dealer):
|
||||
"save_card": False,
|
||||
},
|
||||
"metadata": metadata,
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
headers = {"Content-Type": "application/json", "Accept": "application/json"}
|
||||
auth = (settings.MOYASAR_SECRET_KEY, "")
|
||||
@ -1998,7 +2022,9 @@ def handle_payment(request, dealer):
|
||||
gateway_response=data,
|
||||
)
|
||||
logger.info(f"Payment initiated: {data}")
|
||||
return data["source"]["transaction_url"],None
|
||||
return data["source"]["transaction_url"], None
|
||||
|
||||
|
||||
# def handle_payment(request, order):
|
||||
# logger.info(f"Handling payment for order {order}")
|
||||
# url = "https://api.moyasar.com/v1/payments"
|
||||
@ -2518,10 +2544,9 @@ def create_account(entity, coa, account_data):
|
||||
logger.info(f"Created account: {account}")
|
||||
if account:
|
||||
account.role_default = account_data.get("default", False)
|
||||
account.save(update_fields=['role_default'])
|
||||
account.save(update_fields=["role_default"])
|
||||
return True
|
||||
|
||||
|
||||
except IntegrityError:
|
||||
return True # Already created by race condition
|
||||
except Exception as e:
|
||||
@ -2529,6 +2554,7 @@ def create_account(entity, coa, account_data):
|
||||
|
||||
return False
|
||||
|
||||
|
||||
# def create_account(entity, coa, account_data):
|
||||
# try:
|
||||
# account = entity.create_account(
|
||||
@ -2810,7 +2836,9 @@ def generate_car_image_simple(car):
|
||||
# Save the resized image
|
||||
logger.info(f" {car.vin}")
|
||||
with open(
|
||||
os.path.join(settings.MEDIA_ROOT, f"car_images/{car.get_hash}.{file_extension}"),
|
||||
os.path.join(
|
||||
settings.MEDIA_ROOT, f"car_images/{car.get_hash}.{file_extension}"
|
||||
),
|
||||
"wb",
|
||||
) as f:
|
||||
f.write(resized_data)
|
||||
@ -2826,9 +2854,7 @@ def generate_car_image_simple(car):
|
||||
return {"success": False, "error": error_msg}
|
||||
|
||||
|
||||
|
||||
|
||||
def create_estimate_(dealer,car,customer):
|
||||
def create_estimate_(dealer, car, customer):
|
||||
entity = dealer.entity
|
||||
title = f"Estimate for {car.vin}-{car.id_car_make.name}-{car.id_car_model.name}-{car.year} for customer {customer.first_name} {customer.last_name}"
|
||||
estimate = entity.create_estimate(
|
||||
|
||||
@ -16,9 +16,10 @@ class SaudiPhoneNumberValidator(RegexValidator):
|
||||
cleaned_value = re.sub(r"[\s\-\(\)\.]", "", str(value))
|
||||
super().__call__(cleaned_value)
|
||||
|
||||
|
||||
def vat_rate_validator(value):
|
||||
if value < 0 or value > 1:
|
||||
raise ValidationError(
|
||||
_('%(value)s is not a valid VAT rate. It must be between 0 and 1.'),
|
||||
params={'value': value},
|
||||
_("%(value)s is not a valid VAT rate. It must be between 0 and 1."),
|
||||
params={"value": value},
|
||||
)
|
||||
1953
inventory/views.py
1953
inventory/views.py
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,9 @@ autobahn==24.4.2
|
||||
Automat==25.4.16
|
||||
Babel==2.15.0
|
||||
beautifulsoup4==4.13.4
|
||||
blacknoise==1.2.0
|
||||
blessed==1.21.0
|
||||
Brotli==1.1.0
|
||||
cattrs==25.1.1
|
||||
certifi==2025.7.9
|
||||
cffi==1.17.1
|
||||
@ -19,15 +21,13 @@ constantly==23.10.4
|
||||
crispy-bootstrap5==2025.6
|
||||
cryptography==45.0.5
|
||||
cssbeautifier==1.15.4
|
||||
daphne==4.2.1
|
||||
cssselect2==0.8.0
|
||||
defusedxml==0.7.1
|
||||
diff-match-patch==20241021
|
||||
distro==1.9.0
|
||||
Django==5.2.4
|
||||
django-allauth==65.10.0
|
||||
django-appconf==1.1.0
|
||||
django-appointment==3.8.0
|
||||
django-background-tasks==1.2.8
|
||||
django-bootstrap5==25.1
|
||||
django-ckeditor==6.7.3
|
||||
django-cors-headers==4.7.0
|
||||
@ -35,6 +35,7 @@ django-countries==7.6.1
|
||||
django-crispy-forms==2.4
|
||||
django-debug-toolbar==5.2.0
|
||||
django-easy-audit==1.3.7
|
||||
django-encrypted-model-fields==0.6.5
|
||||
django-extensions==4.1
|
||||
django-filter==25.1
|
||||
django-imagekit==5.0.0
|
||||
@ -47,7 +48,6 @@ django-ordered-model==3.7.4
|
||||
django-phonenumber-field==8.0.0
|
||||
django-picklefield==3.3
|
||||
django-plans==2.0.0
|
||||
django-prometheus==2.4.1
|
||||
django-q2==1.8.0
|
||||
django-query-builder==3.2.0
|
||||
django-schema-graph==3.1.0
|
||||
@ -56,8 +56,6 @@ django-tables2==2.7.5
|
||||
django-treebeard==4.7.1
|
||||
django-widget-tweaks==1.5.0
|
||||
djangorestframework==3.16.0
|
||||
djhtml==3.0.8
|
||||
djlint==1.36.4
|
||||
dnspython==2.7.0
|
||||
docopt==0.6.2
|
||||
EditorConfig==0.17.1
|
||||
@ -78,8 +76,6 @@ hyperlink==21.0.0
|
||||
icalendar==6.3.1
|
||||
idna==3.10
|
||||
incremental==24.7.2
|
||||
iron-core==1.2.1
|
||||
iron-mq==0.9
|
||||
jiter==0.10.0
|
||||
jsbeautifier==1.15.4
|
||||
json5==0.12.0
|
||||
@ -109,16 +105,17 @@ phonenumbers==8.13.42
|
||||
pilkit==3.0
|
||||
pillow==10.4.0
|
||||
priority==1.3.0
|
||||
prometheus_client==0.22.1
|
||||
psycopg2-binary==2.9.10
|
||||
pyasn1==0.6.1
|
||||
pyasn1_modules==0.4.2
|
||||
pycparser==2.22
|
||||
pydantic==2.11.7
|
||||
pydantic_core==2.33.2
|
||||
pydyf==0.11.0
|
||||
Pygments==2.19.2
|
||||
pymongo==4.14.1
|
||||
pyOpenSSL==25.1.0
|
||||
pyphen==0.17.2
|
||||
python-dateutil==2.9.0.post0
|
||||
python-dotenv==1.1.1
|
||||
python-slugify==8.0.4
|
||||
@ -131,8 +128,6 @@ redis==6.2.0
|
||||
regex==2024.11.6
|
||||
requests==2.32.4
|
||||
requests-toolbelt==1.0.0
|
||||
rich==14.0.0
|
||||
ruff==0.12.2
|
||||
service-identity==24.2.0
|
||||
setuptools==80.9.0
|
||||
six==1.17.0
|
||||
@ -140,11 +135,15 @@ sniffio==1.3.1
|
||||
soupsieve==2.7
|
||||
SQLAlchemy==2.0.41
|
||||
sqlparse==0.5.3
|
||||
starlette==0.47.3
|
||||
static3==0.7.0
|
||||
suds==1.2.0
|
||||
swapper==1.3.0
|
||||
tablib==3.8.0
|
||||
tenacity==9.1.2
|
||||
text-unidecode==1.3
|
||||
tinycss2==1.4.0
|
||||
tinyhtml5==2.0.0
|
||||
tqdm==4.67.1
|
||||
Twisted==25.5.0
|
||||
txaio==25.6.1
|
||||
@ -156,6 +155,8 @@ urllib3==2.5.0
|
||||
uvicorn==0.35.0
|
||||
uvicorn-worker==0.3.0
|
||||
wcwidth==0.2.13
|
||||
whitenoise==6.9.0
|
||||
weasyprint==66.0
|
||||
webencodings==0.5.1
|
||||
zope.interface==7.2
|
||||
zopfli==0.2.3.post1
|
||||
zstandard==0.23.0
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% translate "Account Inactive" %}
|
||||
{% endelement %}
|
||||
{% element p %}
|
||||
{% translate "This account is inactive." %}
|
||||
{% endelement %}
|
||||
{% endelement %}
|
||||
{% element p %}
|
||||
{% translate "This account is inactive." %}
|
||||
{% endelement %}
|
||||
{% endblock content %}
|
||||
|
||||
@ -7,42 +7,42 @@
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% translate "Enter Email Verification Code" %}
|
||||
{% endelement %}
|
||||
{% setvar email_link %}
|
||||
<a href="mailto:{{ email }}">{{ email }}</a>
|
||||
{% endsetvar %}
|
||||
{% element p %}
|
||||
{% blocktranslate %}We’ve sent a code to {{ email_link }}. The code expires shortly, so please enter it soon.{% endblocktranslate %}
|
||||
{% endelement %}
|
||||
{% url 'account_email_verification_sent' as action_url %}
|
||||
{% element form form=form method="post" action=action_url tags="entrance,email,verification" %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{% element fields form=form unlabeled=True %}
|
||||
{% endelement %}
|
||||
{{ redirect_field }}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button type="submit" tags="prominent,confirm" %}
|
||||
{% translate "Confirm" %}
|
||||
{% endelement %}
|
||||
{% if cancel_url %}
|
||||
{% endelement %}
|
||||
{% setvar email_link %}
|
||||
<a href="mailto:{{ email }}">{{ email }}</a>
|
||||
{% endsetvar %}
|
||||
{% element p %}
|
||||
{% blocktranslate %}We’ve sent a code to {{ email_link }}. The code expires shortly, so please enter it soon.{% endblocktranslate %}
|
||||
{% endelement %}
|
||||
{% url 'account_email_verification_sent' as action_url %}
|
||||
{% element form form=form method="post" action=action_url tags="entrance,email,verification" %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{% element fields form=form unlabeled=True %}
|
||||
{% endelement %}
|
||||
{{ redirect_field }}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button type="submit" tags="prominent,confirm" %}
|
||||
{% translate "Confirm" %}
|
||||
{% endelement %}
|
||||
{% if cancel_url %}
|
||||
{% element button href=cancel_url tags="link,cancel" %}
|
||||
{% translate "Cancel" %}
|
||||
{% endelement %}
|
||||
{% else %}
|
||||
{% element button type="submit" form="logout-from-stage" tags="link,cancel" %}
|
||||
{% translate "Cancel" %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% if not cancel_url %}
|
||||
{% endelement %}
|
||||
{% else %}
|
||||
{% element button type="submit" form="logout-from-stage" tags="link,cancel" %}
|
||||
{% translate "Cancel" %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% if not cancel_url %}
|
||||
<form id="logout-from-stage"
|
||||
method="post"
|
||||
action="{% url 'account_logout' %}">
|
||||
<input type="hidden" name="next" value="{% url 'account_login' %}">
|
||||
{% csrf_token %}
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
||||
@ -52,6 +52,6 @@
|
||||
{% csrf_token %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
||||
@ -7,22 +7,22 @@
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% trans "Email Address" %}
|
||||
{% endelement %}
|
||||
{% if not emailaddresses %}
|
||||
{% endelement %}
|
||||
{% if not emailaddresses %}
|
||||
{% include "account/snippets/warn_no_email.html" %}
|
||||
{% endif %}
|
||||
{% url 'account_email' as action_url %}
|
||||
{% element form method="post" action=action_url %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{% if current_emailaddress %}
|
||||
{% endif %}
|
||||
{% url 'account_email' as action_url %}
|
||||
{% element form method="post" action=action_url %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{% if current_emailaddress %}
|
||||
{% element field id="current_email" disabled=True type="email" value=current_emailaddress.email %}
|
||||
{% slot label %}
|
||||
{% translate "Current email" %}:
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% if new_emailaddress %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% if new_emailaddress %}
|
||||
{% element field id="new_email" value=new_emailaddress.email disabled=True type="email" %}
|
||||
{% slot label %}
|
||||
{% if not current_emailaddress %}
|
||||
@ -30,33 +30,33 @@
|
||||
{% else %}
|
||||
{% translate "Changing to" %}:
|
||||
{% endif %}
|
||||
{% endslot %}
|
||||
{% slot help_text %}
|
||||
{% blocktranslate %}Your email address is still pending verification.{% endblocktranslate %}
|
||||
{% element button form="pending-email" type="submit" name="action_send" tags="minor,secondary" %}
|
||||
{% trans 'Re-send Verification' %}
|
||||
{% endelement %}
|
||||
{% if current_emailaddress %}
|
||||
{% endslot %}
|
||||
{% slot help_text %}
|
||||
{% blocktranslate %}Your email address is still pending verification.{% endblocktranslate %}
|
||||
{% element button form="pending-email" type="submit" name="action_send" tags="minor,secondary" %}
|
||||
{% trans 'Re-send Verification' %}
|
||||
{% endelement %}
|
||||
{% if current_emailaddress %}
|
||||
{% element button form="pending-email" type="submit" name="action_remove" tags="danger,minor" %}
|
||||
{% trans 'Cancel Change' %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% element field id=form.email.auto_id name="email" value=form.email.value errors=form.email.errors type="email" %}
|
||||
{% slot label %}
|
||||
{% translate "Change to" %}:
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button name="action_add" type="submit" %}
|
||||
{% trans "Change Email" %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% if new_emailaddress %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% element field id=form.email.auto_id name="email" value=form.email.value errors=form.email.errors type="email" %}
|
||||
{% slot label %}
|
||||
{% translate "Change to" %}:
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button name="action_add" type="submit" %}
|
||||
{% trans "Change Email" %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% if new_emailaddress %}
|
||||
<form style="display: none"
|
||||
id="pending-email"
|
||||
method="post"
|
||||
@ -64,5 +64,5 @@
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="email" value="{{ new_emailaddress.email }}">
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
||||
@ -204,12 +204,12 @@
|
||||
<button class="btn btn-support-chat p-0 border border-translucent">
|
||||
<span class="fs-8 btn-text text-primary text-nowrap">Chat demo</span><span class="ping-icon-wrapper mt-n4 ms-n6 mt-sm-0 ms-sm-2 position-absolute position-sm-relative"><span class="ping-icon-bg"></span><span class="fa-solid fa-circle ping-icon"></span></span><span class="fa-solid fa-headset text-primary fs-8 d-sm-none"></span><span class="fa-solid fa-chevron-down text-primary fs-7"></span>
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</main>
|
||||
<!-- ===============================================-->
|
||||
<!-- End of Main Content-->
|
||||
<!-- ===============================================-->
|
||||
<div class="offcanvas offcanvas-end settings-panel border-0"
|
||||
<div class="offcanvas offcanvas-end settings-panel border-0"
|
||||
id="settings-offcanvas"
|
||||
tabindex="-1"
|
||||
aria-labelledby="settings-offcanvas">
|
||||
@ -548,8 +548,8 @@
|
||||
href="https://themes.getbootstrap.com/product/phoenix-admin-dashboard-webapp-template/"
|
||||
target="_blank">Purchase template</a>
|
||||
</div>
|
||||
</div>
|
||||
<a class="card setting-toggle"
|
||||
</div>
|
||||
<a class="card setting-toggle"
|
||||
href="#settings-offcanvas"
|
||||
data-bs-toggle="offcanvas">
|
||||
<div class="card-body d-flex align-items-center px-2 py-1">
|
||||
@ -571,19 +571,19 @@
|
||||
</div>
|
||||
<small class="text-uppercase text-body-tertiary fw-bold py-2 pe-2 ps-1 rounded-end">customize</small>
|
||||
</div>
|
||||
</a>
|
||||
</a>
|
||||
<!-- ===============================================-->
|
||||
<!-- JavaScripts-->
|
||||
<!-- ===============================================-->
|
||||
<script src="../../../vendors/popper/popper.min.js"></script>
|
||||
<script src="../../../vendors/bootstrap/bootstrap.min.js"></script>
|
||||
<script src="../../../vendors/anchorjs/anchor.min.js"></script>
|
||||
<script src="../../../vendors/is/is.min.js"></script>
|
||||
<script src="../../../vendors/fontawesome/all.min.js"></script>
|
||||
<script src="../../../vendors/lodash/lodash.min.js"></script>
|
||||
<script src="../../../vendors/list.js/list.min.js"></script>
|
||||
<script src="../../../vendors/feather-icons/feather.min.js"></script>
|
||||
<script src="../../../vendors/dayjs/dayjs.min.js"></script>
|
||||
<script src="../../../assets/js/phoenix.js"></script>
|
||||
</body>
|
||||
<script src="../../../vendors/popper/popper.min.js"></script>
|
||||
<script src="../../../vendors/bootstrap/bootstrap.min.js"></script>
|
||||
<script src="../../../vendors/anchorjs/anchor.min.js"></script>
|
||||
<script src="../../../vendors/is/is.min.js"></script>
|
||||
<script src="../../../vendors/fontawesome/all.min.js"></script>
|
||||
<script src="../../../vendors/lodash/lodash.min.js"></script>
|
||||
<script src="../../../vendors/list.js/list.min.js"></script>
|
||||
<script src="../../../vendors/feather-icons/feather.min.js"></script>
|
||||
<script src="../../../vendors/dayjs/dayjs.min.js"></script>
|
||||
<script src="../../../assets/js/phoenix.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -91,11 +91,11 @@
|
||||
{% trans "Mail me a sign-in code" %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% if SOCIALACCOUNT_ENABLED %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% if SOCIALACCOUNT_ENABLED %}
|
||||
{% include "socialaccount/snippets/login.html" with page_layout="entrance" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
{% block extra_body %}
|
||||
{{ block.super }}
|
||||
|
||||
@ -7,19 +7,19 @@
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% trans "Set Password" %}
|
||||
{% endelement %}
|
||||
{% url 'account_set_password' as action_url %}
|
||||
{% element form method="post" action=action_url %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{{ redirect_field }}
|
||||
{% element fields form=form %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button type="submit" name="action" %}
|
||||
{% trans 'Set Password' %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endelement %}
|
||||
{% url 'account_set_password' as action_url %}
|
||||
{% element form method="post" action=action_url %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{{ redirect_field }}
|
||||
{% element fields form=form %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button type="submit" name="action" %}
|
||||
{% trans 'Set Password' %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endblock content %}
|
||||
|
||||
@ -4,19 +4,19 @@
|
||||
{% block reauthenticate_content %}
|
||||
{% element p %}
|
||||
{% blocktranslate %}Enter your password:{% endblocktranslate %}
|
||||
{% endelement %}
|
||||
{% url 'account_reauthenticate' as action_url %}
|
||||
{% element form form=form method="post" action=action_url %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{% element fields form=form unlabeled=True %}
|
||||
{% endelement %}
|
||||
{{ redirect_field }}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button type="submit" tags="primary,reauthenticate" %}
|
||||
{% trans "Confirm" %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endelement %}
|
||||
{% url 'account_reauthenticate' as action_url %}
|
||||
{% element form form=form method="post" action=action_url %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{% element fields form=form unlabeled=True %}
|
||||
{% endelement %}
|
||||
{{ redirect_field }}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button type="submit" tags="primary,reauthenticate" %}
|
||||
{% trans "Confirm" %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endblock %}
|
||||
|
||||
@ -7,26 +7,26 @@
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% translate "Mail me a sign-in code" %}
|
||||
{% endelement %}
|
||||
{% element p %}
|
||||
{% blocktranslate %}You will receive an email containing a special code for a password-free sign-in.{% endblocktranslate %}
|
||||
{% endelement %}
|
||||
{% url 'account_request_login_code' as login_url %}
|
||||
{% element form form=form method="post" action=login_url tags="entrance,login" %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{% element fields form=form unlabeled=True %}
|
||||
{% endelement %}
|
||||
{{ redirect_field }}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button type="submit" tags="prominent,login" %}
|
||||
{% translate "Request Code" %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% url 'account_login' as login_url %}
|
||||
{% element button href=login_url tags="link" %}
|
||||
{% translate "Other sign-in options" %}
|
||||
{% endelement %}
|
||||
{% endelement %}
|
||||
{% element p %}
|
||||
{% blocktranslate %}You will receive an email containing a special code for a password-free sign-in.{% endblocktranslate %}
|
||||
{% endelement %}
|
||||
{% url 'account_request_login_code' as login_url %}
|
||||
{% element form form=form method="post" action=login_url tags="entrance,login" %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{% element fields form=form unlabeled=True %}
|
||||
{% endelement %}
|
||||
{{ redirect_field }}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button type="submit" tags="prominent,login" %}
|
||||
{% translate "Request Code" %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% url 'account_login' as login_url %}
|
||||
{% element button href=login_url tags="link" %}
|
||||
{% translate "Other sign-in options" %}
|
||||
{% endelement %}
|
||||
{% endblock content %}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% load i18n allauth %}
|
||||
{% element p %}
|
||||
<strong>{% trans 'Warning:' %}</strong> {% trans "You currently do not have any email address set up. You should really add an email address so you can receive notifications, reset your password, etc." %}
|
||||
<strong>{% trans 'Warning:' %}</strong> {% trans "You currently do not have any email address set up. You should really add an email address so you can receive notifications, reset your password, etc." %}
|
||||
{% endelement %}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if request.user.is_superuser %}
|
||||
{% if request.user.is_superuser %}
|
||||
<div class="container py-5">
|
||||
<header class="mb-5">
|
||||
<h1 class="display-4 fw-bold">
|
||||
@ -42,5 +42,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
@ -97,7 +97,7 @@
|
||||
{{ form.as_p }} <!-- Renders the form fields -->
|
||||
<button type="submit">{% trans 'Reset Password' %}</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% block customJS %}
|
||||
{% endblock %}
|
||||
{% block customJS %}
|
||||
<script src="{% static 'js/js-utils.js' %}"></script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -162,4 +162,4 @@
|
||||
</div>
|
||||
<div>
|
||||
{% include "bill/includes/mark_as.html" %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
{% load static %}
|
||||
{% load django_ledger %}
|
||||
{% load widget_tweaks %}
|
||||
<form id="bill-update-form"
|
||||
<form id="bill-update-form"
|
||||
action="{% url 'bill-update-items' dealer_slug=dealer_slug entity_slug=entity_slug bill_pk=bill_pk %}"
|
||||
method="post">
|
||||
<div class="container-fluid py-4">
|
||||
@ -130,4 +130,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
@ -55,8 +55,8 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer d-flex align-items-center gap-2 border-top border-translucent ps-3 pe-4 py-3">
|
||||
</div>
|
||||
<div class="card-footer d-flex align-items-center gap-2 border-top border-translucent ps-3 pe-4 py-3">
|
||||
<div class="d-flex align-items-center flex-1 gap-3 border border-translucent rounded-pill px-4">
|
||||
<input class="form-control outline-none border-0 flex-1 fs-9 px-0"
|
||||
type="text"
|
||||
@ -75,10 +75,10 @@
|
||||
<button class="btn p-0 border-0 send-btn">
|
||||
<span class="fa-solid fa-paper-plane fs-9"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-support-chat p-0 border border-translucent">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-support-chat p-0 border border-translucent">
|
||||
<span class="fs-8 btn-text text-primary text-nowrap">Chat demo</span><span class="ping-icon-wrapper mt-n4 ms-n6 mt-sm-0 ms-sm-2 position-absolute position-sm-relative"><span class="ping-icon-bg"></span><span class="fa-solid fa-circle ping-icon"></span></span><span class="fa-solid fa-headset text-primary fs-8 d-sm-none"></span><span class="fa-solid fa-chevron-down text-primary fs-7"></span>
|
||||
</button>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
hx-target="#notesTable"
|
||||
hx-on::after-request="{ resetSubmitButton(document.querySelector('.add_note_form button[type=submit]')); $('#noteModal').modal('hide'); }"
|
||||
hx-swap="outerHTML show:window.top"
|
||||
hx-select-oob="#timeline"
|
||||
method="post"
|
||||
class="add_note_form">
|
||||
{% csrf_token %}
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
hx-target=".taskTable"
|
||||
hx-on::after-request="{ resetSubmitButton(document.querySelector('.add_schedule_form button[type=submit]')); $('#scheduleModal').modal('hide'); }"
|
||||
hx-swap="outerHTML"
|
||||
hx-select-oob="#toast-container:outerHTML"
|
||||
hx-select-oob="#toast-container:outerHTML,#timeline:outerHTML"
|
||||
method="post"
|
||||
class="add_schedule_form">
|
||||
{% csrf_token %}
|
||||
|
||||
@ -335,7 +335,7 @@
|
||||
</div>
|
||||
<div class="row justify-content-between align-items-md-center hover-actions-trigger btn-reveal-trigger border-translucent py-3 gx-0 border-top">
|
||||
<div class="col-12 col-lg-auto">
|
||||
<div class="timeline-basic mb-9">
|
||||
<div id="timeline" class="timeline-basic mb-9">
|
||||
{% for activity in activities %}
|
||||
<div class="timeline-item">
|
||||
<div class="row g-3">
|
||||
@ -354,6 +354,8 @@
|
||||
<span class="fa-solid fa-users text-danger fs-8"></span>
|
||||
{% elif activity.activity_type == "whatsapp" %}
|
||||
<span class="fab fa-whatsapp text-success-dark fs-7"></span>
|
||||
{% elif activity.activity_type == "meeting" %}
|
||||
<span class="fa-solid fa-users text-danger fs-8"></span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if forloop.last %}
|
||||
@ -815,8 +817,8 @@
|
||||
{% include "components/note_modal.html" with content_type="lead" slug=lead.slug %}
|
||||
<!-- schedule Modal -->
|
||||
{% include "components/schedule_modal.html" with content_type="lead" slug=lead.slug %}
|
||||
{% endblock content %}
|
||||
{% block customJS %}
|
||||
{% endblock content %}
|
||||
{% block customJS %}
|
||||
<script>
|
||||
function reset_form() {
|
||||
document.querySelector('#id_note').value = ""
|
||||
@ -873,4 +875,4 @@
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock customJS %}
|
||||
{% endblock customJS %}
|
||||
|
||||
@ -260,4 +260,4 @@
|
||||
{% url 'lead_create' request.dealer.slug as create_lead_url %}
|
||||
{% include "empty-illustration-page.html" with value=empty_state_value url=create_lead_url %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -59,6 +59,6 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
||||
@ -3,16 +3,16 @@
|
||||
<form method="post"
|
||||
action="{% url 'update_note_to_lead' note.pk %}"
|
||||
enctype="multipart/form-data">
|
||||
{% else %}
|
||||
{% else %}
|
||||
<form method="post"
|
||||
action="{% url 'add_note_to_lead' lead.slug %}"
|
||||
enctype="multipart/form-data">
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
{% if form.instance.pk %}
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
{% if form.instance.pk %}
|
||||
<button type="submit" class="btn btn-sm btn-phoenix-primary w-100">{{ _("Update") }}</button>
|
||||
{% else %}
|
||||
{% else %}
|
||||
<button type="submit" class="btn btn-sm btn-phoenix-success w-100">{{ _("Add") }}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
@ -7,24 +7,24 @@
|
||||
|
||||
{% block customeCSS %}
|
||||
|
||||
/* General Layout */
|
||||
body {
|
||||
/* General Layout */
|
||||
body {
|
||||
background-color: #f8f9fa; /* Light gray background for contrast */
|
||||
}
|
||||
}
|
||||
|
||||
/* List Item Styling */
|
||||
.list-item {
|
||||
/* List Item Styling */
|
||||
.list-item {
|
||||
transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.list-item:hover {
|
||||
.list-item:hover {
|
||||
background-color: #f1f3f5;
|
||||
transform: translateY(-2px); /* Subtle lift on hover */
|
||||
}
|
||||
}
|
||||
|
||||
/* Unread Notification Dot */
|
||||
.unread-dot {
|
||||
/* Unread Notification Dot */
|
||||
.unread-dot {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
@ -32,12 +32,12 @@ body {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
/* HTMX Loading Indicator */
|
||||
.htmx-request #loading-indicator {
|
||||
/* HTMX Loading Indicator */
|
||||
.htmx-request #loading-indicator {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<main class="container-fluid p-5">
|
||||
|
||||
@ -629,7 +629,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade"
|
||||
<div class="tab-pane fade"
|
||||
id="tab-emails"
|
||||
role="tabpanel"
|
||||
aria-labelledby="emails-tab">
|
||||
@ -738,9 +738,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade"
|
||||
<div class="tab-pane fade"
|
||||
id="tab-activity"
|
||||
hx-get="{% url 'opportunity_detail' request.dealer.slug opportunity.slug %}"
|
||||
hx-trigger="htmx:afterRequest from:"
|
||||
@ -813,11 +813,11 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade"
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade"
|
||||
id="updateStageModal"
|
||||
tabindex="-1"
|
||||
aria-hidden="true">
|
||||
@ -846,18 +846,18 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'modal/delete_modal.html' %}
|
||||
</div>
|
||||
{% include 'modal/delete_modal.html' %}
|
||||
<!-- email Modal -->
|
||||
{% include "components/email_modal.html" %}
|
||||
{% include "components/email_modal.html" %}
|
||||
<!-- task Modal -->
|
||||
{% include "components/task_modal.html" with content_type="opportunity" slug=opportunity.slug %}
|
||||
{% include "components/task_modal.html" with content_type="opportunity" slug=opportunity.slug %}
|
||||
<!-- note Modal -->
|
||||
{% include "components/note_modal.html" with content_type="opportunity" slug=opportunity.slug %}
|
||||
{% include "components/note_modal.html" with content_type="opportunity" slug=opportunity.slug %}
|
||||
<!-- schedule Modal -->
|
||||
{% include "components/schedule_modal.html" with content_type="opportunity" slug=opportunity.slug %}
|
||||
{% include "components/schedule_modal.html" with content_type="opportunity" slug=opportunity.slug %}
|
||||
|
||||
<div class="modal fade"
|
||||
<div class="modal fade"
|
||||
id="estimateModal"
|
||||
tabindex="-1"
|
||||
aria-labelledby="estimateModalLabel"
|
||||
|
||||
@ -181,7 +181,7 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block customJS %}
|
||||
<script>
|
||||
<script>
|
||||
function updateProbabilityValue(value) {
|
||||
const amount = document.getElementById('id_amount');
|
||||
const expectedRevenue = document.getElementById('id_expected_revenue');
|
||||
@ -213,5 +213,5 @@
|
||||
updateProbabilityValue(rangeInput.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
{% endblock %}
|
||||
@ -161,4 +161,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
@ -163,4 +163,4 @@
|
||||
{% url "customer_create" request.dealer.slug as create_customer_url %}
|
||||
{% include "empty-illustration-page.html" with value=empty_state_value url=create_customer_url %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
'#39e6a9', '#4d4f79', '#9f1d35', '#2a5a5b', '#f77f00',
|
||||
'#3282b8', '#00bcd4', '#009688', '#4caf50', '#8bc34a',
|
||||
'#ffeb3b', '#ff9800', '#ff5722', '#795548', '#9e9e9e'
|
||||
];
|
||||
];
|
||||
|
||||
// Pass translated strings from Django to JavaScript
|
||||
const translatedStrings = {
|
||||
@ -326,11 +326,11 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
// -----------------------------------------------------------
|
||||
// 5. Inventory by Make (Pie Chart)
|
||||
// -----------------------------------------------------------
|
||||
{% if request.is_dealer or request.is_manager or request.is_inventory %}
|
||||
{% if request.is_dealer or request.is_manager or request.is_inventory %}
|
||||
const ctxInventoryMake = document.getElementById('inventoryByMakeChart').getContext('2d');
|
||||
new Chart(ctxInventoryMake, {
|
||||
type: 'pie',
|
||||
|
||||
@ -126,4 +126,4 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
@ -1,7 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}
|
||||
{% trans "Sales Dashboard" %}
|
||||
{% trans "Sales Dashboard" %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="main-content flex-grow-1 container-fluid mt-4 mb-3">
|
||||
|
||||
@ -340,4 +340,4 @@
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@ -210,12 +210,12 @@
|
||||
<button class="btn btn-support-chat p-0 border border-translucent">
|
||||
<span class="fs-8 btn-text text-primary text-nowrap">Chat demo</span><span class="ping-icon-wrapper mt-n4 ms-n6 mt-sm-0 ms-sm-2 position-absolute position-sm-relative"><span class="ping-icon-bg"></span><span class="fa-solid fa-circle ping-icon"></span></span><span class="fa-solid fa-headset text-primary fs-8 d-sm-none"></span><span class="fa-solid fa-chevron-down text-primary fs-7"></span>
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</main>
|
||||
<!-- ===============================================-->
|
||||
<!-- End of Main Content-->
|
||||
<!-- ===============================================-->
|
||||
<div class="offcanvas offcanvas-end settings-panel border-0"
|
||||
<div class="offcanvas offcanvas-end settings-panel border-0"
|
||||
id="settings-offcanvas"
|
||||
tabindex="-1"
|
||||
aria-labelledby="settings-offcanvas">
|
||||
@ -532,8 +532,8 @@
|
||||
href="https://themes.getbootstrap.com/product/phoenix-admin-dashboard-webapp-template/"
|
||||
target="_blank">Purchase template</a>
|
||||
</div>
|
||||
</div>
|
||||
<a class="card setting-toggle"
|
||||
</div>
|
||||
<a class="card setting-toggle"
|
||||
href="#settings-offcanvas"
|
||||
data-bs-toggle="offcanvas">
|
||||
<div class="card-body d-flex align-items-center px-2 py-1">
|
||||
@ -555,19 +555,19 @@
|
||||
</div>
|
||||
<small class="text-uppercase text-body-tertiary fw-bold py-2 pe-2 ps-1 rounded-end">customize</small>
|
||||
</div>
|
||||
</a>
|
||||
</a>
|
||||
<!-- ===============================================-->
|
||||
<!-- JavaScripts-->
|
||||
<!-- ===============================================-->
|
||||
<script src="../../vendors/popper/popper.min.js"></script>
|
||||
<script src="../../vendors/bootstrap/bootstrap.min.js"></script>
|
||||
<script src="../../vendors/anchorjs/anchor.min.js"></script>
|
||||
<script src="../../vendors/is/is.min.js"></script>
|
||||
<script src="../../vendors/fontawesome/all.min.js"></script>
|
||||
<script src="../../vendors/lodash/lodash.min.js"></script>
|
||||
<script src="../../vendors/list.js/list.min.js"></script>
|
||||
<script src="../../vendors/feather-icons/feather.min.js"></script>
|
||||
<script src="../../vendors/dayjs/dayjs.min.js"></script>
|
||||
<script src="../../assets/js/phoenix.js"></script>
|
||||
</body>
|
||||
<script src="../../vendors/popper/popper.min.js"></script>
|
||||
<script src="../../vendors/bootstrap/bootstrap.min.js"></script>
|
||||
<script src="../../vendors/anchorjs/anchor.min.js"></script>
|
||||
<script src="../../vendors/is/is.min.js"></script>
|
||||
<script src="../../vendors/fontawesome/all.min.js"></script>
|
||||
<script src="../../vendors/lodash/lodash.min.js"></script>
|
||||
<script src="../../vendors/list.js/list.min.js"></script>
|
||||
<script src="../../vendors/feather-icons/feather.min.js"></script>
|
||||
<script src="../../vendors/dayjs/dayjs.min.js"></script>
|
||||
<script src="../../assets/js/phoenix.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -206,12 +206,12 @@
|
||||
<button class="btn btn-support-chat p-0 border border-translucent">
|
||||
<span class="fs-8 btn-text text-primary text-nowrap">Chat demo</span><span class="ping-icon-wrapper mt-n4 ms-n6 mt-sm-0 ms-sm-2 position-absolute position-sm-relative"><span class="ping-icon-bg"></span><span class="fa-solid fa-circle ping-icon"></span></span><span class="fa-solid fa-headset text-primary fs-8 d-sm-none"></span><span class="fa-solid fa-chevron-down text-primary fs-7"></span>
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</main>
|
||||
<!-- ===============================================-->
|
||||
<!-- End of Main Content-->
|
||||
<!-- ===============================================-->
|
||||
<div class="offcanvas offcanvas-end settings-panel border-0"
|
||||
<div class="offcanvas offcanvas-end settings-panel border-0"
|
||||
id="settings-offcanvas"
|
||||
tabindex="-1"
|
||||
aria-labelledby="settings-offcanvas">
|
||||
@ -528,8 +528,8 @@
|
||||
href="https://themes.getbootstrap.com/product/phoenix-admin-dashboard-webapp-template/"
|
||||
target="_blank">Purchase template</a>
|
||||
</div>
|
||||
</div>
|
||||
<a class="card setting-toggle"
|
||||
</div>
|
||||
<a class="card setting-toggle"
|
||||
href="#settings-offcanvas"
|
||||
data-bs-toggle="offcanvas">
|
||||
<div class="card-body d-flex align-items-center px-2 py-1">
|
||||
@ -551,19 +551,19 @@
|
||||
</div>
|
||||
<small class="text-uppercase text-body-tertiary fw-bold py-2 pe-2 ps-1 rounded-end">customize</small>
|
||||
</div>
|
||||
</a>
|
||||
</a>
|
||||
<!-- ===============================================-->
|
||||
<!-- JavaScripts-->
|
||||
<!-- ===============================================-->
|
||||
<script src="../../vendors/popper/popper.min.js"></script>
|
||||
<script src="../../vendors/bootstrap/bootstrap.min.js"></script>
|
||||
<script src="../../vendors/anchorjs/anchor.min.js"></script>
|
||||
<script src="../../vendors/is/is.min.js"></script>
|
||||
<script src="../../vendors/fontawesome/all.min.js"></script>
|
||||
<script src="../../vendors/lodash/lodash.min.js"></script>
|
||||
<script src="../../vendors/list.js/list.min.js"></script>
|
||||
<script src="../../vendors/feather-icons/feather.min.js"></script>
|
||||
<script src="../../vendors/dayjs/dayjs.min.js"></script>
|
||||
<script src="../../assets/js/phoenix.js"></script>
|
||||
</body>
|
||||
<script src="../../vendors/popper/popper.min.js"></script>
|
||||
<script src="../../vendors/bootstrap/bootstrap.min.js"></script>
|
||||
<script src="../../vendors/anchorjs/anchor.min.js"></script>
|
||||
<script src="../../vendors/is/is.min.js"></script>
|
||||
<script src="../../vendors/fontawesome/all.min.js"></script>
|
||||
<script src="../../vendors/lodash/lodash.min.js"></script>
|
||||
<script src="../../vendors/list.js/list.min.js"></script>
|
||||
<script src="../../vendors/feather-icons/feather.min.js"></script>
|
||||
<script src="../../vendors/dayjs/dayjs.min.js"></script>
|
||||
<script src="../../assets/js/phoenix.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -125,4 +125,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -438,10 +438,10 @@
|
||||
|
||||
</ul>
|
||||
</div> {% endcomment %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="navbar-vertical-footer">
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="navbar-vertical-footer">
|
||||
<a class="nav-link ps-2" href="{% if request.is_dealer%}{% url 'ticket_list' request.dealer.slug %} {% else %}#{%endif%}">
|
||||
<div class="d-flex align-items-center">
|
||||
{% if user.is_authenticated%}
|
||||
@ -452,7 +452,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<nav class="navbar navbar-top fixed-top navbar-expand" id="navbarDefault">
|
||||
<div class="collapse navbar-collapse justify-content-between">
|
||||
@ -677,8 +677,8 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
{% load i18n %}
|
||||
{% block title %}
|
||||
{% trans 'Add Colors' %} {% endblock %}
|
||||
{% block content %}
|
||||
{% block content %}
|
||||
<div class="row mt-4 mb-3">
|
||||
<h3 class="text-center">{% trans "Add Colors" %}</h3>
|
||||
<p class="text-center">
|
||||
@ -117,4 +117,4 @@
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -91,8 +91,8 @@
|
||||
<span class="ms-2 badge rounded-pill text-bg-light">{{ active_estimates|length }}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if perms.inventory.view_car %}
|
||||
<div class="row-fluid {% if car.status == 'sold' %}disabled{% endif %}">
|
||||
<div class="row g-3 justify-content-between">
|
||||
@ -542,7 +542,7 @@
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="Close"></button>
|
||||
</div>
|
||||
<div id="estimateModalBody" class="main-modal-body" style="padding: 20px;">
|
||||
<div id="estimateModalBody" style="padding: 20px;">
|
||||
<form action="{% url 'create_estimate_for_car' request.dealer.slug car.slug %}" method="post">
|
||||
{% csrf_token %}
|
||||
{{estimate_form|crispy}}
|
||||
@ -660,7 +660,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block customJS %}
|
||||
<script>
|
||||
@ -772,15 +772,15 @@
|
||||
|
||||
document.addEventListener('htmx:afterRequest', e => {
|
||||
console.log('PUT Success!')
|
||||
});
|
||||
document.addEventListener('htmx:beforeSwap', e => {
|
||||
});
|
||||
document.addEventListener('htmx:beforeSwap', e => {
|
||||
console.log('Before Swap!')
|
||||
});
|
||||
document.addEventListener('htmx:swapError', e => {
|
||||
});
|
||||
document.addEventListener('htmx:swapError', e => {
|
||||
console.log('Swap Error!')
|
||||
});
|
||||
document.addEventListener('htmx:afterSwap', e => {
|
||||
});
|
||||
document.addEventListener('htmx:afterSwap', e => {
|
||||
console.log('After Swap!')
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@ -303,10 +303,10 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block customJS%}
|
||||
<script>
|
||||
<script>
|
||||
function toggle_filter() {
|
||||
const filterContainer = document.querySelector('.filter');
|
||||
filterContainer.classList.toggle('d-none');
|
||||
}
|
||||
</script>
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
@ -45,7 +45,7 @@
|
||||
#065535
|
||||
#000000
|
||||
#133337
|
||||
#ffc0cb</a>
|
||||
#ffc0cb</a>
|
||||
<br>
|
||||
<span class="glyphicon glyphicon-star"></span>707
|
||||
</div>
|
||||
|
||||
@ -355,4 +355,4 @@
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@ -7,14 +7,14 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<section class="hero-section text-center py-5">
|
||||
<section class="hero-section text-center py-5">
|
||||
<div class="container">
|
||||
<h1 class="display-4 fw-bold text-primary">{{ expense.name|title }}</h1>
|
||||
<p class="lead text-muted">{% trans "Comprehensive details for your expense." %}</p>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<div class="container my-5">
|
||||
<div class="container my-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-11">
|
||||
<div class="card shadow-lg border-0 rounded-4">
|
||||
@ -93,5 +93,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@ -7,14 +7,14 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<section class="hero-section text-center py-5">
|
||||
<section class="hero-section text-center py-5">
|
||||
<div class="container">
|
||||
<h1 class="display-5 fw-bold">{{ service.name|title }}</h1>
|
||||
<p class=" mt-3">{{ service.description|default:"No description provided." }}</p>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section class="py-5">
|
||||
<section class="py-5">
|
||||
<div class="container">
|
||||
|
||||
<div class="card mb-5 p-4 p-lg-5">
|
||||
@ -61,6 +61,6 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@ -78,4 +78,4 @@
|
||||
{% url 'bank_account_create' request.dealer.slug as create_bank_account_url %}
|
||||
{% include "empty-illustration-page.html" with value="bank account" url=create_bank_account_url %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -49,6 +49,8 @@
|
||||
<span class="badge badge-phoenix badge-phoenix-success">
|
||||
{% elif bill.is_canceled %}
|
||||
<span class="badge badge-phoenix badge-phoenix-danger">
|
||||
{% elif bill.is_void %}
|
||||
<span class="badge badge-phoenix badge-phoenix-secondary">
|
||||
{% endif %}
|
||||
{{ bill.bill_status }}
|
||||
</span>
|
||||
@ -92,4 +94,4 @@
|
||||
{% url "bill-create" request.dealer.slug request.entity.slug as create_bill_url %}
|
||||
{% include "empty-illustration-page.html" with value="bill" url=create_bill_url %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -156,4 +156,4 @@
|
||||
</div>
|
||||
</div>
|
||||
<!--test-->
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -56,4 +56,4 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -293,7 +293,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const makeSelect = document.getElementById('make-select');
|
||||
const modelSelect = document.getElementById('model-select');
|
||||
@ -357,6 +357,6 @@
|
||||
// Initial call to populate other dropdowns on page load
|
||||
fetchAndUpdateDropdowns();
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
@ -13,7 +13,7 @@
|
||||
font-size: 0.50rem">{{ notifications_.count }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<a class="nav-link"
|
||||
<a class="nav-link"
|
||||
href="{% url 'fetch_notifications' %}"
|
||||
hx-get="{% url 'fetch_notifications' %}"
|
||||
hx-swap="innerHTML"
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<main class="d-flex align-items-center justify-content-center min-vh-80 py-5">
|
||||
<main class="d-flex align-items-center justify-content-center min-vh-80 py-5">
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow-lg border-0 rounded-4 overflow-hidden animate__animated animate__fadeInUp">
|
||||
<div class="card-header bg-gradient py-4 border-0 rounded-top-4">
|
||||
@ -34,5 +34,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</main>
|
||||
{% endblock %}
|
||||
@ -12,4 +12,4 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -54,4 +54,4 @@
|
||||
{% endblocktrans %}
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<div class="max-w-4xl mx-auto">
|
||||
<div class="max-w-4xl mx-auto">
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<h1 class="text-3xl font-bold text-gray-800">
|
||||
{% blocktrans with object.id as order_id %}Order #{{ order_id }}{% endblocktrans %}
|
||||
@ -104,5 +104,5 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@ -155,12 +155,14 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if po_model.can_void %}
|
||||
{% comment %} TODO: upgrade djnago ledger or replace core functionality {% endcomment %}
|
||||
{% comment %} issue with django ledger base functionality when marking as void throughs error , will be fix in future {% endcomment %}
|
||||
{% comment %} {% if po_model.can_void %}
|
||||
<button class="btn btn-phoenix-danger"
|
||||
onclick="showPOModal('{% trans "Void Purchase Order" %}', '{% url 'po-action-mark-as-void' request.dealer.slug entity_slug po_model.pk %}', 'Mark As Void')">
|
||||
<i class="fas fa-times-circle me-2"></i>{% trans 'Void' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
{% endif %} {% endcomment %}
|
||||
{% if po_model.can_cancel %}
|
||||
<button class="btn btn-phoenix-secondary"
|
||||
onclick="showPOModal('Cancel PO', '{% url 'po-action-mark-as-canceled' request.dealer.slug entity_slug po_model.pk %}', 'Mark As Cancelled')">
|
||||
|
||||
@ -32,8 +32,8 @@
|
||||
</button>
|
||||
{% endif %}
|
||||
</th>
|
||||
<th>{% trans 'Unit Cost' %}</th>
|
||||
<th>{% trans 'Quantity' %}</th>
|
||||
<th>{% trans 'Unit Cost' %}</th>
|
||||
<th>{% trans 'Unit' %}</th>
|
||||
<th class="text-end">{% trans 'Amount' %}</th>
|
||||
<th>{% trans 'Status' %}</th>
|
||||
@ -52,8 +52,8 @@
|
||||
{{ f.item_model|add_class:"form-control" }}
|
||||
{% if f.errors %}<div class="text-danger small">{{ f.errors }}</div>{% endif %}
|
||||
</td>
|
||||
<td id="{{ f.instance.html_id_unit_cost }}">{{ f.po_unit_cost|add_class:"form-control" }}</td>
|
||||
<td id="{{ f.instance.html_id_quantity }}">{{ f.po_quantity|add_class:"form-control" }}</td>
|
||||
<td id="{{ f.instance.html_id_unit_cost }}">{{ f.po_unit_cost|add_class:"form-control" }}</td>
|
||||
<td>{{ f.entity_unit|add_class:"form-control" }}</td>
|
||||
<td class="text-end" id="{{ f.instance.html_id_total_amount }}">
|
||||
<span class="currency">{{ CURRENCY }}</span>{{ f.instance.po_total_amount | currency_format }}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
{% load i18n static custom_filters num2words_tags %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="ar" dir="rtl">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ po_model.po_number }}</title>
|
||||
<style>
|
||||
@ -152,8 +152,8 @@
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document-header">
|
||||
|
||||
<div>
|
||||
@ -228,5 +228,5 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
@ -106,4 +106,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ po_model.po_number }}</title>
|
||||
<style>
|
||||
@ -144,8 +144,8 @@
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document-header">
|
||||
<div>
|
||||
<h1>{{ dealer.name }}</h1>
|
||||
@ -218,5 +218,5 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
@ -124,4 +124,4 @@
|
||||
{% include "message-illustration.html" with value1=_("You don't have a Vendor, Please add a Vendor before creating a Purchase Order.") value2=_("Create New Vendor") url=vendor_create_url %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -58,4 +58,4 @@
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
{% endblock content %}
|
||||
{% endblock content %}
|
||||
|
||||
@ -47,8 +47,8 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
<!-- Results table -->
|
||||
<div class="table-responsive mt-3">{% include "recalls/partials/recall_cars_table.html" %}</div>
|
||||
<div class="table-responsive mt-3">{% include "recalls/partials/recall_cars_table.html" %}</div>
|
||||
{% endblock content %}
|
||||
|
||||
@ -315,15 +315,15 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of .row-->
|
||||
</section>
|
||||
</section>
|
||||
<!-- <section> close ============================-->
|
||||
<!-- ============================================-->
|
||||
<!-- add update Modal -->
|
||||
<div class="modal fade"
|
||||
<div class="modal fade"
|
||||
id="additionalModal"
|
||||
tabindex="-1"
|
||||
aria-labelledby="additionalModalLabel"
|
||||
@ -348,7 +348,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block customJS %}
|
||||
<script>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{% load i18n static custom_filters num2words_tags %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="ar" dir="rtl">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>عرض سعر</title>
|
||||
|
||||
@ -168,8 +168,8 @@
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="document-header">
|
||||
<div>
|
||||
@ -255,9 +255,9 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<div class="table-container">
|
||||
<div class="table-header">
|
||||
<span>التفاصيل المالية</span>
|
||||
</div>
|
||||
@ -291,7 +291,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if data.additional_services %}
|
||||
<div class="table-container">
|
||||
@ -353,5 +353,5 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,7 +1,7 @@
|
||||
{% load static custom_filters num2words_tags %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Quotation</title>
|
||||
|
||||
@ -171,8 +171,8 @@
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="document-header">
|
||||
<div>
|
||||
@ -258,9 +258,9 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<div class="table-container">
|
||||
<div class="table-header">
|
||||
<span>Financial Details</span>
|
||||
</div>
|
||||
@ -294,7 +294,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if data.additional_services %}
|
||||
<div class="table-container">
|
||||
@ -356,5 +356,5 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
@ -379,7 +379,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
{% endblock %}
|
||||
{% block customJS %}
|
||||
<script>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{% load i18n static custom_filters num2words_tags %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="ar">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% trans "Invoice Preview" %}</title>
|
||||
|
||||
@ -158,8 +158,8 @@
|
||||
font-size: 9px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document-container">
|
||||
<div class="document-header">
|
||||
<div>
|
||||
@ -329,5 +329,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,7 +1,7 @@
|
||||
{% load static custom_filters num2words_tags %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="ar" dir="rtl">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<title>فاتورة</title>
|
||||
@ -170,8 +170,8 @@
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="document-header">
|
||||
<div>
|
||||
@ -257,9 +257,9 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<div class="table-container">
|
||||
<div class="table-header">
|
||||
<span>التفاصيل المالية</span>
|
||||
</div>
|
||||
@ -293,7 +293,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if data.additional_services %}
|
||||
<div class="table-container">
|
||||
@ -355,5 +355,5 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,7 +1,7 @@
|
||||
{% load static custom_filters num2words_tags %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Invoice</title>
|
||||
|
||||
@ -172,8 +172,8 @@
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="document-header">
|
||||
<div>
|
||||
@ -259,9 +259,9 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<div class="table-container">
|
||||
<div class="table-header">
|
||||
<span>Financial Details</span>
|
||||
</div>
|
||||
@ -295,7 +295,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if data.additional_services %}
|
||||
<div class="table-container">
|
||||
@ -357,5 +357,5 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
@ -22,6 +22,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@ -53,4 +53,4 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
{% load custom_filters %}
|
||||
{% block title %}
|
||||
{% trans 'Sale Orders' %} {% endblock %}
|
||||
{% block content %}
|
||||
{% block content %}
|
||||
{% if txs or request.GET.q %}
|
||||
<section class="mt-2">
|
||||
<div class="row overflow-x-auto whitespace-nowrap -mx-2 sm:mx-0">
|
||||
@ -122,4 +122,4 @@
|
||||
{% url 'estimate_create' request.dealer.slug as url %}
|
||||
{% include "empty-illustration-page.html" with value="Sale Orders" url=url %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
{% load crispy_forms_tags %}
|
||||
{% load i18n %}
|
||||
{% block title %}
|
||||
{% trans "Update Ticket" %} #{{ ticket.id }}
|
||||
{% trans "Update Ticket" %} #{{ ticket.id }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container py-5">
|
||||
|
||||
2
templates/vendors/vendors_list.html
vendored
2
templates/vendors/vendors_list.html
vendored
@ -168,4 +168,4 @@
|
||||
{% url "vendor_create" request.dealer.slug as create_vendor_url %}
|
||||
{% include "empty-illustration-page.html" with value="vendor" url=create_vendor_url %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user