Redesign products list and form to match catalog mockups.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-05 16:26:09 +03:30
co-authored by Cursor
parent 028362da44
commit 55f360c13f
9 changed files with 1626 additions and 236 deletions
@@ -0,0 +1,12 @@
-- AlterTable
ALTER TABLE "Product" ADD COLUMN IF NOT EXISTS "kind" TEXT NOT NULL DEFAULT 'product';
ALTER TABLE "Product" ADD COLUMN IF NOT EXISTS "category" TEXT;
ALTER TABLE "Product" ADD COLUMN IF NOT EXISTS "unit" TEXT DEFAULT 'عدد';
ALTER TABLE "Product" ADD COLUMN IF NOT EXISTS "stockQty" INTEGER;
ALTER TABLE "Product" ADD COLUMN IF NOT EXISTS "brand" TEXT;
ALTER TABLE "Product" ADD COLUMN IF NOT EXISTS "model" TEXT;
ALTER TABLE "Product" ADD COLUMN IF NOT EXISTS "country" TEXT;
ALTER TABLE "Product" ADD COLUMN IF NOT EXISTS "tags" TEXT[] DEFAULT ARRAY[]::TEXT[];
-- CreateIndex
CREATE INDEX IF NOT EXISTS "Product_organizationId_category_idx" ON "Product"("organizationId", "category");
+10
View File
@@ -504,9 +504,18 @@ model Product {
id String @id @default(cuid())
organizationId String
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
/// product | service
kind String @default("product")
name String
sku String?
description String?
category String?
unit String? @default("عدد")
stockQty Int?
brand String?
model String?
country String?
tags String[] @default([])
unitPrice Decimal? @db.Decimal(18, 2)
currency String @default("IRR")
isActive Boolean @default(true)
@@ -518,6 +527,7 @@ model Product {
@@index([organizationId, name])
@@index([organizationId, isActive])
@@index([organizationId, category])
}
model DealLineItem {
+93
View File
@@ -1,6 +1,9 @@
import { Type } from 'class-transformer';
import {
IsArray,
IsBoolean,
IsIn,
IsInt,
IsNumber,
IsOptional,
IsString,
@@ -11,6 +14,10 @@ import {
} from 'class-validator';
export class CreateProductDto {
@IsOptional()
@IsIn(['product', 'service'])
kind?: 'product' | 'service';
@IsString()
@MinLength(1)
@MaxLength(160)
@@ -26,6 +33,43 @@ export class CreateProductDto {
@MaxLength(1000)
description?: string;
@IsOptional()
@IsString()
@MaxLength(80)
category?: string;
@IsOptional()
@IsString()
@MaxLength(40)
unit?: string;
@IsOptional()
@ValidateIf((_, v) => v !== '' && v != null)
@Type(() => Number)
@IsInt()
@Min(0)
stockQty?: number | null;
@IsOptional()
@IsString()
@MaxLength(80)
brand?: string;
@IsOptional()
@IsString()
@MaxLength(80)
model?: string;
@IsOptional()
@IsString()
@MaxLength(80)
country?: string;
@IsOptional()
@IsArray()
@IsString({ each: true })
tags?: string[];
@IsOptional()
@ValidateIf((_, v) => v !== '' && v != null)
@Type(() => Number)
@@ -44,6 +88,10 @@ export class CreateProductDto {
}
export class UpdateProductDto {
@IsOptional()
@IsIn(['product', 'service'])
kind?: 'product' | 'service';
@IsOptional()
@IsString()
@MinLength(1)
@@ -60,6 +108,43 @@ export class UpdateProductDto {
@MaxLength(1000)
description?: string | null;
@IsOptional()
@IsString()
@MaxLength(80)
category?: string | null;
@IsOptional()
@IsString()
@MaxLength(40)
unit?: string | null;
@IsOptional()
@ValidateIf((_, v) => v !== '' && v != null)
@Type(() => Number)
@IsInt()
@Min(0)
stockQty?: number | null;
@IsOptional()
@IsString()
@MaxLength(80)
brand?: string | null;
@IsOptional()
@IsString()
@MaxLength(80)
model?: string | null;
@IsOptional()
@IsString()
@MaxLength(80)
country?: string | null;
@IsOptional()
@IsArray()
@IsString({ each: true })
tags?: string[];
@IsOptional()
@ValidateIf((_, v) => v !== '' && v != null)
@Type(() => Number)
@@ -86,4 +171,12 @@ export class ListProductsQueryDto {
@IsOptional()
@IsString()
q?: string;
@IsOptional()
@IsString()
category?: string;
@IsOptional()
@IsIn(['product', 'service'])
kind?: 'product' | 'service';
}
@@ -29,9 +29,19 @@ export class ProductsController {
return this.productsService.list(user.organizationId, {
activeOnly: query.activeOnly,
q: query.q,
category: query.category,
kind: query.kind,
});
}
@Get(':id')
getOne(
@CurrentUser() user: { organizationId: string },
@Param('id') id: string,
) {
return this.productsService.get(user.organizationId, id);
}
@Post()
@Roles('owner', 'admin')
create(
+81 -1
View File
@@ -13,9 +13,17 @@ import { PrismaService } from '../prisma/prisma.service';
type ProductRow = {
id: string;
kind: string;
name: string;
sku: string | null;
description: string | null;
category: string | null;
unit: string | null;
stockQty: number | null;
brand: string | null;
model: string | null;
country: string | null;
tags: string[];
unitPrice: Prisma.Decimal | null;
currency: string;
isActive: boolean;
@@ -29,17 +37,38 @@ export class ProductsService {
async list(
organizationId: string,
opts?: { activeOnly?: boolean; q?: string },
opts?: {
activeOnly?: boolean;
q?: string;
category?: string;
kind?: string;
},
): Promise<ProductDto[]> {
const rows = await this.prisma.product.findMany({
where: {
organizationId,
...(opts?.activeOnly ? { isActive: true } : {}),
...(opts?.category?.trim()
? { category: opts.category.trim() }
: {}),
...(opts?.kind ? { kind: opts.kind } : {}),
...(opts?.q?.trim()
? {
OR: [
{ name: { contains: opts.q.trim(), mode: 'insensitive' } },
{ sku: { contains: opts.q.trim(), mode: 'insensitive' } },
{
description: {
contains: opts.q.trim(),
mode: 'insensitive',
},
},
{
category: {
contains: opts.q.trim(),
mode: 'insensitive',
},
},
],
}
: {}),
@@ -49,6 +78,14 @@ export class ProductsService {
return rows.map((row) => this.toDto(row));
}
async get(organizationId: string, id: string): Promise<ProductDto> {
const row = await this.prisma.product.findFirst({
where: { id, organizationId },
});
if (!row) throw new NotFoundException('محصول پیدا نشد');
return this.toDto(row);
}
async create(
organizationId: string,
dto: CreateProductRequest,
@@ -59,9 +96,17 @@ export class ProductsService {
const row = await this.prisma.product.create({
data: {
organizationId,
kind: dto.kind === 'service' ? 'service' : 'product',
name,
sku: emptyToNull(dto.sku),
description: emptyToNull(dto.description),
category: emptyToNull(dto.category),
unit: emptyToNull(dto.unit) ?? 'عدد',
stockQty: normalizeStock(dto.stockQty),
brand: emptyToNull(dto.brand),
model: emptyToNull(dto.model),
country: emptyToNull(dto.country),
tags: normalizeTags(dto.tags),
unitPrice:
dto.unitPrice == null || Number.isNaN(Number(dto.unitPrice))
? null
@@ -80,6 +125,9 @@ export class ProductsService {
): Promise<ProductDto> {
await this.ensureExists(organizationId, id);
const data: Prisma.ProductUpdateInput = {};
if (dto.kind !== undefined) {
data.kind = dto.kind === 'service' ? 'service' : 'product';
}
if (dto.name !== undefined) {
const name = dto.name.trim();
if (!name) throw new BadRequestException('نام محصول الزامی است');
@@ -87,6 +135,13 @@ export class ProductsService {
}
if ('sku' in dto) data.sku = emptyToNull(dto.sku);
if ('description' in dto) data.description = emptyToNull(dto.description);
if ('category' in dto) data.category = emptyToNull(dto.category);
if ('unit' in dto) data.unit = emptyToNull(dto.unit) ?? 'عدد';
if ('stockQty' in dto) data.stockQty = normalizeStock(dto.stockQty);
if ('brand' in dto) data.brand = emptyToNull(dto.brand);
if ('model' in dto) data.model = emptyToNull(dto.model);
if ('country' in dto) data.country = emptyToNull(dto.country);
if (dto.tags !== undefined) data.tags = normalizeTags(dto.tags);
if ('unitPrice' in dto) {
data.unitPrice =
dto.unitPrice == null || Number.isNaN(Number(dto.unitPrice))
@@ -122,9 +177,17 @@ export class ProductsService {
private toDto(row: ProductRow): ProductDto {
return {
id: row.id,
kind: row.kind === 'service' ? 'service' : 'product',
name: row.name,
sku: row.sku,
description: row.description,
category: row.category,
unit: row.unit,
stockQty: row.stockQty,
brand: row.brand,
model: row.model,
country: row.country,
tags: row.tags ?? [],
unitPrice: row.unitPrice == null ? null : Number(row.unitPrice),
currency: row.currency,
isActive: row.isActive,
@@ -139,3 +202,20 @@ function emptyToNull(value?: string | null): string | null {
const trimmed = value.trim();
return trimmed.length ? trimmed : null;
}
function normalizeStock(value?: number | null): number | null {
if (value == null) return null;
const n = Number(value);
if (!Number.isFinite(n) || n < 0) return null;
return Math.floor(n);
}
function normalizeTags(tags?: string[] | null): string[] {
if (!tags?.length) return [];
const out: string[] = [];
for (const t of tags) {
const s = String(t ?? '').trim();
if (s && !out.includes(s)) out.push(s.slice(0, 40));
}
return out.slice(0, 20);
}
+12
View File
@@ -198,6 +198,18 @@ export const router = createRouter({
component: () => import('@/views/ProductsSettingsView.vue'),
meta: { roles: ['owner', 'admin'] as UserRole[] },
},
{
path: 'settings/products/new',
name: 'product-new',
component: () => import('@/views/ProductFormView.vue'),
meta: { roles: ['owner', 'admin'] as UserRole[] },
},
{
path: 'settings/products/:id/edit',
name: 'product-edit',
component: () => import('@/views/ProductFormView.vue'),
meta: { roles: ['owner', 'admin'] as UserRole[] },
},
{
path: 'settings/currencies',
name: 'currencies',
+673
View File
@@ -0,0 +1,673 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import axios from 'axios';
import { api } from '@/lib/api';
import MoneyInput from '@/components/MoneyInput.vue';
import UiIcon from '@/components/UiIcon.vue';
import type {
CreateProductRequest,
OrganizationDto,
ProductDto,
} from '@mento/shared';
const CATEGORIES = [
'طلا و جواهر',
'سکه',
'خدمات',
'نرم‌افزار',
'آموزش',
'سایر',
];
const UNITS = ['عدد', 'گرم', 'مثقال', 'سوت', 'کیلوگرم', 'ساعت', 'بسته'];
const route = useRoute();
const router = useRouter();
const editId = computed(() =>
typeof route.params.id === 'string' ? route.params.id : '',
);
const isEdit = computed(() => Boolean(editId.value));
const loading = ref(false);
const saving = ref(false);
const error = ref('');
const enabledCurrencies = ref<string[]>(['IRR']);
const kind = ref<'product' | 'service'>('product');
const name = ref('');
const category = ref('');
const sku = ref('');
const unitPrice = ref('');
const currency = ref('IRR');
const unit = ref('عدد');
const stockQty = ref('');
const description = ref('');
const isActive = ref(true);
const brand = ref('');
const model = ref('');
const country = ref('');
const tagInput = ref('');
const tags = ref<string[]>([]);
const title = computed(() => (isEdit.value ? 'ویرایش محصول' : 'افزودن محصول'));
const submitLabel = computed(() =>
saving.value
? 'در حال ثبت…'
: isEdit.value
? 'ذخیره تغییرات'
: 'ثبت محصول',
);
function addTag() {
const t = tagInput.value.trim();
if (!t) return;
if (!tags.value.includes(t)) tags.value = [...tags.value, t].slice(0, 20);
tagInput.value = '';
}
function removeTag(t: string) {
tags.value = tags.value.filter((x) => x !== t);
}
function onTagKey(e: KeyboardEvent) {
if (e.key === 'Enter') {
e.preventDefault();
addTag();
}
}
async function loadOrg() {
const { data } = await api.get<OrganizationDto>('/organizations/current');
enabledCurrencies.value = data.enabledCurrencies?.length
? data.enabledCurrencies
: [data.baseCurrency || 'IRR'];
currency.value = data.baseCurrency || 'IRR';
}
async function loadProduct() {
if (!editId.value) return;
loading.value = true;
try {
const { data } = await api.get<ProductDto>(`/products/${editId.value}`);
kind.value = data.kind;
name.value = data.name;
category.value = data.category ?? '';
sku.value = data.sku ?? '';
unitPrice.value = data.unitPrice == null ? '' : String(data.unitPrice);
currency.value = data.currency || 'IRR';
unit.value = data.unit ?? 'عدد';
stockQty.value = data.stockQty == null ? '' : String(data.stockQty);
description.value = data.description ?? '';
isActive.value = data.isActive;
brand.value = data.brand ?? '';
model.value = data.model ?? '';
country.value = data.country ?? '';
tags.value = data.tags ?? [];
} catch {
error.value = 'بارگذاری محصول ناموفق بود.';
} finally {
loading.value = false;
}
}
function buildPayload(): CreateProductRequest {
return {
kind: kind.value,
name: name.value.trim(),
sku: sku.value.trim() || undefined,
description: description.value.trim() || undefined,
category: category.value.trim() || undefined,
unit: unit.value.trim() || undefined,
stockQty: stockQty.value === '' ? null : Number(stockQty.value),
brand: brand.value.trim() || undefined,
model: model.value.trim() || undefined,
country: country.value.trim() || undefined,
tags: tags.value,
unitPrice: unitPrice.value === '' ? null : Number(unitPrice.value),
currency: currency.value || 'IRR',
isActive: isActive.value,
};
}
async function submit() {
if (!name.value.trim()) {
error.value = 'نام محصول را وارد کنید.';
return;
}
if (!category.value.trim()) {
error.value = 'دسته‌بندی را انتخاب کنید.';
return;
}
saving.value = true;
error.value = '';
try {
const payload = buildPayload();
if (isEdit.value) {
await api.patch(`/products/${editId.value}`, payload);
} else {
await api.post('/products', payload);
}
await router.push({ name: 'products' });
} catch (e) {
if (axios.isAxiosError(e)) {
const msg = (e.response?.data as { message?: string | string[] })?.message;
error.value = Array.isArray(msg)
? msg.join('، ')
: (msg ?? 'ثبت محصول ناموفق بود');
} else {
error.value = 'ثبت محصول ناموفق بود';
}
} finally {
saving.value = false;
}
}
function cancel() {
void router.push({ name: 'products' });
}
onMounted(async () => {
try {
await loadOrg();
await loadProduct();
} catch {
error.value = 'بارگذاری فرم ناموفق بود.';
}
});
</script>
<template>
<section class="page">
<header class="page-head">
<button type="button" class="back mob-only" aria-label="بازگشت" @click="cancel">
<UiIcon name="chevron" :size="20" />
</button>
<div class="title-row">
<span class="title-ico" aria-hidden="true">
<UiIcon name="box" :size="22" />
</span>
<div>
<h1>{{ title }}</h1>
<p class="lead">اطلاعات محصول را وارد کنید</p>
</div>
</div>
</header>
<p v-if="loading" class="muted">در حال بارگذاری…</p>
<p v-if="error" class="error">{{ error }}</p>
<form v-else class="form" @submit.prevent="submit">
<div class="kind-seg mob-only">
<button
type="button"
:class="{ on: kind === 'product' }"
@click="kind = 'product'"
>
<UiIcon name="box" :size="16" />
محصول
</button>
<button
type="button"
:class="{ on: kind === 'service' }"
@click="kind = 'service'"
>
<UiIcon name="briefcase" :size="16" />
خدمت
</button>
</div>
<div class="grid">
<section class="card main">
<h2>اطلاعات اصلی</h2>
<label class="field kind-desk">
<span>نوع</span>
<div class="kind-seg">
<button
type="button"
:class="{ on: kind === 'product' }"
@click="kind = 'product'"
>
<UiIcon name="box" :size="16" />
محصول
</button>
<button
type="button"
:class="{ on: kind === 'service' }"
@click="kind = 'service'"
>
<UiIcon name="briefcase" :size="16" />
خدمت
</button>
</div>
</label>
<label class="field">
<span>نام محصول <em>*</em></span>
<div class="control">
<UiIcon name="box" :size="18" />
<input v-model="name" required placeholder="مثلاً انگشتر طلا مدل ونوس" />
</div>
</label>
<label class="field">
<span>دسته‌بندی <em>*</em></span>
<div class="control">
<UiIcon name="layers" :size="18" />
<select v-model="category" required>
<option disabled value="">دسته‌بندی را انتخاب کنید</option>
<option v-for="c in CATEGORIES" :key="c" :value="c">{{ c }}</option>
</select>
</div>
</label>
<label class="field">
<span>کد / SKU <em>*</em></span>
<div class="control">
<UiIcon name="flag" :size="18" />
<input v-model="sku" required placeholder="MNT-001" dir="ltr" />
</div>
</label>
<div class="row-2">
<label class="field">
<span>قیمت واحد <em>*</em></span>
<div class="control price">
<UiIcon name="dollar" :size="18" />
<MoneyInput v-model="unitPrice" :decimals="0" placeholder="مبلغ را وارد کنید" />
<span class="suffix">{{ currency === 'IRR' || currency === 'IRT' ? 'تومان' : currency }}</span>
</div>
</label>
<label class="field">
<span>ارز</span>
<div class="control">
<select v-model="currency">
<option v-for="code in enabledCurrencies" :key="code" :value="code">
{{ code }}
</option>
</select>
</div>
</label>
</div>
<div class="row-2">
<label class="field">
<span>واحد سنجش <em>*</em></span>
<div class="control">
<UiIcon name="layers" :size="18" />
<select v-model="unit" required>
<option v-for="u in UNITS" :key="u" :value="u">{{ u }}</option>
</select>
</div>
</label>
<label class="field">
<span>موجودی</span>
<div class="control">
<UiIcon name="bag" :size="18" />
<input v-model="stockQty" type="number" min="0" placeholder="مثلاً ۱۲۰" dir="ltr" />
</div>
</label>
</div>
<div class="status-row">
<span>وضعیت محصول</span>
<label class="switch">
<input v-model="isActive" type="checkbox" />
<span class="track" />
<span class="switch-text">این محصول فعال باشد</span>
</label>
</div>
</section>
<div class="side">
<section class="card">
<h2>توضیحات</h2>
<label class="field">
<div class="control area">
<UiIcon name="document" :size="18" />
<textarea
v-model="description"
rows="5"
placeholder="توضیحات محصول را وارد کنید..."
/>
</div>
</label>
</section>
<section class="card desk-only">
<h2>اطلاعات تکمیلی</h2>
<label class="field">
<span>برند</span>
<div class="control">
<UiIcon name="building" :size="18" />
<input v-model="brand" placeholder="برند را وارد کنید" />
</div>
</label>
<label class="field">
<span>مدل</span>
<div class="control">
<UiIcon name="grid" :size="18" />
<input v-model="model" placeholder="مدل محصول" />
</div>
</label>
<label class="field">
<span>کشور سازنده</span>
<div class="control">
<UiIcon name="target" :size="18" />
<input v-model="country" placeholder="کشور سازنده" />
</div>
</label>
<label class="field">
<span>برچسب‌ها</span>
<div class="control">
<UiIcon name="star" :size="18" />
<input
v-model="tagInput"
placeholder="برچسب را وارد کنید و Enter بزنید"
@keydown="onTagKey"
/>
</div>
<div v-if="tags.length" class="tags">
<button
v-for="t in tags"
:key="t"
type="button"
class="tag"
@click="removeTag(t)"
>
{{ t }} ×
</button>
</div>
</label>
</section>
</div>
</div>
<footer class="actions">
<button class="btn primary" type="submit" :disabled="saving">
<UiIcon name="check" :size="18" />
{{ submitLabel }}
</button>
<button class="btn ghost desk-only" type="button" @click="cancel">انصراف</button>
</footer>
</form>
</section>
</template>
<style scoped>
.page {
display: grid;
gap: 1rem;
max-width: 1100px;
}
.page-head {
display: flex;
align-items: flex-start;
gap: 0.75rem;
}
.back {
border: 1px solid var(--line);
background: var(--surface);
width: 40px;
height: 40px;
border-radius: 12px;
display: grid;
place-items: center;
cursor: pointer;
transform: scaleX(-1);
}
.title-row {
display: flex;
gap: 0.75rem;
align-items: flex-start;
}
.title-ico {
width: 44px;
height: 44px;
border-radius: 12px;
display: grid;
place-items: center;
background: var(--accent-soft);
color: var(--accent);
}
h1 {
margin: 0;
font-size: 1.45rem;
}
.lead {
margin: 0.2rem 0 0;
color: var(--muted);
}
.form {
display: grid;
gap: 1rem;
}
.grid {
display: grid;
grid-template-columns: 1.4fr 1fr;
gap: 1rem;
align-items: start;
}
.side {
display: grid;
gap: 1rem;
}
.card {
background: var(--surface);
border: 1px solid var(--line);
border-radius: 16px;
padding: 1rem 1.1rem;
display: grid;
gap: 0.85rem;
}
.card h2 {
margin: 0;
font-size: 1rem;
}
.field {
display: grid;
gap: 0.35rem;
font-size: 0.88rem;
color: var(--muted);
}
.field em {
color: #dc2626;
font-style: normal;
}
.control {
display: flex;
align-items: center;
gap: 0.45rem;
border: 1px solid var(--line);
border-radius: 12px;
padding: 0.55rem 0.75rem;
background: #fff;
color: var(--muted);
}
.control input,
.control select,
.control textarea {
border: 0;
outline: 0;
width: 100%;
background: transparent;
color: var(--text);
font: inherit;
}
.control.area {
align-items: flex-start;
}
.control.price {
padding-inline-end: 0.35rem;
}
.control.price :deep(input) {
border: 0;
outline: 0;
background: transparent;
width: 100%;
}
.suffix {
color: var(--muted);
font-size: 0.85rem;
white-space: nowrap;
padding: 0.25rem 0.45rem;
background: #f8fafc;
border-radius: 8px;
}
.row-2 {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.75rem;
}
.kind-seg {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.4rem;
background: #f1f5f9;
border-radius: 12px;
padding: 0.3rem;
}
.kind-seg button {
border: 0;
background: transparent;
border-radius: 10px;
padding: 0.55rem 0.6rem;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.35rem;
cursor: pointer;
color: #475569;
font-weight: 700;
}
.kind-seg button.on {
background: var(--accent);
color: #fff;
}
.status-row {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 0.75rem;
align-items: center;
color: var(--muted);
font-size: 0.9rem;
}
.switch {
display: inline-flex;
align-items: center;
gap: 0.55rem;
cursor: pointer;
color: var(--text);
}
.switch input {
position: absolute;
opacity: 0;
pointer-events: none;
}
.track {
width: 44px;
height: 26px;
border-radius: 999px;
background: #cbd5e1;
position: relative;
transition: 0.15s ease;
}
.track::after {
content: '';
position: absolute;
top: 3px;
right: 3px;
width: 20px;
height: 20px;
border-radius: 50%;
background: #fff;
transition: 0.15s ease;
}
.switch input:checked + .track {
background: var(--accent);
}
.switch input:checked + .track::after {
right: 21px;
}
.tags {
display: flex;
flex-wrap: wrap;
gap: 0.35rem;
margin-top: 0.35rem;
}
.tag {
border: 0;
background: var(--accent-soft);
color: var(--accent);
border-radius: 999px;
padding: 0.25rem 0.55rem;
cursor: pointer;
font-size: 0.8rem;
}
.actions {
display: flex;
gap: 0.55rem;
justify-content: flex-start;
flex-wrap: wrap;
}
.btn {
border: 0;
border-radius: 12px;
padding: 0.75rem 1.15rem;
font-weight: 700;
display: inline-flex;
align-items: center;
gap: 0.4rem;
cursor: pointer;
}
.btn.primary {
background: var(--accent);
color: #fff;
min-width: 160px;
justify-content: center;
}
.btn.ghost {
background: var(--surface);
color: var(--text);
border: 1px solid var(--line);
}
.error {
color: #b91c1c;
}
.muted {
color: var(--muted);
}
.mob-only {
display: none;
}
@media (max-width: 900px) {
.grid {
grid-template-columns: 1fr;
}
.row-2 {
grid-template-columns: 1fr;
}
.desk-only {
display: none;
}
.mob-only {
display: grid;
}
.kind-desk {
display: none;
}
.back.mob-only {
display: grid;
}
.actions .btn.primary {
width: 100%;
}
}
@media (min-width: 901px) {
.mob-only {
display: none !important;
}
}
</style>
File diff suppressed because it is too large Load Diff
+24
View File
@@ -697,9 +697,17 @@ export interface ImportContactsResult {
export interface ProductDto {
id: string;
kind: "product" | "service";
name: string;
sku: string | null;
description: string | null;
category: string | null;
unit: string | null;
stockQty: number | null;
brand: string | null;
model: string | null;
country: string | null;
tags: string[];
unitPrice: number | null;
currency: string;
isActive: boolean;
@@ -708,18 +716,34 @@ export interface ProductDto {
}
export interface CreateProductRequest {
kind?: "product" | "service";
name: string;
sku?: string;
description?: string;
category?: string;
unit?: string;
stockQty?: number | null;
brand?: string;
model?: string;
country?: string;
tags?: string[];
unitPrice?: number | null;
currency?: string;
isActive?: boolean;
}
export interface UpdateProductRequest {
kind?: "product" | "service";
name?: string;
sku?: string | null;
description?: string | null;
category?: string | null;
unit?: string | null;
stockQty?: number | null;
brand?: string | null;
model?: string | null;
country?: string | null;
tags?: string[];
unitPrice?: number | null;
currency?: string;
isActive?: boolean;