[feat] negodata: 신규 견적유형 + 목표가·앵커링 산정 + 협력사유형 + 협상카드 용도
- 견적유형 4종: QuotationType 에 신규협상(3)·신규견적(4) 추가(1·2 재 고정)
- 목표가 산정: items(매입가·판매가·인터넷최저가) + quotations.md_price +
quotation_settings.internet_average_fee 로 _calc_target_price(KTC 이식, 신규/재 분리),
세션 target_price·target_anchoring_price 저장
- 협력사유형: quotations.supplier_type(SupplierType) + 직전유형 조회 API(/supplier/{id}/last-type)
- 협상카드 용도: nego_cards/wild_cards.usage_type(CardUsageType: 공통/신규견적전용/재견적전용)
- 스키마(01-schema.sql)·ORM·protocol·service·crud·프론트(생성타입/폼) 일괄, /backend enums·models 미러
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
21e9f71f53
commit
103c80046e
59 files changed
+871
-78
No files matched your search
@@ -9,6 +9,7 @@ import type { CardDataName } from './cardDataName';
|
||||
import type { CardDataNumber } from './cardDataNumber';
|
||||
import type { CardDataScript } from './cardDataScript';
|
||||
import type { CardDataEditScript } from './cardDataEditScript';
|
||||
import type { CardUsageType } from './cardUsageType';
|
||||
import type { CardStatus } from './cardStatus';
|
||||
import type { CardDataCondition } from './cardDataCondition';
|
||||
import type { CardDataMemo } from './cardDataMemo';
|
||||
@@ -23,6 +24,7 @@ export interface CardData {
|
||||
number?: CardDataNumber;
|
||||
script?: CardDataScript;
|
||||
edit_script?: CardDataEditScript;
|
||||
usage_type?: CardUsageType;
|
||||
status?: CardStatus;
|
||||
condition?: CardDataCondition;
|
||||
memo?: CardDataMemo;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* nego_cards/wild_cards.usage_type 코드값. 카드가 적용되는 견적 구분.
|
||||
공통=신규·재 모두(기본), 신규전용=신규협상/신규견적(QuotationType 3·4), 재전용=재협상/재견적(1·2).
|
||||
*/
|
||||
export type CardUsageType = typeof CardUsageType[keyof typeof CardUsageType];
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const CardUsageType = {
|
||||
COMMON: 1,
|
||||
NEW: 2,
|
||||
REUSE: 3,
|
||||
} as const;
|
||||
@@ -18,6 +18,7 @@ export * from './cardDataUpdatedAt';
|
||||
export * from './cardDataUserId';
|
||||
export * from './cardStatus';
|
||||
export * from './cardType';
|
||||
export * from './cardUsageType';
|
||||
export * from './chatMessageData';
|
||||
export * from './chatMessageDataCardId';
|
||||
export * from './chatMessageDataCardType';
|
||||
@@ -41,13 +42,16 @@ export * from './itemDataCreatedAt';
|
||||
export * from './itemDataDeliveryFeeYn';
|
||||
export * from './itemDataDeliveryType';
|
||||
export * from './itemDataImageUrl';
|
||||
export * from './itemDataInternetLowestPrice';
|
||||
export * from './itemDataLeadTime';
|
||||
export * from './itemDataMadeIn';
|
||||
export * from './itemDataManufacturer';
|
||||
export * from './itemDataModelName';
|
||||
export * from './itemDataMoq';
|
||||
export * from './itemDataPrice';
|
||||
export * from './itemDataPurchasePrice';
|
||||
export * from './itemDataQuantityUnit';
|
||||
export * from './itemDataSellingPrice';
|
||||
export * from './itemDataSpec';
|
||||
export * from './itemDataUpdatedAt';
|
||||
export * from './itemDataVatYn';
|
||||
@@ -75,10 +79,12 @@ export * from './quotationDataItemName';
|
||||
export * from './quotationDataManagerContactNumber';
|
||||
export * from './quotationDataManagerEmail';
|
||||
export * from './quotationDataManagerName';
|
||||
export * from './quotationDataMdPrice';
|
||||
export * from './quotationDataMemo';
|
||||
export * from './quotationDataPreferredSpId';
|
||||
export * from './quotationDataPreferredSpName';
|
||||
export * from './quotationDataPreferredSpYn';
|
||||
export * from './quotationDataSupplierType';
|
||||
export * from './quotationDataUpdatedAt';
|
||||
export * from './quotationSettingData';
|
||||
export * from './quotationSettingDataCreatedAt';
|
||||
@@ -101,22 +107,27 @@ export * from './reqCreateItemCode';
|
||||
export * from './reqCreateItemDeliveryFeeYn';
|
||||
export * from './reqCreateItemDeliveryType';
|
||||
export * from './reqCreateItemImageUrl';
|
||||
export * from './reqCreateItemInternetLowestPrice';
|
||||
export * from './reqCreateItemLeadTime';
|
||||
export * from './reqCreateItemMadeIn';
|
||||
export * from './reqCreateItemManufacturer';
|
||||
export * from './reqCreateItemModelName';
|
||||
export * from './reqCreateItemMoq';
|
||||
export * from './reqCreateItemPrice';
|
||||
export * from './reqCreateItemPurchasePrice';
|
||||
export * from './reqCreateItemQuantityUnit';
|
||||
export * from './reqCreateItemSellingPrice';
|
||||
export * from './reqCreateItemSpec';
|
||||
export * from './reqCreateItemVatYn';
|
||||
export * from './reqCreateQuotation';
|
||||
export * from './reqCreateQuotationManagerContactNumber';
|
||||
export * from './reqCreateQuotationManagerEmail';
|
||||
export * from './reqCreateQuotationManagerName';
|
||||
export * from './reqCreateQuotationMdPrice';
|
||||
export * from './reqCreateQuotationMemo';
|
||||
export * from './reqCreateQuotationSetting';
|
||||
export * from './reqCreateQuotationStartTime';
|
||||
export * from './reqCreateQuotationSupplierType';
|
||||
export * from './reqCreateQuotationVersionId';
|
||||
export * from './reqCreateSupplier';
|
||||
export * from './reqCreateSupplierCode';
|
||||
@@ -134,6 +145,7 @@ export * from './reqUpdateCardName';
|
||||
export * from './reqUpdateCardNumber';
|
||||
export * from './reqUpdateCardScript';
|
||||
export * from './reqUpdateCardStatus';
|
||||
export * from './reqUpdateCardUsageType';
|
||||
export * from './reqUpdateItem';
|
||||
export * from './reqUpdateItemCategory';
|
||||
export * from './reqUpdateItemCategoryType';
|
||||
@@ -141,6 +153,7 @@ export * from './reqUpdateItemCode';
|
||||
export * from './reqUpdateItemDeliveryFeeYn';
|
||||
export * from './reqUpdateItemDeliveryType';
|
||||
export * from './reqUpdateItemImageUrl';
|
||||
export * from './reqUpdateItemInternetLowestPrice';
|
||||
export * from './reqUpdateItemInternetLowestPriceYn';
|
||||
export * from './reqUpdateItemLeadTime';
|
||||
export * from './reqUpdateItemMadeIn';
|
||||
@@ -149,12 +162,15 @@ export * from './reqUpdateItemModelName';
|
||||
export * from './reqUpdateItemMoq';
|
||||
export * from './reqUpdateItemName';
|
||||
export * from './reqUpdateItemPrice';
|
||||
export * from './reqUpdateItemPurchasePrice';
|
||||
export * from './reqUpdateItemQuantityUnit';
|
||||
export * from './reqUpdateItemSellingPrice';
|
||||
export * from './reqUpdateItemSpec';
|
||||
export * from './reqUpdateItemVatYn';
|
||||
export * from './reqUpdateQuotationSetting';
|
||||
export * from './reqUpdateQuotationSettingAnchoringValue';
|
||||
export * from './reqUpdateQuotationSettingCardCount';
|
||||
export * from './reqUpdateQuotationSettingInternetAverageFee';
|
||||
export * from './reqUpdateQuotationSettingTargetMarginRate';
|
||||
export * from './reqUpdateSupplier';
|
||||
export * from './reqUpdateSupplierCode';
|
||||
@@ -197,6 +213,10 @@ export * from './resItemItem';
|
||||
export * from './resItemList';
|
||||
export * from './resItemListMsg';
|
||||
export * from './resItemMsg';
|
||||
export * from './resLastSupplierType';
|
||||
export * from './resLastSupplierTypeMsg';
|
||||
export * from './resLastSupplierTypeQtNumber';
|
||||
export * from './resLastSupplierTypeSupplierType';
|
||||
export * from './resLogin';
|
||||
export * from './resLoginMsg';
|
||||
export * from './resLowestPriceResult';
|
||||
@@ -260,6 +280,7 @@ export * from './supplierDataManagerEmail';
|
||||
export * from './supplierDataManagerName';
|
||||
export * from './supplierDataPriority';
|
||||
export * from './supplierDataUpdatedAt';
|
||||
export * from './supplierType';
|
||||
export * from './userRole';
|
||||
export * from './validationError';
|
||||
export * from './validationErrorCtx';
|
||||
|
||||
@@ -12,6 +12,9 @@ import type { ItemDataSpec } from './itemDataSpec';
|
||||
import type { ItemDataManufacturer } from './itemDataManufacturer';
|
||||
import type { ItemDataMadeIn } from './itemDataMadeIn';
|
||||
import type { ItemDataPrice } from './itemDataPrice';
|
||||
import type { ItemDataInternetLowestPrice } from './itemDataInternetLowestPrice';
|
||||
import type { ItemDataPurchasePrice } from './itemDataPurchasePrice';
|
||||
import type { ItemDataSellingPrice } from './itemDataSellingPrice';
|
||||
import type { ItemDataMoq } from './itemDataMoq';
|
||||
import type { ItemDataLeadTime } from './itemDataLeadTime';
|
||||
import type { ItemDataQuantityUnit } from './itemDataQuantityUnit';
|
||||
@@ -36,6 +39,9 @@ export interface ItemData {
|
||||
made_in?: ItemDataMadeIn;
|
||||
price?: ItemDataPrice;
|
||||
internet_lowest_price_yn?: boolean;
|
||||
internet_lowest_price?: ItemDataInternetLowestPrice;
|
||||
purchase_price?: ItemDataPurchasePrice;
|
||||
selling_price?: ItemDataSellingPrice;
|
||||
moq?: ItemDataMoq;
|
||||
lead_time?: ItemDataLeadTime;
|
||||
quantity_unit?: ItemDataQuantityUnit;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ItemDataInternetLowestPrice = number | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ItemDataPurchasePrice = number | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ItemDataSellingPrice = number | null;
|
||||
@@ -10,6 +10,8 @@ import type { QuotationDataManagerName } from './quotationDataManagerName';
|
||||
import type { QuotationDataManagerEmail } from './quotationDataManagerEmail';
|
||||
import type { QuotationDataManagerContactNumber } from './quotationDataManagerContactNumber';
|
||||
import type { QuotationDataMemo } from './quotationDataMemo';
|
||||
import type { QuotationDataMdPrice } from './quotationDataMdPrice';
|
||||
import type { QuotationDataSupplierType } from './quotationDataSupplierType';
|
||||
import type { QuotationDataPreferredSpYn } from './quotationDataPreferredSpYn';
|
||||
import type { QuotationDataPreferredSpId } from './quotationDataPreferredSpId';
|
||||
import type { QuotationDataPreferredSpName } from './quotationDataPreferredSpName';
|
||||
@@ -36,6 +38,8 @@ export interface QuotationData {
|
||||
manager_email?: QuotationDataManagerEmail;
|
||||
manager_contact_number?: QuotationDataManagerContactNumber;
|
||||
memo?: QuotationDataMemo;
|
||||
md_price?: QuotationDataMdPrice;
|
||||
supplier_type?: QuotationDataSupplierType;
|
||||
iteration?: number;
|
||||
preferred_sp_yn?: QuotationDataPreferredSpYn;
|
||||
preferred_sp_id?: QuotationDataPreferredSpId;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type QuotationDataMdPrice = number | null;
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { SupplierType } from './supplierType';
|
||||
|
||||
export type QuotationDataSupplierType = SupplierType | null;
|
||||
@@ -13,6 +13,7 @@ export interface QuotationSettingData {
|
||||
user_id?: QuotationSettingDataUserId;
|
||||
target_margin_rate: number;
|
||||
anchoring_value: number;
|
||||
internet_average_fee?: number;
|
||||
card_count: number;
|
||||
created_at?: QuotationSettingDataCreatedAt;
|
||||
updated_at?: QuotationSettingDataUpdatedAt;
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* quotations.type 코드값. 1=renego(재협상 1:1), 2=requote(재견적 1:N).
|
||||
* quotations.type 코드값. 신규/재 × 협상(1:1)/견적(1:N).
|
||||
1=재협상(1:1), 2=재견적(1:N), 3=신규협상(1:1), 4=신규견적(1:N).
|
||||
기존 데이터 보존 위해 재협상/재견적 코드(1·2)는 고정, 신규는 3·4로 추가.
|
||||
*/
|
||||
export type QuotationType = typeof QuotationType[keyof typeof QuotationType];
|
||||
|
||||
@@ -15,4 +17,6 @@ export type QuotationType = typeof QuotationType[keyof typeof QuotationType];
|
||||
export const QuotationType = {
|
||||
RENEGO: 1,
|
||||
REQUOTE: 2,
|
||||
NEW_NEGO: 3,
|
||||
NEW_QUOTE: 4,
|
||||
} as const;
|
||||
@@ -17,6 +17,7 @@ export interface ReqCreateCard {
|
||||
number?: ReqCreateCardNumber;
|
||||
script?: ReqCreateCardScript;
|
||||
edit_script?: ReqCreateCardEditScript;
|
||||
usage_type?: number;
|
||||
status?: number;
|
||||
condition?: ReqCreateCardCondition;
|
||||
memo?: ReqCreateCardMemo;
|
||||
|
||||
@@ -12,6 +12,9 @@ import type { ReqCreateItemSpec } from './reqCreateItemSpec';
|
||||
import type { ReqCreateItemManufacturer } from './reqCreateItemManufacturer';
|
||||
import type { ReqCreateItemMadeIn } from './reqCreateItemMadeIn';
|
||||
import type { ReqCreateItemPrice } from './reqCreateItemPrice';
|
||||
import type { ReqCreateItemInternetLowestPrice } from './reqCreateItemInternetLowestPrice';
|
||||
import type { ReqCreateItemPurchasePrice } from './reqCreateItemPurchasePrice';
|
||||
import type { ReqCreateItemSellingPrice } from './reqCreateItemSellingPrice';
|
||||
import type { ReqCreateItemMoq } from './reqCreateItemMoq';
|
||||
import type { ReqCreateItemLeadTime } from './reqCreateItemLeadTime';
|
||||
import type { ReqCreateItemQuantityUnit } from './reqCreateItemQuantityUnit';
|
||||
@@ -31,6 +34,9 @@ export interface ReqCreateItem {
|
||||
made_in?: ReqCreateItemMadeIn;
|
||||
price?: ReqCreateItemPrice;
|
||||
internet_lowest_price_yn?: boolean;
|
||||
internet_lowest_price?: ReqCreateItemInternetLowestPrice;
|
||||
purchase_price?: ReqCreateItemPurchasePrice;
|
||||
selling_price?: ReqCreateItemSellingPrice;
|
||||
moq?: ReqCreateItemMoq;
|
||||
lead_time?: ReqCreateItemLeadTime;
|
||||
quantity_unit?: ReqCreateItemQuantityUnit;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqCreateItemInternetLowestPrice = number | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqCreateItemPurchasePrice = number | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqCreateItemSellingPrice = number | null;
|
||||
@@ -10,6 +10,8 @@ import type { ReqCreateQuotationManagerName } from './reqCreateQuotationManagerN
|
||||
import type { ReqCreateQuotationManagerEmail } from './reqCreateQuotationManagerEmail';
|
||||
import type { ReqCreateQuotationManagerContactNumber } from './reqCreateQuotationManagerContactNumber';
|
||||
import type { ReqCreateQuotationMemo } from './reqCreateQuotationMemo';
|
||||
import type { ReqCreateQuotationMdPrice } from './reqCreateQuotationMdPrice';
|
||||
import type { ReqCreateQuotationSupplierType } from './reqCreateQuotationSupplierType';
|
||||
|
||||
export interface ReqCreateQuotation {
|
||||
qt_setting_id: string;
|
||||
@@ -24,6 +26,8 @@ export interface ReqCreateQuotation {
|
||||
manager_email?: ReqCreateQuotationManagerEmail;
|
||||
manager_contact_number?: ReqCreateQuotationManagerContactNumber;
|
||||
memo?: ReqCreateQuotationMemo;
|
||||
md_price?: ReqCreateQuotationMdPrice;
|
||||
supplier_type?: ReqCreateQuotationSupplierType;
|
||||
item_ids?: string[];
|
||||
supplier_ids?: string[];
|
||||
card_ids?: string[];
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqCreateQuotationMdPrice = number | null;
|
||||
@@ -8,5 +8,6 @@
|
||||
export interface ReqCreateQuotationSetting {
|
||||
target_margin_rate: number;
|
||||
anchoring_value?: number;
|
||||
internet_average_fee?: number;
|
||||
card_count?: number;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqCreateQuotationSupplierType = number | null;
|
||||
@@ -8,6 +8,7 @@ import type { ReqUpdateCardName } from './reqUpdateCardName';
|
||||
import type { ReqUpdateCardNumber } from './reqUpdateCardNumber';
|
||||
import type { ReqUpdateCardScript } from './reqUpdateCardScript';
|
||||
import type { ReqUpdateCardEditScript } from './reqUpdateCardEditScript';
|
||||
import type { ReqUpdateCardUsageType } from './reqUpdateCardUsageType';
|
||||
import type { ReqUpdateCardStatus } from './reqUpdateCardStatus';
|
||||
import type { ReqUpdateCardCondition } from './reqUpdateCardCondition';
|
||||
import type { ReqUpdateCardMemo } from './reqUpdateCardMemo';
|
||||
@@ -17,6 +18,7 @@ export interface ReqUpdateCard {
|
||||
number?: ReqUpdateCardNumber;
|
||||
script?: ReqUpdateCardScript;
|
||||
edit_script?: ReqUpdateCardEditScript;
|
||||
usage_type?: ReqUpdateCardUsageType;
|
||||
status?: ReqUpdateCardStatus;
|
||||
condition?: ReqUpdateCardCondition;
|
||||
memo?: ReqUpdateCardMemo;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqUpdateCardUsageType = number | null;
|
||||
@@ -15,6 +15,9 @@ import type { ReqUpdateItemManufacturer } from './reqUpdateItemManufacturer';
|
||||
import type { ReqUpdateItemMadeIn } from './reqUpdateItemMadeIn';
|
||||
import type { ReqUpdateItemPrice } from './reqUpdateItemPrice';
|
||||
import type { ReqUpdateItemInternetLowestPriceYn } from './reqUpdateItemInternetLowestPriceYn';
|
||||
import type { ReqUpdateItemInternetLowestPrice } from './reqUpdateItemInternetLowestPrice';
|
||||
import type { ReqUpdateItemPurchasePrice } from './reqUpdateItemPurchasePrice';
|
||||
import type { ReqUpdateItemSellingPrice } from './reqUpdateItemSellingPrice';
|
||||
import type { ReqUpdateItemMoq } from './reqUpdateItemMoq';
|
||||
import type { ReqUpdateItemLeadTime } from './reqUpdateItemLeadTime';
|
||||
import type { ReqUpdateItemQuantityUnit } from './reqUpdateItemQuantityUnit';
|
||||
@@ -34,6 +37,9 @@ export interface ReqUpdateItem {
|
||||
made_in?: ReqUpdateItemMadeIn;
|
||||
price?: ReqUpdateItemPrice;
|
||||
internet_lowest_price_yn?: ReqUpdateItemInternetLowestPriceYn;
|
||||
internet_lowest_price?: ReqUpdateItemInternetLowestPrice;
|
||||
purchase_price?: ReqUpdateItemPurchasePrice;
|
||||
selling_price?: ReqUpdateItemSellingPrice;
|
||||
moq?: ReqUpdateItemMoq;
|
||||
lead_time?: ReqUpdateItemLeadTime;
|
||||
quantity_unit?: ReqUpdateItemQuantityUnit;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqUpdateItemInternetLowestPrice = number | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqUpdateItemPurchasePrice = number | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqUpdateItemSellingPrice = number | null;
|
||||
@@ -6,10 +6,12 @@
|
||||
*/
|
||||
import type { ReqUpdateQuotationSettingTargetMarginRate } from './reqUpdateQuotationSettingTargetMarginRate';
|
||||
import type { ReqUpdateQuotationSettingAnchoringValue } from './reqUpdateQuotationSettingAnchoringValue';
|
||||
import type { ReqUpdateQuotationSettingInternetAverageFee } from './reqUpdateQuotationSettingInternetAverageFee';
|
||||
import type { ReqUpdateQuotationSettingCardCount } from './reqUpdateQuotationSettingCardCount';
|
||||
|
||||
export interface ReqUpdateQuotationSetting {
|
||||
target_margin_rate?: ReqUpdateQuotationSettingTargetMarginRate;
|
||||
anchoring_value?: ReqUpdateQuotationSettingAnchoringValue;
|
||||
internet_average_fee?: ReqUpdateQuotationSettingInternetAverageFee;
|
||||
card_count?: ReqUpdateQuotationSettingCardCount;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ReqUpdateQuotationSettingInternetAverageFee = number | null;
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ErrorInfo } from './errorInfo';
|
||||
import type { ResLastSupplierTypeMsg } from './resLastSupplierTypeMsg';
|
||||
import type { ResLastSupplierTypeSupplierType } from './resLastSupplierTypeSupplierType';
|
||||
import type { ResLastSupplierTypeQtNumber } from './resLastSupplierTypeQtNumber';
|
||||
|
||||
export interface ResLastSupplierType {
|
||||
result?: ErrorInfo;
|
||||
msg?: ResLastSupplierTypeMsg;
|
||||
supplier_type?: ResLastSupplierTypeSupplierType;
|
||||
qt_number?: ResLastSupplierTypeQtNumber;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ResLastSupplierTypeMsg = string | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ResLastSupplierTypeQtNumber = string | null;
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { SupplierType } from './supplierType';
|
||||
|
||||
export type ResLastSupplierTypeSupplierType = SupplierType | null;
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* suppliers.type 코드값(KTC 앵커링 기준). 0=기타는 매칭 실패 폴백용 — UI 선택지엔 미노출.
|
||||
*/
|
||||
export type SupplierType = typeof SupplierType[keyof typeof SupplierType];
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const SupplierType = {
|
||||
DISTRIBUTION: 1,
|
||||
MANUFACTURE: 2,
|
||||
SOLE_AGENCY: 3,
|
||||
ETC: 0,
|
||||
} as const;
|
||||
@@ -30,6 +30,7 @@ import type {
|
||||
ReqRegenerateQuotation,
|
||||
ResCreateQuotation,
|
||||
ResDeleteQuotation,
|
||||
ResLastSupplierType,
|
||||
ResQuotation,
|
||||
ResQuotationCards,
|
||||
ResQuotationList,
|
||||
@@ -852,6 +853,98 @@ export const useDeleteQuotation = <TError = void | HTTPValidationError,
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
}
|
||||
/**
|
||||
* @summary 협력사 직전 견적 유형
|
||||
*/
|
||||
export const getSupplierLastType = (
|
||||
supplierId: string,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResLastSupplierType>(
|
||||
{url: `/v1/quotation/supplier/${supplierId}/last-type`, method: 'GET', signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export const getGetSupplierLastTypeQueryKey = (supplierId?: string,) => {
|
||||
return [
|
||||
`/v1/quotation/supplier/${supplierId}/last-type`
|
||||
] as const;
|
||||
}
|
||||
|
||||
|
||||
export const getGetSupplierLastTypeQueryOptions = <TData = Awaited<ReturnType<typeof getSupplierLastType>>, TError = void | HTTPValidationError>(supplierId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSupplierLastType>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
) => {
|
||||
|
||||
const {query: queryOptions, request: requestOptions} = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getGetSupplierLastTypeQueryKey(supplierId);
|
||||
|
||||
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSupplierLastType>>> = ({ signal }) => getSupplierLastType(supplierId, requestOptions, signal);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { queryKey, queryFn, enabled: !!(supplierId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getSupplierLastType>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
}
|
||||
|
||||
export type GetSupplierLastTypeQueryResult = NonNullable<Awaited<ReturnType<typeof getSupplierLastType>>>
|
||||
export type GetSupplierLastTypeQueryError = void | HTTPValidationError
|
||||
|
||||
|
||||
export function useGetSupplierLastType<TData = Awaited<ReturnType<typeof getSupplierLastType>>, TError = void | HTTPValidationError>(
|
||||
supplierId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSupplierLastType>>, TError, TData>> & Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getSupplierLastType>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getSupplierLastType>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetSupplierLastType<TData = Awaited<ReturnType<typeof getSupplierLastType>>, TError = void | HTTPValidationError>(
|
||||
supplierId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSupplierLastType>>, TError, TData>> & Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getSupplierLastType>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getSupplierLastType>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetSupplierLastType<TData = Awaited<ReturnType<typeof getSupplierLastType>>, TError = void | HTTPValidationError>(
|
||||
supplierId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSupplierLastType>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
/**
|
||||
* @summary 협력사 직전 견적 유형
|
||||
*/
|
||||
|
||||
export function useGetSupplierLastType<TData = Awaited<ReturnType<typeof getSupplierLastType>>, TError = void | HTTPValidationError>(
|
||||
supplierId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSupplierLastType>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
||||
|
||||
const queryOptions = getGetSupplierLastTypeQueryOptions(supplierId,options)
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
query.queryKey = queryOptions.queryKey ;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @summary 견적 조회
|
||||
*/
|
||||
export const getQuotation = (
|
||||
|
||||
@@ -9,11 +9,13 @@ import { Input } from '@/components/ui/input';
|
||||
import { Sheet } from '@/components/ui/sheet';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { type NegotiationCard, type CardTab, generateCardCode } from '../types';
|
||||
import { CardUsageType } from '@/api/generated/model';
|
||||
import type { CardInput } from '../hooks/useCards';
|
||||
import { CardScriptEditor, deserialize, serializeToText } from '../editor';
|
||||
|
||||
const schema = z.object({
|
||||
isWildcard: z.boolean(),
|
||||
usageType: z.number(),
|
||||
code: z.string().trim().min(1, '카드번호는 필수 기입 사항입니다.'),
|
||||
title: z.string().trim().min(1, '카드이름은 필수 기입 사항입니다.'),
|
||||
editorScript: z
|
||||
@@ -45,6 +47,7 @@ function buildDefaults(
|
||||
if (mode === 'edit' && card) {
|
||||
return {
|
||||
isWildcard: card.isWildcard,
|
||||
usageType: card.usageType,
|
||||
code: card.code,
|
||||
title: card.title,
|
||||
// 저장된 Slate JSON 우선, 없으면 레거시 평문 script 를 변수 노드로 복원.
|
||||
@@ -57,6 +60,7 @@ function buildDefaults(
|
||||
const wild = activeTab === 'WILD';
|
||||
return {
|
||||
isWildcard: wild,
|
||||
usageType: CardUsageType.COMMON, // 기본: 공통(신규·재 모두)
|
||||
code: generateCardCode(wild),
|
||||
title: '',
|
||||
editorScript: deserialize(), // 새 빈 값(공용 상수 mutate 방지)
|
||||
@@ -100,6 +104,7 @@ export function CardFormSheet({
|
||||
editorScript: v.editorScript,
|
||||
status: v.status,
|
||||
isWildcard: v.isWildcard,
|
||||
usageType: v.usageType,
|
||||
triggerCondition: v.triggerCondition,
|
||||
memo: v.memo,
|
||||
};
|
||||
@@ -220,6 +225,34 @@ export function CardFormSheet({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 카드 용도(usage_type): 공통 / 신규전용 / 재전용 */}
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="small" className="font-semibold">카드 용도</Typography>
|
||||
<Controller
|
||||
control={control}
|
||||
name="usageType"
|
||||
render={({ field }) => (
|
||||
<Select value={String(field.value)} onValueChange={(v) => field.onChange(Number(v))}>
|
||||
<SelectTrigger id="form-card-usage-type" className="w-full">
|
||||
<SelectValue>
|
||||
{(value) =>
|
||||
value === String(CardUsageType.NEW)
|
||||
? '신규견적전용'
|
||||
: value === String(CardUsageType.REUSE)
|
||||
? '재견적전용'
|
||||
: '공통'}
|
||||
</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value={String(CardUsageType.COMMON)}>공통</SelectItem>
|
||||
<SelectItem value={String(CardUsageType.NEW)}>신규견적전용</SelectItem>
|
||||
<SelectItem value={String(CardUsageType.REUSE)}>재견적전용</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Title */}
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="small" className="font-semibold">카드이름</Typography>
|
||||
|
||||
@@ -21,6 +21,7 @@ export type CardInput = {
|
||||
editorScript: Descendant[];
|
||||
status: 'ACTIVE' | 'INACTIVE';
|
||||
isWildcard: boolean;
|
||||
usageType: number; // usage_type(CardUsageType): 1=공통 2=신규견적전용 3=재견적전용
|
||||
triggerCondition?: string;
|
||||
memo?: string;
|
||||
};
|
||||
@@ -36,6 +37,7 @@ function cardError(res: ResCard): string | null {
|
||||
function toReq(input: CardInput): ReqCreateCard {
|
||||
return {
|
||||
is_wildcard: input.isWildcard,
|
||||
usage_type: input.usageType,
|
||||
name: input.title,
|
||||
number: input.code,
|
||||
script: serializeToText(input.editorScript), // 평문 미리보기({변수} 토큰 포함)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { NegotiationCard } from '@/types';
|
||||
import type { CardData } from '@/api/generated/model/cardData';
|
||||
import { CardStatus } from '@/api/generated/model';
|
||||
import { CardStatus, CardUsageType } from '@/api/generated/model';
|
||||
|
||||
export type { NegotiationCard };
|
||||
|
||||
@@ -17,6 +17,7 @@ export function mapCardData(c: CardData): NegotiationCard {
|
||||
return {
|
||||
id: c.nego_card_id,
|
||||
isWildcard: c.is_wildcard ?? false,
|
||||
usageType: c.usage_type ?? CardUsageType.COMMON,
|
||||
code: c.number ?? '',
|
||||
title: c.name ?? '',
|
||||
scriptPreview: c.script ?? '',
|
||||
|
||||
@@ -33,6 +33,8 @@ const schema = z.object({
|
||||
vatYn: z.boolean(),
|
||||
deliveryFeeYn: z.boolean(),
|
||||
internetLowestPriceYn: z.boolean(),
|
||||
purchasePrice: z.number({ message: '숫자를 입력해 주십시오.' }).min(0, '매입가는 0 이상이어야 합니다.'),
|
||||
sellingPrice: z.number({ message: '숫자를 입력해 주십시오.' }).min(0, '판매가는 0 이상이어야 합니다.'),
|
||||
});
|
||||
|
||||
type FormValues = z.infer<typeof schema>;
|
||||
@@ -71,6 +73,8 @@ function buildDefaults(mode: 'create' | 'edit', product: Product | null): FormVa
|
||||
vatYn: product.vat_yn !== false,
|
||||
deliveryFeeYn: product.delivery_fee_yn || false,
|
||||
internetLowestPriceYn: product.internet_lowest_price_yn || false,
|
||||
purchasePrice: product.purchase_price || 0,
|
||||
sellingPrice: product.selling_price || 0,
|
||||
};
|
||||
}
|
||||
return {
|
||||
@@ -91,6 +95,8 @@ function buildDefaults(mode: 'create' | 'edit', product: Product | null): FormVa
|
||||
vatYn: true,
|
||||
deliveryFeeYn: false,
|
||||
internetLowestPriceYn: true,
|
||||
purchasePrice: 0,
|
||||
sellingPrice: 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -145,6 +151,8 @@ export function ProductFormSheet({
|
||||
vat_yn: v.vatYn,
|
||||
delivery_fee_yn: v.deliveryFeeYn,
|
||||
internet_lowest_price_yn: v.internetLowestPriceYn,
|
||||
purchase_price: v.purchasePrice,
|
||||
selling_price: v.sellingPrice,
|
||||
};
|
||||
|
||||
if (mode === 'create') {
|
||||
@@ -262,6 +270,33 @@ export function ProductFormSheet({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
{/* 매입가 */}
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="label">매입가 (₩)</Typography>
|
||||
<Input
|
||||
id="form-product-purchase-price"
|
||||
type="number"
|
||||
{...register('purchasePrice', { valueAsNumber: true })}
|
||||
className={`${inputClass} font-mono`}
|
||||
placeholder="0"
|
||||
/>
|
||||
{errors.purchasePrice && <p className="text-[10px] text-rose-500">{errors.purchasePrice.message}</p>}
|
||||
</div>
|
||||
{/* 판매가 */}
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="label">판매가 (₩)</Typography>
|
||||
<Input
|
||||
id="form-product-selling-price"
|
||||
type="number"
|
||||
{...register('sellingPrice', { valueAsNumber: true })}
|
||||
className={`${inputClass} font-mono`}
|
||||
placeholder="0"
|
||||
/>
|
||||
{errors.sellingPrice && <p className="text-[10px] text-rose-500">{errors.sellingPrice.message}</p>}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
{/* Model Name */}
|
||||
<div className="space-y-1">
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { useState } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { X, PlusSquare, ArrowRight, Loader2 } from 'lucide-react';
|
||||
import { useGetSupplierLastType } from '@/api/generated/quotation/quotation';
|
||||
import { updateItem } from '@/api/generated/item/item';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Typography } from '@/components/ui/typography';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -7,7 +9,8 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
|
||||
import type { Product, Partner, QuotationSetting, NegotiationCard } from '../types';
|
||||
import type { CreateQuotationInput } from '../hooks/useQuotations';
|
||||
import { QuotationType } from '@/api/generated/model';
|
||||
import { QUOTATION_TYPE_OPTIONS } from '../types';
|
||||
import { QUOTATION_TYPE_OPTIONS, supplierTypeOptions } from '../types';
|
||||
import { showToast } from '@/lib/notify';
|
||||
|
||||
// datetime-local 디폴트값: 현재 한국시간(Asia/Seoul)의 'YYYY-MM-DDTHH:mm'.
|
||||
// sv-SE 로케일이 'YYYY-MM-DD HH:mm:ss' 를 주고, timeZone 명시로 브라우저 TZ 와 무관하게 KST 로 고정한다.
|
||||
@@ -44,9 +47,37 @@ export function QuotationCreateModal({
|
||||
const [settingId, setSettingId] = useState(quotationSettings[0]?.qt_setting_id ?? '');
|
||||
const [selectedCardIds, setSelectedCardIds] = useState<string[]>([]);
|
||||
const [memo, setMemo] = useState('');
|
||||
const [mdPrice, setMdPrice] = useState(''); // MD 제시가(원). 비우면 미전송 → 서버가 마진식으로 목표가 산정
|
||||
const [purchaseInput, setPurchaseInput] = useState(''); // 재견적·재협상 매입가(상품 저장값 디폴트, 필수)
|
||||
const [sellingInput, setSellingInput] = useState(''); // 재견적·재협상 판매가(상품 저장값 디폴트, 선택)
|
||||
const [supplierType, setSupplierType] = useState(''); // 협력사 유형(SupplierType). 재견적 1:1 → 견적에 기록
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const typeOptions = QUOTATION_TYPE_OPTIONS;
|
||||
|
||||
// 협력사 유형은 재협상(1:1)에서만. 선택된 협력사의 직전 견적 supplier_type 을 조회해 디폴트로 채운다.
|
||||
const renegoSupplierId = type === QuotationType.RENEGO ? (selectedPartnerIds[0] ?? '') : '';
|
||||
const lastTypeQuery = useGetSupplierLastType(renegoSupplierId, {
|
||||
query: { enabled: !!renegoSupplierId },
|
||||
});
|
||||
const prevSupplierType = lastTypeQuery.data?.supplier_type ?? null; // 협력사 직전 견적 유형(없으면 null)
|
||||
const prevQtNumber = lastTypeQuery.data?.qt_number ?? '';
|
||||
// 협력사가 정해지면 직전 견적 유형으로 디폴트(이후 사용자가 바꾸면 그 값 유지).
|
||||
useEffect(() => {
|
||||
setSupplierType(prevSupplierType != null ? String(prevSupplierType) : '');
|
||||
}, [renegoSupplierId, prevSupplierType]);
|
||||
|
||||
// 재견적·재협상(RE)에서만 매입가/판매가 입력을 노출한다. 상품이 정해지면 그 상품 저장값으로 디폴트.
|
||||
const selectedProduct = products.find((p) => p.id === productId);
|
||||
const isReType = type === QuotationType.RENEGO || type === QuotationType.REQUOTE;
|
||||
const showPrices = isReType && !!productId;
|
||||
// 상품/유형이 바뀌면 그 상품의 저장된 매입가·판매가로 입력칸을 채운다(이후 사용자가 고치면 유지).
|
||||
useEffect(() => {
|
||||
if (!isReType || !selectedProduct) return;
|
||||
setPurchaseInput(selectedProduct.purchase_price != null ? String(selectedProduct.purchase_price) : '');
|
||||
setSellingInput(selectedProduct.selling_price != null ? String(selectedProduct.selling_price) : '');
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [productId, isReType]);
|
||||
|
||||
if (!open) return null;
|
||||
|
||||
const togglePartner = (id: string) =>
|
||||
@@ -64,6 +95,17 @@ export function QuotationCreateModal({
|
||||
if (submitting) return;
|
||||
setSubmitting(true);
|
||||
try {
|
||||
// 재견적·재협상은 매입가 필수 — 입력된 매입가/판매가를 상품에 저장한 뒤 진행한다.
|
||||
if (showPrices) {
|
||||
if (!purchaseInput) {
|
||||
showToast('재견적·재협상은 매입가가 필수입니다.', 'error');
|
||||
return; // finally 에서 submitting 해제
|
||||
}
|
||||
await updateItem(productId, {
|
||||
purchase_price: Number(purchaseInput),
|
||||
selling_price: sellingInput ? Number(sellingInput) : undefined,
|
||||
});
|
||||
}
|
||||
// 서버가 견적+세션 생성을 끝내고 응답할 때까지 기다린 뒤에 완료(닫기) 처리한다.
|
||||
const ok = await onCreate({
|
||||
title,
|
||||
@@ -74,6 +116,8 @@ export function QuotationCreateModal({
|
||||
settingId,
|
||||
cardIds: selectedCardIds,
|
||||
memo,
|
||||
mdPrice: mdPrice ? Number(mdPrice) : null,
|
||||
supplierType: supplierType ? Number(supplierType) : null,
|
||||
});
|
||||
if (ok) onClose();
|
||||
} finally {
|
||||
@@ -92,7 +136,7 @@ export function QuotationCreateModal({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="w-full max-w-xl bg-card border border-border rounded-lg shadow-2xl p-6 overflow-hidden animate-scale-up font-mono">
|
||||
<div className="w-full max-w-2xl bg-card border border-border rounded-lg shadow-2xl p-6 overflow-hidden animate-scale-up font-mono">
|
||||
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between pb-4 border-b border-border">
|
||||
@@ -107,11 +151,11 @@ export function QuotationCreateModal({
|
||||
|
||||
{/* Steps indicator */}
|
||||
<div className="flex items-center justify-between gap-2 py-4 border-b border-border/40 text-[10px] text-muted-foreground">
|
||||
<Typography as="span" variant="label" className={`font-semibold ${step >= 1 ? 'text-primary' : 'text-muted-foreground'}`}>1. 기본 등록</Typography>
|
||||
<Typography as="span" variant="label" className={`font-semibold ${step >= 1 ? 'text-primary' : 'text-muted-foreground'}`}>1. 기본 정보</Typography>
|
||||
<ArrowRight size={10} />
|
||||
<Typography as="span" variant="label" className={`font-semibold ${step >= 2 ? 'text-primary' : 'text-muted-foreground'}`}>2. 협력사 선택</Typography>
|
||||
<Typography as="span" variant="label" className={`font-semibold ${step >= 2 ? 'text-primary' : 'text-muted-foreground'}`}>2. 협력사 초청</Typography>
|
||||
<ArrowRight size={10} />
|
||||
<Typography as="span" variant="label" className={`font-semibold ${step >= 3 ? 'text-primary' : 'text-muted-foreground'}`}>3. 설정 및 완료</Typography>
|
||||
<Typography as="span" variant="label" className={`font-semibold ${step >= 3 ? 'text-primary' : 'text-muted-foreground'}`}>3. 설정·완료</Typography>
|
||||
</div>
|
||||
|
||||
{/* Step content */}
|
||||
@@ -119,21 +163,10 @@ export function QuotationCreateModal({
|
||||
|
||||
{step === 1 && (
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="label">견적건명</Typography>
|
||||
<Input
|
||||
id="wizard-title"
|
||||
type="text"
|
||||
className="text-xs"
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
placeholder="예: 6월 배터리 원부자재 견적 의뢰"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
{/* 견적 유형이 맨 위 — 신규/재 여부가 아래 매입가 필수 여부까지 결정한다 */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="label">유형</Typography>
|
||||
<Typography as="label" variant="label">견적 유형</Typography>
|
||||
<Select
|
||||
value={String(type)}
|
||||
onValueChange={(v) => {
|
||||
@@ -167,6 +200,18 @@ export function QuotationCreateModal({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="label">견적건명</Typography>
|
||||
<Input
|
||||
id="wizard-title"
|
||||
type="text"
|
||||
className="text-xs"
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
placeholder="예: 6월 배터리 원부자재 견적 의뢰"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="label">상품</Typography>
|
||||
<Select value={productId} onValueChange={setProductId}>
|
||||
@@ -189,6 +234,50 @@ export function QuotationCreateModal({
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{/* MD 제시가 — 신규·재 공통(입력 시 목표가로 사용) */}
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="label">MD 제시가 (선택)</Typography>
|
||||
<Input
|
||||
id="wizard-md-price"
|
||||
type="number"
|
||||
min={0}
|
||||
className="text-xs"
|
||||
value={mdPrice}
|
||||
onChange={(e) => setMdPrice(e.target.value)}
|
||||
placeholder="입력 시 목표가로 사용 · 미입력 시 자동 산정"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 재견적·재협상 — 매입가(필수)·판매가, 선택 상품의 저장값으로 디폴트 */}
|
||||
{showPrices && (
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="label" className="text-amber-600">매입가 (필수)</Typography>
|
||||
<Input
|
||||
id="wizard-purchase-price"
|
||||
type="number"
|
||||
min={0}
|
||||
className="text-xs"
|
||||
value={purchaseInput}
|
||||
onChange={(e) => setPurchaseInput(e.target.value)}
|
||||
placeholder="상품 저장값 · 비우면 진행 불가"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="label">판매가 (선택)</Typography>
|
||||
<Input
|
||||
id="wizard-selling-price"
|
||||
type="number"
|
||||
min={0}
|
||||
className="text-xs"
|
||||
value={sellingInput}
|
||||
onChange={(e) => setSellingInput(e.target.value)}
|
||||
placeholder="상품 저장값 · 마진 상한 산정에 사용"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -226,6 +315,34 @@ export function QuotationCreateModal({
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* 협력사 유형 — 재협상(1:1)에서 협력사 선택 후 노출. 직전 견적 값 자동 디폴트. */}
|
||||
{type === QuotationType.RENEGO && selectedPartnerIds.length > 0 && (
|
||||
<div className="space-y-1 pt-3 border-t border-border/40">
|
||||
<Typography as="label" variant="label">협력사 유형</Typography>
|
||||
<Select value={supplierType} onValueChange={(v) => setSupplierType(v ?? '')}>
|
||||
<SelectTrigger id="wizard-supplier-type" className="w-full">
|
||||
<SelectValue>
|
||||
{(value) =>
|
||||
value
|
||||
? supplierTypeOptions.find((o) => String(o.value) === value)?.label ?? ''
|
||||
: '협력사 유형 선택...'
|
||||
}
|
||||
</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{supplierTypeOptions.map((o) => (
|
||||
<SelectItem key={o.value} value={String(o.value)}>{o.label}</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{prevSupplierType != null && (
|
||||
<Typography as="span" variant="small" className="text-[10px] text-muted-foreground">
|
||||
이전 견적({prevQtNumber}) 값으로 자동 선택됨 · 수정 가능
|
||||
</Typography>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -317,7 +434,17 @@ export function QuotationCreateModal({
|
||||
|
||||
<div className="flex gap-2">
|
||||
{step < 3 ? (
|
||||
<Button type="button" size="sm" onClick={() => setStep((prev) => prev + 1)}>
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
if (step === 1 && showPrices && !purchaseInput) {
|
||||
showToast('재견적·재협상은 매입가가 필수입니다.', 'error');
|
||||
return;
|
||||
}
|
||||
setStep((prev) => prev + 1);
|
||||
}}
|
||||
>
|
||||
다음 단계로
|
||||
</Button>
|
||||
) : (
|
||||
|
||||
@@ -24,16 +24,18 @@ export function QuotationSettingsModal({
|
||||
}: QuotationSettingsModalProps) {
|
||||
const [targetMargin, setTargetMargin] = useState('');
|
||||
const [anchoringValue, setAnchoringValue] = useState('');
|
||||
const [internetFee, setInternetFee] = useState('7.8');
|
||||
const [cardUseCount, setCardUseCount] = useState('');
|
||||
|
||||
if (!open) return null;
|
||||
|
||||
const handleAdd = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
const ok = onAdd({ targetMargin, anchoringValue, cardUseCount });
|
||||
const ok = onAdd({ targetMargin, anchoringValue, internetFee, cardUseCount });
|
||||
if (ok) {
|
||||
setTargetMargin('');
|
||||
setAnchoringValue('');
|
||||
setInternetFee('7.8');
|
||||
setCardUseCount('');
|
||||
}
|
||||
};
|
||||
@@ -99,7 +101,7 @@ export function QuotationSettingsModal({
|
||||
<form onSubmit={handleAdd} className="space-y-3 pt-4 border-t border-border/60">
|
||||
<span className="font-bold text-foreground block text-xs">신규 견적 세팅 추가</span>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-3">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="muted" className="text-[10px] font-semibold">목표 마진율 (%)</Typography>
|
||||
<Input type="number" step="0.1" value={targetMargin} onChange={(e) => setTargetMargin(e.target.value)} placeholder="예: 12" />
|
||||
@@ -108,6 +110,10 @@ export function QuotationSettingsModal({
|
||||
<Typography as="label" variant="muted" className="text-[10px] font-semibold">앵커링 값</Typography>
|
||||
<Input type="number" step="0.01" value={anchoringValue} onChange={(e) => setAnchoringValue(e.target.value)} placeholder="예: 0.01" />
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="muted" className="text-[10px] font-semibold">인터넷 수수료율 (%)</Typography>
|
||||
<Input type="number" step="0.1" value={internetFee} onChange={(e) => setInternetFee(e.target.value)} placeholder="예: 7.8" />
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Typography as="label" variant="muted" className="text-[10px] font-semibold">카드 사용 횟수</Typography>
|
||||
<Input type="number" step="1" value={cardUseCount} onChange={(e) => setCardUseCount(e.target.value)} placeholder="예: 3" />
|
||||
|
||||
@@ -36,11 +36,14 @@ export type CreateQuotationInput = {
|
||||
settingId: string;
|
||||
cardIds: string[];
|
||||
memo: string;
|
||||
mdPrice?: number | null; // MD 제시가(원). 비우면 미전송 → 서버가 기존 마진식으로 목표가 산정
|
||||
supplierType?: number | null; // 협력사 유형(SupplierType). 재견적 1:1 → 견적에 기록
|
||||
};
|
||||
|
||||
export type SettingInput = {
|
||||
targetMargin: string;
|
||||
anchoringValue: string;
|
||||
internetFee: string;
|
||||
cardUseCount: string;
|
||||
};
|
||||
|
||||
@@ -116,13 +119,14 @@ export function useQuotations(params: ListQuotationsParams) {
|
||||
const addSetting = (input: SettingInput): boolean => {
|
||||
const marginPct = Number(String(input.targetMargin).replace('%', '').trim());
|
||||
const anchoring = Number(String(input.anchoringValue).trim());
|
||||
const feePct = Number(String(input.internetFee).replace('%', '').trim());
|
||||
const cardCount = parseInt(String(input.cardUseCount).replace(/[^0-9-]/g, ''), 10);
|
||||
if (!Number.isFinite(marginPct) || !Number.isFinite(anchoring) || !Number.isInteger(cardCount)) {
|
||||
showToast('목표 마진율·앵커링 값·카드 사용 횟수를 숫자로 입력해야 합니다.', 'error');
|
||||
if (!Number.isFinite(marginPct) || !Number.isFinite(anchoring) || !Number.isFinite(feePct) || !Number.isInteger(cardCount)) {
|
||||
showToast('목표 마진율·앵커링 값·수수료율·카드 사용 횟수를 숫자로 입력해야 합니다.', 'error');
|
||||
return false;
|
||||
}
|
||||
createSettingMutation.mutate(
|
||||
{ data: { target_margin_rate: marginPct / 100, anchoring_value: anchoring, card_count: cardCount } },
|
||||
{ data: { target_margin_rate: marginPct / 100, anchoring_value: anchoring, internet_average_fee: feePct / 100, card_count: cardCount } },
|
||||
{
|
||||
onSuccess: () => {
|
||||
invalidateSettings();
|
||||
@@ -183,6 +187,8 @@ export function useQuotations(params: ListQuotationsParams) {
|
||||
manager_email: me?.email || undefined,
|
||||
manager_contact_number: me?.contact || undefined,
|
||||
memo: input.memo.trim() || undefined,
|
||||
md_price: input.mdPrice && input.mdPrice > 0 ? input.mdPrice : undefined,
|
||||
supplier_type: input.supplierType ?? undefined,
|
||||
};
|
||||
|
||||
try {
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { QuotationSettingData } from '@/api/generated/model/quotationSettin
|
||||
import type { QuotationData } from '@/api/generated/model/quotationData';
|
||||
import type { SessionData } from '@/api/generated/model/sessionData';
|
||||
import type { QuotationCardData } from '@/api/generated/model/quotationCardData';
|
||||
import { QuotationType, QuotationStatus, SessionStatus, CardType } from '@/api/generated/model';
|
||||
import { QuotationType, QuotationStatus, SessionStatus, CardType, SupplierType } from '@/api/generated/model';
|
||||
import { DELIVERY_TYPE_LABEL } from '@/lib/enumLabels';
|
||||
import { toMinPrice } from '@/features/products/types';
|
||||
import type { Product, Partner, NegotiationCard } from '@/types';
|
||||
@@ -136,14 +136,29 @@ export const QUOTATION_STATUS_OPTIONS = Object.values(QuotationStatus).map((valu
|
||||
export const QUOTATION_TYPE_LABEL: Record<QuotationType, string> = {
|
||||
[QuotationType.RENEGO]: '재협상',
|
||||
[QuotationType.REQUOTE]: '재견적',
|
||||
[QuotationType.NEW_NEGO]: '신규협상',
|
||||
[QuotationType.NEW_QUOTE]: '신규견적',
|
||||
};
|
||||
export const quotationTypeLabel = (t?: number | null): string =>
|
||||
t != null ? QUOTATION_TYPE_LABEL[t as QuotationType] ?? String(t) : '';
|
||||
export const QUOTATION_TYPE_OPTIONS = [QuotationType.REQUOTE, QuotationType.RENEGO].map((value) => ({
|
||||
export const QUOTATION_TYPE_OPTIONS = [
|
||||
QuotationType.NEW_QUOTE,
|
||||
QuotationType.NEW_NEGO,
|
||||
QuotationType.REQUOTE,
|
||||
QuotationType.RENEGO,
|
||||
].map((value) => ({
|
||||
value,
|
||||
label: QUOTATION_TYPE_LABEL[value],
|
||||
}));
|
||||
|
||||
// 협력사 유형 선택지(견적생성 모달). 재견적은 1:1이라 견적에 협력사 유형을 박는다. 없음(ETC=0) 포함.
|
||||
export const supplierTypeOptions: { value: number; label: string }[] = [
|
||||
{ value: SupplierType.DISTRIBUTION, label: '유통' },
|
||||
{ value: SupplierType.MANUFACTURE, label: '제조' },
|
||||
{ value: SupplierType.SOLE_AGENCY, label: '총판' },
|
||||
{ value: SupplierType.ETC, label: '없음' },
|
||||
];
|
||||
|
||||
// ── 라운드 체인(같은 견적번호) ───────────────────────────────────────────
|
||||
// 한 라운드(견적)의 결과를 한 단어로. 낙찰=종료, 동가/마감=후속 라운드 가능, 진행중=아직 안 닫힘.
|
||||
export type ChainRoundState = 'awarded' | 'equal' | 'closed' | 'active';
|
||||
|
||||
@@ -23,6 +23,7 @@ export type Partner = SupplierData & {
|
||||
export interface NegotiationCard {
|
||||
id: string;
|
||||
isWildcard: boolean;
|
||||
usageType: number; // usage_type(CardUsageType): 1=공통 2=신규견적전용 3=재견적전용
|
||||
code: string;
|
||||
title: string;
|
||||
scriptPreview: string;
|
||||
|
||||
Reference in new issue
Block a user