update
This commit is contained in:
parent
7379bb9e4d
commit
53d7db0bfc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
from django import forms
|
||||
from django.utils.translation import get_language
|
||||
|
||||
from django.urls import reverse, reverse_lazy
|
||||
|
||||
class AddClassMixin:
|
||||
"""
|
||||
@ -41,3 +41,26 @@ class LocalizedNameMixin:
|
||||
# return super().form_valid(form)
|
||||
# else:
|
||||
# return form.errors
|
||||
class BaseDateNavigationUrlMixIn:
|
||||
BASE_DATE_URL_KWARGS = (
|
||||
'entity_slug',
|
||||
'unit_slug',
|
||||
'ledger_pk',
|
||||
'account_pk',
|
||||
'coa_slug'
|
||||
)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(BaseDateNavigationUrlMixIn, self).get_context_data(**kwargs)
|
||||
self.get_base_date_nav_url(context)
|
||||
return context
|
||||
|
||||
def get_base_date_nav_url(self, context, **kwargs):
|
||||
view_name = context['view'].request.resolver_match.url_name
|
||||
view_name_base = '-'.join(view_name.split('-')[:2])
|
||||
context['date_navigation_url'] = reverse(
|
||||
view_name_base,
|
||||
kwargs={
|
||||
k: v for k, v in self.kwargs.items() if
|
||||
k in self.BASE_DATE_URL_KWARGS
|
||||
})
|
||||
Binary file not shown.
@ -326,3 +326,24 @@ def number_to_words_arabic(number):
|
||||
# return number_to_words_arabic(number)
|
||||
# else:
|
||||
# return number_to_words_english(number)
|
||||
|
||||
@register.inclusion_tag('components/date_picker.html', takes_context=True)
|
||||
def date_picker(context, nav_url=None, date_picker_id=None):
|
||||
try:
|
||||
entity_slug = context['view'].kwargs.get('entity_slug')
|
||||
except KeyError:
|
||||
entity_slug = context['entity_slug']
|
||||
|
||||
if not date_picker_id:
|
||||
date_picker_id = f'djl-datepicker-{randint(10000, 99999)}'
|
||||
|
||||
if 'date_picker_ids' not in context:
|
||||
context['date_picker_ids'] = list()
|
||||
context['date_picker_ids'].append(date_picker_id)
|
||||
|
||||
date_navigation_url = nav_url if nav_url else context.get('date_navigation_url')
|
||||
return {
|
||||
'entity_slug': entity_slug,
|
||||
'date_picker_id': date_picker_id,
|
||||
'date_navigation_url': date_navigation_url
|
||||
}
|
||||
@ -439,21 +439,23 @@ class AjaxHandlerView(LoginRequiredMixin, View):
|
||||
model_id = request.GET.get("model_id")
|
||||
year = request.GET.get("year")
|
||||
|
||||
if not model_id or not year:
|
||||
return JsonResponse(
|
||||
{"error": "Missing required parameters: model_id or year"}, status=400
|
||||
)
|
||||
model_id = int(model_id)
|
||||
year = int(year)
|
||||
|
||||
query = Q(id_car_model=model_id) & (
|
||||
Q(year_begin__lte=year, year_end__gte=year) |
|
||||
Q(year_end__isnull=True) |
|
||||
Q(year_begin__isnull=True)
|
||||
)
|
||||
try:
|
||||
model_id = int(model_id)
|
||||
year = int(year)
|
||||
except ValueError:
|
||||
return JsonResponse({"error": "Invalid year format"}, status=400)
|
||||
|
||||
series = models.CarSerie.objects.filter(
|
||||
id_car_model=model_id,year_begin__lte = year, year_end__gte = year
|
||||
).values("id_car_serie", "name", "arabic_name", "generation_name")
|
||||
#
|
||||
|
||||
series = models.CarSerie.objects.filter(query).values(
|
||||
"id_car_serie",
|
||||
"name",
|
||||
"arabic_name",
|
||||
"generation_name"
|
||||
)
|
||||
except Exception as e:
|
||||
return JsonResponse({"error": "Server error occurred"}, status=500)
|
||||
return JsonResponse(list(series), safe=False)
|
||||
|
||||
def get_trims(self, request):
|
||||
|
||||
Binary file not shown.
@ -7470,27 +7470,18 @@ msgid "Not set."
|
||||
msgstr "غير محدد"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/appointment/utils/date_time.py:84
|
||||
#, fuzzy, python-format
|
||||
#| msgid "%(count)d day"
|
||||
#| msgid_plural "%(count)d days"
|
||||
msgid "%(count)d day"
|
||||
msgid_plural "%(count)d days"
|
||||
msgstr[0] "%(num)d يوم"
|
||||
msgstr[1] "%(num)d أيام"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/appointment/utils/date_time.py:88
|
||||
#, fuzzy, python-format
|
||||
#| msgid "%(count)d hour"
|
||||
#| msgid_plural "%(count)d hours"
|
||||
msgid "%(count)d hour"
|
||||
msgid_plural "%(count)d hours"
|
||||
msgstr[0] "%(num)d ساعة"
|
||||
msgstr[1] "%(num)d ساعات"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/appointment/utils/date_time.py:92
|
||||
#, fuzzy, python-format
|
||||
#| msgid "%(count)d minute"
|
||||
#| msgid_plural "%(count)d minutes"
|
||||
msgid "%(count)d minute"
|
||||
msgid_plural "%(count)d minutes"
|
||||
msgstr[0] "%(num)d دقيقة"
|
||||
@ -8921,62 +8912,62 @@ msgstr "ديسمبر"
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:53
|
||||
msgctxt "abbrev. month"
|
||||
msgid "Jan."
|
||||
msgstr "يناير."
|
||||
msgstr "يناير"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:54
|
||||
msgctxt "abbrev. month"
|
||||
msgid "Feb."
|
||||
msgstr "فبراير."
|
||||
msgstr "فبراير"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:55
|
||||
msgctxt "abbrev. month"
|
||||
msgid "March"
|
||||
msgstr "مارس."
|
||||
msgstr "مارس"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:56
|
||||
msgctxt "abbrev. month"
|
||||
msgid "April"
|
||||
msgstr "أبريل."
|
||||
msgstr "أبريل"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:57
|
||||
msgctxt "abbrev. month"
|
||||
msgid "May"
|
||||
msgstr "مايو."
|
||||
msgstr "مايو"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:58
|
||||
msgctxt "abbrev. month"
|
||||
msgid "June"
|
||||
msgstr "يونيو."
|
||||
msgstr "يونيو"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:59
|
||||
msgctxt "abbrev. month"
|
||||
msgid "July"
|
||||
msgstr "يوليو."
|
||||
msgstr "يوليو"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:60
|
||||
msgctxt "abbrev. month"
|
||||
msgid "Aug."
|
||||
msgstr "أغسطس."
|
||||
msgstr "أغسطس"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:61
|
||||
msgctxt "abbrev. month"
|
||||
msgid "Sept."
|
||||
msgstr "سبتمبر."
|
||||
msgstr "سبتمبر"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:62
|
||||
msgctxt "abbrev. month"
|
||||
msgid "Oct."
|
||||
msgstr "أكتوبر."
|
||||
msgstr "أكتوبر"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:63
|
||||
msgctxt "abbrev. month"
|
||||
msgid "Nov."
|
||||
msgstr "نوفمبر."
|
||||
msgstr "نوفمبر"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:64
|
||||
msgctxt "abbrev. month"
|
||||
msgid "Dec."
|
||||
msgstr "ديسمبر."
|
||||
msgstr "ديسمبر"
|
||||
|
||||
#: venv/lib/python3.11/site-packages/django/utils/dates.py:67
|
||||
msgctxt "alt. month"
|
||||
|
||||
BIN
static/images/car_make/Lincoln.png
Normal file
BIN
static/images/car_make/Lincoln.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.6 KiB |
@ -106,7 +106,7 @@ function notify(tag,msg){
|
||||
|
||||
</main>
|
||||
{% block customJS %}
|
||||
<script src="{% static 'django_ledger/bundle/djetler.bundle.js' %}"></script>
|
||||
<script src="{% static 'js/djetler.bundle.js' %}"></script>
|
||||
|
||||
<script src="{% static 'js/js-utils.js' %}"></script>
|
||||
<script src="{% static 'js/modal/show_modal.js' %}"></script>
|
||||
|
||||
7
templates/ledger/reports/components/date_picker.html
Normal file
7
templates/ledger/reports/components/date_picker.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% load i18n %}
|
||||
|
||||
{% if date_navigation_url %}
|
||||
<button id="{{ date_picker_id }}" data-baseurl="{{ date_navigation_url }}"
|
||||
class="button is-small is-rounded is-dark is-outlined">{% trans 'Select Date' %}</button>
|
||||
{% endif %}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
{% load django_ledger %}
|
||||
|
||||
{% load i18n %}
|
||||
|
||||
<div class="card shadow-sm">
|
||||
@ -17,15 +18,15 @@
|
||||
<div class="text-center mb-3">
|
||||
<p class="mb-1">
|
||||
|
||||
<span class="fw-bold">Year: </span>
|
||||
<span class="fw-bold">{{ _("Year") }}: </span>
|
||||
<a href="{{ previous_year_url }}" class="text-decoration-none me-2">
|
||||
<span class="fas fa-chevron-left"> </span>
|
||||
<span class="fas fa-chevron-left"> </span>
|
||||
<span class="fas fa-chevron-right"> </span>
|
||||
<span class="fas fa-chevron-right"> </span>
|
||||
{{ previous_year }}</a>
|
||||
<a href="{{ current_year_url }}" class="text-decoration-none me-2 fw-bolder">{{ year }}</a>
|
||||
<a href="{{ next_year_url }}" class="text-decoration-none">{{ next_year }}
|
||||
<span class="fas fa-chevron-right"> </span>
|
||||
<span class="fas fa-chevron-right"> </span>
|
||||
<span class="fas fa-chevron-left"> </span>
|
||||
<span class="fas fa-chevron-left"> </span>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
<h2 class="display-4 font-weight-light">
|
||||
{% if quarter %}{{ year }} | Q{{ quarter }}
|
||||
{% elif month %}{{ start_date | date:'F, Y' }}
|
||||
{% else %}Fiscal Year {{ year }}
|
||||
{% else %}{{ _("Fiscal Year")}} {{ year }}
|
||||
{% endif %}</h2>
|
||||
<h3 class="h4 font-italic font-weight-light">
|
||||
{{ from_date | date:'m/d/Y' }} - {{ to_date | date:'m/d/Y' }}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user