Show sidebar labels on tablet, improve theme-safe UI, and keep Jalali dates on tracking. Co-authored-by: Cursor <cursoragent@cursor.com>
164 lines
3.9 KiB
Vue
164 lines
3.9 KiB
Vue
<script setup lang="ts">
|
|
import { computed, watch } from 'vue'
|
|
import { useRouter } from 'vue-router'
|
|
import { useOrderStore } from '@/stores/order'
|
|
import PageHeader from '@/components/layout/PageHeader.vue'
|
|
import IconCheckBook from '@/components/icons/IconCheckBook.vue'
|
|
import IconEditPen from '@/components/icons/IconEditPen.vue'
|
|
import { useRequirePricedOrder } from '@/composables/useRequirePricedOrder'
|
|
import { formatCurrency } from '@/utils/format'
|
|
|
|
const router = useRouter()
|
|
const orderStore = useOrderStore()
|
|
|
|
const { orderId, order } = useRequirePricedOrder()
|
|
|
|
const invoiceLabel = computed(() =>
|
|
order.value?.finalAmount ? formatCurrency(order.value.finalAmount) : '—',
|
|
)
|
|
|
|
watch(
|
|
orderId,
|
|
async (id) => {
|
|
if (!id) return
|
|
if (!orderStore.getOrderById(id)) await orderStore.fetchOrder(id)
|
|
if (orderStore.draftOrderId !== id) orderStore.startCheckDraft(id)
|
|
},
|
|
{ immediate: true },
|
|
)
|
|
|
|
function selectMode(mode: 'full' | 'brief') {
|
|
orderStore.setCheckMode(mode)
|
|
router.push(`/orders/${orderId.value}/check-form`)
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div class="page check-mode-page">
|
|
<PageHeader
|
|
title="تسویه چکی"
|
|
subtitle="بر اساس مبلغ فاکتور، نحوه ثبت چک را انتخاب کنید"
|
|
show-back
|
|
centered
|
|
@back="router.push(`/orders/${orderId}`)"
|
|
/>
|
|
|
|
<div class="page__scroll check-mode-page__scroll">
|
|
<div class="check-mode-invoice">
|
|
<span class="check-mode-invoice__label">مبلغ فاکتور</span>
|
|
<strong class="check-mode-invoice__value">{{ invoiceLabel }}</strong>
|
|
</div>
|
|
|
|
<div class="mode-options">
|
|
<button type="button" class="mode-card" @click="selectMode('full')">
|
|
<span class="mode-card__icon">
|
|
<IconCheckBook :size="36" />
|
|
</span>
|
|
<h3 class="mode-card__title">ثبت کامل (پیشنهادی)</h3>
|
|
<p class="mode-card__desc">وارد کردن همه اطلاعات چک</p>
|
|
</button>
|
|
|
|
<button type="button" class="mode-card" @click="selectMode('brief')">
|
|
<span class="mode-card__icon">
|
|
<IconEditPen :size="36" />
|
|
</span>
|
|
<h3 class="mode-card__title">ثبت مختصر</h3>
|
|
<p class="mode-card__desc">وارد کردن حداقل اطلاعات</p>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.check-mode-page {
|
|
background: var(--color-bg);
|
|
}
|
|
|
|
.check-mode-page__scroll {
|
|
padding-bottom: 24px;
|
|
}
|
|
|
|
.check-mode-invoice {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 4px;
|
|
padding: 16px;
|
|
margin-bottom: 8px;
|
|
border-radius: 16px;
|
|
background: var(--color-primary-light);
|
|
border: 1px solid var(--color-primary);
|
|
}
|
|
|
|
.check-mode-invoice__label {
|
|
font-size: 0.8125rem;
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.check-mode-invoice__value {
|
|
font-size: 1.125rem;
|
|
font-weight: 700;
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.mode-options {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 16px;
|
|
padding-top: 8px;
|
|
}
|
|
|
|
.mode-card {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
text-align: center;
|
|
width: 100%;
|
|
padding: 32px 24px;
|
|
border: none;
|
|
border-radius: 16px;
|
|
background: var(--color-elevated);
|
|
color: var(--color-text);
|
|
box-shadow: var(--shadow-sm);
|
|
cursor: pointer;
|
|
transition:
|
|
box-shadow 0.15s,
|
|
transform 0.15s;
|
|
}
|
|
|
|
.mode-card:hover {
|
|
box-shadow: var(--shadow-md);
|
|
}
|
|
|
|
.mode-card:active {
|
|
transform: scale(0.99);
|
|
}
|
|
|
|
.mode-card__icon {
|
|
width: 64px;
|
|
height: 64px;
|
|
border-radius: 50%;
|
|
background: var(--color-primary-light);
|
|
color: var(--color-primary);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.mode-card__title {
|
|
margin: 0 0 8px;
|
|
font-size: 1.0625rem;
|
|
font-weight: 700;
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.mode-card__desc {
|
|
margin: 0;
|
|
font-size: 0.875rem;
|
|
color: var(--color-text-muted);
|
|
line-height: 1.5;
|
|
}
|
|
</style>
|