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_unval'); ?>
|
||||||
<?= $this->include('shared/dialog_audit'); ?>
|
<?= $this->include('shared/dialog_audit'); ?>
|
||||||
<?= $this->include('shared/dialog_results_generate'); ?>
|
<?= $this->include('shared/dialog_results_generate'); ?>
|
||||||
<?= $this->include('shared/dialog_eng_result'); ?>
|
|
||||||
</main>
|
</main>
|
||||||
<?= $this->endSection(); ?>
|
<?= $this->endSection(); ?>
|
||||||
|
|
||||||
|
|||||||
@ -214,6 +214,9 @@ $configKey = $roleMap[$userRole] ?? '';
|
|||||||
$previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
|
$previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
|
||||||
?>
|
?>
|
||||||
<td>
|
<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): ?>
|
<?php if ($previewEnabled): ?>
|
||||||
<template x-if="['Pend', 'PartColl', 'Coll'].includes(req.STATS)">
|
<template x-if="['Pend', 'PartColl', 'Coll'].includes(req.STATS)">
|
||||||
<button disabled class="btn btn-xs w-full btn-warning opacity-70 cursor-not-allowed">
|
<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>
|
<span class="text-xs">Ready</span>
|
||||||
</div>
|
</div>
|
||||||
<ul tabindex="0"
|
<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">
|
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: ?>
|
<?php else: ?>
|
||||||
<div class="dropdown dropdown-top dropdown-end dropdown-hover">
|
<div class="dropdown dropdown-top dropdown-end dropdown-hover">
|
||||||
<div tabindex="0" role="button"
|
<div tabindex="0" role="button"
|
||||||
class="btn btn-xs w-full"
|
class="btn btn-xs w-full"
|
||||||
@ -247,7 +250,7 @@ $previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
|
|||||||
</div>
|
</div>
|
||||||
<ul tabindex="0"
|
<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">
|
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">
|
<template x-if="req.VAL1USER && req.VAL2USER">
|
||||||
<div>
|
<div>
|
||||||
<li>
|
<li>
|
||||||
@ -270,20 +273,22 @@ $previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
|
|||||||
<i class="fa fa-file-pdf mr-2"></i> PDF Eng
|
<i class="fa fa-file-pdf mr-2"></i> PDF Eng
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php if (!in_array(session('userroleid'), [3, 4])): ?>
|
<?php if (!in_array(session('userroleid'), [3, 4])): ?>
|
||||||
<li>
|
<li>
|
||||||
<a @click="openGenerateDialog(req.SP_ACCESSNUMBER)">
|
<a @click="openGenerateDialog(req.SP_ACCESSNUMBER)">
|
||||||
<i class="fa fa-file-pdf mr-2"></i>
|
<i class="fa fa-file-pdf mr-2"></i>
|
||||||
<span>Generate Result</span>
|
<span>Generate Result</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<li x-show="!req.REPORT_LANG || req.REPORT_LANG != 1">
|
<?php if (!in_array(session('userroleid'), [3, 4])): ?>
|
||||||
<a @click="openEngResultDialog(req)">
|
<li x-show="!req.REPORT_LANG || req.REPORT_LANG != 1">
|
||||||
<i class="fa fa-language mr-2"></i>
|
<a @click="openEngResultDialog(req)">
|
||||||
<span>Create Eng Result</span>
|
<i class="fa fa-language mr-2"></i>
|
||||||
</a>
|
<span>Create Eng Result</span>
|
||||||
</li>
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<?php if (!$previewEnabled): ?>
|
<?php if (!$previewEnabled): ?>
|
||||||
@ -298,38 +303,43 @@ $previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
|
|||||||
</template>
|
</template>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php if ($previewEnabled): ?>
|
<?php if ($previewEnabled): ?>
|
||||||
</template>
|
</template>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown dropdown-top dropdown-end dropdown-hover">
|
<?php if (session('userroleid') == 3): ?>
|
||||||
<div tabindex="0" role="button" class="btn btn-xs btn-primary w-full">
|
<span class="text-xs text-base-content/40">-</span>
|
||||||
<i class="fa fa-cog mr-1"></i> Actions
|
<?php else: ?>
|
||||||
</div>
|
<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"
|
<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">
|
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'); ?>')">
|
<li x-show="req.ISVAL == 1 && req.ISPENDING != 1 && (req.VAL1USER == '<?= session('userid'); ?>' || req.VAL2USER == '<?= session('userid'); ?>')">
|
||||||
<?php if (session()->get('userlevel') <= 1): ?>
|
<?php if (session()->get('userlevel') <= 1): ?>
|
||||||
<a @click="openUnvalDialog(req.SP_ACCESSNUMBER)" class="text-error hover:bg-error/10">
|
<a @click="openUnvalDialog(req.SP_ACCESSNUMBER)" class="text-error hover:bg-error/10">
|
||||||
<i class="fa fa-times-circle mr-2"></i> UnVal
|
<i class="fa fa-times-circle mr-2"></i> UnVal
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a @click="openSampleDialog(req.SP_ACCESSNUMBER)">
|
<a @click="openSampleDialog(req.SP_ACCESSNUMBER)">
|
||||||
<i class="fa fa-vial mr-2 text-success"></i> View Samples
|
<i class="fa fa-vial mr-2 text-success"></i> View Samples
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a @click="openAuditDialog(req.SP_ACCESSNUMBER)">
|
<a @click="openAuditDialog(req.SP_ACCESSNUMBER)">
|
||||||
<i class="fa fa-history mr-2 text-info"></i> View Audit Trail
|
<i class="fa fa-history mr-2 text-info"></i> View Audit Trail
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -47,6 +47,9 @@ document.addEventListener('alpine:init', () => {
|
|||||||
Fin: ['Fin'],
|
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
|
// Sorting & Pagination
|
||||||
sortCol: 'REQDATE',
|
sortCol: 'REQDATE',
|
||||||
sortAsc: false,
|
sortAsc: false,
|
||||||
@ -126,6 +129,14 @@ document.addEventListener('alpine:init', () => {
|
|||||||
|
|
||||||
computeSorted() {
|
computeSorted() {
|
||||||
this.sorted = this.filtered.slice().sort((a, b) => {
|
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;
|
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;
|
||||||
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() {
|
fetchList() {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.list = [];
|
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();
|
let param = new URLSearchParams(this.filter).toString();
|
||||||
for (let k in this.counters) { this.counters[k] = 0; }
|
for (let k in this.counters) { this.counters[k] = 0; }
|
||||||
fetch(`${BASEURL}/api/requests?${param}`, {
|
fetch(`${BASEURL}/api/requests?${param}`, {
|
||||||
@ -174,11 +184,6 @@ document.addEventListener('alpine:init', () => {
|
|||||||
this.counters.Total++;
|
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
|
// Compute derived data after list is loaded
|
||||||
this.computeFiltered();
|
this.computeFiltered();
|
||||||
this.computeValidatedCount();
|
this.computeValidatedCount();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user