Update printer configuration, label controller, and shared views

This commit is contained in:
mahdahar 2026-02-26 12:42:49 +07:00
parent 5f6cf47689
commit 42d5abc25a
6 changed files with 57 additions and 110 deletions

View File

@ -7,29 +7,33 @@ use CodeIgniter\Config\BaseConfig;
class Printers extends BaseConfig
{
public array $printers = [
"lab" => [
"zebracs1" => [
"name" => "CS 2 Printer",
"command" => "copy /B file.txt \\\\glenlis\\zebracs1",
],
"zebracs2" => [
"name" => "CS 4 Printer",
"command" => "copy /B file.txt \\\\glenlis\\zebracs2",
],
"zebracs3" => [
"name" => "CS Lab Printer",
"command" => "copy /B file.txt \\\\glenlis\\zebracs3",
],
"zebralab" => [
"name" => "Lab Printer",
"command" => "copy /B file.txt \\\\glenlis\\zebralab",
],
"phlebo" => [
"name" => "Phlebo Printer",
"command" => "copy /B file.txt \\\\print-server\\phlebo-printer",
],
"reception" => [
"name" => "Reception Printer",
"command" => 'copy /B file.txt \\\\print-server\\reception-printer',
],
];
public array $roleDefaults = [
0 => "lab",
1 => "lab",
2 => "lab",
3 => "phlebo",
4 => "reception",
0 => "zebracs2",
1 => "zebralab",
2 => "zebralab",
3 => "zebracs2",
4 => "zebracs2",
];
public string $defaultPrinter = "lab";
public string $defaultPrinter = "zebracs2";
public function getPrinter(string $printerKey): ?array
{

View File

@ -1,6 +1,8 @@
<?php
namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
class LabelController extends BaseController
{
use ResponseTrait;

View File

@ -235,8 +235,8 @@ $previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
<i class="fa fa-clipboard-check mr-1"></i>
<span class="text-xs">Ready</span>
</div>
<ul tabindex="0"
class="dropdown-content menu bg-base-100 rounded-box z-[1] w-40 p-2 shadow-lg border border-base-300 text-xs">
<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: ?>
<div class="dropdown dropdown-top dropdown-end dropdown-hover">
<div tabindex="0" role="button"
@ -246,7 +246,7 @@ $previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
<span class="text-xs" x-text="req.VAL1USER && req.VAL2USER ? 'Ready' : 'Pending'"></span>
</div>
<ul tabindex="0"
class="dropdown-content menu bg-base-100 rounded-box z-[1] 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; ?>
<template x-if="req.VAL1USER && req.VAL2USER">
<div>
@ -309,8 +309,8 @@ $previewEnabled = $configFile[$configKey]['previewEnabled'] ?? false;
<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-[1] w-48 p-2 shadow-lg border border-base-300 text-xs">
<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">

View File

@ -3,16 +3,8 @@
<div class='flex justify-between items-center mb-2'>
<div class='flex items-center gap-2'>
<label class="text-xs font-medium text-base-content/70">Printer:</label>
<select x-model="selectedPrinter" class="select select-bordered select-xs w-32">
<option value="lab">Lab Printer</option>
<option value="phlebo">Phlebo Printer</option>
<option value="reception">Reception Printer</option>
</select>
</div>
<div class='flex gap-2 ml-auto'>
<template x-if="item.accessnumber">
<div class='flex gap-2 ml-auto'>
<template x-if="item && item.accessnumber">
<button class="btn btn-xs btn-outline btn-info" @click="openAuditDialog(item.accessnumber)">
<i class="fa fa-history"></i> Audit
</button>
@ -28,7 +20,7 @@
</div>
</template>
<template x-if="!isSampleLoading">
<template x-if="!isSampleLoading && item">
<div>
<table class="table table-xs table-compact w-full mb-4">
<tr>
@ -56,8 +48,18 @@
<th>Sample Name</th>
<th class='text-center'>Collected</th>
<th class='text-center'>Received</th>
<th>Action</th>
<th></th>
<th>
<div class='flex items-center gap-2'>
<span>Action</span>
<select x-model="selectedPrinter" class="select select-bordered select-xs w-28">
<option value="zebracs1">CS 2 Printer</option>
<option value="zebracs2">CS 4 Printer</option>
<option value="zebracs3">CS Lab Printer</option>
<option value="zebralab">Lab Printer</option>
</select>
</div>
</th>
<th></th>
</tr>
</thead>

View File

@ -7,7 +7,13 @@ document.addEventListener('alpine:init', () => {
isLoading: false,
counters: { Pend: 0, Coll: 0, Recv: 0, Inc: 0, Fin: 0, Total: 0 },
selectedPrinter: 'lab',
selectedPrinter: localStorage.getItem('selectedPrinter') || 'zebracs2',
initSelectedPrinter() {
this.$watch('selectedPrinter', value => {
localStorage.setItem('selectedPrinter', value);
});
},
// PDF Generation Dialog
isGenerateDialogOpen: false,
generateAccessnumber: null,
@ -142,8 +148,7 @@ document.addEventListener('alpine:init', () => {
this.filter.date1 = this.today;
this.filter.date2 = this.today;
const defaultPrinter = '<?= $config[session()->get("userrole")]["sampleDialog"]["defaultPrinter"] ?? "lab" ?>';
this.selectedPrinter = defaultPrinter || 'lab';
this.initSelectedPrinter();
// Initial load only - no auto-refresh
this.fetchList();

View File

@ -5,80 +5,14 @@ q400
Q224,24+0
I8,A,001
D10
A10,3,0,3,1,1,N," CHRISTINA TANJUNG, MS"
A10,27,0,2,1,1,N,"F 26/Nov/1995 29Y"
A225,27,0,3,1,1,N,"5111825322"
B120,50,0,1,2,8,90,N,"5111825322"
A80,150,0,2,2,1,N,"01251101328"
A10,195,0,1,1,1,N,"HIS : 01251101328"
A190,190,0,2,1,1,N,"18/Nov/2025 09:11"
P1
][
N
OD
q400
Q224,24+0
I8,A,001
D10
A10,3,0,3,1,1,N," CHRISTINA TANJUNG, MS "
A10,27,0,2,1,1,N,"F 29Y"
B130,50,0,1,2,8,90,N,"10125322"
A380,27,5,3,1,1,N,"10125322"
A10,3,0,3,1,1,N," DANIEL GANADI, MR "
A10,27,0,2,1,1,N,"M 70Y"
B130,50,0,1,2,8,90,N,"10133381"
A380,27,5,3,1,1,N,"10133381"
A10,80,0,2,1,2,R,"EDTA"
A10,150,0,2,1,1,N,"G6PD,DL"
A10,180,0,1,1,1,N,"LIS : 5111825322"
A10,195,0,1,1,1,N,"HIS : 01251101328"
A190,190,0,2,1,1,N,"18/Nov/2025 09:11"
P1
][
N
OD
q400
Q224,24+0
I8,A,001
D10
A10,3,0,3,1,1,N," CHRISTINA TANJUNG, MS "
A10,27,0,2,1,1,N,"F 29Y"
B130,50,0,1,2,8,90,N,"25025322"
A380,27,5,3,1,1,N,"25025322"
A10,80,0,2,1,2,R,"Serum"
A10,150,0,2,1,1,N,"TOXM,RUBM,TPHA,VD25,AHBSM"
A10,180,0,1,1,1,N,"LIS : 5111825322"
A10,195,0,1,1,1,N,"HIS : 01251101328"
A190,190,0,2,1,1,N,"18/Nov/2025 09:11"
P1
][
N
OD
q400
Q224,24+0
I8,A,001
D10
A10,3,0,3,1,1,N," CHRISTINA TANJUNG, MS "
A10,27,0,2,1,1,N,"F 29Y"
B130,50,0,1,2,8,90,N,"35025322"
A380,27,5,3,1,1,N,"35025322"
A10,80,0,2,1,2,R,"Urin"
A10,150,0,2,1,1,N,"UL"
A10,180,0,1,1,1,N,"LIS : 5111825322"
A10,195,0,1,1,1,N,"HIS : 01251101328"
A190,190,0,2,1,1,N,"18/Nov/2025 09:11"
P1
][
N
OD
q400
Q224,24+0
I8,A,001
D10
A10,3,0,3,1,1,N," CHRISTINA TANJUNG, MS "
A10,27,0,2,1,1,N,"F 29Y"
B130,50,0,1,2,8,90,N,"90025322"
A380,27,5,3,1,1,N,"90025322"
A10,80,0,2,1,2,R,"Other"
A10,150,0,2,1,1,N,"SFPL"
A10,180,0,1,1,1,N,"LIS : 5111825322"
A10,195,0,1,1,1,N,"HIS : 01251101328"
A190,190,0,2,1,1,N,"18/Nov/2025 09:11"
A10,150,0,2,1,1,N,"HBA1C"
A10,180,0,1,1,1,N,"LIS : 6022633381"
A10,195,0,1,1,1,N,"HIS : 01260201721"
A190,190,0,2,1,1,N,"26/Feb/2026 05:21"
P1
]