Files
votervue/xsl/searchRecreationalLicenses.xsl
T
2026-07-03 15:46:56 -04:00

501 lines
27 KiB
XML

<?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">2.0</xsl:param>
<xsl:param name="PAGE-TITLE">Search Recreational Licenses</xsl:param>
<xsl:param name="PAGE-NAME">searchRecreationalLicenses</xsl:param>
<!-- Variables -->
<xsl:variable name="PAGINATION_COUNT" select="//licenses/@count"/>
<xsl:variable name="PAGINATION_START" select="//licenses/@start"/>
<xsl:variable name="PAGINATION_END" select="//licenses/@end"/>
<xsl:variable name="PAGINATION_PAGE" select="//licenses/@page"/>
<xsl:template match="/">
<script src="js/{$PAGE-NAME}.js?version={$VERSION}"/>
<div class="{$PAGE-NAME}">
<div class="row g-4">
<div class="col-lg-3">
<div class="card">
<div class="card-header bg-primary text-white p-1 ps-3 d-flex align-items-center">
<i class="bi bi-search me-2"/>
<xsl:value-of select="$PAGE-TITLE"/>
</div>
<div class="card-body">
<form action="" name="{$PAGE-NAME}" method="post" id="{$PAGE-NAME}">
<input type="hidden" name="action" value="FWCLicenses.searchRecreationalLicenses"/>
<input type="hidden" name="step" value="search"/>
<div class="row">
<div class="col-lg-6 mb-3">
<label class="form-label" for="license_last_name">Last Name</label>
<input type="text" class="form-control form-control-sm" name="license_last_name" id="license_last_name" maxlength="100" autocomplete="off"/>
</div>
<div class="col-lg-6 mb-3">
<label class="form-label" for="license_first_name">First Name</label>
<input type="text" class="form-control form-control-sm" name="license_first_name" id="license_first_name" maxlength="100" autocomplete="off"/>
</div>
</div>
<div class="row">
<div class="col-lg-6 mb-3">
<label class="form-label" for="license_county">County</label>
<select class="form-control form-control-sm multiple-dropdown" multiple="multiple" name="license_county[]" id="license_county" size="1">
<xsl:call-template name="dropdowns">
<xsl:with-param name="dropdown-name" select="'florida_counties'"/>
<xsl:with-param name="selected-path" select="'florida_counties'"/>
</xsl:call-template>
</select>
</div>
<div class="col-lg-6 mb-3">
<label class="form-label" for="license_city">City</label>
<input type="text" class="form-control form-control-sm" name="license_city" id="license_city" maxlength="100" autocomplete="off"/>
</div>
</div>
<div class="row">
<div class="col-lg-12 mb-3">
<label class="form-label" for="license_type">License Type</label>
<select class="form-control form-control-sm multiple-dropdown" multiple="multiple" name="license_type[]" id="license_type" size="1">
<xsl:call-template name="dropdowns">
<xsl:with-param name="dropdown-name" select="'license_types'"/>
<xsl:with-param name="selected-path" select="'license_types'"/>
</xsl:call-template>
</select>
</div>
</div>
<div class="row">
<div class="col-lg-6 mb-3">
<label class="form-label" for="license_start_date">Start Date</label>
<div class="input-group input-group-sm license_start_date">
<input type="text" class="form-control form-control-sm date-mask" name="license_start_date" id="license_start_date" autocomplete="off" value=""/>
<button class="btn btn-sm btn-outline-primary btnLicenseStartDateCalendar" type="button" tabindex="-1">
<i class="bi bi-calendar3"></i>
</button>
</div>
</div>
<div class="col-lg-6 mb-3">
<label class="form-label" for="license_expire_date">Expire Date</label>
<div class="input-group input-group-sm license_expire_date">
<input type="text" class="form-control form-control-sm date-mask" name="license_expire_date" id="license_expire_date" autocomplete="off" value=""/>
<button class="btn btn-sm btn-outline-primary btnLicenseExpireDateCalendar" type="button" tabindex="-1">
<i class="bi bi-calendar3"></i>
</button>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 mb-3">
<label class="form-label" for="license_gender">Gender</label>
<select class="form-control form-control-sm multiple-dropdown" multiple="multiple" name="license_gender[]" id="license_gender" size="1">
<xsl:apply-templates select="//Constants/Genders"/>
</select>
</div>
<div class="col-lg-6 mb-3">
<label class="form-label" for="license_ethnicity">Ethnicity</label>
<select class="form-control form-control-sm multiple-dropdown" multiple="multiple" name="license_ethnicity[]" id="license_ethnicity" size="1">
<xsl:call-template name="dropdowns">
<xsl:with-param name="dropdown-name" select="'ethnicities'"/>
<xsl:with-param name="selected-path" select="'ethnicities'"/>
</xsl:call-template>
</select>
</div>
</div>
</form>
<div class="buttons mt-1 mb-2">
<button type="button" class="btn btn-sm btn-primary me-2 btnHome">
<i class="bi bi-house me-2"/>Home</button>
<button type="button" class="btn btn-sm btn-primary me-2 btnSearch">
<i class="bi bi-search me-2"/>Search</button>
<button type="button" class="btn btn-sm btn-primary me-2 btnReset">
<i class="bi bi-arrow-clockwise me-2"/>Reset Search</button>
<div id="search-form-error" class="search-form-error fs-5 text-danger fw-bold fst-italic mt-3 mb-1 d-none">
</div>
</div>
</div>
</div> <!-- Search Card -->
</div>
<!-- Results Card -->
<div class="col-lg-9">
<xsl:choose>
<xsl:when test="count(//licenses/record) > 0">
<div class="card">
<div class="card-header bg-primary text-white p-1 ps-3">
<i class="bi bi-tools me-2"/>
Results
<xsl:if test="$PAGINATION_COUNT > 0">
<xsl:text> | Showing </xsl:text>
<xsl:value-of select="format-number($PAGINATION_START, '###,##0')"/>
<xsl:text> to </xsl:text>
<xsl:value-of select="format-number($PAGINATION_END, '###,##0')"/>
<xsl:text> of </xsl:text>
<xsl:value-of select="format-number($PAGINATION_COUNT, '###,##0')"/>
</xsl:if>
</div>
<div class="card-body">
<div class="row align-items-center mt-2 mb-2">
<div class="col-lg-4 mb-2">
<div class="input-group input-group-sm">
<input type="text" class="form-control autosave" name="filter" id="filter" maxlength="100" autocomplete="off" placeholder="{//popovers/record[popover_name = 'filter_licenses']/popover_placeholder}"/>
<button type="button" class="btn btn-primary fw-bold btnClearFilter" data-bs-toggle="tooltip" data-bs-title="Clear Filter" data-bs-custom-class="custom-tooltip">
<i class="bi bi-arrow-clockwise"/>
</button>
</div>
</div>
<div class="col-auto mb-2">
<div class="input-group input-group-sm" data-bs-toggle="tooltip" data-bs-title="Show Per Page" data-bs-custom-class="custom-tooltip">
<div class="input-group-text">
<i class="bi bi-list-ol"/>
</div>
<select class="form-select" name="licenses_per_page" id="licenses_per_page">
<option value="20">20</option>
<option value="40">40</option>
<option value="60">60</option>
<option value="80">80</option>
<option value="100">100</option>
</select>
</div>
</div>
</div>
<!-- Action Buttons -->
<div class="buttons mt-1 mb-1">
<xsl:if test="count(//licenses/record) > 0">
<button type="button" class="btn btn-sm btn-primary me-2 mb-2 btnSelectAll">
<i class="bi bi-check2-square me-2"/>Select All</button>
</xsl:if>
<button type="button" class="btn btn-sm btn-primary me-2 mb-2 btnDeselectAll d-none">
<i class="bi bi-square me-2"/>Deselect All</button>
<div class="btn-group">
<button type="button" class="btn btn-sm btn-primary me-2 mb-2 dropdown-toggle btnExportSelected d-none" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-download me-2"/>Export Selected
</button>
<ul class="dropdown-menu">
<li>
<button class="dropdown-item btnExportCSV">
<i class="bi bi-filetype-csv me-2"/>CSV File</button>
</li>
<li>
<button class="dropdown-item btnExportExcel">
<i class="bi bi-filetype-xlsx me-2"/>Excel Spreadsheet</button>
</li>
<li>
<button class="dropdown-item btnPrintSelected">
<i class="bi bi-printer me-2"/>PDF</button>
</li>
</ul>
</div>
<div class="btn-group">
<button type="button" class="btn btn-sm btn-primary me-2 mb-2 dropdown-toggle btnExportAll" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-download me-2"/>Export Full
</button>
<ul class="dropdown-menu">
<li>
<button class="dropdown-item btnExportSearchResultsCSV">
<i class="bi bi-filetype-csv me-2"/>CSV</button>
</li>
<li>
<button class="dropdown-item btnExportAllPDF">
<i class="bi bi-filetype-pdf me-1"></i>PDF</button>
</li>
</ul>
</div>
<div class="btn-group ms-2 mb-2" role="group">
<xsl:if test="$PAGINATION_PAGE > 1">
<button type="button" class="btn btn-sm btn-primary btnPagination" data-pagination="first" data-bs-toggle="tooltip" data-bs-title="First Page" data-bs-custom-class="custom-tooltip">
<i class="bi bi-chevron-bar-left me-1"/>First</button>
<button type="button" class="btn btn-sm btn-primary btnPagination" data-pagination="previous" data-bs-toggle="tooltip" data-bs-title="Previous Page" data-bs-custom-class="custom-tooltip">
<i class="bi bi-chevron-left me-1"/>Previous</button>
</xsl:if>
<xsl:if test="$PAGINATION_COUNT > $PAGINATION_END">
<button type="button" class="btn btn-sm btn-primary btnPagination" data-pagination="next" data-bs-toggle="tooltip" data-bs-title="Next Page" data-bs-custom-class="custom-tooltip">
<i class="bi bi-chevron-right me-1"/>Next</button>
<button type="button" class="btn btn-sm btn-primary btnPagination" data-pagination="last" data-bs-toggle="tooltip" data-bs-title="Last Page" data-bs-custom-class="custom-tooltip">
<i class="bi bi-chevron-bar-right me-1"/>Last</button>
</xsl:if>
</div>
</div>
<hr class="mt-2 mb-2"/>
<xsl:choose>
<xsl:when test="count(//licenses/record) = 0">
<div class="filter-error fs-5 text-danger fw-bold fst-italic mb-1">
<xsl:text>There are no Licenses to view...</xsl:text>
</div>
</xsl:when>
<xsl:otherwise>
<div class="filter-error fs-5 text-danger fw-bold fst-italic mb-1 d-none">
<xsl:text>There are no Licenses to view...</xsl:text>
</div>
<div class="table-responsive scrollable">
<table class="table table-sm table-striped table-hover base-table" id="licenses-table">
<thead class="sticky-header" data-theme="{$THEME}">
<th class="text-center" >Select</th>
<th class="text-nowrap sortable" data-order-by="license_first_name" >First Name</th>
<th class="text-nowrap sortable" data-order-by="license_last_name" >Last Name</th>
<th class="text-nowrap sortable" data-order-by="license_county" >County</th>
<th class="text-nowrap sortable" data-order-by="license_city" >City</th>
<th class="text-nowrap sortable" data-order-by="license_type" >Type</th>
<th class="text-nowrap sortable text-center" data-order-by="license_gender" >Gender</th>
<th class="text-nowrap sortable" data-order-by="license_ethnicity" >Ethnicity</th>
<th class="text-nowrap sortable" data-order-by="license_start_date" >Start Date</th>
<th class="text-nowrap sortable" data-order-by="license_expire_date">Expire Date</th>
</thead>
<tbody>
<xsl:apply-templates select="//licenses/record"/>
</tbody>
</table>
</div>
</xsl:otherwise>
</xsl:choose>
</div>
</div>
</xsl:when>
<xsl:otherwise>
<div class="card">
<div class="card-header bg-primary text-white p-1 ps-3">
<i class="bi bi-tools me-2"/>
Results
</div>
<div class="card-body">
<div class="fs-5 text-danger fw-bold fst-italic mb-1">
<xsl:text>There are no Licenses to view...</xsl:text>
</div>
</div>
</div>
</xsl:otherwise>
</xsl:choose>
</div>
</div>
</div>
</xsl:template>
<!-- Template for Dropdowns -->
<xsl:template name="dropdowns">
<xsl:param name="dropdown-name"/>
<!-- the node name inside searchhistory_parameters that holds <id> list -->
<xsl:param name="selected-path"/>
<!-- Grab the selected ids once -->
<xsl:variable name="selectedIds" select="/XML/searchhistory/record/searchhistory_parameters/*[name()=$selected-path]/id"/>
<xsl:for-each select="/XML/dropdowns/record[dropdowntype_name = $dropdown-name]">
<option value="{dropdown_serial}" data-tokens="{dropdown_value}">
<xsl:if test="$selectedIds = dropdown_serial">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="dropdown_value"/>
</option>
</xsl:for-each>
</xsl:template>
<!-- Template for Gender dropdown -->
<xsl:template match="Constants/Genders">
<xsl:for-each select="Gender">
<xsl:sort select="."/>
<option value="{@abbreviation}" data-tokens="{@abbreviation}">
<xsl:value-of select="." />
</option>
</xsl:for-each>
</xsl:template>
<!-- Template for License Types dropdown -->
<xsl:template match="licensetypes">
<xsl:for-each select="record">
<option value="{license_type}" data-tokens="{license_type}">
<xsl:value-of select="license_type"/>
</option>
</xsl:for-each>
</xsl:template>
<!-- Template for Cities dropdown -->
<xsl:template match="cities">
<xsl:for-each select="record">
<option value="{city_name}" data-tokens="{city_name}">
<xsl:value-of select="city_name"/>
</option>
</xsl:for-each>
</xsl:template>
<!-- Template for Commercial License Codes dropdown -->
<xsl:template match="licensecodes">
<xsl:for-each select="record">
<option value="{license_code}" data-tokens="{license_code}">
<xsl:value-of select="concat(license_code, ' - ', license_description)"/>
</option>
</xsl:for-each>
</xsl:template>
<!-- Template for Recreational License rows -->
<xsl:template match="licenses/record">
<xsl:choose>
<xsl:when test="../@type = 'commercial'">
<xsl:call-template name="commercial-license-row"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="recreational-license-row"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="recreational-license-row">
<tr class="hoverable license-row text-nowrap" data-license-serial="{license_serial}">
<td class="checkbox text-center selection-checkboxes selection-area">
<input type="checkbox" class="selection-checkbox selection-area" name="selected[]" value="{license_serial}">
</input>
<span class="selection-area user-select-none">&#160;</span>
</td>
<td class="license_first_name filterable">
<xsl:value-of select="license_first_name"/>
</td>
<td class="license_last_name text-nowrap filterable">
<xsl:value-of select="license_last_name"/>
</td>
<td class="license_county text-nowrap filterable">
<xsl:value-of select="license_county"/>
</td>
<td class="license_city text-nowrap filterable">
<xsl:value-of select="license_city"/>
</td>
<td class="license_type filterable">
<xsl:value-of select="license_type"/>
</td>
<td class="license_gender text-center">
<xsl:value-of select="license_gender"/>
</td>
<td class="license_ethnicity filterable">
<xsl:value-of select="license_ethnicity"/>
</td>
<td class="license_start_date filterable">
<xsl:value-of select="license_start_date_verbose"/>
</td>
<td class="license_expire_date filterable">
<xsl:value-of select="license_expire_date_verbose"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>