feat: update SMS settings review functionality

- Changed the tab name from 'post-visit-review' to 'post-visit-approved' in SmsPage.
- Introduced a new query for fetching approved post-visit texts.
- Updated the UI to display approved post-visit texts and their details.
- Enhanced the API endpoint to filter SMS settings based on status (pending/approved).
- Added entity name resolution for doctors and clinics in the SMS settings.
- Updated the SmsWalletPage to include new post-visit text variables for SMS templates.
- Improved type definitions in index.ts for better clarity and consistency.
This commit is contained in:
hamed
2026-06-22 10:30:46 +03:30
parent 8ed119e12a
commit 3c103bc51e
8 changed files with 1831 additions and 1011 deletions
+25 -3
View File
@@ -194,15 +194,26 @@ class SmsWalletController extends BaseController
#[Route('/api/v1/admin/sms/settings/review', methods: ['GET'])]
#[IsGranted('ROLE_ADMIN')]
public function adminReviewList(): JsonResponse
public function adminReviewList(Request $request): JsonResponse
{
$status = $request->query->get('status', SmsSettings::TEXT_STATUS_PENDING);
if (!in_array($status, [SmsSettings::TEXT_STATUS_PENDING, SmsSettings::TEXT_STATUS_APPROVED], true)) {
$status = SmsSettings::TEXT_STATUS_PENDING;
}
$pending = $this->settingsRepo->createQueryBuilder('s')
->where('s.postVisitTextStatus = :status')
->setParameter('status', SmsSettings::TEXT_STATUS_PENDING)
->setParameter('status', $status)
->getQuery()
->getResult();
return $this->success(['data' => array_map(fn(SmsSettings $s) => $s->toArray(), $pending)]);
$data = array_map(function (SmsSettings $s) {
$row = $s->toArray();
$row['entity_name'] = $this->resolveEntityName($s->getEntityType(), $s->getEntityId());
return $row;
}, $pending);
return $this->success(['data' => $data]);
}
#[Route('/api/v1/admin/sms/settings/{id}/approve', methods: ['POST'])]
@@ -241,6 +252,17 @@ class SmsWalletController extends BaseController
return $this->success($settings->toArray());
}
private function resolveEntityName(string $type, int $id): ?string
{
if ($type === 'doctor') {
return $this->doctorRepo->find($id)?->getName();
}
if ($type === 'clinic') {
return $this->clinicRepo->find($id)?->getName();
}
return null;
}
#[Route('/api/v1/admin/sms/wallet-report', methods: ['GET'])]
#[IsGranted('ROLE_ADMIN')]
public function adminReport(Request $request): JsonResponse