diff --git a/API.md b/API.md index 744f122..e105ca4 100644 --- a/API.md +++ b/API.md @@ -230,6 +230,7 @@ Response 200: "currency": "USD", "imgs": ["https://...", "https://..."], "tags": ["new", "featured"], + "badges": ["new", "exclusive"], "simpleDescription": "Latest iPhone...", "description": [ { "key": "Color", "value": "Black" }, @@ -275,6 +276,7 @@ Body: "currency": "USD", // USD | EUR | RUB | GBP | UAH "imgs": ["https://..."], "tags": ["new"], + "badges": ["new", "exclusive"], // optional - predefined or custom badge labels "simpleDescription": "Short description", "description": [ { "key": "Size", "value": "Large" } @@ -364,6 +366,7 @@ Response 201: - Use `PATCH` for partial updates - send only the fields you want to change. - `priority`: lower number = appears first in the list. - `currency` supported values: `USD`, `EUR`, `RUB`, `GBP`, `UAH`. +- `badges`: optional string array. Predefined values with UI colors: `new`, `sale`, `exclusive`, `hot`, `limited`, `bestseller`, `featured`. Custom strings are also allowed. - `imgs`: always send the **complete** array on update, not individual images. - `description`: array of `{ key, value }` pairs - free-form attributes per item. - Auto-save from the backoffice fires `PATCH` with a single field every ~500 ms. diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index acf0d69..31397b8 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -5,6 +5,7 @@ import { CategoryEditorComponent } from './pages/category-editor/category-editor import { SubcategoryEditorComponent } from './pages/subcategory-editor/subcategory-editor.component'; import { ItemsListComponent } from './pages/items-list/items-list.component'; import { ItemEditorComponent } from './pages/item-editor/item-editor.component'; +import { ItemPreviewComponent } from './pages/item-preview/item-preview.component'; export const routes: Routes = [ { @@ -30,6 +31,10 @@ export const routes: Routes = [ { path: 'item/:itemId', component: ItemEditorComponent + }, + { + path: 'item/:itemId/preview', + component: ItemPreviewComponent } ] }, diff --git a/src/app/components/create-dialog/create-dialog.component.ts b/src/app/components/create-dialog/create-dialog.component.ts index 7b5bdce..000c8bd 100644 --- a/src/app/components/create-dialog/create-dialog.component.ts +++ b/src/app/components/create-dialog/create-dialog.component.ts @@ -6,6 +6,7 @@ import { MatButtonModule } from '@angular/material/button'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatInputModule } from '@angular/material/input'; import { MatSlideToggleModule } from '@angular/material/slide-toggle'; +import { MatSelectModule } from '@angular/material/select'; export interface CreateDialogData { title: string; @@ -13,10 +14,11 @@ export interface CreateDialogData { fields: { name: string; label: string; - type: 'text' | 'number' | 'toggle'; + type: 'text' | 'number' | 'toggle' | 'select'; required?: boolean; value?: any; hint?: string; + options?: { value: any; label: string }[]; }[]; } @@ -30,7 +32,8 @@ export interface CreateDialogData { MatButtonModule, MatFormFieldModule, MatInputModule, - MatSlideToggleModule + MatSlideToggleModule, + MatSelectModule ], template: `