Simplify JavaScript to remove complex label logic and use simple display for readonly mode

This commit is contained in:
Mohamed Eltayar 2025-08-28 15:54:22 +03:00
parent c92a8875b8
commit a7887fbddc
1 changed files with 6 additions and 20 deletions

View File

@ -126,32 +126,18 @@ odoo.define('web_hijri_datepicker.datepicker', function (require) {
var parsed_date = this.value ? this.datewidget._parseDate(this.value) : '';
var hijri_value = parsed_date ? this.datewidget._convertGregorianToHijri(parsed_date) : '';
// Original Gregorian date (unchanged)
// Gregorian Date
$('<div>', {
class: this.$el.attr('class'),
text: value,
}).appendTo($div);
// Hijri date with label layout
var $hijriContainer = $('<div>', {
class: 'o_hijri_readonly_container'
});
var $hijriRow = $('<div>', {
class: 'o_hijri_readonly_row'
}).appendTo($hijriContainer);
// Hijri Date with simple display
$('<div>', {
class: 'o_hijri_readonly_label',
text: 'التاريخ الهجري:'
}).appendTo($hijriRow);
$('<div>', {
class: 'o_hijri_readonly_value ' + this.$el.attr('class'),
text: hijri_value,
}).appendTo($hijriRow);
$hijriContainer.appendTo($div);
class: this.$el.attr('class') + ' mt-1',
text: hijri_value ? 'التاريخ الهجري: ' + hijri_value : '',
style: 'font-size: 12px; color: #6c757d;'
}).appendTo($div);
this.datewidget.appendTo('<div>').then(function () {
self._replaceElement($div);