feat(payment): add Jalali date formatting for appointment confirmation SMS
This commit is contained in:
@@ -51,6 +51,7 @@ class PaymentController extends BaseController
|
||||
private readonly ClinicRepository $clinicRepo,
|
||||
private readonly SiteConfigRepository $configRepo,
|
||||
private readonly \App\Settlement\Service\CommissionService $commissionService,
|
||||
private readonly \App\Representation\Service\JalaliDateService $jalali,
|
||||
private readonly string $appBaseUrl,
|
||||
private readonly string $allowedFrontendHosts = '',
|
||||
) {}
|
||||
@@ -646,7 +647,7 @@ class PaymentController extends BaseController
|
||||
|
||||
$mobile = $appointment->getPatientMobile();
|
||||
if ($mobile) {
|
||||
$when = date('Y-m-d H:i', $appointment->getSlotStart());
|
||||
$when = $this->jalali->formatDateTime($appointment->getSlotStart());
|
||||
$message = $this->smsText->resolve(\App\Sms\Entity\SmsLog::TAG_PAYMENT, [
|
||||
'doctor' => $appointment->getDoctor()->getName(),
|
||||
'date' => $when,
|
||||
|
||||
@@ -43,6 +43,21 @@ class JalaliDateService
|
||||
return [$jy, $jm, $jd];
|
||||
}
|
||||
|
||||
/** تبدیل timestamp به رشتهی شمسی: «۱۴۰۵/۰۴/۰۲ ۰۹:۰۰» (پیشفرض با ساعت). */
|
||||
public function formatDateTime(int $timestamp, bool $withTime = true): string
|
||||
{
|
||||
$pattern = $withTime ? 'yyyy/MM/dd HH:mm' : 'yyyy/MM/dd';
|
||||
$f = new \IntlDateFormatter(
|
||||
'fa_IR@calendar=persian',
|
||||
\IntlDateFormatter::NONE,
|
||||
\IntlDateFormatter::NONE,
|
||||
'Asia/Tehran',
|
||||
\IntlDateFormatter::TRADITIONAL,
|
||||
$pattern,
|
||||
);
|
||||
return $f->format($timestamp);
|
||||
}
|
||||
|
||||
public function jalaliYear(int $timestamp): int
|
||||
{
|
||||
return $this->gregorianToJalali(
|
||||
|
||||
Reference in New Issue
Block a user