{
+ if (creatingProduct) return;
+ setShowCreateProductModal(false);
+ setCreateProductError('');
+ }}
+ onConfirm={(payload: QuickCreateProductConfirm) => {
+ void (async () => {
+ if (creatingProduct) return;
+ if (!payload.name) { setCreateProductError(t('orders.enterSkuName')); return; }
+ if (!payload.categoryCode) { setCreateProductError(t('orders.pickCategory')); return; }
+ setCreatingProduct(true);
+ setCreateProductError('');
+ try {
+ const created = await createCatalogProductForOrderLine({
+ name: payload.name,
+ categoryCode: payload.categoryCode,
+ unit: payload.unit,
+ salePrice: payload.salePrice,
+ costPrice: payload.costPrice,
+ spec: payload.spec,
+ });
+ setInlineDraft((d) => ({
+ ...d,
+ sku_code: created.skuCode,
+ unit: payload.unit || d.unit,
+ cost_price: payload.costPrice ? String(payload.costPrice) : d.cost_price,
+ sale_price: payload.salePrice ? String(payload.salePrice) : d.sale_price,
+ }));
+ await reloadSkus();
+ setShowCreateProductModal(false);
+ notify.success(t('quotes.toast.updated'));
+ } catch (err: any) {
+ setCreateProductError(err?.message || String(err));
+ } finally {
+ setCreatingProduct(false);
+ }
+ })();
+ }}
+ />
{(expandedDetail.enrichedItems || []).length === 0 ? (
{t('quotes.detail.emptyItems')}