[feat] negosium/협상: 협상 종료폼 통일·의견 수취 — rejectRSP/CM를 단일 RejectForm(사유·희망가·의견)으로 통합해 액션바 렌더, 타결 부가정보에 의견 추가(custom.opinion), 결렬 제출값 파싱해 reject_reason/reject_price 컬럼 저장, 상품상세 필드 라벨 회사설정 연동·협상 단가 VAT별도 표기
This commit is contained in:
1 parent
b33ae05cd6
commit
a56589c6d9
14 files changed
+290
-317
No files matched your search
@@ -15,6 +15,9 @@ export function ExtraInfoBar({ proceedText }: { proceedText: string }) {
|
||||
const fields: SessionField[] = user?.sessionFields ?? []
|
||||
const save = useSaveExtraInfoMutation()
|
||||
const existing = useChatInitStore((s) => s.custom) // 기존 입력값(재진입 프리필)
|
||||
// 의견은 session_fields 와 무관한 공통 필드 — 타결·결렬 모두 항상 받는다. custom.opinion 에 저장.
|
||||
const [opinion, setOpinion] = useState<string | null>(null)
|
||||
const opinionValue = opinion ?? String(existing?.opinion ?? '')
|
||||
|
||||
// 사용자가 건드린 값만 state 로 두고, 나머지는 기존값/기본값에서 렌더마다 파생한다(초기화 effect 불필요).
|
||||
const [overrides, setOverrides] = useState<Record<string, unknown>>({})
|
||||
@@ -23,17 +26,6 @@ export function ExtraInfoBar({ proceedText }: { proceedText: string }) {
|
||||
|
||||
const proceed = () => sendMessage(proceedText)
|
||||
|
||||
// 필드 미정의 회사 → 부가정보 없이 동의만.
|
||||
if (fields.length === 0) {
|
||||
return (
|
||||
<div className="flex w-full justify-center">
|
||||
<button className={PRIMARY} onClick={proceed}>
|
||||
{proceedText || '확인'}
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const set = (key: string, value: unknown) => setOverrides((v) => ({ ...v, [key]: value }))
|
||||
|
||||
// 저장 성공 후에만 동의(협상 종료)로 넘어간다 — 저장 실패 시 화면 유지.
|
||||
@@ -45,6 +37,8 @@ export function ExtraInfoBar({ proceedText }: { proceedText: string }) {
|
||||
if (f.type === 'boolean') custom[f.key] = !!v
|
||||
else if (v !== '' && v != null) custom[f.key] = f.type === 'number' ? Number(v) : v
|
||||
}
|
||||
if (opinionValue.trim()) custom.opinion = opinionValue.trim()
|
||||
if (Object.keys(custom).length === 0) { proceed(); return } // 입력 없음 → 저장 생략하고 종료
|
||||
save.mutate(
|
||||
{ sessionId, request: { custom } },
|
||||
{
|
||||
@@ -102,6 +96,20 @@ export function ExtraInfoBar({ proceedText }: { proceedText: string }) {
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
{/* 의견 — 타결·결렬 공통 필드(IMK #18). custom.opinion 저장. */}
|
||||
<div className="flex flex-col gap-1">
|
||||
<label className="text-sm font-semibold text-neutral-80">
|
||||
의견 <span className="font-normal text-neutral-50">(선택)</span>
|
||||
</label>
|
||||
<textarea
|
||||
value={opinionValue}
|
||||
onChange={(e) => setOpinion(e.target.value)}
|
||||
rows={2}
|
||||
maxLength={255}
|
||||
placeholder="추가로 남길 의견이 있으면 작성해 주세요."
|
||||
className="w-full resize-none rounded-xl border border-border bg-white px-3 py-2 text-sm outline-none focus:border-brand-600 focus:ring-1 focus:ring-brand-600"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" onClick={handleSaveAndProceed} disabled={save.isPending} className={`${PRIMARY} mt-3 w-full`}>
|
||||
{save.isPending ? '저장 중…' : proceedText || '저장하고 마무리'}
|
||||
|
||||
Reference in new issue
Block a user