diff --git a/odex25_ensan/odex_takaful/__manifest__.py b/odex25_ensan/odex_takaful/__manifest__.py index 93c14dc4e..fa2b729ab 100644 --- a/odex25_ensan/odex_takaful/__manifest__.py +++ b/odex25_ensan/odex_takaful/__manifest__.py @@ -77,7 +77,7 @@ 'reports/transfer_deduction_report.xml', 'reports/transfer_deduction_report_templates.xml', ], - 'icon': 'static/description/icon5.png', + 'icon': 'static/description/icon.png', # 'installable': True, # 'application': True, # 'auto_install': False, diff --git a/odex25_ensan/odex_takaful/views/assets.xml b/odex25_ensan/odex_takaful/views/assets.xml index 4e5f5b785..8298c1ab8 100644 --- a/odex25_ensan/odex_takaful/views/assets.xml +++ b/odex25_ensan/odex_takaful/views/assets.xml @@ -206,37 +206,63 @@ _setupSimpleUI: function () { var self = this; var currentData = self.model.localData[self.handle].data; - // CRITICAL: Buttons are ONLY editable in 'draft' state - // Even if user clicks "Edit", buttons remain readonly if state != 'draft' + + // CRITICAL: Buttons are editable ONLY if: + // 1. Form is in edit mode (self.mode === 'edit') + // 2. AND state is 'draft' + var isFormEdit = self.mode === 'edit'; var isDraftState = currentData.state === 'draft'; + var isEditable = isFormEdit && isDraftState; // Remove old event handlers to prevent duplicates this.$('.record_option').off('click'); this.$('.mechanism_option').off('click'); - // Disable buttons if NOT in draft state (regardless of form mode) - if (!isDraftState) { + // Maintain visual selection (selected class) but disable interaction + // Update selected state based on current values + var recordType = currentData.record_type; + var donationMechanism = currentData.donation_mechanism; + + // Update visual selection for record_type + this.$('.record_option').each(function() { + var $opt = $(this); + if ($opt.data('value') === recordType) { + $opt.addClass('selected'); + } else { + $opt.removeClass('selected'); + } + }); + + // Update visual selection for donation_mechanism + this.$('.mechanism_option').each(function() { + var $opt = $(this); + if ($opt.data('value') === donationMechanism) { + $opt.addClass('selected'); + } else { + $opt.removeClass('selected'); + } + }); + + // Disable/Enable buttons based on edit state + if (!isEditable) { + // Disable buttons but KEEP their visual appearance (colors, selection) this.$('.record_option').css({ 'pointer-events': 'none', - 'opacity': '0.6', 'cursor': 'not-allowed' }); this.$('.mechanism_option').css({ 'pointer-events': 'none', - 'opacity': '0.6', 'cursor': 'not-allowed' }); - return; // Don't attach click handlers if not draft + return; // Don't attach click handlers } else { - // Enable buttons ONLY in draft state + // Enable buttons in draft state AND edit mode this.$('.record_option').css({ 'pointer-events': 'auto', - 'opacity': '1', 'cursor': 'pointer' }); this.$('.mechanism_option').css({ 'pointer-events': 'auto', - 'opacity': '1', 'cursor': 'pointer' }); } diff --git a/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml b/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml index 891e9881a..95bec7a24 100644 --- a/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml +++ b/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml @@ -218,7 +218,8 @@ - +