65 lines
1.5 KiB
Vue
65 lines
1.5 KiB
Vue
<script setup lang="ts">
|
||||
|
|
import type { BillingAccountDto, BillingPlanCode } from '@mento/shared';
|
|||
|
|
import { BILLING_PLAN_CODES, BILLING_PLAN_LABELS } from '@mento/shared';
|
|||
|
|
import { toFaDigits } from '@/lib/jalali';
|
|||
|
|
|
|||
|
|
defineProps<{
|
|||
|
|
billing?: BillingAccountDto | null;
|
|||
|
|
busyId: string;
|
|||
|
|
userId: string;
|
|||
|
|
}>();
|
|||
|
|
|
|||
|
|
const emit = defineEmits<{
|
|||
|
|
apply: [planCode: BillingPlanCode];
|
|||
|
|
}>();
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<template>
|
|||
|
|
<div class="billing">
|
|||
|
|
<strong>اشتراک مالک</strong>
|
|||
|
|
<p v-if="billing" class="muted">
|
|||
|
|
{{ BILLING_PLAN_LABELS[billing.planCode] }}
|
|||
|
|
· {{ billing.status }}
|
|||
|
|
· {{ toFaDigits(billing.daysRemaining) }} روز
|
|||
|
|
· سقف محیط {{ toFaDigits(billing.maxOrganizations) }}
|
|||
|
|
</p>
|
|||
|
|
<p v-else class="muted">هنوز پلن ندارد — یکی از پلنها را اعمال کنید.</p>
|
|||
|
|
<div class="plan-row">
|
|||
|
|
<button
|
|||
|
|
v-for="code in BILLING_PLAN_CODES.filter((c) => c !== 'custom')"
|
|||
|
|
:key="code"
|
|||
|
|
class="btn btn-ghost"
|
|||
|
|
type="button"
|
|||
|
|
:disabled="busyId === `plan-${userId}-${code}`"
|
|||
|
|
@click="emit('apply', code)"
|
|||
|
|
>
|
|||
|
|
{{ BILLING_PLAN_LABELS[code] }}
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<style scoped>
|
|||
|
|
.billing {
|
|||
|
|
margin-bottom: 0.85rem;
|
|||
|
|
padding: 0.75rem;
|
|||
|
|
border-radius: 12px;
|
|||
|
|
background: #f8fafc;
|
|||
|
|
border: 1px solid var(--line);
|
|||
|
|
display: grid;
|
|||
|
|
gap: 0.45rem;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.muted {
|
|||
|
|
margin: 0;
|
|||
|
|
color: var(--muted);
|
|||
|
|
font-size: 0.88rem;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.plan-row {
|
|||
|
|
display: flex;
|
|||
|
|
flex-wrap: wrap;
|
|||
|
|
gap: 0.4rem;
|
|||
|
|
}
|
|||
|
|
</style>
|