tinyqc/app/Views/master/test/dialog_test_form.php
mahdahar ef6be6522e refactor: Replace dropdowns with select inputs and improve caching
- Replace dropdown components with select elements in department filters
- Add cache-control headers to test and control API endpoints
- Add merged report page for consolidated reporting
- Update navigation sidebar with separate report links
- Refactor AGENTS.md to concise format with Serena tools emphasis
- Clean up gitignore and remove CLAUDE.md
2026-02-05 20:06:51 +07:00

154 lines
7.7 KiB
PHP

<dialog class="modal modal-bottom sm:modal-middle" :class="{ 'modal-open': showModal }">
<div class="modal-box border border-base-300 shadow-2xl bg-base-100">
<h3 class="font-bold text-lg mb-4 flex items-center gap-2 text-base-content">
<i class="fa-solid fa-flask-vial text-primary"></i>
<span x-text="form.testId ? 'Edit Test' : 'New Test'"></span>
</h3>
<div class="space-y-4">
<template x-if="loadingDepartments">
<div class="flex items-center justify-center py-2">
<span class="loading loading-spinner loading-sm text-primary"></span>
<span class="ml-2 text-xs opacity-50">Loading departments...</span>
</div>
</template>
<template x-if="departments">
<div class="form-control">
<label class="label">
<span class="label-text font-medium text-base-content opacity-80">Department</span>
</label>
<select
class="select select-bordered input-sm w-full focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary bg-base-200 border-base-300 text-base-content"
:class="{'border-error': errors.deptId}"
x-model="form.deptId"
placeholder="Select department">
<option value="">Select Department</option>
<template x-for="dept in departments" :key="dept.deptId">
<option :value="dept.deptId" x-text="dept.deptName"></option>
</template>
</select>
<template x-if="errors.deptId">
<label class="label">
<span class="label-text-alt text-error" x-text="errors.deptId"></span>
</label>
</template>
</div>
</template>
<div class="form-control">
<label class="label">
<span class="label-text font-medium text-base-content opacity-80">Test Code</span>
</label>
<input
type="text"
class="input input-bordered input-sm w-full focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary bg-base-200 border-base-300 text-base-content placeholder:opacity-50"
x-model="form.testCode"
placeholder="Enter test code"
/>
</div>
<div class="form-control">
<label class="label">
<span class="label-text font-medium text-base-content opacity-80">Test Name</span>
</label>
<input
type="text"
class="input input-bordered input-sm w-full focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary bg-base-200 border-base-300 text-base-content placeholder:opacity-50"
:class="{'border-error': errors.testName}"
x-model="form.testName"
placeholder="Enter test name"
/>
<template x-if="errors.testName">
<label class="label">
<span class="label-text-alt text-error" x-text="errors.testName"></span>
</label>
</template>
</div>
<div class="grid grid-cols-2 gap-4">
<div class="form-control">
<label class="label">
<span class="label-text font-medium text-base-content opacity-80">Unit</span>
</label>
<input
type="text"
class="input input-bordered input-sm w-full focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary bg-base-200 border-base-300 text-base-content placeholder:opacity-50"
x-model="form.testUnit"
placeholder="e.g., mg/dL"
/>
</div>
<div class="form-control">
<label class="label">
<span class="label-text font-medium text-base-content opacity-80">Method</span>
</label>
<input
type="text"
class="input input-bordered input-sm w-full focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary bg-base-200 border-base-300 text-base-content placeholder:opacity-50"
x-model="form.testMethod"
placeholder="e.g., Enzymatic"
/>
</div>
</div>
<div class="grid grid-cols-3 gap-4">
<div class="form-control">
<label class="label">
<span class="label-text font-medium text-base-content opacity-80">CVa</span>
</label>
<input
type="number"
step="0.01"
class="input input-bordered input-sm w-full focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary bg-base-200 border-base-300 text-base-content placeholder:opacity-50"
x-model="form.cva"
placeholder="0.00"
/>
</div>
<div class="form-control">
<label class="label">
<span class="label-text font-medium text-base-content opacity-80">BA</span>
</label>
<input
type="number"
step="0.01"
class="input input-bordered input-sm w-full focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary bg-base-200 border-base-300 text-base-content placeholder:opacity-50"
x-model="form.ba"
placeholder="0.00"
/>
</div>
<div class="form-control">
<label class="label">
<span class="label-text font-medium text-base-content opacity-80">TEa</span>
</label>
<input
type="number"
step="0.01"
class="input input-bordered input-sm w-full focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary bg-base-200 border-base-300 text-base-content placeholder:opacity-50"
x-model="form.tea"
placeholder="0.00"
/>
</div>
</div>
</div>
<div class="modal-action mt-6">
<button class="btn btn-ghost opacity-70" @click="closeModal()">Cancel</button>
<button
class="btn btn-sm btn-primary gap-2 shadow-lg shadow-primary/20 font-medium"
:class="{'loading': loading}"
@click="save()"
:disabled="loading"
>
<template x-if="!loading">
<span><i class="fa-solid fa-save"></i> Save</span>
</template>
<template x-if="loading">
<span>Saving...</span>
</template>
</button>
</div>
</div>
<form method="dialog" class="modal-backdrop bg-black/60" @click="closeModal()"></form>
</dialog>