Files

147 lines
7.2 KiB
XML
Raw Permalink Normal View History

2026-05-29 14:52:16 -04:00
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="utf-8" indent="yes"/>
<!-- Parameters -->
<xsl:param name="VERSION">1.0</xsl:param>
<xsl:param name="PAGE-TITLE">Add Subscription to User</xsl:param>
<xsl:param name="PAGE-NAME">addSubscriptionToUser</xsl:param>
<xsl:template match="/">
<script src="js/{$PAGE-NAME}.js?version={$VERSION}"/>
<div class="{$PAGE-NAME}">
<div class="card">
<div class="card-header bg-primary text-white p-1 ps-3">
<i class="bi bi-list-check me-2"/>
<xsl:value-of select="$PAGE-TITLE"/>
|
<xsl:value-of select="//users/record/user_name"/>
|
<xsl:value-of select="//users/record/user_id"/>
</div>
<div class="card-body">
<form action="" name="{$PAGE-NAME}" method="post" id="{$PAGE-NAME}">
<input type="hidden" name="action" value="Subscriptions.addSubscriptionToUser"/>
<input type="hidden" name="step" value="add"/>
<input type="hidden" name="user_serial" value="{//users/record/user_serial}"/>
<div class="alert alert-info py-2 small">
<i class="bi bi-info-circle me-2"/>
The subscriptions listed below will be added to the user.
</div>
<div class="row g-4">
<!-- Left Side: Subscriptions Being Copied -->
<div class="col-lg-8">
<div class="card h-100">
<div class="card-body p-0">
<div class="">
<table class="table table-sm table-striped table-hover mb-0 align-middle subscriptions_error">
<thead class="table-light">
<tr>
<th style="width: 20px;">
<input type="checkbox" class="form-check-input" id="selectAllSubscriptions"/>
</th>
<th>Subscription</th>
<th>Start Date</th>
<th>End Date</th>
</tr>
</thead>
<tbody>
<xsl:choose>
<xsl:when test="count(//subscriptions/record[not(subscription_serial = //usersubscriptions/record/usersubscription_subscription)]) = 0">
<tr>
<td colspan="4" class="text-center text-muted py-3">
This user already has all available subscriptions.
</td>
</tr>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="//subscriptions/record[not(subscription_serial = //usersubscriptions/record/usersubscription_subscription)]"/>
</xsl:otherwise>
</xsl:choose>
</tbody>
</table>
</div>
<div id="subscriptions_errors" class="d-none px-3 pt-3">
<div class="alert alert-danger py-2 small">
<i class="bi bi-info-circle me-2"/>
Select at least one subscription to copy.
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<div class="buttons mt-1 mb-2">
<div class="buttons mt-3 mb-1">
<button type="button" class="btn btn-sm btn-primary me-2 btnCancel">
<i class="bi bi-box-arrow-left me-2"/>Cancel
</button>
<button type="button" class="btn btn-sm btn-primary me-2 btnSave">
<i class="bi bi-floppy me-2"/>Save</button>
</div>
</div>
</div>
</div>
</div>
</xsl:template>
<!-- Subscriptions Rows -->
<xsl:template match="subscriptions/record">
<tr>
<td>
<input type="checkbox" class="form-check-input subscription-checkbox" name="subscriptions[]" value="{subscription_serial}"/>
</td>
<td class="fw-semibold">
<xsl:value-of select="subscription_full_title"/>
</td>
<td>
<div class="input-group input-group-sm subscription_start_date">
<input type="text" class="form-control form-control-sm date-mask subscription-start-date" name="subscription_start_date[]"/>
<button class="btn btn-sm btn-outline-primary btnSubscriptionStartDateCalendar" type="button" data-bs-toggle="tooltip" data-bs-title="Calendar" data-bs-custom-class="custom-tooltip" tabindex="-1">
<i class="bi bi-calendar3"/>
</button>
</div>
</td>
<td>
<div class="input-group input-group-sm subscription_end_date">
<input type="text" class="form-control form-control-sm date-mask subscription-end-date" name="subscription_end_date[]"/>
<button class="btn btn-sm btn-outline-primary btnSubscriptionEndDateCalendar" type="button" data-bs-toggle="tooltip" data-bs-title="Calendar" data-bs-custom-class="custom-tooltip" tabindex="-1">
<i class="bi bi-calendar3"/>
</button>
</div>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>