feat: update ClinicDetailPage and ClinicsPage for address handling and UI improvements
This commit is contained in:
@@ -567,6 +567,10 @@ class ClinicController extends BaseController
|
||||
return $this->error(ErrorCodes::ERR_AUTH_006, 'دسترسی ممنوع', 403);
|
||||
}
|
||||
|
||||
if ($this->addressRepo->countByClinic($clinic->getId()) > 0) {
|
||||
return $this->error(ErrorCodes::ERR_CONFLICT_001, 'این کلینیک قبلاً آدرس دارد. برای ویرایش از endpoint PATCH استفاده کنید', 409);
|
||||
}
|
||||
|
||||
$data = json_decode($request->getContent(), true) ?? [];
|
||||
$address = DoctorAddress::forClinic($clinic->getId());
|
||||
$this->hydrateClinicAddress($address, $data);
|
||||
@@ -618,11 +622,6 @@ class ClinicController extends BaseController
|
||||
return $this->error(ErrorCodes::ERR_VALIDATION_002, 'آدرس یافت نشد', 404);
|
||||
}
|
||||
|
||||
$remaining = $this->addressRepo->countByClinic($clinic->getId());
|
||||
if ($remaining <= 1) {
|
||||
return $this->error(ErrorCodes::ERR_CONFLICT_001, 'کلینیک باید حداقل یک آدرس داشته باشد', 409);
|
||||
}
|
||||
|
||||
$this->addressRepo->remove($address);
|
||||
|
||||
return $this->success(['message' => 'آدرس با موفقیت حذف شد']);
|
||||
|
||||
Reference in New Issue
Block a user