fix: enforce unique national ID validation and fix sync updated_at corruption

This commit is contained in:
SajjadMahmoody
2026-04-28 23:31:19 +03:30
parent dc524f1fb6
commit 721ee30948
9 changed files with 77 additions and 186 deletions
+10 -2
View File
@@ -195,7 +195,15 @@ public static function form(Schema $schema): Schema
TextInput::make('icno')
->label(__('patients.fields.icno'))
->required()
->maxLength(11),
->maxLength(11)
->unique(
table: Patient::class,
column: 'icno',
ignorable: fn ($record) => $record,
)
->validationMessages([
'unique' => __('patients.validation.icno_unique'),
]),
TextInput::make('hand_phone')
->label(__('patients.fields.hand_phone'))
@@ -807,7 +815,7 @@ public static function table(Table $table): Table
->iconColor(fn ($state) => $state ? 'success' : 'gray')
->placeholder('-'),
])
->defaultSort('created_at', 'desc')
->defaultSort('updated_at', 'desc')
->recordActions([
Action::make('surgeryAppointment')
->label(__('patients.actions.surgery_appointment'))