feat: create registration patient
This commit is contained in:
parent
daafcbdf4c
commit
fc41a62b2e
@ -2,9 +2,90 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ManageRegistration\StoreNewRegistration;
|
||||
use App\Http\Requests\ManageRegistration\UpdateRegistration;
|
||||
use App\Models\Insurance;
|
||||
use App\Models\PatienRegistration;
|
||||
use App\Models\Patient;
|
||||
use App\Models\ServiceRoom;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PatienRegistrationController extends Controller
|
||||
{
|
||||
//
|
||||
public function index()
|
||||
{
|
||||
$registrations = PatienRegistration::with(['user', 'patient', 'insurance', 'service_room'])->get();
|
||||
return view('registration.index', compact('registrations'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$patients = Patient::all();
|
||||
$insurances = Insurance::all();
|
||||
$serviceRooms = ServiceRoom::all();
|
||||
return view('registration.add', compact('patients', 'insurances', 'serviceRooms'));
|
||||
}
|
||||
|
||||
public function store(StoreNewRegistration $request)
|
||||
{
|
||||
$validatedData = $request->validated();
|
||||
$data = [
|
||||
'registration_date' => $validatedData['registration_date'],
|
||||
'patient_id' => $validatedData['patient_id'],
|
||||
'insurance_id' => $validatedData['insurance_id'],
|
||||
'insurance_number' => $validatedData['insurance_number'],
|
||||
'service_room_id' => $validatedData['service_room_id'],
|
||||
'responsible_person_name' => $validatedData['responsible_person_name'],
|
||||
'responsible_person_phone' => $validatedData['responsible_person_phone'],
|
||||
'responsible_email' => $validatedData['responsible_email'],
|
||||
'responsible_person_relationship' => $validatedData['responsible_person_relationship'],
|
||||
'responsible_person_address' => $validatedData['responsible_person_address'],
|
||||
'user_id' => auth()->id(),
|
||||
];
|
||||
|
||||
PatienRegistration::create($data);
|
||||
|
||||
|
||||
return redirect()->route('patient-registration.index')->with('success', 'Pendaftaran pasien berhasil.');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$registration = PatienRegistration::findOrFail($id);
|
||||
$patients = Patient::all();
|
||||
$insurances = Insurance::all();
|
||||
$serviceRooms = ServiceRoom::all();
|
||||
|
||||
return view('registration.edit', compact('registration', 'patients', 'insurances', 'serviceRooms'));
|
||||
}
|
||||
|
||||
public function update(UpdateRegistration $request, $id)
|
||||
{
|
||||
$registration = PatienRegistration::findOrFail($id);
|
||||
$validatedData = $request->validated();
|
||||
$data = [
|
||||
'registration_date' => $validatedData['registration_date'],
|
||||
'patient_id' => $validatedData['patient_id'],
|
||||
'insurance_id' => $validatedData['insurance_id'],
|
||||
'insurance_number' => $validatedData['insurance_number'],
|
||||
'service_room_id' => $validatedData['service_room_id'],
|
||||
'responsible_person_name' => $validatedData['responsible_person_name'],
|
||||
'responsible_person_phone' => $validatedData['responsible_person_phone'],
|
||||
'responsible_email' => $validatedData['responsible_email'],
|
||||
'responsible_person_relationship' => $validatedData['responsible_person_relationship'],
|
||||
'responsible_person_address' => $validatedData['responsible_person_address'],
|
||||
'user_id' => auth()->id(),
|
||||
];
|
||||
|
||||
$registration->update($data);
|
||||
|
||||
return redirect()->route('patient-registration.index')->with('success', 'Pendaftaran pasien berhasil diperbarui.');
|
||||
}
|
||||
public function destroy($id)
|
||||
{
|
||||
$registration = PatienRegistration::findOrFail($id);
|
||||
$registration->delete();
|
||||
|
||||
return redirect()->route('patient-registration.index')->with('success', 'Pendaftaran pasien berhasil dihapus.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\ManageRegistration;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreNewRegistration extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'registration_date' => ['required', 'date'],
|
||||
'patient_id' => ['required', 'exists:patients,id'],
|
||||
'insurance_id' => ['required', 'exists:insurances,id'],
|
||||
'insurance_number' => ['required', 'numeric'],
|
||||
'service_room_id' => ['required', 'exists:service_rooms,id'],
|
||||
'responsible_person_name' => ['required', 'string', 'max:255'],
|
||||
'responsible_person_phone' => ['required', 'string', 'max:15'],
|
||||
'responsible_email' => ['required', 'email', 'max:255'],
|
||||
'responsible_person_relationship' => ['required', 'string', 'max:100'],
|
||||
'responsible_person_address' => ['required', 'string', 'max:500'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom error messages for validation rules.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'registration_date.required' => 'Tanggal registrasi wajib diisi.',
|
||||
'registration_date.date' => 'Tanggal registrasi harus berupa tanggal yang valid.',
|
||||
'patient_id.required' => 'Pasien wajib dipilih.',
|
||||
'patient_id.exists' => 'Pasien yang dipilih tidak valid.',
|
||||
'insurance_id.required' => 'Asuransi wajib dipilih.',
|
||||
'insurance_id.exists' => 'Asuransi yang dipilih tidak valid.',
|
||||
'insurance_number.required' => 'Nomor asuransi wajib diisi.',
|
||||
'insurance_number.string' => 'Nomor asuransi harus berupa teks.',
|
||||
'insurance_number.max' => 'Nomor asuransi tidak boleh lebih dari 20 karakter.',
|
||||
'service_room_id.required' => 'Ruangan layanan wajib dipilih.',
|
||||
'service_room_id.exists' => 'Ruangan layanan yang dipilih tidak valid.',
|
||||
'responsible_person_name.required' => 'Nama penanggung jawab wajib diisi.',
|
||||
'responsible_person_name.string' => 'Nama penanggung jawab harus berupa teks.',
|
||||
'responsible_person_name.max' => 'Nama penanggung jawab tidak boleh lebih dari 255 karakter.',
|
||||
'responsible_person_phone.required' => 'Nomor HP penanggung jawab wajib diisi.',
|
||||
'responsible_person_phone.string' => 'Nomor HP penanggung jawab harus berupa teks.',
|
||||
'responsible_person_phone.max' => 'Nomor HP penanggung jawab tidak boleh lebih dari 15 karakter.',
|
||||
'responsible_email.required' => 'Email penanggung jawab wajib diisi.',
|
||||
'responsible_email.email' => 'Email penanggung jawab harus berupa alamat email yang valid.',
|
||||
'responsible_email.max' => 'Email penanggung jawab tidak boleh lebih dari 255 karakter.',
|
||||
'responsible_person_relationship.required' => 'Hubungan dengan pasien wajib diisi.',
|
||||
'responsible_person_relationship.string' => 'Hubungan dengan pasien harus berupa teks.',
|
||||
'responsible_person_relationship.max' => 'Hubungan dengan pasien tidak boleh lebih dari 100 karakter.',
|
||||
'responsible_person_address.required' => 'Alamat penanggung jawab wajib diisi.',
|
||||
'responsible_person_address.string' => 'Alamat penanggung jawab harus berupa teks.',
|
||||
'responsible_person_address.max' => 'Alamat penanggung jawab tidak boleh lebih dari 500 karakter.',
|
||||
];
|
||||
}
|
||||
}
|
||||
75
app/Http/Requests/ManageRegistration/UpdateRegistration.php
Normal file
75
app/Http/Requests/ManageRegistration/UpdateRegistration.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\ManageRegistration;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateRegistration extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'registration_date' => ['required', 'date'],
|
||||
'patient_id' => ['required', 'exists:patients,id'],
|
||||
'insurance_id' => ['required', 'exists:insurances,id'],
|
||||
'insurance_number' => ['required', 'numeric'],
|
||||
'service_room_id' => ['required', 'exists:service_rooms,id'],
|
||||
'responsible_person_name' => ['required', 'string', 'max:255'],
|
||||
'responsible_person_phone' => ['required', 'string', 'max:15'],
|
||||
'responsible_email' => ['required', 'email', 'max:255'],
|
||||
'responsible_person_relationship' => ['required', 'string', 'max:100'],
|
||||
'responsible_person_address' => ['required', 'string', 'max:500'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom error messages for validation rules.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'registration_date.required' => 'Tanggal registrasi wajib diisi.',
|
||||
'registration_date.date' => 'Tanggal registrasi harus berupa tanggal yang valid.',
|
||||
'patient_id.required' => 'Pasien wajib dipilih.',
|
||||
'patient_id.exists' => 'Pasien yang dipilih tidak valid.',
|
||||
'insurance_id.required' => 'Asuransi wajib dipilih.',
|
||||
'insurance_id.exists' => 'Asuransi yang dipilih tidak valid.',
|
||||
'insurance_number.required' => 'Nomor asuransi wajib diisi.',
|
||||
'insurance_number.string' => 'Nomor asuransi harus berupa teks.',
|
||||
'insurance_number.max' => 'Nomor asuransi tidak boleh lebih dari 20 karakter.',
|
||||
'service_room_id.required' => 'Ruangan layanan wajib dipilih.',
|
||||
'service_room_id.exists' => 'Ruangan layanan yang dipilih tidak valid.',
|
||||
'responsible_person_name.required' => 'Nama penanggung jawab wajib diisi.',
|
||||
'responsible_person_name.string' => 'Nama penanggung jawab harus berupa teks.',
|
||||
'responsible_person_name.max' => 'Nama penanggung jawab tidak boleh lebih dari 255 karakter.',
|
||||
'responsible_person_phone.required' => 'Nomor HP penanggung jawab wajib diisi.',
|
||||
'responsible_person_phone.string' => 'Nomor HP penanggung jawab harus berupa teks.',
|
||||
'responsible_person_phone.max' => 'Nomor HP penanggung jawab tidak boleh lebih dari 15 karakter.',
|
||||
'responsible_email.required' => 'Email penanggung jawab wajib diisi.',
|
||||
'responsible_email.email' => 'Email penanggung jawab harus berupa alamat email yang valid.',
|
||||
'responsible_email.max' => 'Email penanggung jawab tidak boleh lebih dari 255 karakter.',
|
||||
'responsible_person_relationship.required' => 'Hubungan dengan pasien wajib diisi.',
|
||||
'responsible_person_relationship.string' => 'Hubungan dengan pasien harus berupa teks.',
|
||||
'responsible_person_relationship.max' => 'Hubungan dengan pasien tidak boleh lebih dari 100 karakter.',
|
||||
'responsible_person_address.required' => 'Alamat penanggung jawab wajib diisi.',
|
||||
'responsible_person_address.string' => 'Alamat penanggung jawab harus berupa teks.',
|
||||
'responsible_person_address.max' => 'Alamat penanggung jawab tidak boleh lebih dari 500 karakter.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -9,4 +9,27 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
class PatienRegistration extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $table = 'patien_registrations';
|
||||
protected $guarded = ["id"];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function patient()
|
||||
{
|
||||
return $this->belongsTo(Patient::class, 'patient_id');
|
||||
}
|
||||
|
||||
public function insurance()
|
||||
{
|
||||
return $this->belongsTo(insurance::class, 'insurance_id');
|
||||
}
|
||||
|
||||
public function service_room()
|
||||
{
|
||||
return $this->belongsTo(ServiceRoom::class, 'service_room_id');
|
||||
}
|
||||
}
|
||||
|
||||
167
resources/views/registration/add.blade.php
Normal file
167
resources/views/registration/add.blade.php
Normal file
@ -0,0 +1,167 @@
|
||||
@extends('layouts.app')
|
||||
@push('styles')
|
||||
{{-- Select2 JS --}}
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
<style>
|
||||
.select2-container--default .select2-selection--single {
|
||||
height: 38px !important;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
@section('content-header')
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0">Tambah Registrasi Pasien</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item active">Tambah Registrasi Pasien</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('main-content')
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Form Registrasi Pasien</h3>
|
||||
</div>
|
||||
<form action="{{ route('patient-registration.store') }}" method="POST">
|
||||
@csrf
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<!-- Left Column -->
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Tanggal Registrasi <strong class="text-danger">*</strong></label>
|
||||
<input name="registration_date" type="date" class="form-control"
|
||||
value="{{ old('registration_date') }}" required>
|
||||
@error('registration_date')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Pasien <strong class="text-danger">*</strong></label>
|
||||
<select name="patient_id" class="form-control select2" required>
|
||||
<option value="">-- Pilih Pasien --</option>
|
||||
@foreach ($patients as $patient)
|
||||
<option value="{{ $patient->id }}"
|
||||
{{ old('patient_id') == $patient->id ? 'selected' : '' }}>
|
||||
{{ $patient->first_name }} {{ $patient->last_name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('patient_id')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Asuransi <strong class="text-danger">*</strong></label>
|
||||
<select name="insurance_id" class="form-control" required>
|
||||
<option value="">-- Pilih Asuransi --</option>
|
||||
@foreach ($insurances as $insurance)
|
||||
<option value="{{ $insurance->id }}"
|
||||
{{ old('insurance_id') == $insurance->id ? 'selected' : '' }}>
|
||||
{{ $insurance->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('insurance_id')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>No. Asuransi <strong class="text-danger">*</strong></label>
|
||||
<input name="insurance_number" type="number" class="form-control"
|
||||
value="{{ old('insurance_number') }}" required>
|
||||
@error('insurance_number')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Ruangan Layanan <strong class="text-danger">*</strong></label>
|
||||
<select name="service_room_id" class="form-control" required>
|
||||
<option value="">-- Pilih Ruangan --</option>
|
||||
@foreach ($serviceRooms as $serviceRoom)
|
||||
<option value="{{ $serviceRoom->id }}"
|
||||
{{ old('service_room_id') == $serviceRoom->id ? 'selected' : '' }}>
|
||||
{{ $serviceRoom->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('service_room_id')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<!-- Right Column -->
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Nama Penanggung Jawab <strong class="text-danger">*</strong></label>
|
||||
<input name="responsible_person_name" type="text" class="form-control"
|
||||
value="{{ old('responsible_person_name') }}" required>
|
||||
@error('responsible_person_name')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>No. HP Penanggung Jawab <strong class="text-danger">*</strong></label>
|
||||
<input name="responsible_person_phone" type="text" class="form-control"
|
||||
value="{{ old('responsible_person_phone') }}" required>
|
||||
@error('responsible_person_phone')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Email Penanggung Jawab <strong class="text-danger">*</strong></label>
|
||||
<input name="responsible_email" type="email" class="form-control"
|
||||
value="{{ old('responsible_email') }}" required>
|
||||
@error('responsible_email')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Hubungan dengan Pasien <strong class="text-danger">*</strong></label>
|
||||
<input name="responsible_person_relationship" type="text" class="form-control"
|
||||
value="{{ old('responsible_person_relationship') }}" required>
|
||||
@error('responsible_person_relationship')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Alamat Penanggung Jawab <strong class="text-danger">*</strong></label>
|
||||
<textarea name="responsible_person_address" class="form-control" rows="3" required>{{ old('responsible_person_address') }}</textarea>
|
||||
@error('responsible_person_address')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button type="button" class="btn btn-primary" onclick="history.back()">Kembali</button>
|
||||
<button type="submit" class="btn btn-success">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@push('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.select2').select2({
|
||||
placeholder: "-- Pilih Pasien --",
|
||||
allowClear: true,
|
||||
width: '100%',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
170
resources/views/registration/edit.blade.php
Normal file
170
resources/views/registration/edit.blade.php
Normal file
@ -0,0 +1,170 @@
|
||||
@extends('layouts.app')
|
||||
@push('styles')
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
<style>
|
||||
.select2-container--default .select2-selection--single {
|
||||
height: 38px !important;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
@section('content-header')
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0">Edit Registrasi Pasien</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item active">Edit Registrasi Pasien</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('main-content')
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Form Edit Registrasi Pasien</h3>
|
||||
</div>
|
||||
<form action="{{ route('patient-registration.update', $registration->id) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<!-- Left Column -->
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Tanggal Registrasi <strong class="text-danger">*</strong></label>
|
||||
<input name="registration_date" type="date" class="form-control"
|
||||
value="{{ old('registration_date', $registration->registration_date) }}" required>
|
||||
@error('registration_date')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Pasien <strong class="text-danger">*</strong></label>
|
||||
<select name="patient_id" class="form-control select2" required>
|
||||
<option value="">-- Pilih Pasien --</option>
|
||||
@foreach ($patients as $patient)
|
||||
<option value="{{ $patient->id }}"
|
||||
{{ old('patient_id', $registration->patient_id) == $patient->id ? 'selected' : '' }}>
|
||||
{{ $patient->first_name }} {{ $patient->last_name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('patient_id')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Asuransi <strong class="text-danger">*</strong></label>
|
||||
<select name="insurance_id" class="form-control" required>
|
||||
<option value="">-- Pilih Asuransi --</option>
|
||||
@foreach ($insurances as $insurance)
|
||||
<option value="{{ $insurance->id }}"
|
||||
{{ old('insurance_id', $registration->insurance_id) == $insurance->id ? 'selected' : '' }}>
|
||||
{{ $insurance->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('insurance_id')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>No. Asuransi <strong class="text-danger">*</strong></label>
|
||||
<input name="insurance_number" type="number" class="form-control"
|
||||
value="{{ old('insurance_number', $registration->insurance_number) }}" required>
|
||||
@error('insurance_number')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Ruangan Layanan <strong class="text-danger">*</strong></label>
|
||||
<select name="service_room_id" class="form-control" required>
|
||||
<option value="">-- Pilih Ruangan --</option>
|
||||
@foreach ($serviceRooms as $serviceRoom)
|
||||
<option value="{{ $serviceRoom->id }}"
|
||||
{{ old('service_room_id', $registration->service_room_id) == $serviceRoom->id ? 'selected' : '' }}>
|
||||
{{ $serviceRoom->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('service_room_id')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<!-- Right Column -->
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Nama Penanggung Jawab <strong class="text-danger">*</strong></label>
|
||||
<input name="responsible_person_name" type="text" class="form-control"
|
||||
value="{{ old('responsible_person_name', $registration->responsible_person_name) }}"
|
||||
required>
|
||||
@error('responsible_person_name')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>No. HP Penanggung Jawab <strong class="text-danger">*</strong></label>
|
||||
<input name="responsible_person_phone" type="text" class="form-control"
|
||||
value="{{ old('responsible_person_phone', $registration->responsible_person_phone) }}"
|
||||
required>
|
||||
@error('responsible_person_phone')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Email Penanggung Jawab <strong class="text-danger">*</strong></label>
|
||||
<input name="responsible_email" type="email" class="form-control"
|
||||
value="{{ old('responsible_email', $registration->responsible_email) }}" required>
|
||||
@error('responsible_email')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Hubungan dengan Pasien <strong class="text-danger">*</strong></label>
|
||||
<input name="responsible_person_relationship" type="text" class="form-control"
|
||||
value="{{ old('responsible_person_relationship', $registration->responsible_person_relationship) }}"
|
||||
required>
|
||||
@error('responsible_person_relationship')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Alamat Penanggung Jawab <strong class="text-danger">*</strong></label>
|
||||
<textarea name="responsible_person_address" class="form-control" rows="3" required>{{ old('responsible_person_address', $registration->responsible_person_address) }}</textarea>
|
||||
@error('responsible_person_address')
|
||||
<small style="color: red;">{{ $message }}</small>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button type="button" class="btn btn-primary" onclick="history.back()">Kembali</button>
|
||||
<button type="submit" class="btn btn-success">Update</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@push('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.select2').select2({
|
||||
placeholder: "-- Pilih Pasien --",
|
||||
allowClear: true,
|
||||
width: '100%',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
159
resources/views/registration/index.blade.php
Normal file
159
resources/views/registration/index.blade.php
Normal file
@ -0,0 +1,159 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@push('styles')
|
||||
<!-- DataTables -->
|
||||
<link rel="stylesheet" href="{{ asset('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('plugins/datatables-responsive/css/responsive.bootstrap4.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('plugins/datatables-buttons/css/buttons.bootstrap4.min.css') }}">
|
||||
@endpush
|
||||
|
||||
@section('content-header')
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0">Registrasi Pasien</h1>
|
||||
</div><!-- /.col -->
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item active">Registrasi Pasien</li>
|
||||
</ol>
|
||||
</div><!-- /.col -->
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('main-content')
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<a href="{{ route('patient-registration.create') }}" class="btn btn-info">
|
||||
<i class="fas fa-plus"></i>
|
||||
Tambah Registrasi Pasien
|
||||
</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table id="tableData" class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Rekam Medis</th>
|
||||
<th>Nama Lengkap</th>
|
||||
<th>Jaminan Kesehatan</th>
|
||||
<th>Dibuat Oleh</th>
|
||||
<th>Dibuat Pada</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($registrations as $index => $data)
|
||||
<tr>
|
||||
<td>{{ $index + 1 }}</td>
|
||||
<td>{{ $data->patient->medical_record_number }}</td>
|
||||
<td>{{ $data->patient->first_name }} {{ $data->patient->last_name }}</td>
|
||||
<td>{{ $data->insurance->name }}</td>
|
||||
<td>{{ $data->user->name }}</td>
|
||||
<td>{{ $data->created_at }}</td>
|
||||
<td>
|
||||
<a href="{{ route('patient-registration.edit', $data->id) }}"
|
||||
class="btn btn-sm btn-warning">
|
||||
<i class="fas fa-pencil-alt"></i> Edit
|
||||
</a>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-danger delete-btn"
|
||||
data-url="{{ route('patient-registration.destroy', $data->id) }}">
|
||||
<i class="fas fa-trash"></i> Hapus
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Delete Confirmation Modal -->
|
||||
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="deleteModalLabel">Konfirmasi Hapus</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Apakah Anda yakin ingin menghapus data ini?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
|
||||
<form id="deleteForm" action="" method="POST">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-danger">Hapus</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@if (session('success'))
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
Toast.fire({
|
||||
icon: 'success',
|
||||
title: "{{ session('success') }}",
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endif
|
||||
@if (session('error'))
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
Toast.fire({
|
||||
icon: 'error',
|
||||
title: "{{ session('error') }}",
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endif
|
||||
|
||||
<script src="{{ asset('plugins/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js') }}"></script>
|
||||
<script src="{{ asset('plugins/datatables-responsive/js/dataTables.responsive.min.js') }}"></script>
|
||||
<script src="{{ asset('plugins/datatables-responsive/js/responsive.bootstrap4.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#tableData").DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": false,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"info": true,
|
||||
"autoWidth": false,
|
||||
"responsive": true,
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const deleteButtons = document.querySelectorAll('.delete-btn');
|
||||
const deleteModal = document.getElementById('deleteModal');
|
||||
const deleteForm = document.getElementById('deleteForm');
|
||||
|
||||
deleteButtons.forEach(button => {
|
||||
button.addEventListener('click', function() {
|
||||
const url = this.getAttribute('data-url');
|
||||
deleteForm.setAttribute('action', url);
|
||||
$(deleteModal).modal('show'); // Use jQuery to show the modal
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@ -5,6 +5,7 @@ use App\Http\Controllers\DashboardController;
|
||||
use App\Http\Controllers\ManageUserController;
|
||||
use App\Http\Controllers\ProfileController;
|
||||
use App\Http\Controllers\InsuranceController;
|
||||
use App\Http\Controllers\PatienRegistrationController;
|
||||
use App\Http\Controllers\PatientController;
|
||||
use App\Http\Controllers\ServiceRoomController;
|
||||
use App\Http\Controllers\TreatmentController;
|
||||
@ -77,6 +78,15 @@ Route::middleware('auth')->group(function () {
|
||||
Route::delete('/pasien/{id}', [PatientController::class, 'destroy'])->name('patient-management.destroy');
|
||||
Route::get('/pasien/{id}', [PatientController::class, 'show'])->name('patient-management.show');
|
||||
|
||||
# Manage Registrasi Pasien
|
||||
Route::get('/registrasi-pasien', [PatienRegistrationController::class, 'index'])->name('patient-registration.index');
|
||||
Route::get('/registrasi-pasien/tambah', [PatienRegistrationController::class, 'create'])->name('patient-registration.create');
|
||||
Route::get('/registrasi-pasien/{id}', [PatienRegistrationController::class, 'show'])->name('patient-registration.show');
|
||||
Route::post('/registrasi-pasien', [PatienRegistrationController::class, 'store'])->name('patient-registration.store');
|
||||
Route::get('/registrasi-pasien/{id}/edit', [PatienRegistrationController::class, 'edit'])->name('patient-registration.edit');
|
||||
Route::put('/registrasi-pasien/{id}', [PatienRegistrationController::class, 'update'])->name('patient-registration.update');
|
||||
Route::delete('/registrasi-pasien/{id}', [PatienRegistrationController::class, 'destroy'])->name('patient-registration.destroy');
|
||||
|
||||
// Profile Page
|
||||
Route::get('/profil-akun', [ProfileController::class, 'edit'])->name('profile.edit');
|
||||
Route::put('/profil-akun', [ProfileController::class, 'update'])->name('profile.update');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user