From 4fe733d7d9d3d873fa395133e9a42cf9fc8c44dc Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Wed, 24 Sep 2025 07:59:35 +0000
Subject: (최겸) 구매 피드백 반영(용어 수정, 견적유형, 조건설정, 첨부파일
 선택사항 등)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../vendor/batch-update-conditions-dialog.tsx      | 59 +++++++++++++++++-----
 1 file changed, 47 insertions(+), 12 deletions(-)

(limited to 'lib/rfq-last/vendor/batch-update-conditions-dialog.tsx')

diff --git a/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx b/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx
index af38ff45..893fd9a3 100644
--- a/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx
+++ b/lib/rfq-last/vendor/batch-update-conditions-dialog.tsx
@@ -128,6 +128,7 @@ export function BatchUpdateConditionsDialog({
   const [shippingOpen, setShippingOpen] = React.useState(false);
   const [destinationOpen, setDestinationOpen] = React.useState(false);
   const [calendarOpen, setCalendarOpen] = React.useState(false);
+  const [currencyOpen, setCurrencyOpen] = React.useState(false);
 
   // 체크박스로 각 필드 업데이트 여부 관리
   const [fieldsToUpdate, setFieldsToUpdate] = React.useState({
@@ -381,7 +382,28 @@ export function BatchUpdateConditionsDialog({
                 {/* 기본 조건 설정 */}
                 <Card>
                   <CardHeader>
-                    <CardTitle className="text-lg">기본 조건</CardTitle>
+                    <div className="flex items-center justify-between">
+                      <CardTitle className="text-lg">기본 조건</CardTitle>
+                      <Button
+                        type="button"
+                        variant="outline"
+                        size="sm"
+                        onClick={() => {
+                          // 기본조건만 전체 선택/해제
+                          const basicFields = ['currency', 'paymentTermsCode', 'incoterms', 'deliveryDate', 'contractDuration', 'taxCode', 'shipping'];
+                          const allBasicSelected = basicFields.every(field => fieldsToUpdate[field as keyof typeof fieldsToUpdate]);
+                          const newState = { ...fieldsToUpdate };
+
+                          basicFields.forEach(field => {
+                            newState[field as keyof typeof newState] = !allBasicSelected;
+                          });
+
+                          setFieldsToUpdate(newState);
+                        }}
+                      >
+                        {['currency', 'paymentTermsCode', 'incoterms', 'deliveryDate', 'contractDuration', 'taxCode', 'shipping'].every(field => fieldsToUpdate[field as keyof typeof fieldsToUpdate]) ? '전체 해제' : '전체 선택'}
+                      </Button>
+                    </div>
                   </CardHeader>
                   <CardContent className="space-y-4">
                     {/* 통화 */}
@@ -405,11 +427,12 @@ export function BatchUpdateConditionsDialog({
                             </FormLabel>
                             <div className="col-span-2">
                               <FormControl>
-                                <Popover>
+                                <Popover open={currencyOpen} onOpenChange={setCurrencyOpen}>
                                   <PopoverTrigger asChild>
                                     <Button
                                       variant="outline"
                                       role="combobox"
+                                      aria-expanded={currencyOpen}
                                       className="w-full justify-between"
                                       disabled={!fieldsToUpdate.currency}
                                     >
@@ -433,7 +456,10 @@ export function BatchUpdateConditionsDialog({
                                             <CommandItem
                                               key={currency}
                                               value={currency}
-                                              onSelect={() => field.onChange(currency)}
+                                              onSelect={() => {
+                                                field.onChange(currency);
+                                                setCurrencyOpen(false);
+                                              }}
                                             >
                                               {currency}
                                               <Check
@@ -1017,9 +1043,12 @@ export function BatchUpdateConditionsDialog({
                     <div className="flex items-center gap-4">
                       <Checkbox
                         checked={fieldsToUpdate.materialPrice}
-                        onCheckedChange={(checked) =>
-                          setFieldsToUpdate({ ...fieldsToUpdate, materialPrice: !!checked })
-                        }
+                        onCheckedChange={(checked) => {
+                          setFieldsToUpdate({ ...fieldsToUpdate, materialPrice: !!checked });
+                          if (checked) {
+                            form.setValue("materialPriceRelatedYn", true);
+                          }
+                        }}
                       />
                       <FormField
                         control={form.control}
@@ -1053,9 +1082,12 @@ export function BatchUpdateConditionsDialog({
                       <div className="flex items-center gap-4">
                         <Checkbox
                           checked={fieldsToUpdate.sparepart}
-                          onCheckedChange={(checked) =>
-                            setFieldsToUpdate({ ...fieldsToUpdate, sparepart: !!checked })
-                          }
+                          onCheckedChange={(checked) => {
+                            setFieldsToUpdate({ ...fieldsToUpdate, sparepart: !!checked });
+                            if (checked) {
+                              form.setValue("sparepartYn", true);
+                            }
+                          }}
                         />
                         <FormField
                           control={form.control}
@@ -1108,9 +1140,12 @@ export function BatchUpdateConditionsDialog({
                       <div className="flex items-center gap-4">
                         <Checkbox
                           checked={fieldsToUpdate.first}
-                          onCheckedChange={(checked) =>
-                            setFieldsToUpdate({ ...fieldsToUpdate, first: !!checked })
-                          }
+                          onCheckedChange={(checked) => {
+                            setFieldsToUpdate({ ...fieldsToUpdate, first: !!checked });
+                            if (checked) {
+                              form.setValue("firstYn", true);
+                            }
+                          }}
                         />
                         <FormField
                           control={form.control}
-- 
cgit v1.2.3

