Complete overhaul of the valueset system to use human-readable names
instead of numeric IDs for improved maintainability and API consistency.
- PatientController: Renamed 'Gender' field to 'Sex' in validation rules
- ValuesetController: Changed API endpoints from ID-based (/:num) to name-based (/:any)
- TestsController: Refactored to use ValueSet library instead of direct valueset queries
- Added ValueSet library (app/Libraries/ValueSet.php) with static lookup methods:
- getOptions() - returns dropdown format [{value, label}]
- getLabel(, ) - returns label for a value
- transformLabels(, ) - batch transform records
- get() and getRaw() for Lookups compatibility
- Added ValueSetApiController for public valueset API endpoints
- Added ValueSet refresh endpoint (POST /api/valueset/refresh)
- Added DemoOrderController for testing order creation without auth
- 2026-01-12-000001: Convert valueset references from VID to VValue
- 2026-01-12-000002: Rename patient.Gender column to Sex
- OrderTestController: Now uses OrderTestModel with proper model pattern
- TestsController: Uses ValueSet library for all lookup operations
- ValueSetController: Simplified to use name-based lookups
- Updated all organization (account/site/workstation) dialogs and index views
- Updated specimen container dialogs and index views
- Updated tests_index.php with ValueSet integration
- Updated patient dialog form and index views
- Removed .factory/config.json and CLAUDE.md (replaced by AGENTS.md)
- Consolidated lookups in Lookups.php (removed inline valueset constants)
- Updated all test files to match new field names
- 32 modified files, 17 new files, 2 deleted files
- Net: +661 insertions, -1443 deletions (significant cleanup)
190 lines
6.4 KiB
PHP
190 lines
6.4 KiB
PHP
<!-- Account Form Modal -->
|
|
<div
|
|
x-show="showModal"
|
|
x-cloak
|
|
class="modal-overlay"
|
|
@click.self="closeModal()"
|
|
x-transition:enter="transition ease-out duration-200"
|
|
x-transition:enter-start="opacity-0"
|
|
x-transition:enter-end="opacity-100"
|
|
x-transition:leave="transition ease-in duration-150"
|
|
x-transition:leave-start="opacity-100"
|
|
x-transition:leave-end="opacity-0"
|
|
>
|
|
<div
|
|
class="modal-content p-6 max-w-4xl w-full max-h-[90vh] overflow-y-auto"
|
|
@click.stop
|
|
x-transition:enter="transition ease-out duration-200"
|
|
x-transition:enter-start="opacity-0 transform scale-95"
|
|
x-transition:enter-end="opacity-100 transform scale-100"
|
|
x-transition:leave="transition ease-in duration-150"
|
|
x-transition:leave-start="opacity-100 transform scale-100"
|
|
x-transition:leave-end="opacity-0 transform scale-95"
|
|
>
|
|
<!-- Header -->
|
|
<div class="flex items-center justify-between mb-6">
|
|
<h3 class="font-bold text-xl flex items-center gap-2" style="color: rgb(var(--color-text));">
|
|
<i class="fa-solid fa-building-circle-plus" style="color: rgb(var(--color-primary));"></i>
|
|
<span x-text="isEditing ? 'Edit Account' : 'New Account'"></span>
|
|
</h3>
|
|
<button class="btn btn-ghost btn-sm btn-square" @click="closeModal()">
|
|
<i class="fa-solid fa-times"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Form -->
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
|
|
<!-- Basic Info Section -->
|
|
<div class="space-y-4">
|
|
<h4 class="font-semibold text-sm uppercase tracking-wider opacity-60" style="color: rgb(var(--color-text));">Basic Information</h4>
|
|
|
|
<div>
|
|
<label class="label">
|
|
<span class="label-text font-medium">Account Name <span style="color: rgb(var(--color-error));">*</span></span>
|
|
</label>
|
|
<input
|
|
type="text"
|
|
class="input"
|
|
:class="errors.AccountName && 'input-error'"
|
|
x-model="form.AccountName"
|
|
placeholder="Main Laboratory Inc."
|
|
/>
|
|
<label class="label" x-show="errors.AccountName">
|
|
<span class="label-text-alt" style="color: rgb(var(--color-error));" x-text="errors.AccountName"></span>
|
|
</label>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="label">
|
|
<span class="label-text font-medium">Initial / Code</span>
|
|
</label>
|
|
<input
|
|
type="text"
|
|
class="input text-center font-mono"
|
|
x-model="form.Initial"
|
|
placeholder="MLAB"
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label class="label">
|
|
<span class="label-text font-medium">Parent Account</span>
|
|
</label>
|
|
<select class="select" x-model="form.Parent">
|
|
<option value="">None (Top Level)</option>
|
|
<template x-for="acc in list" :key="acc.AccountID">
|
|
<option :value="acc.AccountID" x-text="acc.AccountName"></option>
|
|
</template>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="divider">Contact Info</div>
|
|
|
|
<div class="grid grid-cols-1 gap-4">
|
|
<div>
|
|
<label class="label">
|
|
<span class="label-text font-medium">Email Address</span>
|
|
</label>
|
|
<input
|
|
type="email"
|
|
class="input"
|
|
x-model="form.EmailAddress1"
|
|
placeholder="contact@lab.com"
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label class="label">
|
|
<span class="label-text font-medium">Phone Number</span>
|
|
</label>
|
|
<input
|
|
type="tel"
|
|
class="input"
|
|
x-model="form.Phone"
|
|
placeholder="+62 21..."
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Address Section -->
|
|
<div class="space-y-4">
|
|
<h4 class="font-semibold text-sm uppercase tracking-wider opacity-60" style="color: rgb(var(--color-text));">Location & Address</h4>
|
|
|
|
<div>
|
|
<label class="label">
|
|
<span class="label-text font-medium">Street Address</span>
|
|
</label>
|
|
<textarea
|
|
class="input h-24 pt-2"
|
|
x-model="form.Street_1"
|
|
placeholder="Jalan Sudirman No. 123..."
|
|
></textarea>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="label">
|
|
<span class="label-text font-medium">City</span>
|
|
</label>
|
|
<input
|
|
type="text"
|
|
class="input"
|
|
x-model="form.City"
|
|
placeholder="Jakarta"
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label class="label">
|
|
<span class="label-text font-medium">Province</span>
|
|
</label>
|
|
<input
|
|
type="text"
|
|
class="input"
|
|
x-model="form.Province"
|
|
placeholder="DKI Jakarta"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="label">
|
|
<span class="label-text font-medium">ZIP Code</span>
|
|
</label>
|
|
<input
|
|
type="text"
|
|
class="input"
|
|
x-model="form.ZIP"
|
|
placeholder="12345"
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label class="label">
|
|
<span class="label-text font-medium">Country</span>
|
|
</label>
|
|
<select class="select" x-model="form.Country">
|
|
<option value="">Select Country</option>
|
|
<template x-for="opt in countryOptions" :key="opt.key">
|
|
<option :value="opt.key" x-text="opt.value"></option>
|
|
</template>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Actions -->
|
|
<div class="flex gap-3 mt-8 pt-6" style="border-top: 1px solid rgb(var(--color-border));">
|
|
<button class="btn btn-ghost flex-1" @click="closeModal()">Cancel</button>
|
|
<button class="btn btn-primary flex-1" @click="save()" :disabled="saving">
|
|
<span x-show="saving" class="spinner spinner-sm"></span>
|
|
<i x-show="!saving" class="fa-solid fa-save mr-2"></i>
|
|
<span x-text="saving ? 'Saving...' : 'Save Account'"></span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|