بلاک‌ها · رزرو و خدمات
ری‌اکت ۱۹ و Next.js با پیاده‌سازی دسترس‌پذیری داخلی دیگویو ۳ با Composition APISvelte ۵ با runesانگولار با signals و دایرکتیوهای standaloneجتپک کامپوز با KotliniOS — هنوز پورت نشده

تکمیل و پرداختِ نوبت

پیش‌نمایش تمام‌صفحه

مراحلِ نوبت، برای خودم یا دیگری، کدِ ملی و موبایل با اعتبارسنجی، بیمهٔ پایه که سهمش از مبلغ کم می‌شود، علتِ مراجعه، روشِ پرداخت و قانونِ لغو؛ بعد از پرداخت رسید با کدِ رهگیری و افزودن به تقویم.

۱. نصب کامپوننت‌ها

این بلاک از ۱۴ آیتم دیگ استفاده می‌کند: avatarbuttoncheckboxcontrol-sizeiconslabelpersianradio-cardradio-groupselectsteppertext-fieldtextareatoggle-group

پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add https://docs.digdesign.ir/r/avatar.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/checkbox.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/label.json https://docs.digdesign.ir/r/persian.json https://docs.digdesign.ir/r/radio-card.json https://docs.digdesign.ir/r/radio-group.json https://docs.digdesign.ir/r/select.json https://docs.digdesign.ir/r/stepper.json https://docs.digdesign.ir/r/text-field.json https://docs.digdesign.ir/r/textarea.json https://docs.digdesign.ir/r/toggle-group.json
pnpm dlx digdesign@latest add https://docs.digdesign.ir/r/avatar.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/checkbox.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/label.json https://docs.digdesign.ir/r/persian.json https://docs.digdesign.ir/r/radio-card.json https://docs.digdesign.ir/r/radio-group.json https://docs.digdesign.ir/r/select.json https://docs.digdesign.ir/r/stepper.json https://docs.digdesign.ir/r/text-field.json https://docs.digdesign.ir/r/textarea.json https://docs.digdesign.ir/r/toggle-group.json
yarn dlx digdesign@latest add https://docs.digdesign.ir/r/avatar.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/checkbox.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/label.json https://docs.digdesign.ir/r/persian.json https://docs.digdesign.ir/r/radio-card.json https://docs.digdesign.ir/r/radio-group.json https://docs.digdesign.ir/r/select.json https://docs.digdesign.ir/r/stepper.json https://docs.digdesign.ir/r/text-field.json https://docs.digdesign.ir/r/textarea.json https://docs.digdesign.ir/r/toggle-group.json
bunx --bun digdesign@latest add https://docs.digdesign.ir/r/avatar.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/checkbox.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/label.json https://docs.digdesign.ir/r/persian.json https://docs.digdesign.ir/r/radio-card.json https://docs.digdesign.ir/r/radio-group.json https://docs.digdesign.ir/r/select.json https://docs.digdesign.ir/r/stepper.json https://docs.digdesign.ir/r/text-field.json https://docs.digdesign.ir/r/textarea.json https://docs.digdesign.ir/r/toggle-group.json
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add avatar button checkbox control-size label persian radio-card radio-group select stepper text-field textarea toggle-group --framework vue
pnpm dlx digdesign@latest add avatar button checkbox control-size label persian radio-card radio-group select stepper text-field textarea toggle-group --framework vue
yarn dlx digdesign@latest add avatar button checkbox control-size label persian radio-card radio-group select stepper text-field textarea toggle-group --framework vue
bunx --bun digdesign@latest add avatar button checkbox control-size label persian radio-card radio-group select stepper text-field textarea toggle-group --framework vue
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add button --framework svelte
pnpm dlx digdesign@latest add button --framework svelte
yarn dlx digdesign@latest add button --framework svelte
bunx --bun digdesign@latest add button --framework svelte
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add avatar button checkbox control-size icons input label persian radio-card radio-group select stepper text-field textarea toggle-group --framework angular
pnpm dlx digdesign@latest add avatar button checkbox control-size icons input label persian radio-card radio-group select stepper text-field textarea toggle-group --framework angular
yarn dlx digdesign@latest add avatar button checkbox control-size icons input label persian radio-card radio-group select stepper text-field textarea toggle-group --framework angular
bunx --bun digdesign@latest add avatar button checkbox control-size icons input label persian radio-card radio-group select stepper text-field textarea toggle-group --framework angular
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add avatar button checkbox control-size label persian radio-card radio-group select stepper text-field textarea toggle-group --framework android
pnpm dlx digdesign@latest add avatar button checkbox control-size label persian radio-card radio-group select stepper text-field textarea toggle-group --framework android
yarn dlx digdesign@latest add avatar button checkbox control-size label persian radio-card radio-group select stepper text-field textarea toggle-group --framework android
bunx --bun digdesign@latest add avatar button checkbox control-size label persian radio-card radio-group select stepper text-field textarea toggle-group --framework android

۲. کد صفحه

کد را در صفحهٔ پروژه‌تان بگذارید (React: app/<route>/page.tsx) و متن‌ها، داده و هندلرها را با محصول خودتان عوض کنید. با سوییچر فریم‌ورک کدِ همین صفحه در فریم‌ورک دیگر را ببینید.

doctor-confirm.tsx
"use client"

import * as React from "react"

import { CalendarIcon, CheckIcon, CreditCardIcon, LocationIcon, WalletIcon } from "@/components/icons"
import { Avatar } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { ControlSizeProvider } from "@/components/ui/control-size"
import { Label } from "@/components/ui/label"
import { RadioCard } from "@/components/ui/radio-card"
import { RadioGroup } from "@/components/ui/radio-group"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { Stepper, StepperItem, StepperTitle } from "@/components/ui/stepper"
import { TextField } from "@/components/ui/text-field"
import { Textarea } from "@/components/ui/textarea"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
import { formatCurrency, isValidMobile, isValidNationalId, toEnDigits, toFaDigits } from "@/lib/persian"
import { stockImages } from "@/lib/stock-images"

const FEE = 850_000
const INSURANCES = [
  { value: "none", label: "بدونِ بیمه", share: 0 },
  { value: "tamin", label: "تأمین اجتماعی", share: 0.3 },
  { value: "salamat", label: "بیمهٔ سلامت", share: 0.3 },
  { value: "army", label: "نیروهای مسلح", share: 0.3 },
]

/**
 * تأیید و پرداختِ نوبت: مراحل (زمان ← اطلاعاتِ بیمار ← پرداخت)، نوبت برای خودم یا دیگری، کدِ ملی و موبایل با
 * اعتبارسنجی بعد از ترکِ فیلد، بیمهٔ پایه که سهمش بی‌درنگ از مبلغ کم می‌شود، علتِ مراجعه که پرکردنش لازم نیست، روشِ پرداخت و
 * پذیرفتنِ قانونِ لغو. خلاصهٔ نوبت کنارِ فرم (در موبایل بالای آن) و بعد از پرداخت، همان کارت رسید با کدِ رهگیری
 * و افزودن به تقویم می‌شود.
 */
export default function DoctorConfirmBlock() {
  const [forWhom, setForWhom] = React.useState("me")
  const [nationalId, setNationalId] = React.useState("0012345679")
  const [mobile, setMobile] = React.useState("09121234567")
  const [patient, setPatient] = React.useState("آرمیتا رستگار")
  const [insurance, setInsurance] = React.useState("tamin")
  const [method, setMethod] = React.useState("wallet")
  const [agreed, setAgreed] = React.useState(false)
  const [touched, setTouched] = React.useState<Record<string, boolean>>({})
  const [submitted, setSubmitted] = React.useState(false)
  const [paid, setPaid] = React.useState(false)

  const share = (INSURANCES.find((item) => item.value === insurance)?.share ?? 0) * FEE
  const total = FEE - share
  const show = (field: string) => submitted || touched[field]
  const errors = {
    patient: !patient.trim() ? "نامِ بیمار را بنویس." : "",
    nationalId: !isValidNationalId(toEnDigits(nationalId)) ? "کدِ ملی درست نیست؛ ۱۰ رقم است، بدونِ خط تیره." : "",
    mobile: !isValidMobile(toEnDigits(mobile)) ? "موبایل را با ۰۹ شروع کن، ۱۱ رقم." : "",
    agreed: !agreed ? "برای ادامه قانونِ لغو را بپذیر." : "",
  }
  const blur = (field: string) => () => setTouched((value) => ({ ...value, [field]: true }))

  const summary = (
    <section aria-label="خلاصهٔ نوبت" className="flex flex-col gap-4 rounded-xl border border-border bg-card p-5">
      <div className="flex items-center gap-3">
        <Avatar src={stockImages.doctorWomanCurly.src} alt="" name="سارا محمدی" className="size-12 shrink-0" />
        <span className="flex min-w-0 flex-col">
          <span className="truncate font-bold">دکتر سارا محمدی</span>
          <span className="truncate text-sm text-muted-foreground">متخصصِ قلب و عروق</span>
        </span>
      </div>
      <ul className="flex flex-col gap-2 text-sm [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground">
        <li className="flex items-center gap-2">
          <CalendarIcon aria-hidden />
          یکشنبه ۲۶ مهر، ساعتِ ۱۶:۴۵
        </li>
        <li className="flex items-start gap-2">
          <LocationIcon aria-hidden className="mt-0.5" />
          مطبِ ونک، ساختمانِ پزشکانِ آرین، طبقهٔ ۴
        </li>
      </ul>
      <dl className="flex flex-col gap-2 border-t border-border pt-4 text-sm">
        <div className="flex justify-between gap-2">
          <dt className="text-muted-foreground">ویزیتِ حضوری</dt>
          <dd className="tabular-nums">{formatCurrency(FEE)}</dd>
        </div>
        {share > 0 && (
          <div className="flex justify-between gap-2">
            <dt className="text-muted-foreground">سهمِ بیمه</dt>
            <dd className="text-success-subtle-foreground tabular-nums">−{formatCurrency(share)}</dd>
          </div>
        )}
        <div className="flex items-baseline justify-between gap-2 border-t border-border pt-3">
          <dt className="font-semibold">{paid ? "پرداخت‌شده" : "قابلِ پرداخت"}</dt>
          <dd className="text-lg font-bold tabular-nums">{formatCurrency(total)}</dd>
        </div>
      </dl>
    </section>
  )

  if (paid) {
    return (
      <ControlSizeProvider size="xl" asChild>
        <main className="mx-auto flex w-full max-w-lg flex-col gap-6 p-4 py-10 sm:p-6">
          <div role="status" className="flex flex-col items-center gap-3 text-center">
            <span aria-hidden className="flex size-14 items-center justify-center rounded-full bg-success-subtle text-success-subtle-foreground [&>svg]:size-7">
              <CheckIcon />
            </span>
            <h1 className="text-2xl leading-snug font-bold">نوبتت قطعی شد</h1>
            <p className="text-muted-foreground">
              کدِ رهگیری <span className="font-bold text-foreground tabular-nums">۴۸۲۷۱۹</span> به موبایلت پیامک شد. ۱۵ دقیقه زودتر برسی، پذیرش راحت‌تر است.
            </p>
          </div>
          {summary}
          <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
            <Button variant="outline">
              <CalendarIcon />
              افزودن به تقویم
            </Button>
            <Button>نوبت‌های من</Button>
          </div>
        </main>
      </ControlSizeProvider>
    )
  }

  return (
    <ControlSizeProvider size="xl" asChild>
      <form
        noValidate
        className="mx-auto grid w-full max-w-5xl grid-cols-1 items-start gap-6 p-4 sm:p-6 lg:grid-cols-[minmax(0,1fr)_20rem] lg:gap-8"
        onSubmit={(event) => {
          event.preventDefault()
          setSubmitted(true)
          const first = Object.entries(errors).find(([, message]) => message)
          if (first) {
            document.getElementById(`dc-${first[0]}`)?.focus()
            return
          }
          setPaid(true)
        }}
      >
        <div className="flex min-w-0 flex-col gap-8">
          <header className="flex flex-col gap-5">
            <h1 className="text-2xl leading-snug font-bold">تکمیلِ نوبت</h1>
            <Stepper value={1}>
              <StepperItem>
                <StepperTitle>زمان</StepperTitle>
              </StepperItem>
              <StepperItem>
                <StepperTitle>اطلاعاتِ بیمار</StepperTitle>
              </StepperItem>
              <StepperItem>
                <StepperTitle>پرداخت</StepperTitle>
              </StepperItem>
            </Stepper>
          </header>

          <div className="lg:hidden">{summary}</div>

          <section aria-labelledby="dc-patient-title" className="flex flex-col gap-5">
            <div className="flex flex-wrap items-center justify-between gap-3">
              <h2 id="dc-patient-title" className="text-lg leading-snug font-bold">
                اطلاعاتِ بیمار
              </h2>
              <ControlSizeProvider size="lg" mobileSize="default" asChild>
                <ToggleGroup
                  type="single"
                  variant="segmented"
                  value={forWhom}
                  onValueChange={(value) => {
                    if (!value) return
                    setForWhom(value as string)
                    if (value === "other") {
                      setPatient("")
                      setNationalId("")
                    }
                  }}
                  aria-label="نوبت برای"
                >
                  <ToggleGroupItem value="me">برای خودم</ToggleGroupItem>
                  <ToggleGroupItem value="other">برای دیگری</ToggleGroupItem>
                </ToggleGroup>
              </ControlSizeProvider>
            </div>
            <div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
              <TextField id="dc-patient" label="نام و نامِ خانوادگیِ بیمار" value={patient} onValueChange={setPatient} onBlur={blur("patient")} invalid={show("patient") && !!errors.patient} errorMessage={errors.patient} autoComplete="name" className="sm:col-span-2" />
              <TextField id="dc-nationalId" label="کدِ ملی" inputMode="numeric" faDigits maxLength={10} value={nationalId} onValueChange={setNationalId} onBlur={blur("nationalId")} invalid={show("nationalId") && !!errors.nationalId} errorMessage={errors.nationalId} autoComplete="off" />
              <TextField id="dc-mobile" label="موبایل" type="tel" inputMode="numeric" faDigits maxLength={11} value={mobile} onValueChange={setMobile} onBlur={blur("mobile")} invalid={show("mobile") && !!errors.mobile} errorMessage={errors.mobile} description="پیامکِ یادآوری و کدِ رهگیری به این شماره می‌آید." autoComplete="tel" />
              <div className="flex flex-col gap-2">
                <Label id="dc-insurance-label">بیمهٔ پایه</Label>
                <Select value={insurance} onValueChange={setInsurance}>
                  <SelectTrigger aria-labelledby="dc-insurance-label" className="w-full">
                    <SelectValue />
                  </SelectTrigger>
                  <ControlSizeProvider size="xl" asChild>
                    <SelectContent>
                      {INSURANCES.map((item) => (
                        <SelectItem key={item.value} value={item.value}>
                          {item.label}
                        </SelectItem>
                      ))}
                    </SelectContent>
                  </ControlSizeProvider>
                </Select>
                <p className="text-xs text-muted-foreground">{share ? `٪${toFaDigits(30)} را بیمه می‌پردازد؛ دفترچه را همراه بیاور.` : "مبلغِ کامل را خودت می‌پردازی."}</p>
              </div>
              <div className="flex flex-col gap-2 sm:col-span-2">
                <Label htmlFor="dc-reason">علتِ مراجعه</Label>
                <Textarea id="dc-reason" rows={3} placeholder="مثلاً تپشِ قلب هنگامِ ورزش از دو هفته پیش" aria-describedby="dc-reason-hint" />
                <p id="dc-reason-hint" className="text-xs text-muted-foreground">
                  پرکردنش لازم نیست؛ پزشک پیش از ویزیت می‌خواندش.
                </p>
              </div>
            </div>
          </section>

          <section aria-labelledby="dc-pay-title" className="flex flex-col gap-4">
            <h2 id="dc-pay-title" className="text-lg leading-snug font-bold">
              روشِ پرداخت
            </h2>
            <RadioGroup value={method} onValueChange={setMethod} aria-labelledby="dc-pay-title" className="gap-2">
              <RadioCard
                value="wallet"
                title="کیف پول"
                description={`موجودی ${formatCurrency(1_200_000)}`}
                media={
                  <span className="flex size-10 items-center justify-center rounded-lg bg-muted [&>svg]:size-5">
                    <WalletIcon />
                  </span>
                }
              />
              <RadioCard
                value="bank"
                title="درگاهِ بانکی"
                description="همهٔ کارت‌های عضوِ شتاب"
                media={
                  <span className="flex size-10 items-center justify-center rounded-lg bg-muted [&>svg]:size-5">
                    <CreditCardIcon />
                  </span>
                }
              />
            </RadioGroup>
          </section>

          <div className="flex flex-col gap-2">
            <label className="flex cursor-pointer items-start gap-3 text-sm leading-6">
              <Checkbox id="dc-agreed" checked={agreed} onCheckedChange={(value) => setAgreed(value === true)} aria-invalid={show("agreed") && !!errors.agreed} aria-describedby={show("agreed") && errors.agreed ? "dc-agreed-error" : undefined} className="mt-1" />
              <span>
                لغو تا ۲ ساعت پیش از نوبت رایگان است و مبلغ به کیف پول برمی‌گردد؛ بعد از آن ٪۵۰ کم می‌شود.{" "}
                <a href="#" className="font-medium text-brand-secondary underline-offset-4 hover:underline">
                  قوانینِ لغو
                </a>
              </span>
            </label>
            {show("agreed") && errors.agreed && (
              <p id="dc-agreed-error" className="text-sm text-destructive">
                {errors.agreed}
              </p>
            )}
          </div>

          <Button type="submit" fullWidth>
            پرداختِ {formatCurrency(total)} و ثبتِ نوبت
          </Button>
        </div>

        <aside className="hidden lg:sticky lg:top-6 lg:block">{summary}</aside>
      </form>
    </ControlSizeProvider>
  )
}
doctor-confirm.vue
<script setup lang="ts">
import { computed, reactive, ref } from "vue"

import Avatar from "@/components/ui/Avatar.vue"
import Button from "@/components/ui/Button.vue"
import Checkbox from "@/components/ui/Checkbox.vue"
import ControlSize from "@/components/ui/ControlSize.vue"
import Label from "@/components/ui/Label.vue"
import RadioCard from "@/components/ui/RadioCard.vue"
import RadioGroup from "@/components/ui/RadioGroup.vue"
import Select from "@/components/ui/Select.vue"
import SelectContent from "@/components/ui/SelectContent.vue"
import SelectItem from "@/components/ui/SelectItem.vue"
import SelectTrigger from "@/components/ui/SelectTrigger.vue"
import SelectValue from "@/components/ui/SelectValue.vue"
import Stepper from "@/components/ui/Stepper.vue"
import StepperItem from "@/components/ui/StepperItem.vue"
import StepperTitle from "@/components/ui/StepperTitle.vue"
import TextField from "@/components/ui/TextField.vue"
import Textarea from "@/components/ui/Textarea.vue"
import ToggleGroup from "@/components/ui/ToggleGroup.vue"
import ToggleGroupItem from "@/components/ui/ToggleGroupItem.vue"
import { DigIcon } from "@/lib/icons"
import { formatCurrency, isValidMobile, isValidNationalId, toEnDigits, toFaDigits } from "@/lib/persian"

const doctorPhoto = "https://docs.digdesign.ir/images/doctor-woman-curly.webp"

const FEE = 850_000
const INSURANCES = [
  { value: "none", label: "بدونِ بیمه", share: 0 },
  { value: "tamin", label: "تأمین اجتماعی", share: 0.3 },
  { value: "salamat", label: "بیمهٔ سلامت", share: 0.3 },
  { value: "army", label: "نیروهای مسلح", share: 0.3 },
]

/**
 * تأیید و پرداختِ نوبت: مراحل (زمان ← اطلاعاتِ بیمار ← پرداخت)، نوبت برای خودم یا دیگری، کدِ ملی و موبایل با
 * اعتبارسنجی بعد از ترکِ فیلد، بیمهٔ پایه که سهمش بی‌درنگ از مبلغ کم می‌شود، علتِ مراجعه که پرکردنش لازم نیست، روشِ پرداخت و
 * پذیرفتنِ قانونِ لغو. خلاصهٔ نوبت کنارِ فرم (در موبایل بالای آن) و بعد از پرداخت، همان کارت رسید با کدِ رهگیری
 * و افزودن به تقویم می‌شود.
 */
const forWhom = ref("me")
const nationalId = ref("0012345679")
const mobile = ref("09121234567")
const patient = ref("آرمیتا رستگار")
const insurance = ref("tamin")
const method = ref("wallet")
const agreed = ref(false)
const touched = reactive<Record<string, boolean>>({})
const submitted = ref(false)
const paid = ref(false)

const share = computed(() => (INSURANCES.find((item) => item.value === insurance.value)?.share ?? 0) * FEE)
const total = computed(() => FEE - share.value)
const show = (field: string) => submitted.value || touched[field]
const errors = computed<Record<string, string>>(() => ({
  patient: !patient.value.trim() ? "نامِ بیمار را بنویس." : "",
  nationalId: !isValidNationalId(toEnDigits(nationalId.value)) ? "کدِ ملی درست نیست؛ ۱۰ رقم است، بدونِ خط تیره." : "",
  mobile: !isValidMobile(toEnDigits(mobile.value)) ? "موبایل را با ۰۹ شروع کن، ۱۱ رقم." : "",
  agreed: !agreed.value ? "برای ادامه قانونِ لغو را بپذیر." : "",
}))

function onWhom(value: string | string[] | undefined) {
  if (!value) return
  forWhom.value = value as string
  if (value === "other") {
    patient.value = ""
    nationalId.value = ""
  }
}

function onSubmit() {
  submitted.value = true
  const first = Object.entries(errors.value).find(([, message]) => message)
  if (first) {
    document.getElementById(`dc-${first[0]}`)?.focus()
    return
  }
  paid.value = true
}
</script>

<template>
  <ControlSize v-if="paid" size="xl" as-child>
    <main class="mx-auto flex w-full max-w-lg flex-col gap-6 p-4 py-10 sm:p-6">
      <div role="status" class="flex flex-col items-center gap-3 text-center">
        <span aria-hidden="true" class="flex size-14 items-center justify-center rounded-full bg-success-subtle text-success-subtle-foreground [&>svg]:size-7">
          <DigIcon name="check" />
        </span>
        <h1 class="text-2xl leading-snug font-bold">نوبتت قطعی شد</h1>
        <p class="text-muted-foreground">
          کدِ رهگیری <span class="font-bold text-foreground tabular-nums">۴۸۲۷۱۹</span> به موبایلت پیامک شد. ۱۵ دقیقه زودتر برسی، پذیرش راحت‌تر است.
        </p>
      </div>
      <section aria-label="خلاصهٔ نوبت" class="flex flex-col gap-4 rounded-xl border border-border bg-card p-5">
        <div class="flex items-center gap-3">
          <Avatar :src="doctorPhoto" alt="" name="سارا محمدی" class="size-12 shrink-0" />
          <span class="flex min-w-0 flex-col">
            <span class="truncate font-bold">دکتر سارا محمدی</span>
            <span class="truncate text-sm text-muted-foreground">متخصصِ قلب و عروق</span>
          </span>
        </div>
        <ul class="flex flex-col gap-2 text-sm [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground">
          <li class="flex items-center gap-2">
            <DigIcon name="calendar" aria-hidden="true" />
            یکشنبه ۲۶ مهر، ساعتِ ۱۶:۴۵
          </li>
          <li class="flex items-start gap-2">
            <DigIcon name="location" aria-hidden="true" class="mt-0.5" />
            مطبِ ونک، ساختمانِ پزشکانِ آرین، طبقهٔ ۴
          </li>
        </ul>
        <dl class="flex flex-col gap-2 border-t border-border pt-4 text-sm">
          <div class="flex justify-between gap-2">
            <dt class="text-muted-foreground">ویزیتِ حضوری</dt>
            <dd class="tabular-nums">{{ formatCurrency(FEE) }}</dd>
          </div>
          <div v-if="share > 0" class="flex justify-between gap-2">
            <dt class="text-muted-foreground">سهمِ بیمه</dt>
            <dd class="text-success-subtle-foreground tabular-nums">−{{ formatCurrency(share) }}</dd>
          </div>
          <div class="flex items-baseline justify-between gap-2 border-t border-border pt-3">
            <dt class="font-semibold">پرداخت‌شده</dt>
            <dd class="text-lg font-bold tabular-nums">{{ formatCurrency(total) }}</dd>
          </div>
        </dl>
      </section>
      <div class="grid grid-cols-1 gap-3 sm:grid-cols-2">
        <Button variant="outline">
          <DigIcon name="calendar" />
          افزودن به تقویم
        </Button>
        <Button>نوبت‌های من</Button>
      </div>
    </main>
  </ControlSize>

  <ControlSize v-else size="xl" as-child>
    <form novalidate class="mx-auto grid w-full max-w-5xl grid-cols-1 items-start gap-6 p-4 sm:p-6 lg:grid-cols-[minmax(0,1fr)_20rem] lg:gap-8" @submit.prevent="onSubmit">
      <div class="flex min-w-0 flex-col gap-8">
        <header class="flex flex-col gap-5">
          <h1 class="text-2xl leading-snug font-bold">تکمیلِ نوبت</h1>
          <Stepper :value="1">
            <StepperItem><StepperTitle>زمان</StepperTitle></StepperItem>
            <StepperItem><StepperTitle>اطلاعاتِ بیمار</StepperTitle></StepperItem>
            <StepperItem><StepperTitle>پرداخت</StepperTitle></StepperItem>
          </Stepper>
        </header>

        <div class="lg:hidden">
          <section aria-label="خلاصهٔ نوبت" class="flex flex-col gap-4 rounded-xl border border-border bg-card p-5">
            <div class="flex items-center gap-3">
              <Avatar :src="doctorPhoto" alt="" name="سارا محمدی" class="size-12 shrink-0" />
              <span class="flex min-w-0 flex-col">
                <span class="truncate font-bold">دکتر سارا محمدی</span>
                <span class="truncate text-sm text-muted-foreground">متخصصِ قلب و عروق</span>
              </span>
            </div>
            <ul class="flex flex-col gap-2 text-sm [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground">
              <li class="flex items-center gap-2">
                <DigIcon name="calendar" aria-hidden="true" />
                یکشنبه ۲۶ مهر، ساعتِ ۱۶:۴۵
              </li>
              <li class="flex items-start gap-2">
                <DigIcon name="location" aria-hidden="true" class="mt-0.5" />
                مطبِ ونک، ساختمانِ پزشکانِ آرین، طبقهٔ ۴
              </li>
            </ul>
            <dl class="flex flex-col gap-2 border-t border-border pt-4 text-sm">
              <div class="flex justify-between gap-2">
                <dt class="text-muted-foreground">ویزیتِ حضوری</dt>
                <dd class="tabular-nums">{{ formatCurrency(FEE) }}</dd>
              </div>
              <div v-if="share > 0" class="flex justify-between gap-2">
                <dt class="text-muted-foreground">سهمِ بیمه</dt>
                <dd class="text-success-subtle-foreground tabular-nums">−{{ formatCurrency(share) }}</dd>
              </div>
              <div class="flex items-baseline justify-between gap-2 border-t border-border pt-3">
                <dt class="font-semibold">قابلِ پرداخت</dt>
                <dd class="text-lg font-bold tabular-nums">{{ formatCurrency(total) }}</dd>
              </div>
            </dl>
          </section>
        </div>

        <section aria-labelledby="dc-patient-title" class="flex flex-col gap-5">
          <div class="flex flex-wrap items-center justify-between gap-3">
            <h2 id="dc-patient-title" class="text-lg leading-snug font-bold">اطلاعاتِ بیمار</h2>
            <ControlSize size="lg" mobile-size="default" as-child>
              <ToggleGroup type="single" variant="segmented" :value="forWhom" aria-label="نوبت برای" @update:value="onWhom">
                <ToggleGroupItem value="me">برای خودم</ToggleGroupItem>
                <ToggleGroupItem value="other">برای دیگری</ToggleGroupItem>
              </ToggleGroup>
            </ControlSize>
          </div>
          <div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
            <TextField
              id="dc-patient"
              v-model="patient"
              label="نام و نامِ خانوادگیِ بیمار"
              :invalid="!!show('patient') && !!errors.patient"
              :error-message="errors.patient"
              autocomplete="name"
              class="sm:col-span-2"
              @blur="touched.patient = true"
            />
            <TextField
              id="dc-nationalId"
              v-model="nationalId"
              label="کدِ ملی"
              inputmode="numeric"
              fa-digits
              :maxlength="10"
              :invalid="!!show('nationalId') && !!errors.nationalId"
              :error-message="errors.nationalId"
              autocomplete="off"
              @blur="touched.nationalId = true"
            />
            <TextField
              id="dc-mobile"
              v-model="mobile"
              label="موبایل"
              type="tel"
              inputmode="numeric"
              fa-digits
              :maxlength="11"
              :invalid="!!show('mobile') && !!errors.mobile"
              :error-message="errors.mobile"
              description="پیامکِ یادآوری و کدِ رهگیری به این شماره می‌آید."
              autocomplete="tel"
              @blur="touched.mobile = true"
            />
            <div class="flex flex-col gap-2">
              <Label id="dc-insurance-label">بیمهٔ پایه</Label>
              <Select :value="insurance" @update:value="(value) => (insurance = value as string)">
                <SelectTrigger aria-labelledby="dc-insurance-label" class="w-full">
                  <SelectValue />
                </SelectTrigger>
                <ControlSize size="xl" as-child>
                  <SelectContent>
                    <SelectItem v-for="item in INSURANCES" :key="item.value" :value="item.value">{{ item.label }}</SelectItem>
                  </SelectContent>
                </ControlSize>
              </Select>
              <p class="text-xs text-muted-foreground">{{ share ? `٪${toFaDigits(30)} را بیمه می‌پردازد؛ دفترچه را همراه بیاور.` : "مبلغِ کامل را خودت می‌پردازی." }}</p>
            </div>
            <div class="flex flex-col gap-2 sm:col-span-2">
              <Label for="dc-reason">علتِ مراجعه</Label>
              <Textarea id="dc-reason" :rows="3" placeholder="مثلاً تپشِ قلب هنگامِ ورزش از دو هفته پیش" aria-describedby="dc-reason-hint" />
              <p id="dc-reason-hint" class="text-xs text-muted-foreground">پرکردنش لازم نیست؛ پزشک پیش از ویزیت می‌خواندش.</p>
            </div>
          </div>
        </section>

        <section aria-labelledby="dc-pay-title" class="flex flex-col gap-4">
          <h2 id="dc-pay-title" class="text-lg leading-snug font-bold">روشِ پرداخت</h2>
          <RadioGroup :value="method" aria-labelledby="dc-pay-title" class="gap-2" @update:value="(value) => (method = value)">
            <RadioCard value="wallet" title="کیف پول" :description="`موجودی ${formatCurrency(1_200_000)}`">
              <template #media>
                <span class="flex size-10 items-center justify-center rounded-lg bg-muted [&>svg]:size-5"><DigIcon name="wallet" /></span>
              </template>
            </RadioCard>
            <RadioCard value="bank" title="درگاهِ بانکی" description="همهٔ کارت‌های عضوِ شتاب">
              <template #media>
                <span class="flex size-10 items-center justify-center rounded-lg bg-muted [&>svg]:size-5"><DigIcon name="credit-card" /></span>
              </template>
            </RadioCard>
          </RadioGroup>
        </section>

        <div class="flex flex-col gap-2">
          <label class="flex cursor-pointer items-start gap-3 text-sm leading-6">
            <Checkbox
              id="dc-agreed"
              :checked="agreed"
              :aria-invalid="!!show('agreed') && !!errors.agreed"
              :aria-describedby="show('agreed') && errors.agreed ? 'dc-agreed-error' : undefined"
              class="mt-1"
              @update:checked="(value) => (agreed = value === true)"
            />
            <span>
              لغو تا ۲ ساعت پیش از نوبت رایگان است و مبلغ به کیف پول برمی‌گردد؛ بعد از آن ٪۵۰ کم می‌شود.
              <a href="#" class="font-medium text-brand-secondary underline-offset-4 hover:underline">قوانینِ لغو</a>
            </span>
          </label>
          <p v-if="show('agreed') && errors.agreed" id="dc-agreed-error" class="text-sm text-destructive">{{ errors.agreed }}</p>
        </div>

        <Button type="submit" full-width>پرداختِ {{ formatCurrency(total) }} و ثبتِ نوبت</Button>
      </div>

      <aside class="hidden lg:sticky lg:top-6 lg:block">
        <section aria-label="خلاصهٔ نوبت" class="flex flex-col gap-4 rounded-xl border border-border bg-card p-5">
          <div class="flex items-center gap-3">
            <Avatar :src="doctorPhoto" alt="" name="سارا محمدی" class="size-12 shrink-0" />
            <span class="flex min-w-0 flex-col">
              <span class="truncate font-bold">دکتر سارا محمدی</span>
              <span class="truncate text-sm text-muted-foreground">متخصصِ قلب و عروق</span>
            </span>
          </div>
          <ul class="flex flex-col gap-2 text-sm [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground">
            <li class="flex items-center gap-2">
              <DigIcon name="calendar" aria-hidden="true" />
              یکشنبه ۲۶ مهر، ساعتِ ۱۶:۴۵
            </li>
            <li class="flex items-start gap-2">
              <DigIcon name="location" aria-hidden="true" class="mt-0.5" />
              مطبِ ونک، ساختمانِ پزشکانِ آرین، طبقهٔ ۴
            </li>
          </ul>
          <dl class="flex flex-col gap-2 border-t border-border pt-4 text-sm">
            <div class="flex justify-between gap-2">
              <dt class="text-muted-foreground">ویزیتِ حضوری</dt>
              <dd class="tabular-nums">{{ formatCurrency(FEE) }}</dd>
            </div>
            <div v-if="share > 0" class="flex justify-between gap-2">
              <dt class="text-muted-foreground">سهمِ بیمه</dt>
              <dd class="text-success-subtle-foreground tabular-nums">−{{ formatCurrency(share) }}</dd>
            </div>
            <div class="flex items-baseline justify-between gap-2 border-t border-border pt-3">
              <dt class="font-semibold">قابلِ پرداخت</dt>
              <dd class="text-lg font-bold tabular-nums">{{ formatCurrency(total) }}</dd>
            </div>
          </dl>
        </section>
      </aside>
    </form>
  </ControlSize>
</template>

کدِ این بلاک هنوز برای Svelte نوشته نشده است.

این موارد هنوز برای Svelte آماده نیستند: avatarcheckboxcontrol-sizelabelpersianradio-cardradio-groupselectsteppertext-fieldtextareatoggle-groupآیکون calendarآیکون checkآیکون credit-cardآیکون locationآیکون wallet

کدِ React همین بلاک مرجع است. با MCP دیگ و get_block با framework="svelte" ایجنت آن را با کامپوننت‌های Svelte می‌سازد.

doctor-confirm.ts
import { Component, ChangeDetectionStrategy, signal, computed } from "@angular/core"

import { DigControlSize } from "@/components/ui/control-size"
import { DigIcon } from "@/lib/icons"
import { DigAvatar } from "@/components/ui/avatar"
import { DigButton } from "@/components/ui/button"
import { DigStepper, DigStepperItem, DigStepperTitle } from "@/components/ui/stepper"
import { DigToggleGroup, DigToggleGroupItem } from "@/components/ui/toggle-group"
import { DigTextField } from "@/components/ui/text-field"
import { DigInput, DigInputField } from "@/components/ui/input"
import { DigLabel } from "@/components/ui/label"
import { DigSelect, DigSelectTrigger, DigSelectValue, DigSelectContent, DigSelectItem } from "@/components/ui/select"
import { DigTextarea } from "@/components/ui/textarea"
import { DigRadioGroup } from "@/components/ui/radio-group"
import { DigRadioCard, DigRadioCardMedia } from "@/components/ui/radio-card"
import { DigCheckbox } from "@/components/ui/checkbox"
import { FormsModule } from "@angular/forms"
import { formatCurrency, isValidMobile, isValidNationalId, toEnDigits, toFaDigits } from "@/lib/persian"

const doctorPhoto = "https://docs.digdesign.ir/images/doctor-woman-curly.webp"

const FEE = 850_000

const INSURANCES = [
  { value: "none", label: "بدونِ بیمه", share: 0 },
  { value: "tamin", label: "تأمین اجتماعی", share: 0.3 },
  { value: "salamat", label: "بیمهٔ سلامت", share: 0.3 },
  { value: "army", label: "نیروهای مسلح", share: 0.3 },
]

@Component({
  selector: "dig-block-doctor-confirm",
  imports: [
    DigControlSize,
    DigIcon,
    DigAvatar,
    DigButton,
    DigStepper,
    DigStepperItem,
    DigStepperTitle,
    DigToggleGroup,
    DigToggleGroupItem,
    DigTextField,
    DigInput,
    DigInputField,
    DigLabel,
    DigSelect,
    DigSelectTrigger,
    DigSelectValue,
    DigSelectContent,
    DigSelectItem,
    DigTextarea,
    DigRadioGroup,
    DigRadioCard,
    DigRadioCardMedia,
    DigCheckbox,
    FormsModule,
  ],
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `
    @if (paid()) {
      <main digControlSize="xl" class="mx-auto flex w-full max-w-lg flex-col gap-6 p-4 py-10 sm:p-6">
        <div role="status" class="flex flex-col items-center gap-3 text-center">
          <span
            aria-hidden="true"
            class="flex size-14 items-center justify-center rounded-full bg-success-subtle text-success-subtle-foreground [&>svg]:size-7"
            ><svg digIcon="check"></svg
          ></span>
          <h1 class="text-2xl leading-snug font-bold">نوبتت قطعی شد</h1>
          <p class="text-muted-foreground">
            کدِ رهگیری <span class="font-bold text-foreground tabular-nums">۴۸۲۷۱۹</span> به موبایلت پیامک شد. ۱۵ دقیقه
            زودتر برسی، پذیرش راحت‌تر است.
          </p>
        </div>
        <section aria-label="خلاصهٔ نوبت" class="flex flex-col gap-4 rounded-xl border border-border bg-card p-5">
          <div class="flex items-center gap-3">
            <span digAvatar [src]="doctorPhoto" alt="" name="سارا محمدی" class="size-12 shrink-0"></span>
            <span class="flex min-w-0 flex-col"
              ><span class="truncate font-bold">دکتر سارا محمدی</span>
              <span class="truncate text-sm text-muted-foreground">متخصصِ قلب و عروق</span></span
            >
          </div>
          <ul class="flex flex-col gap-2 text-sm [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground">
            <li class="flex items-center gap-2">
              <svg digIcon="calendar" aria-hidden="true"></svg>
              یکشنبه ۲۶ مهر، ساعتِ ۱۶:۴۵
            </li>
            <li class="flex items-start gap-2">
              <svg digIcon="location" aria-hidden="true" class="mt-0.5"></svg>
              مطبِ ونک، ساختمانِ پزشکانِ آرین، طبقهٔ ۴
            </li>
          </ul>
          <dl class="flex flex-col gap-2 border-t border-border pt-4 text-sm">
            <div class="flex justify-between gap-2">
              <dt class="text-muted-foreground">ویزیتِ حضوری</dt>
              <dd class="tabular-nums">{{ formatCurrency(FEE) }}</dd>
            </div>
            @if (share() > 0) {
              <div class="flex justify-between gap-2">
                <dt class="text-muted-foreground">سهمِ بیمه</dt>
                <dd class="text-success-subtle-foreground tabular-nums">−{{ formatCurrency(share()) }}</dd>
              </div>
            }
            <div class="flex items-baseline justify-between gap-2 border-t border-border pt-3">
              <dt class="font-semibold">پرداخت‌شده</dt>
              <dd class="text-lg font-bold tabular-nums">{{ formatCurrency(total()) }}</dd>
            </div>
          </dl>
        </section>
        <div class="grid grid-cols-1 gap-3 sm:grid-cols-2">
          <button digButton type="button" variant="outline">
            <svg digIcon="calendar"></svg>
            افزودن به تقویم
          </button>
          <button digButton type="button">نوبت‌های من</button>
        </div>
      </main>

    } @else {
      <form
        digControlSize="xl"
        novalidate
        class="mx-auto grid w-full max-w-5xl grid-cols-1 items-start gap-6 p-4 sm:p-6 lg:grid-cols-[minmax(0,1fr)_20rem] lg:gap-8"
        (submit)="$event.preventDefault(); onSubmit()"
      >
        <div class="flex min-w-0 flex-col gap-8">
          <header class="flex flex-col gap-5">
            <h1 class="text-2xl leading-snug font-bold">تکمیلِ نوبت</h1>
            <div digStepper [value]="1">
              <div digStepperItem><p digStepperTitle>زمان</p></div>
              <div digStepperItem><p digStepperTitle>اطلاعاتِ بیمار</p></div>
              <div digStepperItem><p digStepperTitle>پرداخت</p></div>
            </div>
          </header>

          <div class="lg:hidden">
            <section aria-label="خلاصهٔ نوبت" class="flex flex-col gap-4 rounded-xl border border-border bg-card p-5">
              <div class="flex items-center gap-3">
                <span digAvatar [src]="doctorPhoto" alt="" name="سارا محمدی" class="size-12 shrink-0"></span>
                <span class="flex min-w-0 flex-col"
                  ><span class="truncate font-bold">دکتر سارا محمدی</span>
                  <span class="truncate text-sm text-muted-foreground">متخصصِ قلب و عروق</span></span
                >
              </div>
              <ul class="flex flex-col gap-2 text-sm [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground">
                <li class="flex items-center gap-2">
                  <svg digIcon="calendar" aria-hidden="true"></svg>
                  یکشنبه ۲۶ مهر، ساعتِ ۱۶:۴۵
                </li>
                <li class="flex items-start gap-2">
                  <svg digIcon="location" aria-hidden="true" class="mt-0.5"></svg>
                  مطبِ ونک، ساختمانِ پزشکانِ آرین، طبقهٔ ۴
                </li>
              </ul>
              <dl class="flex flex-col gap-2 border-t border-border pt-4 text-sm">
                <div class="flex justify-between gap-2">
                  <dt class="text-muted-foreground">ویزیتِ حضوری</dt>
                  <dd class="tabular-nums">{{ formatCurrency(FEE) }}</dd>
                </div>
                @if (share() > 0) {
                  <div class="flex justify-between gap-2">
                    <dt class="text-muted-foreground">سهمِ بیمه</dt>
                    <dd class="text-success-subtle-foreground tabular-nums">−{{ formatCurrency(share()) }}</dd>
                  </div>
                }
                <div class="flex items-baseline justify-between gap-2 border-t border-border pt-3">
                  <dt class="font-semibold">قابلِ پرداخت</dt>
                  <dd class="text-lg font-bold tabular-nums">{{ formatCurrency(total()) }}</dd>
                </div>
              </dl>
            </section>
          </div>

          <section aria-labelledby="dc-patient-title" class="flex flex-col gap-5">
            <div class="flex flex-wrap items-center justify-between gap-3">
              <h2 id="dc-patient-title" class="text-lg leading-snug font-bold">اطلاعاتِ بیمار</h2>
              <div digControlSize="lg" mobileSize="default">
                <div
                  digToggleGroup
                  type="single"
                  variant="segmented"
                  [value]="forWhom()"
                  aria-label="نوبت برای"
                  (valueChange)="onWhom($event)"
                >
                  <button digToggleGroupItem value="me">برای خودم</button>
                  <button digToggleGroupItem value="other">برای دیگری</button>
                </div>
              </div>
            </div>
            <div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
              <div
                digTextField
                id="dc-patient"
                label="نام و نامِ خانوادگیِ بیمار"
                [invalid]="!!show('patient') && !!errors().patient"
                [errorMessage]="errors().patient"
                class="sm:col-span-2"
              >
                <dig-input
                  ><input
                    digInput
                    [ngModel]="patient()"
                    [ngModelOptions]="{ standalone: true }"
                    (ngModelChange)="patient.set($event)"
                    autocomplete="name"
                    (blur)="touched().patient = true"
                /></dig-input>
              </div>
              <div
                digTextField
                id="dc-nationalId"
                label="کدِ ملی"
                [invalid]="!!show('nationalId') && !!errors().nationalId"
                [errorMessage]="errors().nationalId"
              >
                <dig-input
                  ><input
                    digInput
                    [ngModel]="nationalId()"
                    [ngModelOptions]="{ standalone: true }"
                    (ngModelChange)="nationalId.set($event)"
                    inputmode="numeric"
                    faDigits
                    [maxlength]="10"
                    autocomplete="off"
                    (blur)="touched().nationalId = true"
                /></dig-input>
              </div>
              <div
                digTextField
                id="dc-mobile"
                label="موبایل"
                [invalid]="!!show('mobile') && !!errors().mobile"
                [errorMessage]="errors().mobile"
                description="پیامکِ یادآوری و کدِ رهگیری به این شماره می‌آید."
              >
                <dig-input
                  ><input
                    digInput
                    [ngModel]="mobile()"
                    [ngModelOptions]="{ standalone: true }"
                    (ngModelChange)="mobile.set($event)"
                    type="tel"
                    inputmode="numeric"
                    faDigits
                    [maxlength]="11"
                    autocomplete="tel"
                    (blur)="touched().mobile = true"
                /></dig-input>
              </div>
              <div class="flex flex-col gap-2">
                <label digLabel id="dc-insurance-label">بیمهٔ پایه</label>
                <ng-container
                  digSelect
                  [value]="insurance()"
                  (valueChange)="typeof $event === 'string' && insurance.set($event)"
                  ><button digSelectTrigger aria-labelledby="dc-insurance-label" class="w-full">
                    <span digSelectValue></span>
                  </button>
                  <div digControlSize="xl" digSelectContent>
                    @for (item of INSURANCES; track item.value) {
                      <div digSelectItem [value]="item.value">{{ item.label }}</div>
                    }
                  </div></ng-container
                >
                <p class="text-xs text-muted-foreground">
                  {{
                    share()
                      ? \`٪\${toFaDigits(30)} را بیمه می‌پردازد؛ دفترچه را همراه بیاور.\`
                      : "مبلغِ کامل را خودت می‌پردازی."
                  }}
                </p>
              </div>
              <div class="flex flex-col gap-2 sm:col-span-2">
                <label digLabel for="dc-reason">علتِ مراجعه</label>
                <textarea
                  digTextarea
                  id="dc-reason"
                  [rows]="3"
                  placeholder="مثلاً تپشِ قلب هنگامِ ورزش از دو هفته پیش"
                  aria-describedby="dc-reason-hint"
                ></textarea>
                <p id="dc-reason-hint" class="text-xs text-muted-foreground">
                  پرکردنش لازم نیست؛ پزشک پیش از ویزیت می‌خواندش.
                </p>
              </div>
            </div>
          </section>

          <section aria-labelledby="dc-pay-title" class="flex flex-col gap-4">
            <h2 id="dc-pay-title" class="text-lg leading-snug font-bold">روشِ پرداخت</h2>
            <div
              digRadioGroup
              [value]="method()"
              aria-labelledby="dc-pay-title"
              class="gap-2"
              (valueChange)="typeof $event === 'string' && method.set($event)"
            >
              <label
                digRadioCard
                value="wallet"
                title="کیف پول"
                [description]="\`موجودی \${formatCurrency(1_200_000)}\`"
                ><span digRadioCardMedia
                  ><span class="flex size-10 items-center justify-center rounded-lg bg-muted [&>svg]:size-5"
                    ><svg digIcon="wallet"></svg></span></span
              ></label>
              <label digRadioCard value="bank" title="درگاهِ بانکی" description="همهٔ کارت‌های عضوِ شتاب"
                ><span digRadioCardMedia
                  ><span class="flex size-10 items-center justify-center rounded-lg bg-muted [&>svg]:size-5"
                    ><svg digIcon="credit-card"></svg></span></span
              ></label>
            </div>
          </section>

          <div class="flex flex-col gap-2">
            <label class="flex cursor-pointer items-start gap-3 text-sm leading-6"
              ><button
                digCheckbox
                id="dc-agreed"
                [checked]="agreed()"
                [attr.aria-invalid]="!!show('agreed') && !!errors().agreed"
                [attr.aria-describedby]="show('agreed') && errors().agreed ? 'dc-agreed-error' : undefined"
                class="mt-1"
                (checkedChange)="agreed.set($event === true)"
              ></button>
              <span>
                لغو تا ۲ ساعت پیش از نوبت رایگان است و مبلغ به کیف پول برمی‌گردد؛ بعد از آن ٪۵۰ کم می‌شود.
                <a href="#" class="font-medium text-brand-secondary underline-offset-4 hover:underline"
                  >قوانینِ لغو</a
                ></span
              ></label
            >
            @if (show("agreed") && errors().agreed) {
              <p id="dc-agreed-error" class="text-sm text-destructive">{{ errors().agreed }}</p>
            }
          </div>

          <button digButton type="submit" fullWidth>پرداختِ {{ formatCurrency(total()) }} و ثبتِ نوبت</button>
        </div>

        <aside class="hidden lg:sticky lg:top-6 lg:block">
          <section aria-label="خلاصهٔ نوبت" class="flex flex-col gap-4 rounded-xl border border-border bg-card p-5">
            <div class="flex items-center gap-3">
              <span digAvatar [src]="doctorPhoto" alt="" name="سارا محمدی" class="size-12 shrink-0"></span>
              <span class="flex min-w-0 flex-col"
                ><span class="truncate font-bold">دکتر سارا محمدی</span>
                <span class="truncate text-sm text-muted-foreground">متخصصِ قلب و عروق</span></span
              >
            </div>
            <ul class="flex flex-col gap-2 text-sm [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground">
              <li class="flex items-center gap-2">
                <svg digIcon="calendar" aria-hidden="true"></svg>
                یکشنبه ۲۶ مهر، ساعتِ ۱۶:۴۵
              </li>
              <li class="flex items-start gap-2">
                <svg digIcon="location" aria-hidden="true" class="mt-0.5"></svg>
                مطبِ ونک، ساختمانِ پزشکانِ آرین، طبقهٔ ۴
              </li>
            </ul>
            <dl class="flex flex-col gap-2 border-t border-border pt-4 text-sm">
              <div class="flex justify-between gap-2">
                <dt class="text-muted-foreground">ویزیتِ حضوری</dt>
                <dd class="tabular-nums">{{ formatCurrency(FEE) }}</dd>
              </div>
              @if (share() > 0) {
                <div class="flex justify-between gap-2">
                  <dt class="text-muted-foreground">سهمِ بیمه</dt>
                  <dd class="text-success-subtle-foreground tabular-nums">−{{ formatCurrency(share()) }}</dd>
                </div>
              }
              <div class="flex items-baseline justify-between gap-2 border-t border-border pt-3">
                <dt class="font-semibold">قابلِ پرداخت</dt>
                <dd class="text-lg font-bold tabular-nums">{{ formatCurrency(total()) }}</dd>
              </div>
            </dl>
          </section>
        </aside>
      </form>
    }
  `,
})
export class DoctorConfirmBlock {
  readonly toFaDigits = toFaDigits

  readonly formatCurrency = formatCurrency

  readonly INSURANCES = INSURANCES

  readonly FEE = FEE

  readonly doctorPhoto = doctorPhoto

  readonly forWhom = signal("me")

  readonly nationalId = signal("0012345679")

  readonly mobile = signal("09121234567")

  readonly patient = signal("آرمیتا رستگار")

  readonly insurance = signal("tamin")

  readonly method = signal("wallet")

  readonly agreed = signal(false)

  readonly touched = signal<Record<string, boolean>>({})

  readonly submitted = signal(false)

  readonly paid = signal(false)

  readonly share = computed(() => (INSURANCES.find((item) => item.value === this.insurance())?.share ?? 0) * FEE)

  readonly total = computed(() => FEE - this.share())

  readonly show = (field: string) => this.submitted() || this.touched()[field]

  readonly errors = computed<Record<string, string>>(() => ({
    patient: !this.patient().trim() ? "نامِ بیمار را بنویس." : "",
    nationalId: !isValidNationalId(toEnDigits(this.nationalId())) ? "کدِ ملی درست نیست؛ ۱۰ رقم است، بدونِ خط تیره." : "",
    mobile: !isValidMobile(toEnDigits(this.mobile())) ? "موبایل را با ۰۹ شروع کن، ۱۱ رقم." : "",
    agreed: !this.agreed() ? "برای ادامه قانونِ لغو را بپذیر." : "",
  }))

  onWhom(value: string | string[] | undefined) {
    if (!value) return
    this.forWhom.set(value as string)
    if (value === "other") {
      this.patient.set("")
      this.nationalId.set("")
    }
  }

  onSubmit() {
    this.submitted.set(true)
    const first = Object.entries(this.errors()).find(([, message]) => message)
    if (first) {
      document.getElementById(`dc-${first[0]}`)?.focus()
      return
    }
    this.paid.set(true)
  }
}

کدِ این بلاک هنوز برای Android نوشته نشده است.

همهٔ کامپوننت‌های لازم برای Android آماده‌اند؛ با MCP می‌توانید همین صفحه را از روی نسخهٔ React بسازید.

کدِ React همین بلاک مرجع است. با MCP دیگ و get_block با framework="android" ایجنت آن را با کامپوننت‌های Android می‌سازد.