From 893a77917e5b620ecc18111696a9556cd56c026c Mon Sep 17 00:00:00 2001 From: Nawcodes Date: Sun, 27 Apr 2025 18:35:55 +0700 Subject: [PATCH] fix: any resource unitest onces siclus --- app/Filament/Resources/MsAsuransiResource.php | 5 ++--- app/Filament/Resources/MsPasienResource.php | 8 ++++++-- app/Filament/Resources/MsPegawaiResource.php | 11 +++++++++++ app/Filament/Resources/MsRuangPelayananResource.php | 5 +++++ app/Filament/Resources/MsTindakanResource.php | 5 +++++ database/migrations/2025_04_26_072035_ms_pasien.php | 8 ++++---- database/migrations/2025_04_26_072149_ms_pegawai.php | 8 ++++---- database/seeders/TransaksiSeed.php | 2 +- .../views/components/pdf/invoice-detail.blade.php | 2 +- 9 files changed, 39 insertions(+), 15 deletions(-) diff --git a/app/Filament/Resources/MsAsuransiResource.php b/app/Filament/Resources/MsAsuransiResource.php index 2c6a6a3..c5fa5b7 100644 --- a/app/Filament/Resources/MsAsuransiResource.php +++ b/app/Filament/Resources/MsAsuransiResource.php @@ -29,12 +29,11 @@ class MsAsuransiResource extends Resource { return $form ->schema([ - Forms\Components\TextInput::make('id_asuransi') - ->required() - ->maxLength(255), Forms\Components\TextInput::make('nama_asuransi') ->required() ->maxLength(255), + Forms\Components\Textarea::make('keterangan') + ->maxLength(255), ]); } diff --git a/app/Filament/Resources/MsPasienResource.php b/app/Filament/Resources/MsPasienResource.php index 0e0c216..283a9f2 100644 --- a/app/Filament/Resources/MsPasienResource.php +++ b/app/Filament/Resources/MsPasienResource.php @@ -33,7 +33,9 @@ class MsPasienResource extends Resource Forms\Components\TextInput::make('nik') ->placeholder('Egs: 1234567890') ->required() - ->unique() + ->unique( + ignoreRecord: true + ) ->maxLength(10), Forms\Components\TextInput::make('nama') ->required() @@ -49,7 +51,9 @@ class MsPasienResource extends Resource Forms\Components\Textarea::make('alamat') ->maxLength(255), Forms\Components\TextInput::make('email') - ->required() + ->unique( + ignoreRecord: true + ) ->maxLength(255), Forms\Components\DatePicker::make('tgl_lahir') ]); diff --git a/app/Filament/Resources/MsPegawaiResource.php b/app/Filament/Resources/MsPegawaiResource.php index 2a7d319..8ce944c 100644 --- a/app/Filament/Resources/MsPegawaiResource.php +++ b/app/Filament/Resources/MsPegawaiResource.php @@ -35,6 +35,17 @@ class MsPegawaiResource extends Resource Forms\Components\TextInput::make('nama_pegawai') ->required() ->maxLength(255), + Forms\Components\TextInput::make('no_hp') + ->maxLength(15), + Forms\Components\TextInput::make('email') + ->unique( + ignoreRecord: true + ) + ->maxLength(255), + Forms\Components\TextInput::make('alamat') + ->maxLength(255), + Forms\Components\TextInput::make('jabatan') + ->maxLength(255), // ]); } diff --git a/app/Filament/Resources/MsRuangPelayananResource.php b/app/Filament/Resources/MsRuangPelayananResource.php index 6a6d3c6..910875d 100644 --- a/app/Filament/Resources/MsRuangPelayananResource.php +++ b/app/Filament/Resources/MsRuangPelayananResource.php @@ -31,10 +31,15 @@ class MsRuangPelayananResource extends Resource ->schema([ Forms\Components\TextInput::make('id_ruang_pelayanan') ->required() + ->unique( + ignoreRecord: true + ) ->maxLength(255), Forms\Components\TextInput::make('nama_ruang_pelayanan') ->required() ->maxLength(255), + Forms\Components\Textarea::make('keterangan') + ->maxLength(255), ]); } diff --git a/app/Filament/Resources/MsTindakanResource.php b/app/Filament/Resources/MsTindakanResource.php index 13014d6..fdd4d66 100644 --- a/app/Filament/Resources/MsTindakanResource.php +++ b/app/Filament/Resources/MsTindakanResource.php @@ -32,6 +32,9 @@ class MsTindakanResource extends Resource ->schema([ Forms\Components\TextInput::make('id_tindakan') ->label('ID Tindakan') + ->unique( + ignoreRecord: true + ) ->required() ->maxLength(255), Forms\Components\TextInput::make('nama_tindakan') @@ -43,6 +46,8 @@ class MsTindakanResource extends Resource ->numeric() ->required() ->prefix('Rp'), + Forms\Components\Textarea::make('keterangan') + ->maxLength(255), ]); } diff --git a/database/migrations/2025_04_26_072035_ms_pasien.php b/database/migrations/2025_04_26_072035_ms_pasien.php index eb9b239..541ec16 100644 --- a/database/migrations/2025_04_26_072035_ms_pasien.php +++ b/database/migrations/2025_04_26_072035_ms_pasien.php @@ -16,10 +16,10 @@ return new class extends Migration $table->id('mr_pasien'); $table->string('nama'); $table->string('nik')->unique(); - $table->string('no_hp'); - $table->string('alamat'); - $table->string('email'); - $table->date('tgl_lahir'); + $table->string('no_hp')->nullable(); + $table->string('alamat')->nullable(); + $table->string('email')->unique()->nullable(); + $table->date('tgl_lahir')->nullable(); $table->enum('jenis_kelamin', ['L', 'P']); $table->timestamps(); }); diff --git a/database/migrations/2025_04_26_072149_ms_pegawai.php b/database/migrations/2025_04_26_072149_ms_pegawai.php index d8143f8..d017c4c 100644 --- a/database/migrations/2025_04_26_072149_ms_pegawai.php +++ b/database/migrations/2025_04_26_072149_ms_pegawai.php @@ -14,10 +14,10 @@ return new class extends Migration Schema::create('ms_pegawai', function (Blueprint $table) { $table->string('id_pegawai')->primary(); $table->string('nama_pegawai'); - $table->string('no_hp'); - $table->string('email'); - $table->string('alamat'); - $table->string('jabatan'); + $table->string('no_hp')->nullable(); + $table->string('email')->unique()->nullable(); + $table->string('alamat')->nullable(); + $table->string('jabatan')->nullable(); $table->timestamps(); }); } diff --git a/database/seeders/TransaksiSeed.php b/database/seeders/TransaksiSeed.php index 0768754..d345f85 100644 --- a/database/seeders/TransaksiSeed.php +++ b/database/seeders/TransaksiSeed.php @@ -38,7 +38,7 @@ class TransaksiSeed extends Seeder 'id_tindakan' => $id_tindakan[array_rand($id_tindakan)], 'id_pegawai' => MsPegawai::all()->random()->id_pegawai, 'total_harga' => $faker->randomFloat(2, 50000, 500000), - 'status' => 'pending', + 'status' => 'paid', 'keterangan' => $faker->sentence, 'created_at' => now(), 'updated_at' => now(), diff --git a/resources/views/components/pdf/invoice-detail.blade.php b/resources/views/components/pdf/invoice-detail.blade.php index d4f8bba..6287ed3 100644 --- a/resources/views/components/pdf/invoice-detail.blade.php +++ b/resources/views/components/pdf/invoice-detail.blade.php @@ -43,7 +43,7 @@

Tanggal Lahir: {{ \Carbon\Carbon::parse($record->pasien->tgl_lahir)->format('d-m-Y') }}

Jenis Kelamin: {{ ucfirst($record->pasien->jenis_kelamin) }}

No Kartu Asuransi: {{ $record->registrasi->nomor_kartu_asuransi }}

-

Asuransi: {{ $record->registrasi->asuransi->nama_asuransi }}

+

Asuransi: {{ $record->registrasi->asuransi?->nama_asuransi }}