Remove unused dialog include and add Phlebo role-specific UI logic
- Remove dialog_eng_result.php include from CS index view - Add role-based status display for Phlebo (role 3) showing Ready/Pending badges - Fix indentation inconsistencies in content_requests.php dropdown menus - Add role restrictions: hide Generate Result and Create Eng Result buttons for CS (role 4) and Phlebo (role 3) - Move status sorting logic from fetchList to computeSorted for proper Alpine.js reactivity - Add statusOrder mapping (Pend -> Coll -> Recv -> Inc -> Fin) for consistent request sorting - Simplify Actions dropdown for Phlebo role to show only status indicator
This commit is contained in:
parent
c2d66d0082
commit
c2c70505e5
@ -11,7 +11,6 @@ $roleConfig = $config['cs'];
|
||||
<?= $this->include('shared/dialog_unval'); ?>
|
||||
<?= $this->include('shared/dialog_audit'); ?>
|
||||
<?= $this->include('shared/dialog_results_generate'); ?>
|
||||
<?= $this->include('shared/dialog_eng_result'); ?>
|
||||
</main>
|
||||
<?= $this->endSection(); ?>
|
||||
|
||||
|
||||
@ -214,6 +214,9 @@ $configKey = $roleMap[$userRole] ?? '';
|
||||
$previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
|
||||
?>
|
||||
<td>
|
||||
<?php if (session('userroleid') == 3): ?>
|
||||
<span class="text-xs font-bold" :class="req.VAL1USER && req.VAL2USER ? 'text-success' : 'text-warning'" x-text="req.VAL1USER && req.VAL2USER ? 'Ready' : 'Pending'"></span>
|
||||
<?php else: ?>
|
||||
<?php if ($previewEnabled): ?>
|
||||
<template x-if="['Pend', 'PartColl', 'Coll'].includes(req.STATS)">
|
||||
<button disabled class="btn btn-xs w-full btn-warning opacity-70 cursor-not-allowed">
|
||||
@ -236,8 +239,8 @@ $previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
|
||||
<span class="text-xs">Ready</span>
|
||||
</div>
|
||||
<ul tabindex="0"
|
||||
class="dropdown-content menu bg-base-100 rounded-box z-50 w-40 p-2 shadow-lg border border-base-300 text-xs">
|
||||
<?php else: ?>
|
||||
class="dropdown-content menu bg-base-100 rounded-box z-50 w-40 p-2 shadow-lg border border-base-300 text-xs">
|
||||
<?php else: ?>
|
||||
<div class="dropdown dropdown-top dropdown-end dropdown-hover">
|
||||
<div tabindex="0" role="button"
|
||||
class="btn btn-xs w-full"
|
||||
@ -247,7 +250,7 @@ $previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
|
||||
</div>
|
||||
<ul tabindex="0"
|
||||
class="dropdown-content menu bg-base-100 rounded-box z-50 w-40 p-2 shadow-lg border border-base-300 text-xs">
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<template x-if="req.VAL1USER && req.VAL2USER">
|
||||
<div>
|
||||
<li>
|
||||
@ -270,20 +273,22 @@ $previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
|
||||
<i class="fa fa-file-pdf mr-2"></i> PDF Eng
|
||||
</a>
|
||||
</li>
|
||||
<?php if (!in_array(session('userroleid'), [3, 4])): ?>
|
||||
<li>
|
||||
<a @click="openGenerateDialog(req.SP_ACCESSNUMBER)">
|
||||
<i class="fa fa-file-pdf mr-2"></i>
|
||||
<span>Generate Result</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<li x-show="!req.REPORT_LANG || req.REPORT_LANG != 1">
|
||||
<a @click="openEngResultDialog(req)">
|
||||
<i class="fa fa-language mr-2"></i>
|
||||
<span>Create Eng Result</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if (!in_array(session('userroleid'), [3, 4])): ?>
|
||||
<li>
|
||||
<a @click="openGenerateDialog(req.SP_ACCESSNUMBER)">
|
||||
<i class="fa fa-file-pdf mr-2"></i>
|
||||
<span>Generate Result</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (!in_array(session('userroleid'), [3, 4])): ?>
|
||||
<li x-show="!req.REPORT_LANG || req.REPORT_LANG != 1">
|
||||
<a @click="openEngResultDialog(req)">
|
||||
<i class="fa fa-language mr-2"></i>
|
||||
<span>Create Eng Result</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</template>
|
||||
<?php if (!$previewEnabled): ?>
|
||||
@ -298,38 +303,43 @@ $previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
|
||||
</template>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<?php if ($previewEnabled): ?>
|
||||
</template>
|
||||
<?php else: ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php if ($previewEnabled): ?>
|
||||
</template>
|
||||
<?php else: ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropdown dropdown-top dropdown-end dropdown-hover">
|
||||
<div tabindex="0" role="button" class="btn btn-xs btn-primary w-full">
|
||||
<i class="fa fa-cog mr-1"></i> Actions
|
||||
</div>
|
||||
<?php if (session('userroleid') == 3): ?>
|
||||
<span class="text-xs text-base-content/40">-</span>
|
||||
<?php else: ?>
|
||||
<div class="dropdown dropdown-top dropdown-end dropdown-hover">
|
||||
<div tabindex="0" role="button" class="btn btn-xs btn-primary w-full">
|
||||
<i class="fa fa-cog mr-1"></i> Actions
|
||||
</div>
|
||||
<ul tabindex="0"
|
||||
class="dropdown-content menu bg-base-100 rounded-box z-50 w-48 p-2 shadow-lg border border-base-300 text-xs">
|
||||
<li x-show="req.ISVAL == 1 && req.ISPENDING != 1 && (req.VAL1USER == '<?= session('userid'); ?>' || req.VAL2USER == '<?= session('userid'); ?>')">
|
||||
<?php if (session()->get('userlevel') <= 1): ?>
|
||||
<a @click="openUnvalDialog(req.SP_ACCESSNUMBER)" class="text-error hover:bg-error/10">
|
||||
<i class="fa fa-times-circle mr-2"></i> UnVal
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<li>
|
||||
<a @click="openSampleDialog(req.SP_ACCESSNUMBER)">
|
||||
<i class="fa fa-vial mr-2 text-success"></i> View Samples
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a @click="openAuditDialog(req.SP_ACCESSNUMBER)">
|
||||
<i class="fa fa-history mr-2 text-info"></i> View Audit Trail
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<li x-show="req.ISVAL == 1 && req.ISPENDING != 1 && (req.VAL1USER == '<?= session('userid'); ?>' || req.VAL2USER == '<?= session('userid'); ?>')">
|
||||
<?php if (session()->get('userlevel') <= 1): ?>
|
||||
<a @click="openUnvalDialog(req.SP_ACCESSNUMBER)" class="text-error hover:bg-error/10">
|
||||
<i class="fa fa-times-circle mr-2"></i> UnVal
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<li>
|
||||
<a @click="openSampleDialog(req.SP_ACCESSNUMBER)">
|
||||
<i class="fa fa-vial mr-2 text-success"></i> View Samples
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a @click="openAuditDialog(req.SP_ACCESSNUMBER)">
|
||||
<i class="fa fa-history mr-2 text-info"></i> View Audit Trail
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
@ -47,6 +47,9 @@ document.addEventListener('alpine:init', () => {
|
||||
Fin: ['Fin'],
|
||||
},
|
||||
|
||||
// Status order for sorting (Pend -> Coll -> Recv -> Inc -> Fin)
|
||||
statusOrder: { Pend: 1, PartColl: 2, Coll: 3, PartRecv: 4, Recv: 5, Inc: 6, Fin: 7 },
|
||||
|
||||
// Sorting & Pagination
|
||||
sortCol: 'REQDATE',
|
||||
sortAsc: false,
|
||||
@ -126,6 +129,14 @@ document.addEventListener('alpine:init', () => {
|
||||
|
||||
computeSorted() {
|
||||
this.sorted = this.filtered.slice().sort((a, b) => {
|
||||
// First sort by status (Pend -> Coll -> Recv -> Inc -> Fin)
|
||||
let statusA = this.statusOrder[a.STATS] ?? 0;
|
||||
let statusB = this.statusOrder[b.STATS] ?? 0;
|
||||
if (statusA !== statusB) {
|
||||
return statusA - statusB;
|
||||
}
|
||||
|
||||
// Then sort by selected column
|
||||
let modifier = this.sortAsc ? 1 : -1;
|
||||
if (a[this.sortCol] < b[this.sortCol]) return -1 * modifier;
|
||||
if (a[this.sortCol] > b[this.sortCol]) return 1 * modifier;
|
||||
@ -157,7 +168,6 @@ document.addEventListener('alpine:init', () => {
|
||||
fetchList() {
|
||||
this.isLoading = true;
|
||||
this.list = [];
|
||||
let statusOrder = { Pend: 1, PartColl: 2, Coll: 3, PartRecv: 4, Recv: 5, Inc: 6, Fin: 7 };
|
||||
let param = new URLSearchParams(this.filter).toString();
|
||||
for (let k in this.counters) { this.counters[k] = 0; }
|
||||
fetch(`${BASEURL}/api/requests?${param}`, {
|
||||
@ -174,11 +184,6 @@ document.addEventListener('alpine:init', () => {
|
||||
this.counters.Total++;
|
||||
}
|
||||
});
|
||||
this.list.sort((a, b) => {
|
||||
let codeA = statusOrder[a.STATS] ?? 0;
|
||||
let codeB = statusOrder[b.STATS] ?? 0;
|
||||
return codeA - codeB;
|
||||
});
|
||||
// Compute derived data after list is loaded
|
||||
this.computeFiltered();
|
||||
this.computeValidatedCount();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user