feat(badges): wire duplex field — hide badge back for single-sided templates
- Add duplex + style_href to properties_to_save so they're cached in IDB
- Derive show_badge_back: true when duplex is null/unset (safe default for
existing templates) or 1; false when duplex=0 (single-sided, e.g. Axonius
NYC using Zebra ZC10L PVC cards)
- Wrap entire badge_back section in {#if show_badge_back} so the DOM node
is fully removed rather than just hidden — cleaner than a CSS class approach
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,8 @@ export const properties_to_save = [
|
||||
'show_qr_back',
|
||||
'layout',
|
||||
'style_filename',
|
||||
'style_href',
|
||||
'duplex',
|
||||
'enable',
|
||||
'hide',
|
||||
'priority',
|
||||
|
||||
@@ -78,6 +78,12 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Show the badge back section when duplex=1 (or when duplex is not yet set, as a safe default).
|
||||
// duplex=0/false → single-sided print (e.g. Zebra ZC10L PVC cards); back section is hidden.
|
||||
let show_badge_back = $derived(
|
||||
$lq__event_badge_template_obj?.duplex == null || !!$lq__event_badge_template_obj?.duplex
|
||||
);
|
||||
|
||||
// *** Set initial variables
|
||||
$effect(() => {
|
||||
$slct.event_badge_id = event_badge_id; // $page['page_for']['event_badge_id'];
|
||||
@@ -1066,6 +1072,8 @@ onkeypress={() => {
|
||||
<!-- *** badge section end *** -->
|
||||
|
||||
<!-- *** badge_back (fold under) section start *** -->
|
||||
<!-- duplex=0 on the template hides this entire section (single-sided print) -->
|
||||
{#if show_badge_back}
|
||||
<section
|
||||
class="badge_back
|
||||
flex flex-col gap-1
|
||||
@@ -1408,6 +1416,7 @@ onkeypress={() => {
|
||||
<!-- </div> -->
|
||||
<!-- fold class div end -->
|
||||
</section>
|
||||
{/if}
|
||||
<!-- *** fold under section end *** -->
|
||||
|
||||
<!-- *** receipt section start *** -->
|
||||
|
||||
Reference in New Issue
Block a user