This commit is contained in:
Marwan Alwali 2025-02-09 09:49:42 +03:00
parent c4ea8db46e
commit 315589b669
7 changed files with 135 additions and 142 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
inventory/.DS_Store vendored

Binary file not shown.

View File

@ -1614,14 +1614,14 @@ def decode_vds(manufacturer, vds):
}, },
'Dongfeng': { 'Dongfeng': {
1: { # First character 1: {
'A': 'A-Series', 'A': 'A-Series',
'B': 'SHINE', # SHINE model 'B': 'SHINE',
'C': 'C-Series', # General C-Series 'C': 'C-Series',
'D': 'MAGE', # MAGE model 'D': 'MAGE',
'E': ['CAPTAIN E', 'E32'], # CAPTAIN and E-Series models 'E': ['CAPTAIN E', 'E32'],
'F': 'CAPTAIN C', # CAPTAIN C model 'F': 'CAPTAIN C',
'G': 'S50', # S50 model 'G': 'S50',
'H': 'Dongfeng Fengshen AX3', 'H': 'Dongfeng Fengshen AX3',
'J': 'Dongfeng Joyear SUV', 'J': 'Dongfeng Joyear SUV',
'K': 'Dongfeng Rich 6', 'K': 'Dongfeng Rich 6',
@ -1629,7 +1629,7 @@ def decode_vds(manufacturer, vds):
'M': 'Dongfeng Glory 580', 'M': 'Dongfeng Glory 580',
}, },
2: { # Second character (for C-Series) 2: {
'3': 'C35', # Specific models in C-Series '3': 'C35', # Specific models in C-Series
'1': 'C31', '1': 'C31',
'2': 'C32', '2': 'C32',

View File

@ -209,26 +209,23 @@ def dealer_signup(request, *args, **kwargs):
) )
# class Login(allauth_views.LoginView): # class OTPView(View, LoginRequiredMixin):
# template_name = "account/login.html" # template_name = "account/otp_verification.html"
# redirect_authenticated_user = True #
class OTPView(View, LoginRequiredMixin): # def get(self, request, *args, **kwargs):
template_name = "account/otp_verification.html" # # device = default_device(request.user)
# # device.generate_challenge()
def get(self, request, *args, **kwargs): # return render(request, self.template_name)
# device = default_device(request.user) #
# device.generate_challenge() # def post(self, request, *args, **kwargs):
return render(request, self.template_name) # otp_code = request.POST.get("otp_code")
#
def post(self, request, *args, **kwargs): # if self.verify_otp(otp_code, request.user):
otp_code = request.POST.get("otp_code") # messages.success(request, _("OTP verified successfully!"))
# return redirect("home")
if self.verify_otp(otp_code, request.user): #
messages.success(request, _("OTP verified successfully!")) # messages.error(request, _("Invalid OTP. Please try again."))
return redirect("home") # return render(request, self.template_name)
messages.error(request, _("Invalid OTP. Please try again."))
return render(request, self.template_name)
# def verify_otp(self, otp_code, user): # def verify_otp(self, otp_code, user):
# device = default_device(user) # device = default_device(user)
@ -237,8 +234,6 @@ class OTPView(View, LoginRequiredMixin):
# return False # return False
class HomeView(TemplateView): class HomeView(TemplateView):
template_name = "index.html" template_name = "index.html"

View File

@ -24,22 +24,22 @@
<!-- VIN --> <!-- VIN -->
<div class="col-lg-4 col-xl-6"> <div class="col-lg-4 col-xl-6">
<div class="card bg-body"> <div class="card bg-body mb-3">
<div class="card-body"> <div class="card-body">
<div class="form-floating"> <div class="form-floating">
<input type="text" <input type="text"
class="form-control form-control-sm" class="form-control form-control-sm"
id="{{ form.vin.id_for_label }}" name="{{ form.vin.html_name }}" required/> id="{{ form.vin.id_for_label }}" name="{{ form.vin.html_name }}" required/>
<label for="{{ form.vin.id_for_label }}">{% trans 'VIN' %}</label> <label for="{{ form.vin.id_for_label }}">{% trans 'VIN' %}</label>
</div> </div>
<div class="input-group input-group-sm my-2"> <div class="input-group input-group-sm my-2">
<button type="button" <button type="button"
class="btn btn-warning rounded-start" class="btn btn-warning rounded-start"
id="scan-vin-btn" id="scan-vin-btn"
data-bs-toggle="modal" data-bs-toggle="modal"
data-bs-target="#scannerModal"> data-bs-target="#scannerModal">
<span class="fas fa-camera fs-9"></span> <span class="fas fa-camera fs-9"></span>
</button> </button>
<button type="button" class="btn btn-sm btn-primary rounded-end ms-1" id="decodeVinBtn"> <button type="button" class="btn btn-sm btn-primary rounded-end ms-1" id="decodeVinBtn">
<span class="fas fa-search fs-9 fw-bolder"></span> <span class="fas fa-search fs-9 fw-bolder"></span>
</button> </button>
@ -76,16 +76,16 @@
</div> </div>
</div> </div>
<div class="col-6" id="trim-row"> <div class="col-6" id="trim-row">
<div class="form-floating"> <div class="form-floating">
<select class="form-select form-select-sm" <select class="form-select form-select-sm"
id="{{ form.id_car_trim.id_for_label }}" id="{{ form.id_car_trim.id_for_label }}"
name="{{ form.id_car_trim.html_name }}"> name="{{ form.id_car_trim.html_name }}">
<option value="">{% trans 'Select' %}</option> <option value="">{% trans 'Select' %}</option>
</select> </select>
<label for="{{ form.id_car_trim.id_for_label }}">{% trans 'trim'|capfirst %}</label> <label for="{{ form.id_car_trim.id_for_label }}">{% trans 'trim'|capfirst %}</label>
</div>
</div> </div>
</div> </div>
</div>
<div class="row mt-2"> <div class="row mt-2">
<div class="col-6" id="model-row"> <div class="col-6" id="model-row">
<div class="form-floating"> <div class="form-floating">
@ -97,115 +97,113 @@
</select> </select>
<label for="{{ form.id_car_model.id_for_label }}">{% trans 'model'|capfirst %}</label> <label for="{{ form.id_car_model.id_for_label }}">{% trans 'model'|capfirst %}</label>
</div> </div>
<div class="badge badge-phoenix fs-11 badge-phoenix-success m-1" id="generation-div"></div> <div class="badge badge-phoenix fs-11 badge-phoenix-success m-1" id="generation-div"></div>
</div>
<div class="col-4 align-items-center">
<button type="button"
class="btn btn-sm btn-phoenix-success p-1"
id="specification-btn"
data-bs-toggle="modal"
data-bs-target="#specificationsModal"
disabled>
{% trans 'specifications'|capfirst %}
</button>
<button type="button"
class="btn btn-sm btn-phoenix-warning p-1"
id="options-btn"
data-bs-toggle="modal"
data-bs-target="#equipmentOptionsModal"
disabled>{% trans 'options'|capfirst %}
</button>
</div> </div>
<div class="col-4 align-items-center">
<button type="button"
class="btn btn-sm btn-phoenix-success p-1"
id="specification-btn"
data-bs-toggle="modal"
data-bs-target="#specificationsModal"
disabled>{% trans 'specifications'|capfirst %}
</button>
<button type="button"
class="btn btn-sm btn-phoenix-warning p-1"
id="options-btn"
data-bs-toggle="modal"
data-bs-target="#equipmentOptionsModal"
disabled>{% trans 'options'|capfirst %}
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row g-3"> <div class="row g-3">
<div class="col-lg-4 col-xl-6"> <div class="col-lg-4 col-xl-6">
<div class="row"> <div class="row">
<!--Vendor Field--> <!--Vendor Field-->
<div class="col-lg-4 col-xl-4"> <div class="col-lg-4 col-xl-4">
<div class="card bg-body my-1"> <div class="card bg-body my-1">
<div class="card-body"> <div class="card-body">
<div class="form-floating"> <div class="form-floating">
{{ form.vendor|add_class:"form-select form-select-sm" }} {{ form.vendor|add_class:"form-select form-select-sm" }}
<label for="{{ form.vendor.id_for_label }}" class="form-label"> <label for="{{ form.vendor.id_for_label }}" class="form-label">
{% trans 'Vendor' %} {% trans 'Vendor' %}
</label> </label>
</div>
</div>
</div> </div>
</div> </div>
</div> <!-- Stock Type Card -->
</div> <div class="col-lg-4 col-xl-4">
<!-- Stock Type Card --> <div class="card bg-body my-1">
<div class="col-lg-4 col-xl-4">
<div class="card bg-body my-1">
<div class="card-body">
<div class="form-floating">
{{ form.stock_type|add_class:"form-select form-select-sm" }}
<label for="{{ form.stock_type.id_for_label }}">
{% trans 'Stock Type'|capfirst %}
</label>
</div>
</div>
</div>
</div>
<!-- Mileage Card -->
<div class="col-lg-4 col-xl-4">
<div class="card bg-body my-1">
<div class="card-body">
<div class="form-floating">
{{ form.mileage|add_class:"form-control form-control-sm" }}
<label for="{{ form.mileage.id_for_label }}">{% trans 'Mileage'|capfirst %}</label>
</div>
</div>
</div>
</div>
<!-- Receiving Date Field -->
<div class="col-lg-4 col-xl-4">
<div class="card bg-body my-3">
<div class="card-body"> <div class="card-body">
<div class="form-floating"> <div class="form-floating">
{{ form.receiving_date|add_class:"form-control form-control-sm" }} {{ form.stock_type|add_class:"form-select form-select-sm" }}
<label for="{{ form.receiving_date.id_for_label }}" <label for="{{ form.stock_type.id_for_label }}">
class="form-label"> {% trans 'Stock Type'|capfirst %}
{% trans 'Receiving Date' %}: </label>
</label> </div>
</div>
</div>
</div>
<!-- Mileage Card -->
<div class="col-lg-4 col-xl-4">
<div class="card bg-body my-1">
<div class="card-body">
<div class="form-floating">
{{ form.mileage|add_class:"form-control form-control-sm" }}
<label for="{{ form.mileage.id_for_label }}">{% trans 'Mileage'|capfirst %}</label>
</div>
</div>
</div>
</div>
<!-- Receiving Date Field -->
<div class="col-lg-4 col-xl-4">
<div class="card bg-body my-3">
<div class="card-body">
<div class="form-floating">
{{ form.receiving_date|add_class:"form-control form-control-sm" }}
<label for="{{ form.receiving_date.id_for_label }}"
class="form-label">
{% trans 'Receiving Date' %}:
</label>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> <!-- Remarks Card -->
<div class="col-lg-4 col-xl-8">
<!-- Remarks Card --> <div class="card bg-body my-3">
<div class="col-lg-4 col-xl-8"> <div class="card-body">
<div class="card bg-body my-3"> <div class="form-floating">
<div class="card-body"> {{ form.remarks|add_class:"form-control form-control-sm" }}
<div class="form-floating"> <label for="{{ form.remarks.id_for_label }}">
{{ form.remarks|add_class:"form-control form-control-sm" }} {% trans 'Remarks'|capfirst %}:
<label for="{{ form.remarks.id_for_label }}"> </label>
{% trans 'Remarks'|capfirst %}: </div>
</label> </div>
</div>
</div> </div>
</div>
<!--Specifications Buttons-->
<div class="btn-group mt-3">
<button type="submit" name="add_another" value="true" class="btn btn-sm btn-phoenix-success me-1">
{% trans "Save and Add Another" %}
</button>
<button type="submit" name="go_to_stats" value="true" class="btn btn-sm btn-phoenix-primary">
{% trans "Save and Go to Inventory" %}
</button>
</div> </div>
</div>
</div> </div>
</div>
<!--Specifications Buttons-->
<div class="btn-group mt-3">
<button type="submit" name="add_another" value="true" class="btn btn-sm btn-phoenix-success me-1">
{% trans "Save and Add Another" %}
</button>
<button type="submit" name="go_to_stats" value="true" class="btn btn-sm btn-phoenix-primary">
{% trans "Save and Go to Inventory" %}
</button>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</form>
<!--Specification Modal--> <!--Specification Modal-->
<div class="modal fade" <div class="modal fade"
@ -289,7 +287,7 @@
</div> </div>
</div> </div>
</div> </div>
</form>
</div> </div>
<script> <script>