[feat] negodata: 협상카드 회사 스코프·공용 읽기전용 + 견적 목표가 산정내역 수정

협상카드
- 목록/조회를 등록자 개인 → 회사(company.users 조인) 단위로 확장: 같은 회사 유저 카드 + 공용(user_id NULL)
- 공용 카드는 기본 제공 자산 → 수정·삭제 불가(OWNER 포함), is_shared=True API 등록 거부
- 개인 카드 변경은 본인∪최고관리자만, 프론트 버튼 disable+툴팁
- 공개범위 셀렉터·엑셀 공개범위 컬럼·CardTable 전체 배지 제거(항상 개인 등록)
- test_card.py 5케이스 재작성

견적 목표가 산정내역
- get_setting_rates: 단일 컬럼 select 결과를 이중 인덱싱해 항상 예외 → 마진율이 늘 0으로 적용되던 버그 수정
- get_target_breakdown: 채택 후보 판정을 '현재 최소값' → '저장 목표가와 값 일치'로 변경(산정 후 상품가 변동에도 초록 체크 유지)
- 견적상세 협상카드 탭 세션ID 컬럼 제거

견적생성 모달
- 목표가 미리보기·마감기한 기본값(+1h)·미래 검증, combobox 팝오버 scrollIntoView, maskPrices 비율(%) 마스킹

Little-Helped: Stupid Claude
This commit is contained in:
minaChoi committed 2026-07-09 17:04:40 +09:00
1 parent 0d62440ee1
commit 1b9ca062f3
20 files changed
+331 -168

No files matched your search

@@ -57,6 +57,7 @@ export function Combobox({
const [text, setText] = useState('');
const [open, setOpen] = useState(false);
const rootRef = useRef<HTMLDivElement>(null);
const popoverRef = useRef<HTMLDivElement>(null);
// 검색어 디바운스 → onQueryChange. 콜백은 ref로 잡아 text 변화에만 반응.
const qcRef = useRef(onQueryChange);
@@ -76,6 +77,13 @@ export function Combobox({
return () => document.removeEventListener('mousedown', onDoc);
}, [variant]);
// field 팝오버가 열리면 스크롤 컨테이너(모달 등) 안에서 잘리지 않게 뷰로 끌어온다.
// 로딩→목록 로 높이가 커질 때도 다시 당겨온다(이미 보이면 scrollIntoView 는 no-op).
useEffect(() => {
if (variant === 'inline' || !open) return;
popoverRef.current?.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
}, [open, variant, loading, options.length]);
const isSelected = (oid: string) => (multiple ? values.includes(oid) : value === oid);
const handlePick = (opt: ComboOption) => {
@@ -168,7 +176,7 @@ export function Combobox({
<ChevronsUpDown size={14} className="text-muted-foreground shrink-0" />
</button>
{open && (
<div className="absolute z-50 mt-1 w-full rounded border border-border bg-card shadow-lg p-1.5 space-y-1.5">
<div ref={popoverRef} className="absolute z-50 mt-1 w-full rounded border border-border bg-card shadow-lg p-1.5 space-y-1.5">
{searchInput}
{list}
</div>
@@ -19,19 +19,16 @@ type RawRow = {
title: string; // 카드이름
script: string; // 스크립트(평문 — 변수는 {변수} 텍스트로)
usage: string; // 카드용도 원문(공통/신규견적전용/재견적전용)
scope: string; // 공개범위 원문(개인/전체)
condition: string; // 와일드 전용 사용조건
memo: string; // 와일드 전용 메모
};
type ValidatedRow = RawRow & { status: '정상' | '오류'; message: string };
type TemplateRow = { kind: string; code: string; title: string; script: string; usage: string; scope: string; condition: string; memo: string };
type TemplateRow = { kind: string; code: string; title: string; script: string; usage: string; condition: string; memo: string };
// 카드종류 원문 → 와일드 여부. '와일드'/'wild' 포함이면 와일드, 그 외 협상.
const isWild = (kind: string) => /와일드|wild/i.test(kind.trim());
// 공개범위 원문 → 전체(공용) 여부. '전체'/'공용'/'all' 이면 공용, 그 외 개인.
const isShared = (scope: string) => /전체|공용|all/i.test(scope.trim());
// 카드용도 원문 → CardUsageType 코드. '신규'→NEW '재'→REUSE 그 외 COMMON.
function usageCode(usage: string): number {
const u = usage.trim();
@@ -59,8 +56,7 @@ function validateRows(rows: RawRow[], serverErrors: Record<string, string>): Val
if (serverErrors[row.code]) return fail(serverErrors[row.code]);
const kind = isWild(row.kind) ? '와일드' : '협상';
const scope = isShared(row.scope) ? '전체' : '개인';
return { ...row, status: '정상', message: `등록 적격 - ${kind}카드 · ${scope}` };
return { ...row, status: '정상', message: `등록 적격 - ${kind}카드` };
});
}
@@ -73,7 +69,6 @@ function toCardInput(row: RawRow): CardInput {
editorScript: deserialize(undefined, row.script),
status: 'ACTIVE',
isWildcard: wild,
isShared: isShared(row.scope),
usageType: usageCode(row.usage),
triggerCondition: wild ? row.condition : undefined,
memo: wild ? row.memo : undefined,
@@ -115,7 +110,6 @@ export function CardExcelUploadModal({ open, onConfirm, onClose }: CardExcelUplo
title: r['카드이름'] ?? '',
script: r['스크립트'] ?? '',
usage: r['카드용도'] ?? '',
scope: r['공개범위'] ?? '',
condition: r['사용조건'] ?? '',
memo: r['메모'] ?? '',
}));
@@ -244,7 +238,6 @@ export function CardExcelUploadModal({ open, onConfirm, onClose }: CardExcelUplo
<TableHead className="p-2 font-semibold">카드이름 *</TableHead>
<TableHead className="p-2 font-semibold">스크립트 *</TableHead>
<TableHead className="p-2 font-semibold w-16">용도</TableHead>
<TableHead className="p-2 font-semibold w-16">공개</TableHead>
</TableRow>
</TableHeader>
<TableBody className="divide-y divide-border">
@@ -304,9 +297,6 @@ export function CardExcelUploadModal({ open, onConfirm, onClose }: CardExcelUplo
<TableCell className="p-2 text-[10px] text-muted-foreground whitespace-nowrap">
{usageCode(row.usage) === CardUsageType.NEW ? '신규' : usageCode(row.usage) === CardUsageType.REUSE ? '재' : '공통'}
</TableCell>
<TableCell className="p-2 text-[10px] text-muted-foreground whitespace-nowrap">
{isShared(row.scope) ? '전체' : '개인'}
</TableCell>
</TableRow>
))}
</TableBody>
@@ -360,13 +350,12 @@ export function downloadCardTemplate() {
{ header: '카드이름', value: (r) => r.title },
{ header: '스크립트', value: (r) => r.script },
{ header: '카드용도', value: (r) => r.usage },
{ header: '공개범위', value: (r) => r.scope },
{ header: '사용조건', value: (r) => r.condition },
{ header: '메모', value: (r) => r.memo },
],
[
{ kind: '협상', code: 'CARD-EX-01', title: '예시) 최우수 등급 부여 카드', script: '귀사를 최우수 협력사로 지정하여 {목표가} 조건을 제안드립니다.', usage: '공통', scope: '개인', condition: '', memo: '' },
{ kind: '와일드', code: 'WILD-EX-01', title: '예시) 원자재 급등 대응 카드', script: '원자재 시세 급등에 따른 단가 재조정을 요청드립니다.', usage: '공통', scope: '전체', condition: '원부자재 시세가 계약일 대비 3.5% 상회 시', memo: '특정 원재료 포함 입찰에만 적용' },
{ kind: '협상', code: 'CARD-EX-01', title: '예시) 최우수 등급 부여 카드', script: '귀사를 최우수 협력사로 지정하여 {목표가} 조건을 제안드립니다.', usage: '공통', condition: '', memo: '' },
{ kind: '와일드', code: 'WILD-EX-01', title: '예시) 원자재 급등 대응 카드', script: '원자재 시세 급등에 따른 단가 재조정을 요청드립니다.', usage: '공통', condition: '원부자재 시세가 계약일 대비 3.5% 상회 시', memo: '특정 원재료 포함 입찰에만 적용' },
],
);
}
@@ -2,6 +2,7 @@ import { useForm, Controller } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';
import type { Descendant } from 'slate';
import { useAuthStore } from '@/stores/auth';
import { showToast } from '@/lib/notify';
import { Typography } from '@/components/ui/typography';
import { Button } from '@/components/ui/button';
@@ -16,7 +17,6 @@ import { CardScriptEditor, deserialize, serializeToText } from '../editor';
const schema = z.object({
isWildcard: z.boolean(),
isShared: z.boolean(),
usageType: z.number(),
code: z.string().trim().min(1, '카드번호는 필수 기입 사항입니다.'),
title: z.string().trim().min(1, '카드이름은 필수 기입 사항입니다.'),
@@ -49,7 +49,6 @@ function buildDefaults(
if (mode === 'edit' && card) {
return {
isWildcard: card.isWildcard,
isShared: card.isShared,
usageType: card.usageType,
code: card.code,
title: card.title,
@@ -63,7 +62,6 @@ function buildDefaults(
const wild = activeTab === 'WILD';
return {
isWildcard: wild,
isShared: false, // 기본: 개인(나만) — 전체 공용은 등록 시 명시 선택
usageType: CardUsageType.COMMON, // 기본: 공통(신규·재 모두)
code: generateCardCode(wild),
title: '',
@@ -101,6 +99,15 @@ export function CardFormSheet({
const isWildcard = watch('isWildcard');
// 수정·삭제 게이팅 — 공용(기본 제공) 카드는 누구도 불가, 개인 카드는 본인 또는 최고관리자만(백엔드와 동일 규칙).
const myUserId = useAuthStore((s) => s.user?.userId);
const isSuperAdmin = useAuthStore((s) => s.user?.role === '최고관리자');
const canMutate =
mode === 'create' || (!!card && !card.isShared && (card.userId === myUserId || isSuperAdmin));
const mutateBlockReason = card?.isShared
? '전체(공용) 카드는 수정·삭제할 수 없습니다.'
: '본인이 등록한 카드만 수정·삭제할 수 있습니다.';
const onValid = async (v: FormValues) => {
const input: CardInput = {
title: v.title,
@@ -108,7 +115,6 @@ export function CardFormSheet({
editorScript: v.editorScript,
status: v.status,
isWildcard: v.isWildcard,
isShared: v.isShared,
usageType: v.usageType,
triggerCondition: v.triggerCondition,
memo: v.memo,
@@ -241,34 +247,6 @@ export function CardFormSheet({
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
{/* 공개 범위(scope): 개인=나만 / 전체=모두 공용(user_id NULL). 등록 시에만 결정, 수정 시 고정 */}
<div className="space-y-1">
<Typography as="label" variant="small" className="font-semibold">공개 범위</Typography>
<Controller
control={control}
name="isShared"
render={({ field }) => (
<Select
value={field.value ? 'ALL' : 'MINE'}
onValueChange={(v) => {
if (mode !== 'create') return; // 스코프는 등록 시에만 결정(수정 시 이동 불가)
field.onChange(v === 'ALL');
}}
>
<SelectTrigger id="form-card-scope" className="w-full" disabled={mode === 'edit'}>
<SelectValue>
{(value) => (value === 'ALL' ? '전체 (모두 공용)' : '개인 (나만)')}
</SelectValue>
</SelectTrigger>
<SelectContent>
<SelectItem value="MINE">개인 (나만)</SelectItem>
<SelectItem value="ALL">전체 (모두 공용)</SelectItem>
</SelectContent>
</Select>
)}
/>
</div>
{/* 카드 용도(usage_type): 공통 / 신규전용 / 재전용 */}
<div className="space-y-1">
<Typography as="label" variant="small" className="font-semibold">카드 용도</Typography>
@@ -354,13 +332,15 @@ export function CardFormSheet({
</div>
)}
{/* Footer — 다른 폼 sheet와 동일: 좌측 삭제(edit), 우측 취소/저장 */}
{/* Footer — 다른 폼 sheet와 동일: 좌측 삭제(edit), 우측 취소/저장. 권한 없으면 비활성(툴팁 사유) */}
<div className="pt-4 flex items-center justify-between gap-2 border-t border-border mt-8">
{mode === 'edit' && card && (
<Button
type="button"
variant="destructive"
size="sm"
disabled={!canMutate}
title={canMutate ? undefined : mutateBlockReason}
onClick={() => {
onDelete(card.id, card.title);
onClose();
@@ -373,7 +353,13 @@ export function CardFormSheet({
<Button type="button" variant="outline" size="sm" onClick={onClose}>
취소
</Button>
<Button type="submit" id="form-card-submit" size="sm" disabled={isSubmitting}>
<Button
type="submit"
id="form-card-submit"
size="sm"
disabled={isSubmitting || !canMutate}
title={canMutate ? undefined : mutateBlockReason}
>
{mode === 'create' ? '저장' : '수정'}
</Button>
</div>
@@ -21,24 +21,16 @@ export function CardTable({ data, onEdit, footer }: CardTableProps) {
{
header: '구분',
headClassName: 'w-24',
cell: (card) => (
<div className="flex flex-col items-start gap-1">
{card.isWildcard ? (
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-bold bg-rose-50 text-rose-700 dark:bg-rose-950/20 dark:text-rose-400 border border-rose-200/40">
와일드카드
</span>
) : (
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-bold bg-blue-50 text-blue-700 dark:bg-blue-950/20 dark:text-blue-400 border border-blue-200/40">
협상카드
</span>
)}
{card.isShared && (
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-bold bg-violet-50 text-violet-700 dark:bg-violet-950/20 dark:text-violet-400 border border-violet-200/40">
전체
</span>
)}
</div>
),
cell: (card) =>
card.isWildcard ? (
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-bold bg-rose-50 text-rose-700 dark:bg-rose-950/20 dark:text-rose-400 border border-rose-200/40">
와일드카드
</span>
) : (
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-bold bg-blue-50 text-blue-700 dark:bg-blue-950/20 dark:text-blue-400 border border-blue-200/40">
협상카드
</span>
),
},
{
header: '카드번호',
@@ -22,24 +22,24 @@ export type CardInput = {
editorScript: Descendant[];
status: 'ACTIVE' | 'INACTIVE';
isWildcard: boolean;
isShared: boolean; // 전체(공용, user_id NULL) 등록 여부. 등록 시에만 유효(수정 시 스코프 고정)
usageType: number; // usage_type(CardUsageType): 1=공통 2=신규견적전용 3=재견적전용
triggerCondition?: string;
memo?: string;
};
// 서버 공통응답(result.success=false)을 한글 사유로 변환. 정상이면 null.
// msg(권한 사유 등 사람용 문구)가 있으면 우선, 없으면 에러코드명(desc).
function cardError(res: ResCard): string | null {
const r = res.result;
if (!r || r.success !== false) return null;
return r.desc || '카드 저장에 실패했습니다.';
return (typeof res.msg === 'string' && res.msg) || r.desc || '카드 저장에 실패했습니다.';
}
// UI 입력 → 서버 요청 본문. 와일드카드 전용 필드(condition/memo)는 isWildcard 일 때만 전송.
// 공용(is_shared) 등록은 폐지 — 카드는 항상 등록자 개인(회사 공유) 소유.
function toReq(input: CardInput): ReqCreateCard {
return {
is_wildcard: input.isWildcard,
is_shared: input.isShared,
usage_type: input.usageType,
name: input.title,
number: input.code,
@@ -72,7 +72,10 @@ export function useCards(params: ListCardsParams) {
await refresh();
};
const deleteCardFn = async (id: string) => {
await deleteCard(id);
const res = await deleteCard(id);
if (res.result?.success === false) {
throw new Error((typeof res.msg === 'string' && res.msg) || res.result.desc || '카드 삭제에 실패했습니다.');
}
await refresh();
};
@@ -18,6 +18,7 @@ export function mapCardData(c: CardData): NegotiationCard {
id: c.nego_card_id,
isWildcard: c.is_wildcard ?? false,
isShared: c.is_shared ?? false,
userId: c.user_id ?? undefined,
usageType: c.usage_type ?? CardUsageType.COMMON,
code: c.number ?? '',
title: c.name ?? '',
@@ -27,13 +27,34 @@ import {
import { supplierTypeLabel } from '@/lib/enumLabels';
import { showToast } from '@/lib/notify';
// datetime-local 디폴트값: 현재 한국시간(Asia/Seoul)의 'YYYY-MM-DDTHH:mm'.
const INTERNET_AVERAGE_FEE = 0.078;
const TARGET_PRICE_UNIT_LIMIT_MULTIPLIER = 2;
// datetime-local 값: 한국시간(Asia/Seoul)의 'YYYY-MM-DDTHH:mm'.
// sv-SE 로케일이 'YYYY-MM-DD HH:mm:ss' 를 주고, timeZone 명시로 브라우저 TZ 와 무관하게 KST 로 고정한다.
function nowKstLocalInput(): string {
const s = new Date().toLocaleString('sv-SE', { timeZone: 'Asia/Seoul' });
function toKstLocalInput(date: Date): string {
const s = date.toLocaleString('sv-SE', { timeZone: 'Asia/Seoul' });
return s.slice(0, 16).replace(' ', 'T');
}
function nowKstLocalInput(): string {
return toKstLocalInput(new Date());
}
function defaultDueDateLocalInput(): string {
return toKstLocalInput(new Date(Date.now() + 60 * 60 * 1000));
}
function isFutureLocalInput(value: string): boolean {
const time = new Date(value).getTime();
return Number.isFinite(time) && time > Date.now();
}
function parsePercent(value: string | undefined): number {
const n = Number(String(value ?? '').replace('%', '').trim());
return Number.isFinite(n) ? n / 100 : 0;
}
type QuotationCreateModalProps = {
open: boolean;
products: Product[];
@@ -62,7 +83,7 @@ export function QuotationCreateModal({
const [isNew, setIsNew] = useState(true); // 신규 / 후속(재)
const [productId, setProductId] = useState('');
const [selectedPartnerIds, setSelectedPartnerIds] = useState<string[]>([]);
const [dueDate, setDueDate] = useState(nowKstLocalInput);
const [dueDate, setDueDate] = useState(defaultDueDateLocalInput);
const [settingId, setSettingId] = useState(quotationSettings[0]?.qt_setting_id ?? '');
const [selectedCardIds, setSelectedCardIds] = useState<string[]>([]);
// 선택 항목 표시데이터 캐시 — 담는 순간 이름/이메일·카드메타를 적재해, 검색어가 바뀌어 콤보 목록에서 빠져도 아래 선택 테이블이 유지되게 한다.
@@ -97,6 +118,7 @@ export function QuotationCreateModal({
// 선택 상품은 검색으로 목록이 좁혀져도 파생값(목표가 후보)이 안 깨지게 id로 단건 조회한다.
const selItem = useGetItem(productId, { query: { enabled: !!productId } }).data?.item ?? null;
// 인터넷최저가·매입가·판매가는 상품 속성 — 모달에선 읽기전용으로만 보여주고, 수정은 상품 상세에서 한다.
const unitPrice = selItem?.price ?? null;
const internetLowest = selItem?.internet_lowest_price ?? null;
const purchase = selItem?.purchase_price ?? null;
const selling = selItem?.selling_price ?? null;
@@ -167,6 +189,20 @@ export function QuotationCreateModal({
const mdRequired = !!productId && !hasItemCandidate;
// 목표가 산정 가능 여부: MD가가 있으면 무조건 OK. 없으면 상품 후보 중 하나라도 있어야.
const targetReady = mdNum > 0 || hasItemCandidate;
const selectedSetting = quotationSettings.find((s) => s.qt_setting_id === settingId);
const margin = parsePercent(selectedSetting?.target_margin);
const targetCandidates = mdNum > 0
? [mdNum]
: [
internetLowest != null ? internetLowest * (1 - INTERNET_AVERAGE_FEE) : null,
!isReType || purchase == null ? null : purchase,
!isReType || selling == null ? null : selling * (1 - margin),
].filter((v): v is number => v != null && v > 0);
const estimatedTargetPrice = targetCandidates.length ? Math.trunc(Math.min(...targetCandidates)) : null;
const targetPriceLimit = unitPrice != null && unitPrice > 0
? unitPrice * TARGET_PRICE_UNIT_LIMIT_MULTIPLIER
: null;
const targetLimitExceeded = targetPriceLimit != null && estimatedTargetPrice != null && estimatedTargetPrice > targetPriceLimit;
if (!open) return null;
@@ -206,6 +242,14 @@ export function QuotationCreateModal({
showToast('목표가 산정에 쓸 값이 없습니다 — MD 제시가를 입력하거나, 상품 상세에서 인터넷최저가·매입가를 채워주세요.', 'error');
return; // finally 에서 submitting 해제
}
if (!isFutureLocalInput(dueDate)) {
showToast('마감기한은 현재 시각보다 나중으로 설정해 주세요.', 'error');
return;
}
if (targetLimitExceeded) {
showToast('목표가는 상품단가의 2배를 초과할 수 없습니다.', 'error');
return;
}
// 낙찰 기준은 1:1 협상만 전송(경매는 미전송 → 서버가 mid=over=AWARD 강제). 카드도 1:1 전용.
const ok = await onCreate({
title,
@@ -303,6 +347,7 @@ export function QuotationCreateModal({
type="datetime-local"
className="w-full p-2 bg-background border border-border rounded text-xs"
value={dueDate}
min={nowKstLocalInput()}
onChange={(e) => setDueDate(e.target.value)}
/>
</div>
@@ -382,11 +427,29 @@ export function QuotationCreateModal({
</div>
))}
</div>
<div className="grid grid-cols-2 gap-2 border-t border-border/60 pt-2">
{[
{ label: '상품단가', value: unitPrice },
{ label: '목표가 상한', value: targetPriceLimit },
].map((r) => (
<div key={r.label} className="space-y-0.5">
<Typography as="span" variant="label" className="text-muted-foreground">{r.label}</Typography>
<Typography as="span" variant="small" className="font-mono block">
{r.value != null ? `₩${Number(r.value).toLocaleString()}` : '-'}
</Typography>
</div>
))}
</div>
{!targetReady && (
<Typography as="p" variant="small" className="text-rose-600 leading-snug">
⚠ MD 제시가도 없고 상품에 산정할 값도 없습니다 — MD가를 입력하거나 위 ‘상품 상세에서 수정’으로 값을 채워야 목표가가 나옵니다.
</Typography>
)}
{targetLimitExceeded && (
<Typography as="p" variant="small" className="text-rose-600 leading-snug">
목표가 예상값 ₩{estimatedTargetPrice?.toLocaleString()}이 상품단가의 2배를 초과합니다 — MD 제시가 또는 상품 가격 정보를 조정해 주세요.
</Typography>
)}
</div>
)}
</div>
@@ -545,6 +608,14 @@ export function QuotationCreateModal({
showToast('목표가 산정에 쓸 값이 없습니다 — MD 제시가를 입력하거나 상품 상세에서 값을 채워주세요.', 'error');
return;
}
if (step === 1 && !isFutureLocalInput(dueDate)) {
showToast('마감기한은 현재 시각보다 나중으로 설정해 주세요.', 'error');
return;
}
if (step === 1 && targetLimitExceeded) {
showToast('목표가는 상품단가의 2배를 초과할 수 없습니다.', 'error');
return;
}
setStep((prev) => prev + 1);
}}
>
@@ -13,7 +13,6 @@ export function QuotationCardsTab({ quotationCardViews }: { quotationCardViews:
<Table className="w-full text-left text-xs border-collapse font-mono">
<TableHeader className="bg-muted text-muted-foreground text-[10px] border-b border-border">
<TableRow>
<TableHead className="p-3 font-semibold">세션 카드 ID</TableHead>
<TableHead className="p-3 font-semibold font-sans">카드 이름</TableHead>
<TableHead className="p-3 font-semibold font-sans">타입</TableHead>
</TableRow>
@@ -22,7 +21,6 @@ export function QuotationCardsTab({ quotationCardViews }: { quotationCardViews:
{quotationCardViews.length > 0 ? (
quotationCardViews.map((qc) => (
<TableRow key={qc.session_card_id} className="hover:bg-muted/30 transition-colors text-[11px]">
<TableCell className="p-3 text-muted-foreground">{qc.session_card_id}</TableCell>
<TableCell className="p-3 text-foreground font-sans font-semibold">
{qc.card_id ? (
<Link
@@ -45,7 +43,7 @@ export function QuotationCardsTab({ quotationCardViews }: { quotationCardViews:
))
) : (
<TableRow>
<TableCell colSpan={3} className="p-12 text-center text-muted-foreground">
<TableCell colSpan={2} className="p-12 text-center text-muted-foreground">
사용된 협상 카드가 없습니다. (리스트가 비어 있습니다)
</TableCell>
</TableRow>
@@ -83,7 +83,7 @@ export function TargetPriceModal({
</Typography>
{bd.is_inherited && (
<Typography as="p" variant="small" className="text-[10px] text-amber-600">
* 저장된 목표가가 현재 후보 최소값과 다름 — 재생성 상속 또는 산정 후 상품·세팅 변경(아래 후보는 현재값 기준 참고용)
* 저장된 목표가와 일치하는 현재 후보 없음 — 재생성 상속 또는 산정 후 상품·세팅 변경(아래 후보는 현재값 기준 참고용)
</Typography>
)}
</div>
+2 -1
View File
@@ -5,9 +5,10 @@ export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
// 문자열에서 금액(원/₩) 표기의 숫자만 '***'로 가린다. 접미사·문장 구조는 유지.
// 문자열에서 금액(원/₩)·비율(%) 표기의 숫자만 '***'로 가린다. 접미사·문장 구조는 유지.
export function maskPrices(text: string): string {
return text
.replace(/₩\s?[0-9][0-9,]*/g, "₩***")
.replace(/[0-9][0-9,]*\s*(?=원)/g, "***")
.replace(/[0-9]+(?:\.[0-9]+)?\s*(?=%)/g, "***")
}
+1 -1
View File
@@ -69,7 +69,7 @@ export default function CardsPage() {
<div>
<Typography variant="h3" className="text-xs">협상카드 및 와일드카드 관리</Typography>
<Typography variant="muted" className="text-[10px] mt-0.5">
본인 카드와 전체(공용) 카드를 함께 조회·관리합니다. 전체 카드는 모든 사용자에게 공유됩니다.
우리 회사 카드와 기본 제공(공용) 카드를 함께 조회합니다. 공용 카드는 수정·삭제할 수 없습니다.
</Typography>
</div>
</div>
+2 -1
View File
@@ -22,7 +22,8 @@ export type Partner = SupplierData & {
export interface NegotiationCard {
id: string;
isWildcard: boolean;
isShared: boolean; // 전체(공용, user_id NULL) 카드 여부 — 개인 카드는 false
isShared: boolean; // 전체(공용, user_id NULL) 카드 여부 — 공용은 수정·삭제 불가(기본 제공 자산)
userId?: string; // 등록자 user_id. 수정·삭제 게이팅(본인∪최고관리자) 판정용. 공용 카드는 없음
usageType: number; // usage_type(CardUsageType): 1=공통 2=신규견적전용 3=재견적전용
code: string;
title: string;