Allow mixed-company cart, add delete confirmations, and fix profile settings routes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-05 14:07:42 +02:00
co-authored by Cursor
parent fd3e5e5126
commit 7eef5e64b3
20 changed files with 802 additions and 145 deletions
+17 -3
View File
@@ -1,6 +1,7 @@
import { computed, ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { useCartStore } from '@/stores/cart'
import { confirm } from '@/composables/useConfirm'
export function useCartPage() {
const router = useRouter()
@@ -9,9 +10,20 @@ export function useCartPage() {
const items = computed(() => cartStore.activeCart?.items ?? [])
const isEmpty = computed(() => items.value.length === 0)
const companyName = computed(() => cartStore.activeCart?.companyName ?? '')
const companyName = computed(() => cartStore.companyNamesLabel || cartStore.activeCart?.companyName || '')
function removeItem(itemId: string) {
async function removeItem(itemId: string) {
const item = items.value.find((entry) => entry.id === itemId)
const ok = await confirm({
title: 'حذف از سبد',
message: item
? `آیا از حذف «${item.productName}» از سبد خرید مطمئن هستید؟`
: 'آیا از حذف این آیتم از سبد خرید مطمئن هستید؟',
confirmLabel: 'حذف',
cancelLabel: 'انصراف',
tone: 'danger',
})
if (!ok) return
cartStore.removeItem(itemId)
}
@@ -32,9 +44,11 @@ export function useCartPage() {
function createNewInvoice() {
cartStore.createNewCartForSameCompany()
showFullDialog.value = false
const companyId = cartStore.activeCart?.companyId
const companyId = cartStore.selectedCompanyId || cartStore.activeCart?.companyId
if (companyId) {
router.push(`/companies/${companyId}/catalogs`)
} else {
router.push('/')
}
}