diff options
| -rw-r--r-- | lib/bidding/approval-actions.ts | 19 | ||||
| -rw-r--r-- | lib/bidding/service.ts | 3 | ||||
| -rw-r--r-- | lib/bidding/vendor/partners-bidding-list-columns.tsx | 8 | ||||
| -rw-r--r-- | lib/tech-project-avl/table/accepted-quotations-table-toolbar-actions.tsx | 37 |
4 files changed, 49 insertions, 18 deletions
diff --git a/lib/bidding/approval-actions.ts b/lib/bidding/approval-actions.ts index 6f02e80c..9a37d83b 100644 --- a/lib/bidding/approval-actions.ts +++ b/lib/bidding/approval-actions.ts @@ -334,6 +334,12 @@ export async function requestBiddingClosureWithApproval(data: { debugError('[BiddingClosureApproval] 폐찰 사유 없음'); throw new Error('폐찰 사유를 입력해주세요'); } + // 2. DB 및 스키마 import (입찰초대 결재 로직 패턴과 동일) + debugLog('[BiddingClosureApproval] DB 연결 및 스키마 import'); + const { default: db } = await import('@/db/db'); + const { biddings } = await import('@/db/schema'); + const { eq } = await import('drizzle-orm'); + // 유찰상태인지 확인 const { bidding } = await db .select() @@ -346,16 +352,13 @@ export async function requestBiddingClosureWithApproval(data: { throw new Error('유찰 상태인 입찰만 폐찰할 수 있습니다.'); } - // 2. 입찰 상태를 결재 진행중으로 변경 + // 3. 입찰 상태를 결재 진행중으로 변경 debugLog('[BiddingClosureApproval] 입찰 상태 변경 시작'); - const { default: db } = await import('@/db/db'); - const { biddings } = await import('@/db/schema'); - const { eq } = await import('drizzle-orm'); await db .update(biddings) .set({ - status: 'closure_pending', // 폐찰 결재 진행중 상태 + status: 'approval_pending', // 폐찰 결재 진행중 상태 updatedBy: data.currentUser.epId, updatedAt: new Date() }) @@ -363,7 +366,7 @@ export async function requestBiddingClosureWithApproval(data: { debugLog('[BiddingClosureApproval] 입찰 상태 변경 완료', { biddingId: data.biddingId, - newStatus: 'closure_pending' + newStatus: 'approval_pending' }); // 3. 결재 데이터 준비 @@ -510,7 +513,7 @@ export async function requestBiddingAwardWithApproval(data: { await db .update(biddings) .set({ - status: 'award_pending', // 낙찰 결재 진행중 상태 + status: 'approval_pending', // 낙찰 결재 진행중 상태 updatedBy: data.currentUser.epId, updatedAt: new Date() }) @@ -518,7 +521,7 @@ export async function requestBiddingAwardWithApproval(data: { debugLog('[BiddingAwardApproval] 입찰 상태 변경 완료', { biddingId: data.biddingId, - newStatus: 'award_pending' + newStatus: 'approval_pending' }); // 3. 결재 데이터 준비 diff --git a/lib/bidding/service.ts b/lib/bidding/service.ts index fe37eaea..d1a0d25c 100644 --- a/lib/bidding/service.ts +++ b/lib/bidding/service.ts @@ -31,7 +31,8 @@ import { lte, SQL, like, - notInArray + notInArray, + inArray } from 'drizzle-orm' import { revalidatePath } from 'next/cache' import { filterColumns } from '@/lib/filter-columns' diff --git a/lib/bidding/vendor/partners-bidding-list-columns.tsx b/lib/bidding/vendor/partners-bidding-list-columns.tsx index 8cbddb3d..a090c3fe 100644 --- a/lib/bidding/vendor/partners-bidding-list-columns.tsx +++ b/lib/bidding/vendor/partners-bidding-list-columns.tsx @@ -171,12 +171,12 @@ export function getPartnersBiddingListColumns({ setRowAction }: PartnersBiddingL const handleView = () => { // 입찰기간 체크 (현 시간 기준으로 입찰기간 시작 전이면 접근 불가) const now = new Date() - const startDate = row.original.submissionStartDate ? new Date(row.original.submissionStartDate) : null - const endDate = row.original.submissionEndDate ? new Date(row.original.submissionEndDate) : null - + const startDate = row.original.submissionStartDate ? new Date(row.original.submissionStartDate).toISOString().slice(0, 16) : null + const endDate = row.original.submissionEndDate ? new Date(row.original.submissionEndDate).toISOString().slice(0, 16) : null + console.log(startDate, endDate, "startDate, endDate") if (startDate && now < startDate) { toast.warning('입찰기간 전 접근 제한', { - description: `입찰기간이 아직 시작되지 않았습니다. 입찰 시작일: ${format(startDate, "yyyy-MM-dd HH:mm")}`, + description: `입찰기간이 아직 시작되지 않았습니다`, duration: 5000, }) return diff --git a/lib/tech-project-avl/table/accepted-quotations-table-toolbar-actions.tsx b/lib/tech-project-avl/table/accepted-quotations-table-toolbar-actions.tsx index 4e2eb578..3f9812b8 100644 --- a/lib/tech-project-avl/table/accepted-quotations-table-toolbar-actions.tsx +++ b/lib/tech-project-avl/table/accepted-quotations-table-toolbar-actions.tsx @@ -2,10 +2,11 @@ import * as React from "react"
import { type Table } from "@tanstack/react-table"
-import { Download, RefreshCcw } from "lucide-react"
+import { Download, RefreshCcw, Send } from "lucide-react"
import { exportTableToExcel } from "@/lib/export"
import { Button } from "@/components/ui/button"
+import { toast } from "sonner"
import { AcceptedQuotationItem } from "./accepted-quotations-table-columns"
interface AcceptedQuotationsTableToolbarActionsProps {
@@ -13,16 +14,42 @@ interface AcceptedQuotationsTableToolbarActionsProps { onRefresh?: () => void
}
-export function AcceptedQuotationsTableToolbarActions({
- table,
- onRefresh
+export function AcceptedQuotationsTableToolbarActions({
+ table,
+ onRefresh
}: AcceptedQuotationsTableToolbarActionsProps) {
-
+
+ const handleSend = async () => {
+ // 선택된 행들 가져오기
+ const selectedRows = table.getFilteredSelectedRowModel().rows
+
+ if (selectedRows.length === 0) {
+ toast.error("전송할 항목을 선택해주세요.")
+ return
+ }
+
+ // 선택된 항목 수에 따른 toast 메시지 출력
+ toast.success(`TODO: 견적서 전송 처리`)
+
+ // 실제 전송 로직은 여기에 구현
+ console.log("전송할 데이터:", selectedRows.map(row => row.original))
+ }
+
return (
<div className="flex items-center gap-2">
<Button
variant="outline"
size="sm"
+ onClick={handleSend}
+ disabled={true}
+ className="gap-2"
+ >
+ <Send className="size-4" aria-hidden="true" />
+ <span className="hidden sm:inline">전송하기</span>
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
onClick={() =>
exportTableToExcel(table, {
filename: "accepted-tech-sales-quotations",
|
