Update JavaScript to support label layout in readonly mode matching the new structure

This commit is contained in:
Mohamed Eltayar 2025-08-28 15:42:25 +03:00
parent b24a733f24
commit 1375ec9270
1 changed files with 23 additions and 24 deletions

View File

@ -126,33 +126,32 @@ 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) : '';
// Gregorian Date Section
// Original Gregorian date (unchanged)
$('<div>', {
class: 'o_date_section'
}).append([
$('<label>', {
class: 'o_date_label o_gregorian_label',
text: 'التاريخ الميلادي'
}),
$('<div>', {
class: 'o_date_value ' + this.$el.attr('class'),
text: value,
})
]).appendTo($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 Section
$('<div>', {
class: 'o_date_section'
}).append([
$('<label>', {
class: 'o_date_label o_hijri_label',
text: 'التاريخ الهجري'
}),
$('<div>', {
class: 'o_date_value ' + this.$el.attr('class'),
text: hijri_value,
})
]).appendTo($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);
this.datewidget.appendTo('<div>').then(function () {
self._replaceElement($div);