105 lines
2.4 KiB
PHP
105 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\InteractsWithUuid;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ServiceRoom extends Model
|
|
{
|
|
use HasFactory, InteractsWithUuid;
|
|
|
|
protected $table = 'm_service_room';
|
|
protected $primaryKey = 'id';
|
|
public $incrementing = false;
|
|
protected $keyType = 'string';
|
|
|
|
protected $fillable = [
|
|
'id',
|
|
'code',
|
|
'name',
|
|
'type',
|
|
'class',
|
|
'floor',
|
|
'building',
|
|
'wing',
|
|
'capacity',
|
|
'price_per_day',
|
|
'facilities',
|
|
'is_available',
|
|
'is_active'
|
|
];
|
|
|
|
protected $casts = [
|
|
'capacity' => 'integer',
|
|
'price_per_day' => 'decimal:2',
|
|
'is_available' => 'boolean',
|
|
'is_active' => 'boolean',
|
|
];
|
|
|
|
protected $attributes = [
|
|
'type' => 'Rawat Inap',
|
|
'class' => 'standard',
|
|
'capacity' => 1,
|
|
'is_available' => true,
|
|
'is_active' => true,
|
|
];
|
|
|
|
public function getTypeNameAttribute(): string
|
|
{
|
|
return match($this->type) {
|
|
'Rawat Jalan' => 'Rawat Jalan',
|
|
'Rawat Inap' => 'Rawat Inap',
|
|
'UGD' => 'UGD',
|
|
'ICU' => 'ICU',
|
|
'Bedah' => 'Bedah',
|
|
'Persalinan' => 'Persalinan',
|
|
'Radiologi' => 'Radiologi',
|
|
'Laboratorium' => 'Laboratorium',
|
|
'Farmasi' => 'Farmasi',
|
|
default => 'Lainnya',
|
|
};
|
|
}
|
|
|
|
public function getClassNameAttribute(): string
|
|
{
|
|
return match($this->class) {
|
|
'vip' => 'VIP',
|
|
'class_1' => 'Kelas 1',
|
|
'class_2' => 'Kelas 2',
|
|
'class_3' => 'Kelas 3',
|
|
'standard' => 'Standard',
|
|
default => 'Non Kelas',
|
|
};
|
|
}
|
|
|
|
public static function getRoomTypes(): array
|
|
{
|
|
return [
|
|
'Rawat Jalan',
|
|
'Rawat Inap',
|
|
'UGD',
|
|
'ICU',
|
|
'Bedah',
|
|
'Persalinan',
|
|
'Radiologi',
|
|
'Laboratorium',
|
|
'Farmasi',
|
|
'Lainnya'
|
|
];
|
|
}
|
|
|
|
public static function getRoomClasses(): array
|
|
{
|
|
return [
|
|
'vip' => 'VIP',
|
|
'class_1' => 'Kelas 1',
|
|
'class_2' => 'Kelas 2',
|
|
'class_3' => 'Kelas 3',
|
|
'standard' => 'Standard',
|
|
'non_class' => 'Non Kelas'
|
|
];
|
|
}
|
|
}
|