fix: bug fix on datepicker simply get year for dob
This commit is contained in:
parent
3111c72091
commit
c5c8e44752
@ -75,7 +75,13 @@ class RegistrationController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$patients = Patient::select(['id', 'name'])->get();
|
||||
$patients = Patient::select(['id', 'name'])
|
||||
->whereNotExists(function($query) {
|
||||
$query->select(DB::raw(1))
|
||||
->from('t_registration')
|
||||
->whereRaw('t_registration.patient_id = m_patient.id');
|
||||
})
|
||||
->get();
|
||||
$employees = Employee::with('user:id,name')->get()->map(function ($employee) {
|
||||
return [
|
||||
'id' => $employee->id,
|
||||
|
||||
@ -98,6 +98,7 @@ class TransactionController extends Controller
|
||||
return [
|
||||
'id' => $employee->id,
|
||||
'name' => $employee->user->name,
|
||||
'specialization' => $employee->specialization,
|
||||
];
|
||||
});
|
||||
|
||||
@ -262,6 +263,7 @@ class TransactionController extends Controller
|
||||
return [
|
||||
'id' => $employee->id,
|
||||
'name' => $employee->user->name,
|
||||
'specialization' => $employee->specialization,
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
@ -24,6 +24,11 @@ const mainNavItems: NavItem[] = [
|
||||
href: '/dashboard',
|
||||
icon: LayoutGrid,
|
||||
},
|
||||
{
|
||||
title: 'Data Pasien',
|
||||
href: '/patients',
|
||||
icon: LucideAmbulance,
|
||||
},
|
||||
{
|
||||
title: 'Registrasi',
|
||||
href: '/registrations',
|
||||
@ -42,11 +47,6 @@ const masterNavItems = [
|
||||
href: '/employees',
|
||||
icon: Users,
|
||||
},
|
||||
{
|
||||
title: 'Data Pasien',
|
||||
href: '/patients',
|
||||
icon: LucideAmbulance,
|
||||
},
|
||||
{
|
||||
title: 'Data Asuransi',
|
||||
href: '/insurances',
|
||||
|
||||
@ -184,17 +184,38 @@ export default function EmployeeForm({ mode, employee }: EmployeeFormProps) {
|
||||
{data.birth_date ? (
|
||||
format(new Date(data.birth_date), "dd/MM/yyyy")
|
||||
) : (
|
||||
<span>Pilih Tanggal</span>
|
||||
<span>Pilih tanggal</span>
|
||||
)}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-auto p-0">
|
||||
<Calendar
|
||||
mode="single"
|
||||
selected={data.birth_date ? new Date(data.birth_date) : undefined}
|
||||
onSelect={(date) => date && setData('birth_date', toLocalISOString(date))}
|
||||
initialFocus
|
||||
/>
|
||||
<PopoverContent className="w-auto p-0" align="start">
|
||||
<div className="flex flex-col">
|
||||
<div className="flex justify-between px-3 pt-3">
|
||||
<select
|
||||
value={data.birth_date ? new Date(data.birth_date).getFullYear() : new Date().getFullYear()}
|
||||
onChange={(e) => {
|
||||
const currentDate = data.birth_date ? new Date(data.birth_date) : new Date();
|
||||
const newDate = new Date(currentDate);
|
||||
newDate.setFullYear(parseInt(e.target.value));
|
||||
setData('birth_date', toLocalISOString(newDate));
|
||||
}}
|
||||
className="border rounded px-2 py-1 text-sm"
|
||||
>
|
||||
{Array.from({ length: 100 }, (_, i) => new Date().getFullYear() - i).map((year) => (
|
||||
<option key={year} value={year}>
|
||||
{year}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<Calendar
|
||||
mode="single"
|
||||
selected={data.birth_date ? new Date(data.birth_date) : undefined}
|
||||
onSelect={(date) => date && setData('birth_date', toLocalISOString(date))}
|
||||
initialFocus
|
||||
showOutsideDays={false}
|
||||
/>
|
||||
</div>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
<InputError message={errors.birth_date} />
|
||||
|
||||
@ -167,13 +167,34 @@ export default function PatientForm({ mode, patient }: PatientFormProps) {
|
||||
)}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-auto p-0">
|
||||
<Calendar
|
||||
mode="single"
|
||||
selected={data.birth_date ? new Date(data.birth_date) : undefined}
|
||||
onSelect={(date) => date && setData('birth_date', toLocalISOString(date))}
|
||||
initialFocus
|
||||
/>
|
||||
<PopoverContent className="w-auto p-0" align="start">
|
||||
<div className="flex flex-col">
|
||||
<div className="flex justify-between px-3 pt-3">
|
||||
<select
|
||||
value={data.birth_date ? new Date(data.birth_date).getFullYear() : new Date().getFullYear()}
|
||||
onChange={(e) => {
|
||||
const currentDate = data.birth_date ? new Date(data.birth_date) : new Date();
|
||||
const newDate = new Date(currentDate);
|
||||
newDate.setFullYear(parseInt(e.target.value));
|
||||
setData('birth_date', toLocalISOString(newDate));
|
||||
}}
|
||||
className="border rounded px-2 py-1 text-sm"
|
||||
>
|
||||
{Array.from({ length: 100 }, (_, i) => new Date().getFullYear() - i).map((year) => (
|
||||
<option key={year} value={year}>
|
||||
{year}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<Calendar
|
||||
mode="single"
|
||||
selected={data.birth_date ? new Date(data.birth_date) : undefined}
|
||||
onSelect={(date) => date && setData('birth_date', toLocalISOString(date))}
|
||||
initialFocus
|
||||
showOutsideDays={false}
|
||||
/>
|
||||
</div>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
<InputError message={errors.birth_date} />
|
||||
|
||||
@ -303,7 +303,7 @@ export default function TransactionForm({
|
||||
<SelectContent>
|
||||
{employees.map((employee) => (
|
||||
<SelectItem key={employee.id} value={employee.id}>
|
||||
{employee.name}
|
||||
{employee.name} - {employee.specialization}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
@ -486,10 +486,11 @@ export default function TransactionForm({
|
||||
<Label htmlFor="paid_amount">Jumlah Pembayaran *</Label>
|
||||
<Input
|
||||
id="paid_amount"
|
||||
type="number"
|
||||
value={data.paid_amount}
|
||||
type="text"
|
||||
value={formatCurrency(data.paid_amount)}
|
||||
onChange={(e) => {
|
||||
const paidAmount = Math.max(0, parseFloat(e.target.value) || 0);
|
||||
const numericValue = e.target.value.replace(/[^0-9]/g, '');
|
||||
const paidAmount = parseFloat(numericValue) || 0;
|
||||
setData('paid_amount', paidAmount);
|
||||
}}
|
||||
placeholder="Jumlah pembayaran"
|
||||
|
||||
@ -150,7 +150,6 @@ export default function TransactionIndex() {
|
||||
<TableHead>No. Invoice</TableHead>
|
||||
<TableHead>No. Registrasi</TableHead>
|
||||
<TableHead>Nama Pasien</TableHead>
|
||||
<TableHead>Asuransi</TableHead>
|
||||
<TableHead>Petugas Kasir</TableHead>
|
||||
<TableHead>Tanggal Transaksi</TableHead>
|
||||
<TableHead>Status</TableHead>
|
||||
@ -163,7 +162,6 @@ export default function TransactionIndex() {
|
||||
<TableCell className="font-medium">{transaction.invoice_number}</TableCell>
|
||||
<TableCell>{transaction.registration_number}</TableCell>
|
||||
<TableCell>{transaction.patient_name}</TableCell>
|
||||
<TableCell>{transaction.insurance_name || 'Tanpa Asuransi'}</TableCell>
|
||||
<TableCell>{transaction.cashier_name || 'N/A'}</TableCell>
|
||||
<TableCell>
|
||||
{new Date(transaction.transaction_datetime).toLocaleDateString('id-ID', {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user