Files
atlhousingreport/xsl/userSubscriptions.xsl
T

150 lines
5.1 KiB
XML
Raw Normal View History

<?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">My Subscriptions</xsl:param>
<xsl:param name="PAGE-NAME">userSubscriptions</xsl:param>
<!-- Main Template -->
<xsl:template match="/">
<script src="js/{$PAGE-NAME}.js?version={$VERSION}"/>
<div class="{$PAGE-NAME}">
<xsl:choose>
<xsl:when test="count(//alerts/record) > 0">
<div class="card mb-4">
<div class="card-header bg-danger text-white p-1 ps-3">
<i class="bi bi-info-circle me-2"/>
Messages
</div>
<div class="card-body">
<xsl:apply-templates select="//alerts"/>
</div>
</div>
</xsl:when>
</xsl:choose>
<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"/>
</div>
<div class="card-body">
<xsl:choose>
<xsl:when test="count(//usersubscriptions/record) = 0">
<div class="fs-5 text-danger fw-bold fst-italic mt-2 mb-2">
<xsl:text>There are no Active Subscriptions to view... Please Contact Support</xsl:text>
</div>
</xsl:when>
<xsl:otherwise>
<div class="table-wrapper table-responsive">
<table class="table table-sm table-striped table-hover base-table table-auto" id="usersubscription-table">
<thead class="sticky-header" data-theme="{$THEME}">
<th class="text-nowrap">Name</th>
<th class="text-nowrap">Expiration Date</th>
<th class="text-nowrap">Status</th>
</thead>
<tbody>
<xsl:apply-templates select="//usersubscriptions"/>
</tbody>
</table>
</div>
</xsl:otherwise>
</xsl:choose>
</div>
</div>
</div>
</xsl:template>
<!-- Template for table rows -->
<xsl:template match="usersubscriptions/record">
<tr class="hoverable usersubscription-row" data-subscription-serial="{subscription_serial}">
<td class="subscription_title">
<xsl:value-of select="concat(subscription_title, '-', subscription_description)"/>
</td>
<td class="usersubscription_stop_date_verbose" data-usersubscription-stop-date="{usersubscription_stop_date}">
<xsl:value-of select="usersubscription_stop_date_verbose"/>
</td>
<td class="usersubscription_status">
<xsl:choose>
<xsl:when test="usersubscription_status = 'EXPIRED'">
<span class="badge rounded-pill text-bg-danger">
<xsl:value-of select="usersubscription_status"/>
</span>
</xsl:when>
<xsl:otherwise>
<span class="badge text-bg-success">
<xsl:value-of select="usersubscription_status"/>
</span>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
<!-- Template to create Alerts objects -->
<xsl:template match="alerts">
<xsl:for-each select="record">
<div class="row">
<xsl:value-of select="alert_message" disable-output-escaping="yes"/>
</div>
<!-- <div class="row alert-time-elapsed-row mb-0 text-muted">
<div class="col alert-company">
<xsl:value-of select="alert_time_elapsed"/>
</div>
</div>-->
<xsl:if test="position() != last()">
<hr class="mt-1 mb-1"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>