176 lines
11 KiB
Plaintext
176 lines
11 KiB
Plaintext
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
$numStaff = db_getVal("SELECT count(*) FROM users WHERE school_num = $base_school_num AND type = 'Staff'");
|
|
$numParents = db_getVal("SELECT count(*) FROM users WHERE school_num = $base_school_num AND type = 'Parent'");
|
|
$numGuests = db_getVal("SELECT count(*) FROM users WHERE school_num = $base_school_num AND type = 'Guest'");
|
|
$numSuppliers = db_getVal("SELECT count(*) FROM users WHERE school_num = $base_school_num AND type = 'Supplier'");
|
|
|
|
?>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<script>
|
|
tailwind.config = { important: '#uo-tw', corePlugins: { preflight: false } }
|
|
</script>
|
|
<style type="text/tailwindcss">
|
|
@layer base {
|
|
#uo-tw *, #uo-tw *::before, #uo-tw *::after {
|
|
box-sizing: border-box;
|
|
border-width: 0;
|
|
border-style: solid;
|
|
border-color: currentColor;
|
|
}
|
|
#uo-tw button { cursor: pointer; }
|
|
#uo-tw input, #uo-tw button, #uo-tw a, #uo-tw select, #uo-tw textarea {
|
|
font-family: inherit;
|
|
font-size: 100%;
|
|
line-height: inherit;
|
|
text-decoration: none;
|
|
color: inherit;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
}
|
|
</style>
|
|
<div id="uo-tw">
|
|
<div class="px-2 py-2 md:px-6 md:py-4 text-left">
|
|
<!-- Header -->
|
|
<div class="flex items-start justify-between mb-4 gap-3">
|
|
<div class="relative flex-1">
|
|
<span class="block w-xs absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0z"/>
|
|
</svg>
|
|
</span>
|
|
<input type='text' name='user-search-field' id='user-search-field'
|
|
placeholder="Search by name, email, or ID..."
|
|
class="flex w-full pl-9 pr-3 py-2 border border-gray-300 rounded-lg text-xs focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent">
|
|
</div>
|
|
<button id='view-matching-users' class="px-4 py-2 border border-gray-300 rounded-lg text-xs font-semibold text-gray-700 hover:bg-gray-50">
|
|
<?php displayLanguageText('TEXT-VIEW'); ?>
|
|
</button>
|
|
<?php if ($school_record['status'] != 'Linked') { ?>
|
|
<a href='#' id='add-user' class='inline-flex items-center gap-1.5 bg-red-600 hover:bg-red-700 text-white text-xs font-semibold px-3 py-2 rounded-lg'>
|
|
+ <?php displayLanguageText('TEXT-ADD-NEW'); ?>
|
|
</a>
|
|
<?php } ?>
|
|
</div>
|
|
|
|
<?php if (strpos($action,'users') !== FALSE) { ?>
|
|
|
|
<!-- FILTER BY -->
|
|
<div class="mb-2">
|
|
<p class="section-toggle text-xs font-semibold text-gray-400 uppercase tracking-widest mb-2 flex items-center justify-between md:hidden">Filter By <span class="chevron md:hidden text-gray-400 transition-transform ">▼</span></p>
|
|
<div class="section-content flex flex-wrap gap-2">
|
|
<div class="text-xs font-semibold text-gray-400 uppercase mr-4 tracking-widest flex items-center hidden md:inline-block">Filter By <span class="chevron md:hidden text-gray-400 transition-transform">▼</span></div>
|
|
|
|
<a href='#' id='view-all-users' class='px-2 py-1 border border-2 border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-VIEW-ALL'); ?></a>
|
|
<a href='#' id='view-admin-users' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-ADMIN-USERS'); ?></a>
|
|
<?php if ($numStaff > 0) { ?>
|
|
<a href='#' id='view-staff-users' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php echo($school_record['group_leaders']) ?></a>
|
|
<?php } ?>
|
|
<?php if ($numParents > 0) { ?>
|
|
<a href='#' id='view-parent-users' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php echo($school_record['registrants_are']) ?></a>
|
|
<?php } ?>
|
|
<?php if ($numGuests > 0) { ?>
|
|
<a href='#' id='view-guest-users' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-GUESTS'); ?></a>
|
|
<?php } ?>
|
|
<?php if ($numSuppliers > 0) { ?>
|
|
<a href='#' id='view-supplier-users' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-SUPPLIERS'); ?></a>
|
|
<?php } ?>
|
|
<?php if ($school_record['registration_volunteer_list'] == 'Y') { ?>
|
|
<a href='#' id='view-users-volunteers' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-VOLUNTEERS'); ?></a>
|
|
<?php } ?>
|
|
<?php if ($siteType == 'hotlunch' || $siteType == 'fundraising' || $siteType == 'schoolfees') { ?>
|
|
<a href='#' id='view-users-no-students' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-NO-STUDENTS'); ?></a>
|
|
<?php } ?>
|
|
<a href='#' id='view-users-no-email' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-NO-EMAIL'); ?></a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- SORT BY -->
|
|
<div class="mb-2">
|
|
<p class="section-toggle text-xs font-semibold text-gray-400 uppercase tracking-widest mb- flex items-center justify-between md:hidden">Sort By <span class="chevron md:hidden text-gray-400 transition-transform">▼</span></p>
|
|
<div class="section-content flex flex-wrap gap-2">
|
|
<div class="section-toggle text-xs font-semibold text-gray-400 uppercase tracking-widest mr-4 flex items-center justify-between hidden md:inline-block">Sort By <span class="chevron md:hidden text-gray-400 transition-transform">▼</span></div>
|
|
<a href='#' id='view-users-first-name-sort' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-ORDER-BY-FIRST-NAME'); ?></a>
|
|
<a href='#' id='view-users-last-name-sort' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-ORDER-BY-LAST-NAME'); ?></a>
|
|
<a href='#' id='view-users-email-sort' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-ORDER-BY-EMAIL'); ?></a>
|
|
<a href='#' id='view-users-user-id-sort' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-ORDER-BY-USER-ID'); ?></a>
|
|
</div>
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
<!-- REPORTS -->
|
|
<div class="mb-2">
|
|
<p class="section-toggle text-xs font-semibold text-gray-400 uppercase tracking-widest mb-2 flex items-center justify-between md:hidden">Reports <span class="chevron md:hidden text-gray-400 transition-transform">▼</span></p>
|
|
<div class="section-content flex flex-wrap gap-2">
|
|
<div class="section-toggle text-xs font-semibold text-gray-400 uppercase tracking-widest mr-4 flex items-center justify-between hidden md:inline-block">Reports <span class="chevron md:hidden text-gray-400 transition-transform">▼</span></div>
|
|
<a href='?action=users-csv' class='inline-flex items-center gap-1 px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'>↓ <?php displayLanguageText('TEXT-USER-CSV'); ?></a>
|
|
<a href='#' id='view-users-balance-owing' class='inline-flex items-center gap-1 px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'>↓ <?php displayLanguageText('TEXT-BALANCE-OWING'); ?></a>
|
|
<a href='#' id='view-users-balance-payable' class='inline-flex items-center gap-1 px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'>↓ <?php displayLanguageText('TEXT-BALANCE-PAYABLE'); ?></a>
|
|
<a href='#' id='view-users-balance-print' class='inline-flex items-center gap-1 px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'>↓ <?php displayLanguageText('TEXT-PRINT-BALANCES'); ?></a>
|
|
<a href='#' id='view-users-balance-details-print' class='inline-flex items-center gap-1 px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'>↓ <?php displayLanguageText('TEXT-DETAILS-REPORT'); ?></a>
|
|
<a href='#' id='view-users-balance-csv' class='inline-flex items-center gap-1 px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'>↓ <?php displayLanguageText('TEXT-BALANCES-CSV'); ?></a>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (strpos($action,'users') !== FALSE) { ?>
|
|
|
|
<!-- ACTIONS -->
|
|
<div class="mb-2">
|
|
<p class="section-toggle text-xs font-semibold text-gray-400 uppercase tracking-widest mb-2 flex items-center justify-between md:hidden">Actions<span class="chevron md:hidden text-gray-400 transition-transform">▼</span></p>
|
|
<div class="flex section-content flex-wrap gap-2">
|
|
<div class="section-toggle text-xs font-semibold text-gray-400 uppercase tracking-widest mr-4 flex items-center justify-between hidden md:inline-block">Actions<span class="chevron md:hidden text-gray-400 transition-transform">▼</span></div>
|
|
<?php if ($siteType == 'hotlunch' || $siteType == 'fundraising' || $siteType == 'schoolfees') { ?>
|
|
<a href='#' id='users-merge-accounts' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-MERGE-USER-ACCOUNTS'); ?></a>
|
|
<?php } ?>
|
|
<a href='' id='block-from-ordering' class='inline-flex items-center gap-1 px-2 py-1 border border-red-300 rounded-lg text-xs text-red-600 hover:bg-red-50'>🚫 <?php displayLanguageText('TEXT-BLOCK-FROM-ORDERING'); ?></a>
|
|
<a href='' id='clear-for-ordering' class='inline-flex items-center gap-1 px-2 py-1 border border-green-300 rounded-lg text-xs text-green-600 hover:bg-green-50'>✓ <?php displayLanguageText('TEXT-CLEAR-FOR-ORDERING'); ?></a>
|
|
<a href='#' id='clear-screen' class='px-2 py-1 border border-gray-200 rounded-lg text-xs text-gray-700 hover:bg-gray-50'><?php displayLanguageText('TEXT-CLEAR-SCREEN'); ?></a>
|
|
</div>
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
</div>
|
|
</div><!-- #uo-tw -->
|
|
|
|
<style>
|
|
@media (max-width: 767px) {
|
|
.section-content {
|
|
display: flex;
|
|
max-height: 0;
|
|
overflow: hidden;
|
|
transition: max-height 0.2s ease;
|
|
}
|
|
.section-content.open {
|
|
max-height: 500px;
|
|
}
|
|
.section-toggle { cursor: pointer; }
|
|
.chevron { transition: transform 0.2s ease; }
|
|
.chevron.open { transform: rotate(180deg); }
|
|
}
|
|
@media (min-width: 768px) {
|
|
.section-content { display: flex; max-height: none; overflow: visible; }
|
|
.section-toggle .chevron { display: none; }
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
$(function() {
|
|
if ($(window).width() < 768) {
|
|
$('.section-toggle').on('click', function() {
|
|
$(this).next('.section-content').toggleClass('open');
|
|
$(this).find('.chevron').toggleClass('open');
|
|
});
|
|
}
|
|
});
|
|
</script>
|