update
This commit is contained in:
parent
91ef0da13b
commit
00c07b5442
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -31,10 +31,11 @@ class CarTrimAdmin(ExportMixin, admin.ModelAdmin):
|
||||
admin.site.register(models.Dealer)
|
||||
admin.site.register(models.Staff)
|
||||
admin.site.register(models.Vendor)
|
||||
admin.site.register(models.DealerSettings)
|
||||
# admin.site.register(models.SaleQuotation)
|
||||
# admin.site.register(models.SaleQuotationCar)
|
||||
admin.site.register(models.SaleOrder)
|
||||
|
||||
admin.site.register(models.CustomGroup)
|
||||
admin.site.register(models.CarFinance)
|
||||
admin.site.register(models.CarColors)
|
||||
admin.site.register(models.CarRegistration)
|
||||
|
||||
@ -23,6 +23,7 @@ from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from appointment.models import StaffMember
|
||||
from plans.quota import get_user_quota
|
||||
# from simple_history.models import HistoricalRecords
|
||||
|
||||
|
||||
class DealerUserManager(UserManager):
|
||||
@ -318,6 +319,7 @@ class AdditionalServices(models.Model, LocalizedNameMixin):
|
||||
blank=True,
|
||||
)
|
||||
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
"name": self.name,
|
||||
@ -401,6 +403,7 @@ class Car(models.Model):
|
||||
mileage = models.IntegerField(blank=True, null=True, verbose_name=_("Mileage"))
|
||||
receiving_date = models.DateTimeField(verbose_name=_("Receiving Date"))
|
||||
hash = models.CharField(max_length=64, blank=True, null=True, verbose_name=_("Hash"))
|
||||
# history = HistoricalRecords()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.hash = self.get_hash
|
||||
|
||||
@ -883,12 +883,12 @@ def update_car_status_on_reservation_update(sender, instance, **kwargs):
|
||||
# notes=f"New schedule created for {instance.purpose} with {instance.lead.full_name} on {instance.scheduled_at}."
|
||||
# )
|
||||
|
||||
@receiver(post_save, sender=models.Staff)
|
||||
def check_users_quota(sender, instance, **kwargs):
|
||||
quota_dict = get_user_quota(instance.dealer.user)
|
||||
allowed_users = quota_dict.get("Users")
|
||||
if allowed_users is None:
|
||||
raise ValidationError(_("The user quota for staff members is not defined. Please contact support."))
|
||||
current_staff_count = instance.dealer.staff.count()
|
||||
if current_staff_count > allowed_users:
|
||||
raise ValidationError(_("You have reached the maximum number of staff users allowed for your plan."))
|
||||
# @receiver(post_save, sender=models.Staff)
|
||||
# def check_users_quota(sender, instance, **kwargs):
|
||||
# quota_dict = get_user_quota(instance.dealer.user)
|
||||
# allowed_users = quota_dict.get("Users")
|
||||
# if allowed_users is None:
|
||||
# raise ValidationError(_("The user quota for staff members is not defined. Please contact support."))
|
||||
# current_staff_count = instance.dealer.staff.count()
|
||||
# if current_staff_count > allowed_users:
|
||||
# raise ValidationError(_("You have reached the maximum number of staff users allowed for your plan."))
|
||||
|
||||
@ -318,6 +318,13 @@ class TestView(TemplateView):
|
||||
class ManagerDashboard(LoginRequiredMixin, TemplateView):
|
||||
template_name = "dashboards/manager.html"
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
if (
|
||||
not request.user.is_authenticated
|
||||
):
|
||||
return redirect("welcome")
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
dealer = get_user_type(self.request)
|
||||
@ -3828,8 +3835,8 @@ def DealerSettingsView(request,pk):
|
||||
instance = form.save(commit=False)
|
||||
instance.dealer = dealer
|
||||
instance.save()
|
||||
messages.success(request, 'ssettings updated')
|
||||
return redirect('dealer_settings', pk=dealer.pk)
|
||||
messages.success(request, 'Settings updated')
|
||||
return redirect('dealer_detail', pk=dealer.pk)
|
||||
else:
|
||||
print(form.errors)
|
||||
form = forms.DealerSettingsForm(instance=dealer_setting,initial={'dealer':dealer})
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -18,6 +18,7 @@ beautifulsoup4==4.13.3
|
||||
bleach==6.2.0
|
||||
blinker==1.9.0
|
||||
Brotli==1.1.0
|
||||
cattrs==24.1.2
|
||||
certifi==2025.1.31
|
||||
cffi==1.17.1
|
||||
chardet==5.2.0
|
||||
@ -67,6 +68,7 @@ django-picklefield==3.2
|
||||
django-plans==1.2.0
|
||||
django-prometheus==2.3.1
|
||||
django-q2==1.7.6
|
||||
django-schema-graph==3.1.0
|
||||
django-sekizai==4.1.0
|
||||
django-sequences==3.0
|
||||
django-silk==5.3.2
|
||||
|
||||
BIN
static/images/images/Alamjdouie-Hyundai-logo_I8WTQve_NvbZyE9.png
Normal file
BIN
static/images/images/Alamjdouie-Hyundai-logo_I8WTQve_NvbZyE9.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
@ -32,7 +32,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">
|
||||
<a class="nav-link" href="{% url 'sales_dashboard' %}">
|
||||
<div class="d-flex align-items-center"><span class="nav-link-text">{{ _("Sales") }}</span></div>
|
||||
</a>
|
||||
</li>
|
||||
@ -451,15 +451,15 @@
|
||||
{% endif %}
|
||||
{% if request.is_dealer %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link px-3 d-block" href="{% url 'user_list' %}"><span class="me-2 text-body align-bottom" data-feather="users"></span>{{ _("Staff & Group") }}</a>
|
||||
<a class="nav-link px-3 d-block" href="{% url 'user_list' %}"><span class="me-2 text-body align-bottom" data-feather="users"></span>{{ _("Staff & Groups") }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link px-3 d-block" href="{% url 'dealer_activity' %}"> <span class="me-2 text-body align-bottom" data-feather="lock"></span>{{ _("Activity") }}</a>
|
||||
<a class="nav-link px-3 d-block" href="{% url 'dealer_activity' %}"> <span class="me-2 text-body align-bottom" data-feather="lock"></span>{{ _("Activities") }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
{% if request.is_dealer %}
|
||||
<a class="nav-link px-3 d-block" href="{% url 'dealer_settings' user.dealer.pk %}"> <span class="me-2 text-body align-bottom" data-feather="settings"></span>Settings & Privacy </a>
|
||||
<a class="nav-link px-3 d-block" href="{% url 'dealer_settings' user.dealer.pk %}"> <span class="me-2 text-body align-bottom" data-feather="settings"></span>{{ _("Settings") }}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
|
||||
@ -68,9 +68,9 @@
|
||||
{% elif estimate.status == 'approved' %}
|
||||
<span class="badge text-bg-success">{% trans "Approved" %}</span>
|
||||
{% elif estimate.status == 'completed' %}
|
||||
<span class="badge text-bg-success">{% trans "completed" %}</span>
|
||||
<span class="badge text-bg-success">{% trans "Completed" %}</span>
|
||||
{% elif estimate.status == 'canceled' %}
|
||||
<span class="badge text-bg-danger">{% trans "canceled" %}</span>
|
||||
<span class="badge text-bg-danger">{% trans "Canceled" %}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user