Files
ilycats/storage/framework/views/feb79afc6662d212e646624204d902f6.php
T
2026-09-23 12:45:02 +07:00

242 lines
16 KiB
PHP

<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<div class="max-w-5xl mx-auto space-y-6 pb-12" x-data="treatmentForm()">
<div class="flex items-center justify-between gap-4">
<div class="flex items-center gap-4">
<a href="<?php echo e(url()->previous()); ?>" class="p-3 bg-white border border-slate-200 rounded-2xl text-slate-400 hover:text-indigo-600 transition-all shadow-sm active:scale-90">
<i class="fas fa-arrow-left"></i>
</a>
<div>
<h2 class="text-2xl font-black text-slate-800 tracking-tight">Tambah Rekam Medis</h2>
<p class="text-sm text-slate-500 font-medium italic uppercase tracking-tighter">Pemeriksaan & Pemberian Obat Pasien (Multi-Medicine Support)</p>
</div>
</div>
</div>
<?php if($errors->any()): ?>
<div class="bg-rose-50 border border-rose-200 rounded-2xl p-6 flex items-start gap-4">
<div class="w-10 h-10 bg-rose-100 text-rose-500 rounded-xl flex items-center justify-center shrink-0">
<i class="fas fa-exclamation-triangle"></i>
</div>
<div>
<h4 class="text-xs font-black text-rose-600 uppercase tracking-widest mb-1">Gagal Menyimpan Data</h4>
<ul class="text-[11px] text-rose-500 font-bold list-disc list-inside space-y-1">
<?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<li><?php echo e($error); ?></li>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</ul>
</div>
</div>
<?php endif; ?>
<form action="<?php echo e(route('treatments.store')); ?>" method="POST" enctype="multipart/form-data" class="space-y-6">
<?php echo csrf_field(); ?>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<div class="lg:col-span-1 space-y-6">
<div class="bg-white border border-slate-200 rounded-[2.5rem] p-6 shadow-sm space-y-6">
<h4 class="text-xs font-black text-indigo-600 uppercase tracking-widest border-b border-slate-100 pb-3">Data Pasien</h4>
<div class="space-y-4">
<div class="space-y-2">
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">Pilih Pasien</label>
<select name="cat_id" required class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-2xl text-sm font-bold text-slate-800 focus:ring-2 focus:ring-indigo-500 transition-all">
<option value="" disabled selected>-- Pilih Pasien --</option>
<?php $__currentLoopData = $cats; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($cat->id); ?>" <?php echo e(($selectedCat && $selectedCat->id == $cat->id) || old('cat_id') == $cat->id ? 'selected' : ''); ?>>
<?php echo e($cat->nama_kucing); ?> (<?php echo e($cat->ras); ?>)
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="space-y-2">
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">Tanggal Pemeriksaan</label>
<input type="date" name="tanggal" value="<?php echo e(old('tanggal', date('Y-m-d'))); ?>" required class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-2xl text-sm font-bold focus:ring-2 focus:ring-indigo-500 transition-all">
</div>
<div class="space-y-2">
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">Foto Bukti / Kondisi (Opsional)</label>
<input type="file" name="foto_bukti" class="w-full text-xs font-bold text-slate-400 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-[10px] file:font-black file:bg-indigo-50 file:text-indigo-600 hover:file:bg-indigo-100 transition-all">
</div>
</div>
</div>
</div>
<div class="lg:col-span-2 space-y-6">
<div class="bg-white border border-slate-200 rounded-[2.5rem] p-8 shadow-sm space-y-6">
<h4 class="text-xs font-black text-rose-600 uppercase tracking-widest border-b border-slate-100 pb-3">Diagnosa Klinik</h4>
<div class="space-y-4">
<div class="space-y-2">
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">Keluhan Utama</label>
<input type="text" name="keluhan" value="<?php echo e(old('keluhan')); ?>" required placeholder="Contoh: Flu berat, Nafsu makan turun" class="w-full px-4 py-3 bg-slate-50 border <?php echo e($errors->has('keluhan') ? 'border-rose-500 ring-1 ring-rose-500' : 'border-slate-200'); ?> rounded-2xl text-sm font-bold focus:ring-2 focus:ring-rose-500 transition-all">
</div>
<div class="space-y-2">
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">Hasil Diagnosa & Tindakan</label>
<textarea name="diagnosa" rows="3" required placeholder="Tulis diagnosa dokter/staf dan tindakan yang diambil..." class="w-full px-4 py-3 bg-slate-50 border <?php echo e($errors->has('diagnosa') ? 'border-rose-500 ring-1 ring-rose-500' : 'border-slate-200'); ?> rounded-2xl text-sm font-bold focus:ring-2 focus:ring-rose-500 transition-all"><?php echo e(old('diagnosa')); ?></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="bg-white border border-slate-200 rounded-[2.5rem] p-8 shadow-sm space-y-6">
<div class="flex items-center justify-between border-b border-slate-100 pb-4">
<h4 class="text-xs font-black text-emerald-600 uppercase tracking-widest">Resep Obat & Penggunaan Stok</h4>
<button type="button" @click="addMedicine" class="px-4 py-2 bg-emerald-50 text-emerald-600 text-[10px] font-black rounded-xl hover:bg-emerald-600 hover:text-white transition-all flex items-center gap-2">
<i class="fas fa-plus"></i> TAMBAH OBAT
</button>
</div>
<div class="space-y-4">
<div class="hidden md:grid grid-cols-12 gap-4 px-4 text-[9px] font-black text-slate-400 uppercase tracking-widest">
<div class="col-span-4">Nama Obat (Stok Tersedia)</div>
<div class="col-span-2 text-center">Jumlah Stok</div>
<!-- <div class="col-span-2 text-center">Dosis</div>
<div class="col-span-3">Keterangan Pakai</div> -->
<div class="col-span-1"></div>
</div>
<template x-for="(item, index) in items" :key="index">
<div class="grid grid-cols-1 md:grid-cols-12 gap-3 bg-slate-50 p-4 md:p-2 rounded-2xl items-center border border-slate-100 transition-all">
<div class="col-span-1 md:col-span-4">
<label class="md:hidden text-[9px] font-black text-slate-400 uppercase">Obat</label>
<select :name="`items[${index}][medicine_id]`"
x-model="item.medicine_id"
@change="updateUnit(index, $event)"
required
class="w-full px-3 py-2 bg-white border border-slate-200 rounded-xl text-xs font-bold focus:ring-emerald-500">
<option value="">-- Pilih Obat --</option>
<?php $__currentLoopData = $medicines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $med): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($med->id); ?>" data-unit="<?php echo e($med->unit); ?>" data-stock="<?php echo e((float)$med->qty); ?>">
<?php echo e($med->nama_obat); ?> (<?php echo e((float)$med->qty); ?> <?php echo e($med->unit); ?>)
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="col-span-1 md:col-span-2">
<label class="md:hidden text-[9px] font-black text-slate-400 uppercase">Qty Potong Stok</label>
<div class="relative">
<input type="number" :name="`items[${index}][qty_used]`" x-model="item.qty_used" step="0.01" required
class="w-full pl-3 pr-10 py-2 bg-white border border-slate-200 rounded-xl text-xs font-black">
<span class="absolute right-3 top-1/2 -translate-y-1/2 text-[8px] font-black text-slate-300" x-text="item.unit"></span>
</div>
</div>
<!-- <div class="col-span-1 md:col-span-2">
<label class="md:hidden text-[9px] font-black text-slate-400 uppercase">Dosis</label>
<input type="text" :name="`items[${index}][dosis]`" x-model="item.dosis" required placeholder="0.5 cc / 1 tablet"
class="w-full px-3 py-2 bg-white border border-slate-200 rounded-xl text-xs font-bold">
</div> -->
<!-- <div class="col-span-1 md:col-span-3">
<label class="md:hidden text-[9px] font-black text-slate-400 uppercase">Ket</label>
<input type="text" :name="`items[${index}][keterangan]`" x-model="item.keterangan" placeholder="Oral / Campur Wetfood"
class="w-full px-3 py-2 bg-white border border-slate-200 rounded-xl text-xs font-bold">
</div> -->
<div class="col-span-1 md:col-span-1 text-center mt-2 md:mt-0">
<button type="button" @click="removeItem(index)" x-show="items.length > 1" class="w-8 h-8 inline-flex items-center justify-center bg-rose-50 text-rose-500 rounded-lg hover:bg-rose-500 hover:text-white transition-all">
<i class="fas fa-times text-xs"></i>
</button>
</div>
</div>
</template>
<div class="bg-amber-50 border border-amber-100 rounded-2xl p-4 flex items-start gap-3">
<i class="fas fa-info-circle text-amber-500 mt-1"></i>
<div>
<p class="text-[10px] text-amber-800 font-bold leading-tight">Gunakan titik (.) untuk angka desimal. Pastikan jumlah potong stok tidak melebihi stok tersedia untuk menghindari error sistem.</p>
</div>
</div>
</div>
</div>
<button type="submit" class="w-full py-5 bg-slate-900 text-white text-sm font-black rounded-3xl shadow-xl hover:bg-indigo-700 transition-all active:scale-[0.98] flex items-center justify-center gap-2">
<i class="fas fa-save"></i> SIMPAN REKAM MEDIS & UPDATE SEMUA STOK
</button>
</form>
</div>
<?php $__env->startPush('scripts'); ?>
<script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
<script>
document.addEventListener('alpine:init', () => {
Alpine.data('treatmentForm', () => ({
// Membaca input lama jika validasi form gagal, agar baris obat tidak hilang
init() {
const oldItems = <?php echo json_encode(old('items', []), 512) ?>;
if (oldItems.length > 0) {
this.items = oldItems.map(item => ({
medicine_id: item.medicine_id || '',
qty_used: item.qty_used || 1,
unit: 'UNIT', // Akan diupdate oleh user
dosis: item.dosis || '',
keterangan: item.keterangan || ''
}));
}
},
items: [{
medicine_id: '',
qty_used: 1,
unit: 'UNIT',
dosis: '',
keterangan: ''
}],
addMedicine() {
this.items.push({
medicine_id: '',
qty_used: 1,
unit: 'UNIT',
dosis: '',
keterangan: ''
});
},
removeItem(index) {
this.items.splice(index, 1);
},
// Menggunakan event.target lebih aman dari querySelectorAll
updateUnit(index, event) {
const select = event.target;
const selectedOption = select.options[select.selectedIndex];
const unit = selectedOption.getAttribute('data-unit');
this.items[index].unit = unit ? unit : 'UNIT';
}
}))
})
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?><?php /**PATH /home/u806112658/domains/earrinasia.com/ilycats/resources/views/pages/treatments/create.blade.php ENDPATH**/ ?>