@vendure-platform/create 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/assets/demo-data/branding/logo.svg +4 -0
- package/dist/assets/demo-data/images/absorbent-pad.webp +0 -0
- package/dist/assets/demo-data/images/adjustable-wrench.webp +0 -0
- package/dist/assets/demo-data/images/anchor-bolt.webp +0 -0
- package/dist/assets/demo-data/images/angle-grinder.webp +0 -0
- package/dist/assets/demo-data/images/barrier-tape.webp +0 -0
- package/dist/assets/demo-data/images/bench-grinder.webp +0 -0
- package/dist/assets/demo-data/images/bracket.webp +0 -0
- package/dist/assets/demo-data/images/broom.webp +0 -0
- package/dist/assets/demo-data/images/bucket.webp +0 -0
- package/dist/assets/demo-data/images/cable-gland.webp +0 -0
- package/dist/assets/demo-data/images/cable-tie.webp +0 -0
- package/dist/assets/demo-data/images/cable-tray.webp +0 -0
- package/dist/assets/demo-data/images/cable.webp +0 -0
- package/dist/assets/demo-data/images/chimney-base-kit.webp +0 -0
- package/dist/assets/demo-data/images/chimney-cowl-bird-guard.webp +0 -0
- package/dist/assets/demo-data/images/chimney-cowl-open.webp +0 -0
- package/dist/assets/demo-data/images/chimney-storm-collar.webp +0 -0
- package/dist/assets/demo-data/images/chimney-wall-bracket.webp +0 -0
- package/dist/assets/demo-data/images/circular-saw.webp +0 -0
- package/dist/assets/demo-data/images/cleaning-spray.webp +0 -0
- package/dist/assets/demo-data/images/conduit.webp +0 -0
- package/dist/assets/demo-data/images/cordless-drill.webp +0 -0
- package/dist/assets/demo-data/images/drill-bits.webp +0 -0
- package/dist/assets/demo-data/images/dust-mask.webp +0 -0
- package/dist/assets/demo-data/images/ear-defenders.webp +0 -0
- package/dist/assets/demo-data/images/ear-plugs.webp +0 -0
- package/dist/assets/demo-data/images/extension-lead.webp +0 -0
- package/dist/assets/demo-data/images/eye-wash-station.webp +0 -0
- package/dist/assets/demo-data/images/face-shield.webp +0 -0
- package/dist/assets/demo-data/images/file-set.webp +0 -0
- package/dist/assets/demo-data/images/first-aid-kit.webp +0 -0
- package/dist/assets/demo-data/images/floor-sign.webp +0 -0
- package/dist/assets/demo-data/images/flue-bend-45.webp +0 -0
- package/dist/assets/demo-data/images/flue-bend-90.webp +0 -0
- package/dist/assets/demo-data/images/flue-section-1000mm.webp +0 -0
- package/dist/assets/demo-data/images/flue-section-250mm.webp +0 -0
- package/dist/assets/demo-data/images/flue-section-500mm.webp +0 -0
- package/dist/assets/demo-data/images/fuse.webp +0 -0
- package/dist/assets/demo-data/images/glove-dispenser.webp +0 -0
- package/dist/assets/demo-data/images/grinding-disc.webp +0 -0
- package/dist/assets/demo-data/images/hacksaw.webp +0 -0
- package/dist/assets/demo-data/images/hammer.webp +0 -0
- package/dist/assets/demo-data/images/hand-sanitiser.webp +0 -0
- package/dist/assets/demo-data/images/head-torch.webp +0 -0
- package/dist/assets/demo-data/images/heat-gun.webp +0 -0
- package/dist/assets/demo-data/images/hex-bolt.webp +0 -0
- package/dist/assets/demo-data/images/hex-key-set.webp +0 -0
- package/dist/assets/demo-data/images/hex-nut.webp +0 -0
- package/dist/assets/demo-data/images/hi-vis-jacket.webp +0 -0
- package/dist/assets/demo-data/images/hi-vis-vest.webp +0 -0
- package/dist/assets/demo-data/images/hose-clamp.webp +0 -0
- package/dist/assets/demo-data/images/impact-driver.webp +0 -0
- package/dist/assets/demo-data/images/jigsaw.webp +0 -0
- package/dist/assets/demo-data/images/junction-box.webp +0 -0
- package/dist/assets/demo-data/images/knee-pads.webp +0 -0
- package/dist/assets/demo-data/images/machine-screw.webp +0 -0
- package/dist/assets/demo-data/images/made-to-order-configurable-chimney.webp +0 -0
- package/dist/assets/demo-data/images/mallet.webp +0 -0
- package/dist/assets/demo-data/images/mcb.webp +0 -0
- package/dist/assets/demo-data/images/mop.webp +0 -0
- package/dist/assets/demo-data/images/paper-towels.webp +0 -0
- package/dist/assets/demo-data/images/pipe-wrench.webp +0 -0
- package/dist/assets/demo-data/images/pliers-set.webp +0 -0
- package/dist/assets/demo-data/images/pry-bar.webp +0 -0
- package/dist/assets/demo-data/images/rcd.webp +0 -0
- package/dist/assets/demo-data/images/reciprocating-saw.webp +0 -0
- package/dist/assets/demo-data/images/rivet.webp +0 -0
- package/dist/assets/demo-data/images/roof-flashing-high-pitch.webp +0 -0
- package/dist/assets/demo-data/images/roof-flashing-low-pitch.webp +0 -0
- package/dist/assets/demo-data/images/safety-boots.webp +0 -0
- package/dist/assets/demo-data/images/safety-glasses.webp +0 -0
- package/dist/assets/demo-data/images/safety-harness.webp +0 -0
- package/dist/assets/demo-data/images/safety-helmet.webp +0 -0
- package/dist/assets/demo-data/images/safety-sign.webp +0 -0
- package/dist/assets/demo-data/images/sanding-disc.webp +0 -0
- package/dist/assets/demo-data/images/saw-blade.webp +0 -0
- package/dist/assets/demo-data/images/screwdriver-set.webp +0 -0
- package/dist/assets/demo-data/images/screwdriver.webp +0 -0
- package/dist/assets/demo-data/images/self-tapping-screw.webp +0 -0
- package/dist/assets/demo-data/images/socket-set.webp +0 -0
- package/dist/assets/demo-data/images/socket.webp +0 -0
- package/dist/assets/demo-data/images/spanner-set.webp +0 -0
- package/dist/assets/demo-data/images/spanner.webp +0 -0
- package/dist/assets/demo-data/images/spill-kit.webp +0 -0
- package/dist/assets/demo-data/images/spirit-level.webp +0 -0
- package/dist/assets/demo-data/images/switch.webp +0 -0
- package/dist/assets/demo-data/images/tape-measure.webp +0 -0
- package/dist/assets/demo-data/images/terminal-block.webp +0 -0
- package/dist/assets/demo-data/images/threaded-rod.webp +0 -0
- package/dist/assets/demo-data/images/torque-wrench.webp +0 -0
- package/dist/assets/demo-data/images/utility-knife.webp +0 -0
- package/dist/assets/demo-data/images/wall-pass-sleeve.webp +0 -0
- package/dist/assets/demo-data/images/wall-plug.webp +0 -0
- package/dist/assets/demo-data/images/washer.webp +0 -0
- package/dist/assets/demo-data/images/waste-bin.webp +0 -0
- package/dist/assets/demo-data/images/wire-connector.webp +0 -0
- package/dist/assets/demo-data/images/wire-cutters.webp +0 -0
- package/dist/assets/demo-data/images/wood-screw.webp +0 -0
- package/dist/assets/demo-data/images/work-gloves.webp +0 -0
- package/dist/assets/demo-data/images/work-light.webp +0 -0
- package/dist/assets/demo-data/initial-data.json +667 -0
- package/dist/assets/demo-data/products.csv +779 -0
- package/dist/assets/storefront/.env.example +14 -0
- package/dist/assets/storefront/.env.local +1 -0
- package/dist/assets/storefront/components.json +22 -0
- package/dist/assets/storefront/eslint.config.mjs +23 -0
- package/dist/assets/storefront/graphql.config.yml +2 -0
- package/dist/assets/storefront/messages/de.json +1196 -0
- package/dist/assets/storefront/messages/en.json +1196 -0
- package/dist/assets/storefront/next-env.d.ts +6 -0
- package/dist/assets/storefront/next.config.ts +73 -0
- package/dist/assets/storefront/package.json +77 -0
- package/dist/assets/storefront/postcss.config.mjs +5 -0
- package/dist/assets/storefront/public/next.svg +22 -0
- package/dist/assets/storefront/public/scenarios/b2b-wholesale/hero/hero-bg.webp +0 -0
- package/dist/assets/storefront/public/scenarios/b2b-wholesale/logo.svg +4 -0
- package/dist/assets/storefront/public/scenarios/default/logo.svg +4 -0
- package/dist/assets/storefront/public/scenarios/kaminpro/hero/hero-bg.webp +0 -0
- package/dist/assets/storefront/public/scenarios/kaminpro/logo.svg +7 -0
- package/dist/assets/storefront/public/vendure.svg +4 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/catalog/page.tsx +65 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/collection/[slug]/loading.tsx +24 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/collection/[slug]/page.tsx +194 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/layout.tsx +9 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/actions.ts +139 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/loading.tsx +46 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/page.tsx +330 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/actions.ts +11 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/loading.tsx +20 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/page.tsx +97 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-analytics-tracker.tsx +46 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-results.tsx +53 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-term.tsx +26 -0
- package/dist/assets/storefront/src/app/[locale]/(scenario)/[...path]/page.tsx +31 -0
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/accept-invitation-client.tsx +56 -0
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/actions.ts +32 -0
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/page.tsx +85 -0
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/sign-out-and-retry.tsx +26 -0
- package/dist/assets/storefront/src/app/[locale]/account/addresses/actions.ts +125 -0
- package/dist/assets/storefront/src/app/[locale]/account/addresses/address-form.tsx +180 -0
- package/dist/assets/storefront/src/app/[locale]/account/addresses/addresses-client.tsx +292 -0
- package/dist/assets/storefront/src/app/[locale]/account/addresses/loading.tsx +48 -0
- package/dist/assets/storefront/src/app/[locale]/account/addresses/page.tsx +54 -0
- package/dist/assets/storefront/src/app/[locale]/account/approvals/actions.ts +28 -0
- package/dist/assets/storefront/src/app/[locale]/account/approvals/page.tsx +340 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/actions.ts +33 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/actions.ts +83 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/address-form.tsx +267 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/addresses-client.tsx +253 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/page.tsx +75 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/actions.ts +70 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-unit-form.tsx +153 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-units-client.tsx +210 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/page.tsx +66 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/types.ts +8 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/edit-company-form.tsx +57 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/page.tsx +89 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/page.tsx +65 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/payment-methods-client.tsx +55 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/roles/page.tsx +66 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/roles/roles-client.tsx +93 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/actions.ts +51 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/page.tsx +57 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/tax-ids-client.tsx +326 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/users/actions.ts +74 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/users/edit-user-form.tsx +157 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/users/invite-user-form.tsx +133 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/users/page.tsx +104 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/users/users-client.tsx +266 -0
- package/dist/assets/storefront/src/app/[locale]/account/error.tsx +24 -0
- package/dist/assets/storefront/src/app/[locale]/account/layout.tsx +50 -0
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/page.tsx +463 -0
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-actions.ts +160 -0
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-dialog.tsx +386 -0
- package/dist/assets/storefront/src/app/[locale]/account/orders/loading.tsx +45 -0
- package/dist/assets/storefront/src/app/[locale]/account/orders/page.tsx +309 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/actions.ts +106 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/change-password-form.tsx +82 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/edit-email-form.tsx +88 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/edit-profile-form.tsx +80 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/loading.tsx +54 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/page.tsx +44 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/actions.ts +103 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/file-upload-tab.tsx +148 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/manual-entry-tab.tsx +112 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/page.tsx +26 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/preview-table.tsx +170 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/quick-order-form.tsx +243 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/save-to-list-dialog.tsx +153 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/sku-autocomplete.tsx +118 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/text-input-tab.tsx +40 -0
- package/dist/assets/storefront/src/app/[locale]/account/quotes/[id]/page.tsx +260 -0
- package/dist/assets/storefront/src/app/[locale]/account/quotes/actions.ts +253 -0
- package/dist/assets/storefront/src/app/[locale]/account/quotes/new/new-quote-form.tsx +28 -0
- package/dist/assets/storefront/src/app/[locale]/account/quotes/new/page.tsx +51 -0
- package/dist/assets/storefront/src/app/[locale]/account/quotes/page.tsx +248 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/loading.tsx +44 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/page.tsx +51 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/shopping-list-detail-client.tsx +562 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/actions.ts +235 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/create-shopping-list-form.tsx +86 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/loading.tsx +48 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/page.tsx +176 -0
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/actions.ts +31 -0
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/claim-form.tsx +41 -0
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/page.tsx +190 -0
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/reveal-code.tsx +38 -0
- package/dist/assets/storefront/src/app/[locale]/account/verify-email/page.tsx +117 -0
- package/dist/assets/storefront/src/app/[locale]/cart/actions.ts +128 -0
- package/dist/assets/storefront/src/app/[locale]/cart/cart-items.tsx +228 -0
- package/dist/assets/storefront/src/app/[locale]/cart/cart-line-actions.tsx +55 -0
- package/dist/assets/storefront/src/app/[locale]/cart/cart-quantity-control.tsx +158 -0
- package/dist/assets/storefront/src/app/[locale]/cart/cart-remove-button.tsx +36 -0
- package/dist/assets/storefront/src/app/[locale]/cart/cart.tsx +151 -0
- package/dist/assets/storefront/src/app/[locale]/cart/code-input.tsx +49 -0
- package/dist/assets/storefront/src/app/[locale]/cart/loading.tsx +10 -0
- package/dist/assets/storefront/src/app/[locale]/cart/order-summary.tsx +178 -0
- package/dist/assets/storefront/src/app/[locale]/cart/page.tsx +33 -0
- package/dist/assets/storefront/src/app/[locale]/cart/promotion-code.tsx +142 -0
- package/dist/assets/storefront/src/app/[locale]/cart/reapproval-confirm.tsx +76 -0
- package/dist/assets/storefront/src/app/[locale]/cart/request-quote-button.tsx +80 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/actions.ts +192 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/cancel-quote-checkout-button.tsx +30 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/checkout-flow.tsx +214 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/checkout-provider.tsx +181 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/loading.tsx +90 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/order-summary.tsx +160 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/page.tsx +154 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/delivery-step.tsx +107 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/payment-step.tsx +110 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/review-step.tsx +180 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/shipping-address-step.tsx +518 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/types.ts +7 -0
- package/dist/assets/storefront/src/app/[locale]/error.tsx +28 -0
- package/dist/assets/storefront/src/app/[locale]/forgot-password/actions.ts +28 -0
- package/dist/assets/storefront/src/app/[locale]/forgot-password/forgot-password-form.tsx +128 -0
- package/dist/assets/storefront/src/app/[locale]/forgot-password/page.tsx +24 -0
- package/dist/assets/storefront/src/app/[locale]/globals.css +72 -0
- package/dist/assets/storefront/src/app/[locale]/layout.tsx +202 -0
- package/dist/assets/storefront/src/app/[locale]/not-found.tsx +26 -0
- package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/order-confirmation.tsx +296 -0
- package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/page.tsx +18 -0
- package/dist/assets/storefront/src/app/[locale]/page.tsx +125 -0
- package/dist/assets/storefront/src/app/[locale]/register/actions.ts +50 -0
- package/dist/assets/storefront/src/app/[locale]/register/page.tsx +82 -0
- package/dist/assets/storefront/src/app/[locale]/register/registration-form.tsx +237 -0
- package/dist/assets/storefront/src/app/[locale]/register-company/actions.ts +40 -0
- package/dist/assets/storefront/src/app/[locale]/register-company/page.tsx +43 -0
- package/dist/assets/storefront/src/app/[locale]/register-company/registration-form.tsx +48 -0
- package/dist/assets/storefront/src/app/[locale]/reset-password/actions.ts +40 -0
- package/dist/assets/storefront/src/app/[locale]/reset-password/page.tsx +32 -0
- package/dist/assets/storefront/src/app/[locale]/reset-password/reset-password-form.tsx +96 -0
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/add-to-cart-button.tsx +31 -0
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/loading.tsx +29 -0
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/page.tsx +157 -0
- package/dist/assets/storefront/src/app/[locale]/sign-in/actions.ts +76 -0
- package/dist/assets/storefront/src/app/[locale]/sign-in/login-form.tsx +177 -0
- package/dist/assets/storefront/src/app/[locale]/sign-in/page.tsx +81 -0
- package/dist/assets/storefront/src/app/[locale]/verify/actions.ts +41 -0
- package/dist/assets/storefront/src/app/[locale]/verify/page.tsx +40 -0
- package/dist/assets/storefront/src/app/[locale]/verify/verify-content.tsx +127 -0
- package/dist/assets/storefront/src/app/[locale]/verify-pending/page.tsx +67 -0
- package/dist/assets/storefront/src/app/api/clear-company-context/route.ts +26 -0
- package/dist/assets/storefront/src/app/api/draft/disable/route.ts +12 -0
- package/dist/assets/storefront/src/app/api/draft/route.ts +17 -0
- package/dist/assets/storefront/src/app/api/revalidate/route.ts +110 -0
- package/dist/assets/storefront/src/app/api/search-analytics/route.ts +16 -0
- package/dist/assets/storefront/src/app/favicon.ico +0 -0
- package/dist/assets/storefront/src/components/commerce/account-nav-items.ts +56 -0
- package/dist/assets/storefront/src/components/commerce/account-sidebar.tsx +112 -0
- package/dist/assets/storefront/src/components/commerce/active-filters.tsx +107 -0
- package/dist/assets/storefront/src/components/commerce/approval-decision-form.tsx +70 -0
- package/dist/assets/storefront/src/components/commerce/approval-status-badge.tsx +37 -0
- package/dist/assets/storefront/src/components/commerce/business-unit-switcher.tsx +56 -0
- package/dist/assets/storefront/src/components/commerce/catalog-search-bar.tsx +83 -0
- package/dist/assets/storefront/src/components/commerce/category-product-section.tsx +69 -0
- package/dist/assets/storefront/src/components/commerce/category-sidebar.tsx +133 -0
- package/dist/assets/storefront/src/components/commerce/collection-hero-banner.tsx +36 -0
- package/dist/assets/storefront/src/components/commerce/company-state-badge.tsx +32 -0
- package/dist/assets/storefront/src/components/commerce/company-switcher.tsx +58 -0
- package/dist/assets/storefront/src/components/commerce/configurator-form.tsx +606 -0
- package/dist/assets/storefront/src/components/commerce/facet-filters.tsx +286 -0
- package/dist/assets/storefront/src/components/commerce/gift-card-pdp.tsx +43 -0
- package/dist/assets/storefront/src/components/commerce/gift-card-product-info.tsx +137 -0
- package/dist/assets/storefront/src/components/commerce/highlighted-text.tsx +30 -0
- package/dist/assets/storefront/src/components/commerce/instant-search-dropdown.tsx +377 -0
- package/dist/assets/storefront/src/components/commerce/order-status-badge.tsx +41 -0
- package/dist/assets/storefront/src/components/commerce/packaging-unit-selector.tsx +146 -0
- package/dist/assets/storefront/src/components/commerce/permission-gate.tsx +20 -0
- package/dist/assets/storefront/src/components/commerce/price-range-filter.tsx +111 -0
- package/dist/assets/storefront/src/components/commerce/price-tiers.tsx +98 -0
- package/dist/assets/storefront/src/components/commerce/price.tsx +29 -0
- package/dist/assets/storefront/src/components/commerce/product-card-list.tsx +121 -0
- package/dist/assets/storefront/src/components/commerce/product-card.tsx +89 -0
- package/dist/assets/storefront/src/components/commerce/product-carousel.tsx +42 -0
- package/dist/assets/storefront/src/components/commerce/product-grid.tsx +54 -0
- package/dist/assets/storefront/src/components/commerce/product-image-carousel.tsx +127 -0
- package/dist/assets/storefront/src/components/commerce/product-info.tsx +525 -0
- package/dist/assets/storefront/src/components/commerce/product-list-expansion.tsx +393 -0
- package/dist/assets/storefront/src/components/commerce/product-list-view.tsx +34 -0
- package/dist/assets/storefront/src/components/commerce/product-sidebar.tsx +175 -0
- package/dist/assets/storefront/src/components/commerce/product-view-switcher.tsx +107 -0
- package/dist/assets/storefront/src/components/commerce/quote-action-buttons.tsx +235 -0
- package/dist/assets/storefront/src/components/commerce/quote-activity-timeline.tsx +320 -0
- package/dist/assets/storefront/src/components/commerce/quote-comment-form.tsx +52 -0
- package/dist/assets/storefront/src/components/commerce/quote-csv-export-button.tsx +97 -0
- package/dist/assets/storefront/src/components/commerce/quote-product-search.tsx +139 -0
- package/dist/assets/storefront/src/components/commerce/quote-request-form.tsx +252 -0
- package/dist/assets/storefront/src/components/commerce/quote-status-badge.tsx +41 -0
- package/dist/assets/storefront/src/components/commerce/quote-validity-indicator.tsx +33 -0
- package/dist/assets/storefront/src/components/commerce/quote-version-comparison.tsx +88 -0
- package/dist/assets/storefront/src/components/commerce/related-products.tsx +56 -0
- package/dist/assets/storefront/src/components/commerce/shop-by-category.tsx +59 -0
- package/dist/assets/storefront/src/components/commerce/shopping-list-toggle.tsx +158 -0
- package/dist/assets/storefront/src/components/commerce/sort-dropdown.tsx +51 -0
- package/dist/assets/storefront/src/components/commerce/store-credit-summary.tsx +45 -0
- package/dist/assets/storefront/src/components/commerce/subcollection-tiles.tsx +56 -0
- package/dist/assets/storefront/src/components/layout/auth-page-shell.tsx +15 -0
- package/dist/assets/storefront/src/components/layout/draft-mode-action.ts +8 -0
- package/dist/assets/storefront/src/components/layout/draft-mode-indicator.tsx +54 -0
- package/dist/assets/storefront/src/components/layout/draft-mode-link.tsx +29 -0
- package/dist/assets/storefront/src/components/layout/footer.tsx +168 -0
- package/dist/assets/storefront/src/components/layout/navbar/actions.ts +33 -0
- package/dist/assets/storefront/src/components/layout/navbar/cart-icon.tsx +50 -0
- package/dist/assets/storefront/src/components/layout/navbar/channel-picker-wrapper.tsx +19 -0
- package/dist/assets/storefront/src/components/layout/navbar/channel-picker.tsx +53 -0
- package/dist/assets/storefront/src/components/layout/navbar/currency-picker-wrapper.tsx +21 -0
- package/dist/assets/storefront/src/components/layout/navbar/currency-picker.tsx +52 -0
- package/dist/assets/storefront/src/components/layout/navbar/language-picker.tsx +51 -0
- package/dist/assets/storefront/src/components/layout/navbar/login-button.tsx +34 -0
- package/dist/assets/storefront/src/components/layout/navbar/mobile-nav.tsx +74 -0
- package/dist/assets/storefront/src/components/layout/navbar/nav-menu-items.tsx +51 -0
- package/dist/assets/storefront/src/components/layout/navbar/navbar-cart.tsx +5 -0
- package/dist/assets/storefront/src/components/layout/navbar/navbar-collections.tsx +291 -0
- package/dist/assets/storefront/src/components/layout/navbar/navbar-link.tsx +28 -0
- package/dist/assets/storefront/src/components/layout/navbar/navbar-user.tsx +147 -0
- package/dist/assets/storefront/src/components/layout/navbar/theme-switcher.tsx +39 -0
- package/dist/assets/storefront/src/components/layout/navbar.tsx +117 -0
- package/dist/assets/storefront/src/components/layout/search-input.tsx +71 -0
- package/dist/assets/storefront/src/components/providers/awaiting-approval-banner.tsx +58 -0
- package/dist/assets/storefront/src/components/providers/cart-count-server.tsx +31 -0
- package/dist/assets/storefront/src/components/providers/company-context-guard.tsx +47 -0
- package/dist/assets/storefront/src/components/providers/company-permissions-server.tsx +14 -0
- package/dist/assets/storefront/src/components/providers/theme-provider.tsx +16 -0
- package/dist/assets/storefront/src/components/shared/breadcrumbs.tsx +39 -0
- package/dist/assets/storefront/src/components/shared/catalog-sidebar-skeleton.tsx +21 -0
- package/dist/assets/storefront/src/components/shared/country-select.tsx +83 -0
- package/dist/assets/storefront/src/components/shared/error-state.tsx +16 -0
- package/dist/assets/storefront/src/components/shared/pagination.tsx +119 -0
- package/dist/assets/storefront/src/components/shared/prefetch-link.tsx +36 -0
- package/dist/assets/storefront/src/components/shared/product-grid-skeleton.tsx +26 -0
- package/dist/assets/storefront/src/components/shared/scenario-paused.tsx +80 -0
- package/dist/assets/storefront/src/components/shared/skeletons/cart-skeleton.tsx +48 -0
- package/dist/assets/storefront/src/components/shared/skeletons/navbar-user-skeleton.tsx +9 -0
- package/dist/assets/storefront/src/components/shared/skeletons/search-input-skeleton.tsx +7 -0
- package/dist/assets/storefront/src/components/shared/skeletons/search-results-skeleton.tsx +17 -0
- package/dist/assets/storefront/src/components/ui/accordion.tsx +66 -0
- package/dist/assets/storefront/src/components/ui/alert-dialog.tsx +157 -0
- package/dist/assets/storefront/src/components/ui/alert.tsx +66 -0
- package/dist/assets/storefront/src/components/ui/aspect-ratio.tsx +11 -0
- package/dist/assets/storefront/src/components/ui/avatar.tsx +53 -0
- package/dist/assets/storefront/src/components/ui/badge.tsx +46 -0
- package/dist/assets/storefront/src/components/ui/breadcrumb.tsx +109 -0
- package/dist/assets/storefront/src/components/ui/button.tsx +58 -0
- package/dist/assets/storefront/src/components/ui/calendar.tsx +213 -0
- package/dist/assets/storefront/src/components/ui/card.tsx +92 -0
- package/dist/assets/storefront/src/components/ui/carousel.tsx +241 -0
- package/dist/assets/storefront/src/components/ui/chart.tsx +357 -0
- package/dist/assets/storefront/src/components/ui/checkbox.tsx +32 -0
- package/dist/assets/storefront/src/components/ui/collapsible.tsx +33 -0
- package/dist/assets/storefront/src/components/ui/command.tsx +184 -0
- package/dist/assets/storefront/src/components/ui/context-menu.tsx +252 -0
- package/dist/assets/storefront/src/components/ui/dialog.tsx +143 -0
- package/dist/assets/storefront/src/components/ui/drawer.tsx +135 -0
- package/dist/assets/storefront/src/components/ui/dropdown-menu.tsx +257 -0
- package/dist/assets/storefront/src/components/ui/empty-state.tsx +37 -0
- package/dist/assets/storefront/src/components/ui/field.tsx +244 -0
- package/dist/assets/storefront/src/components/ui/form.tsx +167 -0
- package/dist/assets/storefront/src/components/ui/hover-card.tsx +44 -0
- package/dist/assets/storefront/src/components/ui/input-otp.tsx +77 -0
- package/dist/assets/storefront/src/components/ui/input.tsx +21 -0
- package/dist/assets/storefront/src/components/ui/kbd-shortcut.tsx +20 -0
- package/dist/assets/storefront/src/components/ui/label.tsx +24 -0
- package/dist/assets/storefront/src/components/ui/menubar.tsx +276 -0
- package/dist/assets/storefront/src/components/ui/navigation-menu.tsx +168 -0
- package/dist/assets/storefront/src/components/ui/pagination.tsx +127 -0
- package/dist/assets/storefront/src/components/ui/popover.tsx +48 -0
- package/dist/assets/storefront/src/components/ui/progress.tsx +31 -0
- package/dist/assets/storefront/src/components/ui/radio-group.tsx +45 -0
- package/dist/assets/storefront/src/components/ui/resizable.tsx +56 -0
- package/dist/assets/storefront/src/components/ui/scroll-area.tsx +58 -0
- package/dist/assets/storefront/src/components/ui/select.tsx +185 -0
- package/dist/assets/storefront/src/components/ui/separator.tsx +28 -0
- package/dist/assets/storefront/src/components/ui/sheet.tsx +139 -0
- package/dist/assets/storefront/src/components/ui/sidebar.tsx +728 -0
- package/dist/assets/storefront/src/components/ui/skeleton.tsx +13 -0
- package/dist/assets/storefront/src/components/ui/slider.tsx +63 -0
- package/dist/assets/storefront/src/components/ui/sonner.tsx +25 -0
- package/dist/assets/storefront/src/components/ui/switch.tsx +31 -0
- package/dist/assets/storefront/src/components/ui/table.tsx +116 -0
- package/dist/assets/storefront/src/components/ui/tabs.tsx +66 -0
- package/dist/assets/storefront/src/components/ui/textarea.tsx +18 -0
- package/dist/assets/storefront/src/components/ui/toggle-group.tsx +73 -0
- package/dist/assets/storefront/src/components/ui/toggle.tsx +47 -0
- package/dist/assets/storefront/src/components/ui/tooltip.tsx +61 -0
- package/dist/assets/storefront/src/config/branding.ts +4 -0
- package/dist/assets/storefront/src/config/scenario-meta.ts +46 -0
- package/dist/assets/storefront/src/config/scenario.ts +313 -0
- package/dist/assets/storefront/src/contexts/auth-context.tsx +35 -0
- package/dist/assets/storefront/src/graphql.ts +14 -0
- package/dist/assets/storefront/src/hooks/use-mobile.ts +19 -0
- package/dist/assets/storefront/src/i18n/locale-utils.ts +33 -0
- package/dist/assets/storefront/src/i18n/locales.ts +18 -0
- package/dist/assets/storefront/src/i18n/navigation.ts +35 -0
- package/dist/assets/storefront/src/i18n/request.ts +19 -0
- package/dist/assets/storefront/src/i18n/routing.ts +19 -0
- package/dist/assets/storefront/src/i18n/server.ts +16 -0
- package/dist/assets/storefront/src/lib/actions/switch-channel.ts +32 -0
- package/dist/assets/storefront/src/lib/actions/switch-currency.ts +25 -0
- package/dist/assets/storefront/src/lib/auth.ts +18 -0
- package/dist/assets/storefront/src/lib/backend-health.ts +38 -0
- package/dist/assets/storefront/src/lib/cart-count-context.tsx +59 -0
- package/dist/assets/storefront/src/lib/cart-guard-utils.ts +10 -0
- package/dist/assets/storefront/src/lib/cart-guard.ts +104 -0
- package/dist/assets/storefront/src/lib/channel-server.ts +28 -0
- package/dist/assets/storefront/src/lib/channel.ts +2 -0
- package/dist/assets/storefront/src/lib/company-context.ts +35 -0
- package/dist/assets/storefront/src/lib/company-permissions-context.tsx +40 -0
- package/dist/assets/storefront/src/lib/currency-server.ts +20 -0
- package/dist/assets/storefront/src/lib/currency.ts +2 -0
- package/dist/assets/storefront/src/lib/format.ts +48 -0
- package/dist/assets/storefront/src/lib/metadata.ts +85 -0
- package/dist/assets/storefront/src/lib/quantity.test.js +20 -0
- package/dist/assets/storefront/src/lib/quantity.ts +20 -0
- package/dist/assets/storefront/src/lib/search-bar-context.tsx +45 -0
- package/dist/assets/storefront/src/lib/search-helpers.ts +69 -0
- package/dist/assets/storefront/src/lib/use-recent-searches.ts +55 -0
- package/dist/assets/storefront/src/lib/utils.ts +6 -0
- package/dist/assets/storefront/src/lib/vendure/actions.ts +96 -0
- package/dist/assets/storefront/src/lib/vendure/api.ts +164 -0
- package/dist/assets/storefront/src/lib/vendure/approval-utils.ts +21 -0
- package/dist/assets/storefront/src/lib/vendure/cached.ts +71 -0
- package/dist/assets/storefront/src/lib/vendure/fragments.ts +213 -0
- package/dist/assets/storefront/src/lib/vendure/instant-search-action.ts +104 -0
- package/dist/assets/storefront/src/lib/vendure/mutations.ts +1136 -0
- package/dist/assets/storefront/src/lib/vendure/queries.ts +1406 -0
- package/dist/assets/storefront/src/middleware.ts +11 -0
- package/dist/assets/storefront/src/scenarios/b2b-wholesale/branding.ts +180 -0
- package/dist/assets/storefront/src/scenarios/b2b-wholesale/hero.tsx +122 -0
- package/dist/assets/storefront/src/scenarios/b2b-wholesale/index.ts +21 -0
- package/dist/assets/storefront/src/scenarios/b2b-wholesale/meta.ts +3 -0
- package/dist/assets/storefront/src/scenarios/default/branding.ts +148 -0
- package/dist/assets/storefront/src/scenarios/default/hero.tsx +107 -0
- package/dist/assets/storefront/src/scenarios/default/index.ts +12 -0
- package/dist/assets/storefront/src/scenarios/default/meta.ts +3 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/auth-gate.tsx +36 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/branding.ts +238 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/cart-items.tsx +359 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/hero.tsx +123 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/index.ts +50 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/meta.ts +9 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/banners.tsx +21 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/bom-basket.tsx +221 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/btn.tsx +38 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/chip.tsx +35 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/config-header.tsx +72 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/field-row.tsx +126 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/info-dot.tsx +38 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/login-notice.tsx +81 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/module-panel.tsx +144 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/quote-dialog.tsx +110 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/schematic.tsx +674 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/why-panel.tsx +66 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/configurator-pdp.tsx +43 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/configurator-shell.tsx +320 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/lib/data.ts +150 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/lib/types.ts +30 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/styles.css +104 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/shop-by-system.tsx +97 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/system-finder/decision-tree.ts +261 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/system-finder/page.tsx +21 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/system-finder/wizard.tsx +600 -0
- package/dist/assets/storefront/src/schema.graphql.placeholder +5 -0
- package/dist/assets/storefront/tsconfig.json +37 -0
- package/dist/assets/templates/CLAUDE.md.hbs +63 -0
- package/dist/assets/templates/README.md.hbs +53 -0
- package/dist/assets/templates/custom-populate.ts.hbs +28 -0
- package/dist/assets/templates/docker-compose.yml.hbs +29 -0
- package/dist/assets/templates/env.hbs +44 -0
- package/dist/assets/templates/environment.d.ts.hbs +32 -0
- package/dist/assets/templates/gitignore.hbs +7 -0
- package/dist/assets/templates/index.ts.hbs +16 -0
- package/dist/assets/templates/npmrc.hbs +1 -0
- package/dist/assets/templates/populate.ts.hbs +27 -0
- package/dist/assets/templates/root-package.json.hbs +17 -0
- package/dist/assets/templates/server-package.json.hbs +31 -0
- package/dist/assets/templates/tsconfig.dashboard.json.hbs +17 -0
- package/dist/assets/templates/tsconfig.root.json.hbs +16 -0
- package/dist/assets/templates/tsconfig.server.json.hbs +20 -0
- package/dist/assets/templates/vendure-config.ts.hbs +80 -0
- package/dist/assets/templates/vite.config.mts.hbs +27 -0
- package/dist/bin/run.d.ts +2 -0
- package/dist/bin/run.js +79 -0
- package/dist/bin/run.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +154 -0
- package/dist/cli.js.map +1 -0
- package/dist/git-init.d.ts +4 -0
- package/dist/git-init.js +60 -0
- package/dist/git-init.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-registry.d.ts +10 -0
- package/dist/plugin-registry.js +485 -0
- package/dist/plugin-registry.js.map +1 -0
- package/dist/scaffolder.d.ts +10 -0
- package/dist/scaffolder.js +218 -0
- package/dist/scaffolder.js.map +1 -0
- package/dist/storefront-copier.d.ts +6 -0
- package/dist/storefront-copier.js +68 -0
- package/dist/storefront-copier.js.map +1 -0
- package/dist/template-renderer.d.ts +30 -0
- package/dist/template-renderer.js +177 -0
- package/dist/template-renderer.js.map +1 -0
- package/dist/types.d.ts +60 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {useState, useTransition} from 'react';
|
|
4
|
+
import {Button} from '@/components/ui/button';
|
|
5
|
+
import {Textarea} from '@/components/ui/textarea';
|
|
6
|
+
import {Send} from 'lucide-react';
|
|
7
|
+
import {addQuoteComment} from '@/app/[locale]/account/quotes/actions';
|
|
8
|
+
|
|
9
|
+
interface QuoteCommentFormProps {
|
|
10
|
+
quoteId: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function QuoteCommentForm({quoteId}: QuoteCommentFormProps) {
|
|
14
|
+
const [text, setText] = useState('');
|
|
15
|
+
const [isPending, startTransition] = useTransition();
|
|
16
|
+
const [result, setResult] = useState<{success: boolean; message?: string} | null>(null);
|
|
17
|
+
|
|
18
|
+
function handleSubmit() {
|
|
19
|
+
if (!text.trim()) return;
|
|
20
|
+
startTransition(async () => {
|
|
21
|
+
const res = await addQuoteComment(quoteId, text.trim());
|
|
22
|
+
setResult(res);
|
|
23
|
+
if (res.success) {
|
|
24
|
+
setText('');
|
|
25
|
+
setResult(null);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className="space-y-2">
|
|
32
|
+
<Textarea
|
|
33
|
+
placeholder="Add a comment..."
|
|
34
|
+
value={text}
|
|
35
|
+
onChange={(e) => setText(e.target.value)}
|
|
36
|
+
rows={2}
|
|
37
|
+
disabled={isPending}
|
|
38
|
+
/>
|
|
39
|
+
{result && !result.success && (
|
|
40
|
+
<p className="text-sm text-red-600">{result.message || 'Failed to add comment'}</p>
|
|
41
|
+
)}
|
|
42
|
+
<Button
|
|
43
|
+
size="sm"
|
|
44
|
+
onClick={handleSubmit}
|
|
45
|
+
disabled={isPending || !text.trim()}
|
|
46
|
+
>
|
|
47
|
+
<Send className="h-4 w-4 mr-1"/>
|
|
48
|
+
Send
|
|
49
|
+
</Button>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {Download} from 'lucide-react';
|
|
4
|
+
import {Button} from '@/components/ui/button';
|
|
5
|
+
|
|
6
|
+
interface QuoteCsvExportButtonProps {
|
|
7
|
+
quoteNumber: string;
|
|
8
|
+
lineItems: Array<{
|
|
9
|
+
sku: string;
|
|
10
|
+
productName: string;
|
|
11
|
+
quantity: number;
|
|
12
|
+
unitPrice: number;
|
|
13
|
+
note?: string | null;
|
|
14
|
+
}>;
|
|
15
|
+
subtotal: number;
|
|
16
|
+
shippingCost: number;
|
|
17
|
+
total: number;
|
|
18
|
+
v1LineItems?: Array<{
|
|
19
|
+
sku: string;
|
|
20
|
+
unitPrice: number;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function escapeCsv(value: string): string {
|
|
25
|
+
if (value.includes(',') || value.includes('"') || value.includes('\n')) {
|
|
26
|
+
return `"${value.replace(/"/g, '""')}"`;
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function QuoteCsvExportButton({
|
|
32
|
+
quoteNumber,
|
|
33
|
+
lineItems,
|
|
34
|
+
subtotal,
|
|
35
|
+
shippingCost,
|
|
36
|
+
total,
|
|
37
|
+
v1LineItems,
|
|
38
|
+
}: QuoteCsvExportButtonProps) {
|
|
39
|
+
const hasComparison = v1LineItems && v1LineItems.length > 0;
|
|
40
|
+
const v1BySku = new Map(v1LineItems?.map(item => [item.sku, item]) ?? []);
|
|
41
|
+
|
|
42
|
+
function handleExport() {
|
|
43
|
+
const headers = ['SKU', 'Product Name', 'Quantity', 'Unit Price', 'Line Total'];
|
|
44
|
+
if (hasComparison) {
|
|
45
|
+
headers.push('Original Price', 'Difference');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const rows: string[][] = [headers];
|
|
49
|
+
|
|
50
|
+
for (const item of lineItems) {
|
|
51
|
+
const unitPrice = (item.unitPrice / 100).toFixed(2);
|
|
52
|
+
const lineTotal = ((item.unitPrice * item.quantity) / 100).toFixed(2);
|
|
53
|
+
const row = [
|
|
54
|
+
escapeCsv(item.sku),
|
|
55
|
+
escapeCsv(item.productName),
|
|
56
|
+
String(item.quantity),
|
|
57
|
+
unitPrice,
|
|
58
|
+
lineTotal,
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
if (hasComparison) {
|
|
62
|
+
const v1Item = v1BySku.get(item.sku);
|
|
63
|
+
if (v1Item) {
|
|
64
|
+
const originalPrice = (v1Item.unitPrice / 100).toFixed(2);
|
|
65
|
+
const diff = ((item.unitPrice - v1Item.unitPrice) / 100).toFixed(2);
|
|
66
|
+
row.push(originalPrice, diff);
|
|
67
|
+
} else {
|
|
68
|
+
row.push('', 'New');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
rows.push(row);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Summary rows
|
|
76
|
+
rows.push([]);
|
|
77
|
+
rows.push(['', '', '', 'Subtotal', (subtotal / 100).toFixed(2)]);
|
|
78
|
+
rows.push(['', '', '', 'Shipping', (shippingCost / 100).toFixed(2)]);
|
|
79
|
+
rows.push(['', '', '', 'Total', (total / 100).toFixed(2)]);
|
|
80
|
+
|
|
81
|
+
const csv = rows.map(row => row.join(',')).join('\n');
|
|
82
|
+
const blob = new Blob([csv], {type: 'text/csv;charset=utf-8;'});
|
|
83
|
+
const url = URL.createObjectURL(blob);
|
|
84
|
+
const link = document.createElement('a');
|
|
85
|
+
link.href = url;
|
|
86
|
+
link.download = `${quoteNumber}.csv`;
|
|
87
|
+
link.click();
|
|
88
|
+
URL.revokeObjectURL(url);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<Button variant="outline" size="sm" onClick={handleExport}>
|
|
93
|
+
<Download className="h-4 w-4 mr-2"/>
|
|
94
|
+
Export CSV
|
|
95
|
+
</Button>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState, useTransition, useRef, useEffect, useCallback } from 'react';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import { Input } from '@/components/ui/input';
|
|
6
|
+
import { Plus, Search, Loader2 } from 'lucide-react';
|
|
7
|
+
import { searchVariantsForQuote } from '@/app/[locale]/account/quotes/actions';
|
|
8
|
+
import type { QuoteLineItemDraft } from './quote-request-form';
|
|
9
|
+
import { useTranslations } from 'next-intl';
|
|
10
|
+
|
|
11
|
+
interface QuoteProductSearchProps {
|
|
12
|
+
onAddItem: (item: QuoteLineItemDraft) => void;
|
|
13
|
+
currencyCode: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function QuoteProductSearch({ onAddItem, currencyCode }: QuoteProductSearchProps) {
|
|
17
|
+
const t = useTranslations('Quotes');
|
|
18
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
19
|
+
const [results, setResults] = useState<Array<{
|
|
20
|
+
productVariantId: string;
|
|
21
|
+
productName: string;
|
|
22
|
+
variantName: string;
|
|
23
|
+
sku: string;
|
|
24
|
+
imageUrl?: string;
|
|
25
|
+
price: number;
|
|
26
|
+
currencyCode: string;
|
|
27
|
+
inStock: boolean;
|
|
28
|
+
}>>([]);
|
|
29
|
+
const [isPending, startTransition] = useTransition();
|
|
30
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
31
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
32
|
+
const debounceRef = useRef<ReturnType<typeof setTimeout>>(undefined);
|
|
33
|
+
|
|
34
|
+
const doSearch = useCallback((term: string) => {
|
|
35
|
+
if (term.length < 2) {
|
|
36
|
+
setResults([]);
|
|
37
|
+
setIsOpen(false);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
startTransition(async () => {
|
|
41
|
+
const data = await searchVariantsForQuote(term);
|
|
42
|
+
setResults(data);
|
|
43
|
+
setIsOpen(true);
|
|
44
|
+
});
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
47
|
+
const handleSearch = (term: string) => {
|
|
48
|
+
setSearchTerm(term);
|
|
49
|
+
clearTimeout(debounceRef.current);
|
|
50
|
+
if (term.length < 2) {
|
|
51
|
+
setResults([]);
|
|
52
|
+
setIsOpen(false);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
debounceRef.current = setTimeout(() => doSearch(term), 300);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Close dropdown on outside click
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
const handleClickOutside = (e: MouseEvent) => {
|
|
61
|
+
if (containerRef.current && !containerRef.current.contains(e.target as Node)) {
|
|
62
|
+
setIsOpen(false);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
66
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
const handleAdd = (item: typeof results[number]) => {
|
|
70
|
+
onAddItem({
|
|
71
|
+
productVariantId: item.productVariantId,
|
|
72
|
+
productName: item.productName,
|
|
73
|
+
variantName: item.variantName,
|
|
74
|
+
sku: item.sku,
|
|
75
|
+
imageUrl: item.imageUrl,
|
|
76
|
+
quantity: 1,
|
|
77
|
+
unitPrice: item.price,
|
|
78
|
+
currencyCode: item.currencyCode || currencyCode,
|
|
79
|
+
inStock: item.inStock,
|
|
80
|
+
});
|
|
81
|
+
setSearchTerm('');
|
|
82
|
+
setResults([]);
|
|
83
|
+
setIsOpen(false);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<div className="relative" ref={containerRef}>
|
|
88
|
+
<div className="relative">
|
|
89
|
+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
|
90
|
+
<Input
|
|
91
|
+
value={searchTerm}
|
|
92
|
+
onChange={e => handleSearch(e.target.value)}
|
|
93
|
+
onKeyDown={e => { if (e.key === 'Escape') setIsOpen(false); }}
|
|
94
|
+
placeholder={t('requestForm.searchPlaceholder')}
|
|
95
|
+
className="pl-10"
|
|
96
|
+
/>
|
|
97
|
+
{isPending && (
|
|
98
|
+
<Loader2 className="absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 animate-spin text-muted-foreground" />
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
{isOpen && results.length > 0 && (
|
|
102
|
+
<div className="absolute z-10 mt-1 w-full rounded-lg border bg-background shadow-lg max-h-64 overflow-y-auto">
|
|
103
|
+
{results.map((item) => (
|
|
104
|
+
<button
|
|
105
|
+
key={item.productVariantId}
|
|
106
|
+
type="button"
|
|
107
|
+
className="flex items-center gap-3 w-full p-3 hover:bg-muted/50 text-left"
|
|
108
|
+
onClick={() => handleAdd(item)}
|
|
109
|
+
>
|
|
110
|
+
{item.imageUrl ? (
|
|
111
|
+
<Image
|
|
112
|
+
src={`${item.imageUrl}?preset=tiny`}
|
|
113
|
+
alt={item.productName}
|
|
114
|
+
width={32}
|
|
115
|
+
height={32}
|
|
116
|
+
className="rounded object-cover"
|
|
117
|
+
/>
|
|
118
|
+
) : (
|
|
119
|
+
<div className="h-8 w-8 rounded bg-muted" />
|
|
120
|
+
)}
|
|
121
|
+
<div className="flex-1 min-w-0">
|
|
122
|
+
<div className="flex items-center gap-1.5">
|
|
123
|
+
<p className="text-sm font-medium truncate">{item.productName}</p>
|
|
124
|
+
{!item.inStock && (
|
|
125
|
+
<span className="shrink-0 text-[10px] font-medium px-1 py-0.5 rounded bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300">
|
|
126
|
+
{t('requestForm.outOfStock')}
|
|
127
|
+
</span>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
<p className="text-xs text-muted-foreground">{item.sku}</p>
|
|
131
|
+
</div>
|
|
132
|
+
<Plus className="h-4 w-4 text-muted-foreground" />
|
|
133
|
+
</button>
|
|
134
|
+
))}
|
|
135
|
+
</div>
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState, useTransition } from 'react';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import { Button } from '@/components/ui/button';
|
|
6
|
+
import { Input } from '@/components/ui/input';
|
|
7
|
+
import { Textarea } from '@/components/ui/textarea';
|
|
8
|
+
import { Label } from '@/components/ui/label';
|
|
9
|
+
import { Price } from '@/components/commerce/price';
|
|
10
|
+
import { Minus, Plus, Trash2, Send } from 'lucide-react';
|
|
11
|
+
import { useTranslations } from 'next-intl';
|
|
12
|
+
|
|
13
|
+
export interface QuoteLineItemDraft {
|
|
14
|
+
productVariantId: string;
|
|
15
|
+
productName: string;
|
|
16
|
+
variantName: string;
|
|
17
|
+
sku: string;
|
|
18
|
+
imageUrl?: string;
|
|
19
|
+
quantity: number;
|
|
20
|
+
unitPrice: number;
|
|
21
|
+
currencyCode: string;
|
|
22
|
+
note?: string;
|
|
23
|
+
inStock?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface QuoteRequestFormProps {
|
|
27
|
+
initialLineItems: QuoteLineItemDraft[];
|
|
28
|
+
sender: {
|
|
29
|
+
name: string;
|
|
30
|
+
email: string;
|
|
31
|
+
company?: string;
|
|
32
|
+
};
|
|
33
|
+
mode: 'from-cart' | 'standalone';
|
|
34
|
+
onSubmit: (
|
|
35
|
+
lineItems: Array<{ productVariantId: string; quantity: number; note?: string }>,
|
|
36
|
+
note?: string,
|
|
37
|
+
) => Promise<{ success: false; message: string } | void>;
|
|
38
|
+
onCancel?: () => void;
|
|
39
|
+
renderSearch?: (addItem: (item: QuoteLineItemDraft) => void) => React.ReactNode;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function QuoteRequestForm({
|
|
43
|
+
initialLineItems,
|
|
44
|
+
sender,
|
|
45
|
+
mode,
|
|
46
|
+
onSubmit,
|
|
47
|
+
onCancel,
|
|
48
|
+
renderSearch,
|
|
49
|
+
}: QuoteRequestFormProps) {
|
|
50
|
+
const t = useTranslations('Quotes');
|
|
51
|
+
const [lineItems, setLineItems] = useState<QuoteLineItemDraft[]>(initialLineItems);
|
|
52
|
+
const [note, setNote] = useState('');
|
|
53
|
+
const [isPending, startTransition] = useTransition();
|
|
54
|
+
const [error, setError] = useState<string | null>(null);
|
|
55
|
+
|
|
56
|
+
const updateQuantity = (index: number, delta: number) => {
|
|
57
|
+
setLineItems(prev =>
|
|
58
|
+
prev.map((item, i) =>
|
|
59
|
+
i === index ? { ...item, quantity: Math.max(1, item.quantity + delta) } : item,
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const setQuantity = (index: number, quantity: number) => {
|
|
65
|
+
setLineItems(prev =>
|
|
66
|
+
prev.map((item, i) => (i === index ? { ...item, quantity: Math.max(1, quantity) } : item)),
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const removeItem = (index: number) => {
|
|
71
|
+
setLineItems(prev => prev.filter((_, i) => i !== index));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const addItem = (item: QuoteLineItemDraft) => {
|
|
75
|
+
setLineItems(prev => {
|
|
76
|
+
const existing = prev.findIndex(li => li.productVariantId === item.productVariantId);
|
|
77
|
+
if (existing >= 0) {
|
|
78
|
+
return prev.map((li, i) =>
|
|
79
|
+
i === existing ? { ...li, quantity: li.quantity + 1 } : li,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
return [...prev, item];
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const subtotal = lineItems.reduce((sum, item) => sum + item.unitPrice * item.quantity, 0);
|
|
87
|
+
const currencyCode = lineItems[0]?.currencyCode ?? 'USD';
|
|
88
|
+
|
|
89
|
+
const handleSubmit = () => {
|
|
90
|
+
if (lineItems.length === 0) return;
|
|
91
|
+
setError(null);
|
|
92
|
+
startTransition(async () => {
|
|
93
|
+
const result = await onSubmit(
|
|
94
|
+
lineItems.map(li => ({
|
|
95
|
+
productVariantId: li.productVariantId,
|
|
96
|
+
quantity: li.quantity,
|
|
97
|
+
note: li.note || undefined,
|
|
98
|
+
})),
|
|
99
|
+
note || undefined,
|
|
100
|
+
);
|
|
101
|
+
if (result && !result.success) {
|
|
102
|
+
setError(result.message);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<div className="space-y-6">
|
|
109
|
+
{/* Sender info */}
|
|
110
|
+
<div className="rounded-lg border bg-muted/30 p-4">
|
|
111
|
+
<div className="text-sm">
|
|
112
|
+
<span className="font-medium">{sender.name}</span>
|
|
113
|
+
<span className="text-muted-foreground ml-2">{sender.email}</span>
|
|
114
|
+
{sender.company && (
|
|
115
|
+
<span className="text-muted-foreground ml-2">({sender.company})</span>
|
|
116
|
+
)}
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
{/* Line items */}
|
|
121
|
+
<div className="space-y-3">
|
|
122
|
+
<Label className="text-sm font-medium">{t('requestForm.lineItemsLabel')}</Label>
|
|
123
|
+
{lineItems.length === 0 ? (
|
|
124
|
+
<p className="text-sm text-muted-foreground py-4 text-center">
|
|
125
|
+
{t('requestForm.noItemsMessage')}
|
|
126
|
+
</p>
|
|
127
|
+
) : (
|
|
128
|
+
<div className="divide-y rounded-lg border">
|
|
129
|
+
{lineItems.map((item, index) => (
|
|
130
|
+
<div key={`${item.productVariantId}-${index}`} className="flex items-center gap-4 p-3">
|
|
131
|
+
{item.imageUrl ? (
|
|
132
|
+
<Image
|
|
133
|
+
src={`${item.imageUrl}?preset=tiny`}
|
|
134
|
+
alt={item.productName}
|
|
135
|
+
width={48}
|
|
136
|
+
height={48}
|
|
137
|
+
className="rounded object-cover"
|
|
138
|
+
/>
|
|
139
|
+
) : (
|
|
140
|
+
<div className="h-12 w-12 rounded bg-muted flex items-center justify-center text-xs text-muted-foreground">
|
|
141
|
+
N/A
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
<div className="flex-1 min-w-0">
|
|
145
|
+
<div className="flex items-center gap-1.5">
|
|
146
|
+
<p className="text-sm font-medium truncate">{item.productName}</p>
|
|
147
|
+
{item.inStock === false && (
|
|
148
|
+
<span className="shrink-0 text-[10px] font-medium px-1 py-0.5 rounded bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300">
|
|
149
|
+
{t('requestForm.outOfStock')}
|
|
150
|
+
</span>
|
|
151
|
+
)}
|
|
152
|
+
</div>
|
|
153
|
+
<p className="text-xs text-muted-foreground">{item.sku}</p>
|
|
154
|
+
</div>
|
|
155
|
+
<div className="flex items-center gap-1">
|
|
156
|
+
<Button
|
|
157
|
+
type="button"
|
|
158
|
+
variant="outline"
|
|
159
|
+
size="icon"
|
|
160
|
+
className="h-7 w-7"
|
|
161
|
+
onClick={() => updateQuantity(index, -1)}
|
|
162
|
+
disabled={item.quantity <= 1}
|
|
163
|
+
>
|
|
164
|
+
<Minus className="h-3 w-3" />
|
|
165
|
+
</Button>
|
|
166
|
+
<Input
|
|
167
|
+
type="number"
|
|
168
|
+
min={1}
|
|
169
|
+
value={item.quantity}
|
|
170
|
+
onChange={e => setQuantity(index, parseInt(e.target.value, 10) || 1)}
|
|
171
|
+
className="h-8 w-20 text-center text-sm"
|
|
172
|
+
/>
|
|
173
|
+
<Button
|
|
174
|
+
type="button"
|
|
175
|
+
variant="outline"
|
|
176
|
+
size="icon"
|
|
177
|
+
className="h-7 w-7"
|
|
178
|
+
onClick={() => updateQuantity(index, 1)}
|
|
179
|
+
>
|
|
180
|
+
<Plus className="h-3 w-3" />
|
|
181
|
+
</Button>
|
|
182
|
+
</div>
|
|
183
|
+
<div className="text-sm text-right w-24">
|
|
184
|
+
<Price value={item.unitPrice * item.quantity} currencyCode={item.currencyCode} />
|
|
185
|
+
</div>
|
|
186
|
+
<Button
|
|
187
|
+
type="button"
|
|
188
|
+
variant="ghost"
|
|
189
|
+
size="icon"
|
|
190
|
+
className="h-7 w-7 text-muted-foreground hover:text-destructive"
|
|
191
|
+
onClick={() => removeItem(index)}
|
|
192
|
+
>
|
|
193
|
+
<Trash2 className="h-3.5 w-3.5" />
|
|
194
|
+
</Button>
|
|
195
|
+
</div>
|
|
196
|
+
))}
|
|
197
|
+
</div>
|
|
198
|
+
)}
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
{/* Product search slot */}
|
|
202
|
+
{renderSearch && renderSearch(addItem)}
|
|
203
|
+
|
|
204
|
+
{/* Subtotal */}
|
|
205
|
+
{lineItems.length > 0 && (
|
|
206
|
+
<div className="flex justify-end text-sm">
|
|
207
|
+
<span className="text-muted-foreground mr-2">{t('requestForm.subtotalLabel')}</span>
|
|
208
|
+
<span className="font-medium">
|
|
209
|
+
<Price value={subtotal} currencyCode={currencyCode} />
|
|
210
|
+
</span>
|
|
211
|
+
</div>
|
|
212
|
+
)}
|
|
213
|
+
|
|
214
|
+
{/* Message */}
|
|
215
|
+
<div className="space-y-2">
|
|
216
|
+
<Label htmlFor="quote-note" className="text-sm font-medium">
|
|
217
|
+
{t('requestForm.messageLabel')}
|
|
218
|
+
</Label>
|
|
219
|
+
<Textarea
|
|
220
|
+
id="quote-note"
|
|
221
|
+
value={note}
|
|
222
|
+
onChange={e => setNote(e.target.value)}
|
|
223
|
+
placeholder={t('requestForm.messagePlaceholder')}
|
|
224
|
+
rows={3}
|
|
225
|
+
/>
|
|
226
|
+
</div>
|
|
227
|
+
|
|
228
|
+
{/* Error */}
|
|
229
|
+
{error && <p className="text-sm text-destructive">{error}</p>}
|
|
230
|
+
|
|
231
|
+
{/* Actions */}
|
|
232
|
+
<div className="flex gap-3 justify-end">
|
|
233
|
+
{onCancel && (
|
|
234
|
+
<Button type="button" variant="outline" onClick={onCancel} disabled={isPending}>
|
|
235
|
+
{t('requestForm.cancelButton')}
|
|
236
|
+
</Button>
|
|
237
|
+
)}
|
|
238
|
+
<Button
|
|
239
|
+
onClick={handleSubmit}
|
|
240
|
+
disabled={isPending || lineItems.length === 0}
|
|
241
|
+
>
|
|
242
|
+
<Send className="h-4 w-4 mr-2" />
|
|
243
|
+
{isPending
|
|
244
|
+
? t('requestForm.submittingButton')
|
|
245
|
+
: mode === 'from-cart'
|
|
246
|
+
? t('requestForm.submitFromCartButton')
|
|
247
|
+
: t('requestForm.submitButton')}
|
|
248
|
+
</Button>
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {Badge} from '@/components/ui/badge';
|
|
2
|
+
import {
|
|
3
|
+
FileEdit,
|
|
4
|
+
Search,
|
|
5
|
+
Clock,
|
|
6
|
+
Send,
|
|
7
|
+
MessageSquare,
|
|
8
|
+
CheckCircle,
|
|
9
|
+
XCircle,
|
|
10
|
+
Ban,
|
|
11
|
+
TimerOff,
|
|
12
|
+
type LucideIcon,
|
|
13
|
+
} from 'lucide-react';
|
|
14
|
+
|
|
15
|
+
const STATUS_CONFIG: Record<string, { color: string; label: string; icon: LucideIcon }> = {
|
|
16
|
+
DRAFT: {color: 'bg-gray-100 text-gray-800', label: 'Draft', icon: FileEdit},
|
|
17
|
+
IN_REVIEW: {color: 'bg-amber-100 text-amber-800', label: 'In Review', icon: Search},
|
|
18
|
+
AWAITING_APPROVAL: {color: 'bg-amber-100 text-amber-800', label: 'Awaiting Approval', icon: Clock},
|
|
19
|
+
QUOTED: {color: 'bg-blue-100 text-blue-800', label: 'Quoted', icon: Send},
|
|
20
|
+
CHANGES_REQUESTED: {color: 'bg-orange-100 text-orange-800', label: 'Changes Requested', icon: MessageSquare},
|
|
21
|
+
ACCEPTED: {color: 'bg-green-100 text-green-800', label: 'Accepted', icon: CheckCircle},
|
|
22
|
+
REJECTED: {color: 'bg-red-100 text-red-800', label: 'Rejected', icon: XCircle},
|
|
23
|
+
CANCELLED: {color: 'bg-red-100 text-red-800', label: 'Cancelled', icon: Ban},
|
|
24
|
+
EXPIRED: {color: 'bg-gray-100 text-gray-600', label: 'Expired', icon: TimerOff},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
interface QuoteStatusBadgeProps {
|
|
28
|
+
status: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function QuoteStatusBadge({status}: QuoteStatusBadgeProps) {
|
|
32
|
+
const config = STATUS_CONFIG[status] || {color: 'bg-gray-100 text-gray-800', label: status, icon: Clock};
|
|
33
|
+
const Icon = config.icon;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Badge className={config.color} variant="secondary">
|
|
37
|
+
<Icon className="h-3 w-3 mr-1"/>
|
|
38
|
+
{config.label}
|
|
39
|
+
</Badge>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {useLocale} from 'next-intl';
|
|
4
|
+
import {formatDate} from '@/lib/format';
|
|
5
|
+
|
|
6
|
+
interface QuoteValidityIndicatorProps {
|
|
7
|
+
validUntil: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function QuoteValidityIndicator({validUntil}: QuoteValidityIndicatorProps) {
|
|
11
|
+
const locale = useLocale();
|
|
12
|
+
const daysRemaining = Math.ceil(
|
|
13
|
+
(new Date(validUntil).getTime() - Date.now()) / (1000 * 60 * 60 * 24),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
if (daysRemaining < 0) {
|
|
17
|
+
return <span className="text-red-600 font-medium">Expired</span>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (daysRemaining === 0) {
|
|
21
|
+
return <span className="text-amber-600 font-medium">Expires today</span>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (daysRemaining <= 7) {
|
|
25
|
+
return (
|
|
26
|
+
<span className={`font-medium ${daysRemaining <= 3 ? 'text-amber-600' : 'text-muted-foreground'}`}>
|
|
27
|
+
Expires in {daysRemaining} day{daysRemaining !== 1 ? 's' : ''}
|
|
28
|
+
</span>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return <span>{formatDate(validUntil, locale)}</span>;
|
|
33
|
+
}
|