feat(representation): add welcome SMS notification for newly added doctors and clinics by representatives

This commit is contained in:
hamed
2026-06-25 09:37:20 +03:30
parent 763ad82b69
commit e65e506dae
8 changed files with 191 additions and 102 deletions
@@ -33,6 +33,8 @@ class RepresentationActionController extends BaseController
private readonly RepresentationRepository $representationRepo,
private readonly \App\Settlement\Repository\SettlementRepository $settlementRepo,
private readonly \App\Subscription\Service\SubscriptionService $subscriptionService,
private readonly \App\Sms\Service\SmsService $smsService,
private readonly \App\Config\Repository\SiteConfigRepository $configRepo,
) {}
#[OA\Get(
@@ -133,6 +135,14 @@ class RepresentationActionController extends BaseController
$this->em->persist($doctor);
$this->em->flush();
// پیام خوش‌آمد به پزشک
$siteName = $this->configRepo->get('site_name') ?: 'کلینیک‌پرو';
$this->smsService->dispatchAsync(
$mobile,
sprintf('دکتر %s عزیز، به %s خوش آمدید. پروفایل شما توسط نماینده ثبت شد.', $name, $siteName),
tag: \App\Sms\Entity\SmsLog::TAG_WELCOME,
);
return $this->success(['uuid' => $doctor->getUuid()], 201);
}
@@ -200,6 +210,14 @@ class RepresentationActionController extends BaseController
$this->em->persist($clinic);
$this->em->flush();
// پیام خوش‌آمد به مالک کلینیک
$siteName = $this->configRepo->get('site_name') ?: 'کلینیک‌پرو';
$this->smsService->dispatchAsync(
$mobile,
sprintf('کلینیک %s به %s خوش آمد. پروفایل کلینیک شما توسط نماینده ثبت شد.', $name, $siteName),
tag: \App\Sms\Entity\SmsLog::TAG_WELCOME,
);
return $this->success([
'uuid' => $clinic->getUuid(),
'name' => $clinic->getName(),
+2
View File
@@ -17,6 +17,7 @@ class SmsLog
public const TAG_PRE_REGISTRATION = 'pre_registration';
public const TAG_NOTIFICATION_MOBILE = 'notification_mobile';
public const TAG_USER_TEMPLATE = 'user_template';
public const TAG_WELCOME = 'welcome';
public const TAGS = [
self::TAG_GLOBAL,
@@ -26,6 +27,7 @@ class SmsLog
self::TAG_PRE_REGISTRATION,
self::TAG_NOTIFICATION_MOBILE,
self::TAG_USER_TEMPLATE,
self::TAG_WELCOME,
];
#[ORM\Id]