[feat] negodata/front: 협상대화 카드내용 렌더 + 견적상세 헤더·테이블 UI 정리
- 협상대화: 사용 카드 번호/멘트(Slate 서식본)/와일드 조건·메모 표시, SlateRenderer
밑줄·헥스색·{변수} 치환 보정, 말풍선 우측정렬·발신자 아바타 제거
- 견적상세 헤더: DB 컬럼명 라벨 제거, 견적정보/(진행상태+세팅)/상품(이미지) 2열 재배치,
협상카드 탭에 사용 카드 수 표시
- DataTable 행 패딩 축소, 협력사명 아바타 제거, 카드관리 본인 카드 안내문
- orval 재생성(QuotationCardData 신규 필드)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
df68609c49
commit
7186446068
114 files changed
+4731
-5537
No files matched your search
@@ -1,36 +1,33 @@
|
||||
import { useState } from 'react';
|
||||
import { Plus, BookOpen } from 'lucide-react';
|
||||
import { useOverlayParams } from '@/lib/useOverlayParams';
|
||||
import { showToast } from '@/lib/notify';
|
||||
import { confirm } from '@/lib/confirm';
|
||||
import { PageContainer } from '@/components/layout/PageContainer';
|
||||
import { SearchInput } from '@/components/layout/PageToolbar';
|
||||
import { Typography } from '@/components/ui/typography';
|
||||
import { useCards } from '@/features/cards/hooks/useCards';
|
||||
import { useCardFilters } from '@/features/cards/hooks/useCardFilters';
|
||||
import { CardTable } from '@/features/cards/components/CardTable';
|
||||
import { CardFormModal } from '@/features/cards/components/CardFormModal';
|
||||
import { CardFormSheet } from '@/features/cards/components/CardFormSheet';
|
||||
import type { CardTab, NegotiationCard } from '@/features/cards/types';
|
||||
|
||||
export default function CardsPage() {
|
||||
const { cards, createCard, updateCard, deleteCard } = useCards();
|
||||
const { search, setSearch, activeTab, setActiveTab, filtered, counts } = useCardFilters(cards);
|
||||
|
||||
const [isFormOpen, setIsFormOpen] = useState(false);
|
||||
const [formMode, setFormMode] = useState<'create' | 'edit'>('create');
|
||||
const [editing, setEditing] = useState<NegotiationCard | null>(null);
|
||||
// 오버레이(폼)를 쿼리스트링으로 → 딥링크·뒤로가기·새로고침 지원.
|
||||
// ?edit=<id> 직접 접근 시 데이터 로드 후 수정 폼이 자동으로 열린다.
|
||||
const overlay = useOverlayParams(['new', 'edit']);
|
||||
const editId = overlay.get('edit');
|
||||
const editing = editId ? cards.find((c) => c.id === editId) ?? null : null;
|
||||
const formMode: 'create' | 'edit' = editId ? 'edit' : 'create';
|
||||
const isFormOpen = overlay.has('new') || !!editing;
|
||||
|
||||
const openCreate = () => {
|
||||
setFormMode('create');
|
||||
setEditing(null);
|
||||
setIsFormOpen(true);
|
||||
};
|
||||
const openEdit = (card: NegotiationCard) => {
|
||||
setFormMode('edit');
|
||||
setEditing(card);
|
||||
setIsFormOpen(true);
|
||||
};
|
||||
const openCreate = () => overlay.open('new');
|
||||
const openEdit = (card: NegotiationCard) => overlay.open('edit', card.id);
|
||||
|
||||
const handleDeleteCard = async (id: string, cardName: string) => {
|
||||
if (confirm(`[${cardName}]을 삭제하시겠습니까?`)) {
|
||||
if (await confirm({ title: '카드 삭제', description: `[${cardName}]을 삭제하시겠습니까?`, confirmText: '삭제', destructive: true })) {
|
||||
try {
|
||||
await deleteCard(id);
|
||||
showToast('삭제되었습니다.', 'info');
|
||||
@@ -55,7 +52,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>
|
||||
@@ -96,10 +93,10 @@ export default function CardsPage() {
|
||||
placeholder="전체 카드이름, 카드번호, 코드 및 핵심멘트 검색..."
|
||||
/>
|
||||
|
||||
<CardTable data={filtered} onEdit={openEdit} onDelete={handleDeleteCard} />
|
||||
<CardTable data={filtered} onEdit={openEdit} />
|
||||
|
||||
{isFormOpen && (
|
||||
<CardFormModal
|
||||
<CardFormSheet
|
||||
key={`${formMode}-${editing?.id ?? 'new'}`}
|
||||
open
|
||||
mode={formMode}
|
||||
@@ -107,7 +104,8 @@ export default function CardsPage() {
|
||||
activeTab={activeTab}
|
||||
onCreate={createCard}
|
||||
onUpdate={updateCard}
|
||||
onClose={() => setIsFormOpen(false)}
|
||||
onDelete={handleDeleteCard}
|
||||
onClose={overlay.close}
|
||||
/>
|
||||
)}
|
||||
</PageContainer>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useState } from 'react';
|
||||
import { Plus, Upload } from 'lucide-react';
|
||||
import { useOverlayParams } from '@/lib/useOverlayParams';
|
||||
import { showToast } from '@/lib/notify';
|
||||
import { confirm } from '@/lib/confirm';
|
||||
import { PageContainer } from '@/components/layout/PageContainer';
|
||||
import { PageToolbar, SearchInput } from '@/components/layout/PageToolbar';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
@@ -28,24 +29,20 @@ export default function PartnersPage() {
|
||||
usePartners(params);
|
||||
const totalPages = list.totalPages(total);
|
||||
|
||||
// 모달 제어 + 폼 컨텍스트
|
||||
const [openModal, setOpenModal] = useState<null | 'form' | 'excel'>(null);
|
||||
const [formMode, setFormMode] = useState<'create' | 'edit'>('create');
|
||||
const [editing, setEditing] = useState<Partner | null>(null);
|
||||
// 오버레이(폼/엑셀)를 쿼리스트링으로 → 딥링크·뒤로가기·새로고침 지원.
|
||||
// ?edit=<id> 직접 접근 시 데이터 로드 후 수정 폼이 자동으로 열린다.
|
||||
const overlay = useOverlayParams(['new', 'edit', 'modal']);
|
||||
const editId = overlay.get('edit');
|
||||
const modal = overlay.get('modal'); // 'excel' | null
|
||||
const editing = editId ? allPartners.find((p) => p.supplier_id === editId) ?? null : null;
|
||||
const formMode: 'create' | 'edit' = editId ? 'edit' : 'create';
|
||||
const isFormOpen = overlay.has('new') || !!editing;
|
||||
|
||||
const openCreate = () => {
|
||||
setFormMode('create');
|
||||
setEditing(null);
|
||||
setOpenModal('form');
|
||||
};
|
||||
const openEdit = (part: Partner) => {
|
||||
setFormMode('edit');
|
||||
setEditing(part);
|
||||
setOpenModal('form');
|
||||
};
|
||||
const openCreate = () => overlay.open('new');
|
||||
const openEdit = (part: Partner) => overlay.open('edit', part.supplier_id);
|
||||
|
||||
const handleDeletePartner = async (id: string, partnerName: string) => {
|
||||
if (confirm(`[${partnerName}] 파트너사를 협력사 목록에서 삭제하시겠습니까?`)) {
|
||||
if (await confirm({ title: '협력사 삭제', description: `[${partnerName}] 파트너사를 협력사 목록에서 삭제하시겠습니까?`, confirmText: '삭제', destructive: true })) {
|
||||
try {
|
||||
await deletePartner(id);
|
||||
showToast('협력사 정보가 명부에서 제거되었습니다.', 'info');
|
||||
@@ -60,7 +57,7 @@ export default function PartnersPage() {
|
||||
<PageToolbar
|
||||
actions={
|
||||
<>
|
||||
<Button variant="outline" onClick={() => setOpenModal('excel')}>
|
||||
<Button variant="outline" onClick={() => overlay.open('modal', 'excel')}>
|
||||
<Upload />
|
||||
엑셀 일괄 업로드
|
||||
</Button>
|
||||
@@ -105,7 +102,7 @@ export default function PartnersPage() {
|
||||
onPageChange={list.setPage}
|
||||
/>
|
||||
|
||||
{openModal === 'form' && (
|
||||
{isFormOpen && (
|
||||
<PartnerFormSheet
|
||||
key={`${formMode}-${editing?.supplier_id ?? 'new'}`}
|
||||
open
|
||||
@@ -114,16 +111,16 @@ export default function PartnersPage() {
|
||||
onCreate={createPartner}
|
||||
onUpdate={updatePartner}
|
||||
onDelete={handleDeletePartner}
|
||||
onClose={() => setOpenModal(null)}
|
||||
onClose={overlay.close}
|
||||
/>
|
||||
)}
|
||||
|
||||
{openModal === 'excel' && (
|
||||
{modal === 'excel' && (
|
||||
<ExcelUploadModal
|
||||
open
|
||||
partners={allPartners}
|
||||
onConfirm={bulkCreate}
|
||||
onClose={() => setOpenModal(null)}
|
||||
onClose={overlay.close}
|
||||
/>
|
||||
)}
|
||||
</PageContainer>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
import { Plus, Upload, TrendingDown } from 'lucide-react';
|
||||
import { useOverlayParams } from '@/lib/useOverlayParams';
|
||||
import { showToast } from '@/lib/notify';
|
||||
import { confirm } from '@/lib/confirm';
|
||||
import { PageContainer } from '@/components/layout/PageContainer';
|
||||
import { PageToolbar, SearchInput } from '@/components/layout/PageToolbar';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
@@ -43,24 +45,20 @@ export default function ProductsPage() {
|
||||
// 행 선택(테이블 체크박스 + 최저가 모달 대상)
|
||||
const [selectedIds, setSelectedIds] = useState<string[]>([]);
|
||||
|
||||
// 모달 제어 + 폼 컨텍스트
|
||||
const [openModal, setOpenModal] = useState<null | 'form' | 'price' | 'excel'>(null);
|
||||
const [formMode, setFormMode] = useState<'create' | 'edit'>('create');
|
||||
const [editing, setEditing] = useState<Product | null>(null);
|
||||
// 오버레이(폼/최저가/엑셀)를 쿼리스트링으로 → 딥링크·뒤로가기·새로고침 지원.
|
||||
// ?edit=<id> 직접 접근 시 데이터 로드 후 수정 폼이 자동으로 열린다.
|
||||
const overlay = useOverlayParams(['new', 'edit', 'modal']);
|
||||
const editId = overlay.get('edit');
|
||||
const modal = overlay.get('modal'); // 'price' | 'excel' | null
|
||||
const editing = editId ? allProducts.find((p) => p.item_id === editId) ?? null : null;
|
||||
const formMode: 'create' | 'edit' = editId ? 'edit' : 'create';
|
||||
const isFormOpen = overlay.has('new') || !!editing;
|
||||
|
||||
const openCreate = () => {
|
||||
setFormMode('create');
|
||||
setEditing(null);
|
||||
setOpenModal('form');
|
||||
};
|
||||
const openEdit = (prod: Product) => {
|
||||
setFormMode('edit');
|
||||
setEditing(prod);
|
||||
setOpenModal('form');
|
||||
};
|
||||
const openCreate = () => overlay.open('new');
|
||||
const openEdit = (prod: Product) => overlay.open('edit', prod.item_id);
|
||||
|
||||
const handleDeleteProduct = async (id: string, prodName: string) => {
|
||||
if (confirm(`[${prodName}] 상품 정보를 완전 삭제하시겠습니까?`)) {
|
||||
if (await confirm({ title: '상품 삭제', description: `[${prodName}] 상품 정보를 완전 삭제하시겠습니까?`, confirmText: '삭제', destructive: true })) {
|
||||
try {
|
||||
await deleteProduct(id);
|
||||
showToast('상품 정보가 대시보드에서 제거되었습니다.', 'info');
|
||||
@@ -78,14 +76,14 @@ export default function ProductsPage() {
|
||||
<Button
|
||||
variant="outline"
|
||||
disabled={selectedIds.length === 0}
|
||||
onClick={() => setOpenModal('price')}
|
||||
onClick={() => overlay.open('modal', 'price')}
|
||||
>
|
||||
<TrendingDown />
|
||||
최저가 업데이트하기
|
||||
{selectedIds.length > 0 && <Badge variant="destructive">{selectedIds.length}</Badge>}
|
||||
</Button>
|
||||
|
||||
<Button variant="outline" onClick={() => setOpenModal('excel')}>
|
||||
<Button variant="outline" onClick={() => overlay.open('modal', 'excel')}>
|
||||
<Upload />
|
||||
엑셀 일괄 업로드
|
||||
</Button>
|
||||
@@ -132,7 +130,7 @@ export default function ProductsPage() {
|
||||
onPageChange={list.setPage}
|
||||
/>
|
||||
|
||||
{openModal === 'form' && (
|
||||
{isFormOpen && (
|
||||
<ProductFormSheet
|
||||
key={`${formMode}-${editing?.item_id ?? 'new'}`}
|
||||
open
|
||||
@@ -144,26 +142,26 @@ export default function ProductsPage() {
|
||||
onCreate={createProduct}
|
||||
onUpdate={updateProduct}
|
||||
onDelete={handleDeleteProduct}
|
||||
onClose={() => setOpenModal(null)}
|
||||
onClose={overlay.close}
|
||||
/>
|
||||
)}
|
||||
|
||||
{openModal === 'price' && (
|
||||
{modal === 'price' && (
|
||||
<PriceUpdateModal
|
||||
open
|
||||
products={allProducts}
|
||||
selectedIds={selectedIds}
|
||||
onDone={() => setSelectedIds([])}
|
||||
onClose={() => setOpenModal(null)}
|
||||
onClose={overlay.close}
|
||||
/>
|
||||
)}
|
||||
|
||||
{openModal === 'excel' && (
|
||||
{modal === 'excel' && (
|
||||
<ExcelUploadModal
|
||||
open
|
||||
products={allProducts}
|
||||
onConfirm={bulkCreate}
|
||||
onClose={() => setOpenModal(null)}
|
||||
onClose={overlay.close}
|
||||
/>
|
||||
)}
|
||||
</PageContainer>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { Settings, Plus } from 'lucide-react';
|
||||
import { useOverlayParams } from '@/lib/useOverlayParams';
|
||||
import { PageContainer } from '@/components/layout/PageContainer';
|
||||
import { PageToolbar, SearchInput } from '@/components/layout/PageToolbar';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
@@ -27,9 +27,12 @@ export default function QuotationPage() {
|
||||
const { search, setSearch, statusFilter, setStatusFilter, typeFilter, setTypeFilter, filtered } =
|
||||
useQuotationFilters(quotations);
|
||||
|
||||
const [detailId, setDetailId] = useState<string | null>(null);
|
||||
const [isCreateOpen, setIsCreateOpen] = useState(false);
|
||||
const [isSettingsOpen, setIsSettingsOpen] = useState(false);
|
||||
// 오버레이(상세/생성/세팅)를 쿼리스트링으로 → 딥링크·뒤로가기·새로고침 지원.
|
||||
// ?detail=<id> 로 직접 접근하면 데이터 로드 후 상세가 자동으로 열린다.
|
||||
const overlay = useOverlayParams(['detail', 'create', 'settings']);
|
||||
const detailId = overlay.get('detail');
|
||||
const isCreateOpen = overlay.has('create');
|
||||
const isSettingsOpen = overlay.has('settings');
|
||||
|
||||
const activeQuotation = quotations.find((e) => e.id === detailId) ?? null;
|
||||
|
||||
@@ -40,7 +43,7 @@ export default function QuotationPage() {
|
||||
<>
|
||||
<button
|
||||
id="quotation-settings-btn"
|
||||
onClick={() => setIsSettingsOpen(true)}
|
||||
onClick={() => overlay.open('settings')}
|
||||
className="flex items-center gap-2 px-3 py-2.5 bg-muted text-foreground border border-border text-xs font-semibold rounded hover:bg-muted-foreground/10 cursor-pointer transition-colors"
|
||||
>
|
||||
<Settings size={14} />
|
||||
@@ -49,7 +52,7 @@ export default function QuotationPage() {
|
||||
|
||||
<button
|
||||
id="quotation-create-btn"
|
||||
onClick={() => setIsCreateOpen(true)}
|
||||
onClick={() => overlay.open('create')}
|
||||
className="flex items-center gap-2 px-4 py-2.5 bg-primary text-primary-foreground text-xs font-bold rounded hover:opacity-95 cursor-pointer transition-colors animate-pulse"
|
||||
>
|
||||
<Plus size={15} />
|
||||
@@ -96,8 +99,7 @@ export default function QuotationPage() {
|
||||
<QuotationTable
|
||||
data={filtered}
|
||||
products={products}
|
||||
onOpenDetail={setDetailId}
|
||||
onStop={stopNegotiation}
|
||||
onOpenDetail={(id) => overlay.open('detail', id)}
|
||||
/>
|
||||
|
||||
{activeQuotation && (
|
||||
@@ -108,7 +110,7 @@ export default function QuotationPage() {
|
||||
partners={partners}
|
||||
quotationSettings={quotationSettings}
|
||||
onStop={stopNegotiation}
|
||||
onClose={() => setDetailId(null)}
|
||||
onClose={overlay.close}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -120,7 +122,7 @@ export default function QuotationPage() {
|
||||
cards={cards}
|
||||
quotationSettings={quotationSettings}
|
||||
onCreate={createQuotation}
|
||||
onClose={() => setIsCreateOpen(false)}
|
||||
onClose={overlay.close}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -130,7 +132,7 @@ export default function QuotationPage() {
|
||||
settings={quotationSettings}
|
||||
onAdd={addSetting}
|
||||
onDelete={deleteSetting}
|
||||
onClose={() => setIsSettingsOpen(false)}
|
||||
onClose={overlay.close}
|
||||
/>
|
||||
)}
|
||||
</PageContainer>
|
||||
|
||||
Reference in new issue
Block a user