PageSourceSearch

https://sellcademy.co.kr/assets/InstantCouponCampaignList-1O49K7PH.js

js sellcademy.co.kr collected 2026-10-02 02:00:30 UTC 11,242 bytes, 1 lines download raw bytes

1import{c as q,u as M,z as G,j as e,C as v,m as y,T as H,L as h,b as A,a5 as E,B as o,r as g,t as V}from"./index-BgwBWvt-.js";import{I as W}from"./input-CnZDmQOI.js";import{R as Z,a as L}from"./radio-group-DkwdslRz.js";import{L as b}from"./label-BBnurwHC.js";import{S as I}from"./separator-BdD7Ll-n.js";import{q as K,r as O,t as U,v as J,u as Q}from"./hook-C1VAkeFZ.js";import{B as N}from"./badge-DZMUDrrm.js";import{S as X}from"./switch-CGfXRqEy.js";import{T as Y,a as ee,b as se,c as te}from"./tooltip-CMmvTWDs.js";import{B as ae,C as ne}from"./calendar-BeHPFnay.js";import{C as ie}from"./clock-BADqRNAM.js";import{P as re}from"./pencil-CYiUI_KC.js";import{H as le}from"./history-CeF71mGz.js";import{Z as ce}from"./zap-Bq_9_K0V.js";import{T as oe}from"./trash-2-B6W1imaA.js";import{T as de}from"./ticket-CkqWxKj5.js";import{P as me}from"./plus-BaaXgnvk.js";import{P as xe}from"./play-DIC--_5Y.js";import{S as ue}from"./search-BZheY89B.js";import"./index-CYYfkdi0.js";import"./index-CqNojjVX.js";import"./index-CVeOmo7z.js";import"./index-CvzCvlfr.js";import"./index-Bzpryxja.js";const he=[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]],pe=q("calendar-range",he);function fe(s){return s.typeOfDiscount==="RATE"?`${s.discount}% 할인`:`${s.discount.toLocaleString()}원 할인`}function je(s){return s==="queued"?"대기 중":s==="running"?"실행 중":s==="creating"?"생성 중":s==="linking"?"연결 중":s==="destroying"||s==="deleting"?"삭제 중":s==="failed"?"실패":null}function ge({campaign:s,userVendorCode:i,onToggle:C,onDelete:w}){const p=M(),k=G(l=>l.user?.name==="김범식"),m=K(),a=!!i&&!!s.vendorCode&&i!==s.vendorCode,r=s.executionStatus!=="idle"&&s.executionStatus!=="done",d=je(s.executionStatus),S=!s.isActive||a||r||m.isPending,f=s.timeWindows?.length?s.timeWindows.map(l=>`${l.issue}~${l.expire}`).join(", "):null,c=s.isUsePeriod&&s.campaignStartDate&&s.campaignEndDate?`${s.campaignStartDate} ~ ${s.campaignEndDate}`:null;function j(){window.confirm("캠페인을 삭제하시겠습니까?")&&w(s.id)}function D(){m.mutate(s.id)}const x=!s.isActive||a;return e.jsx(v,{children:e.jsxs(y,{children:[e.jsxs("div",{className:A("space-y-6",x&&"opacity-60"),children:[a&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 dark:border-red-900 dark:bg-red-950/30",children:[e.jsx(H,{className:"h-4 w-4 shrink-0 text-red-500"}),e.jsx("p",{className:"text-caption text-red-600 dark:text-red-400",children:"업체코드가 달라 사용할 수 없습니다."})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(N,{variant:"outline",className:"gap-1.5 rounded-full px-3 py-1",children:[e.jsx(ae,{className:"h-3.5 w-3.5"}),s.vendorCode]}),d&&e.jsxs(N,{variant:"secondary",className:"gap-1 rounded-full px-2.5 py-1",children:[s.executionStatus!=="failed"&&e.jsx(h,{className:"h-3 w-3 animate-spin"}),d]}),s.wowExclusive&&e.jsx(N,{className:"rounded-full bg-amber-500 px-2.5 py-1 hover:bg-amber-500",children:"와우전용"})]}),e.jsxs("div",{className:A("flex items-center gap-2",a||r?"pointer-events-none opacity-50":"cursor-pointer"),onClick:()=>!a&&!r&&C(s.id,s.isActive),children:[e.jsx(b,{className:"text-body-sm text-muted-foreground cursor-pointer",children:s.isActive?"동작 중":"중지됨"}),e.jsx(X,{checked:s.isActive,disabled:a||r})]})]}),e.jsx("h3",{className:"mt-5 text-h4 truncate",children:s.title}),s.description&&e.jsx("p",{className:"mt-0.5 text-body-sm text-muted-foreground line-clamp-2",children:s.description})]}),e.jsxs("div",{className:"rounded-lg border bg-muted/30 px-4 py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-body-sm truncate",children:s.couponTitle}),e.jsx(N,{variant:"outline",className:"shrink-0",children:fe(s)})]}),e.jsxs("p",{className:"text-caption text-muted-foreground",children:["최대할인: ",s.maximumDiscountPrice.toLocaleStr
1ing(),"원"]}),f&&e.jsxs("p",{className:"flex items-center gap-1 text-caption text-muted-foreground",children:[e.jsx(ie,{className:"h-3 w-3 shrink-0"}),"발급/종료: ",f]}),c&&e.jsxs("p",{className:"flex items-center gap-1 text-caption text-muted-foreground",children:[e.jsx(pe,{className:"h-3 w-3 shrink-0"}),"실행기간: ",c]})]}),e.jsxs("div",{className:"flex items-center justify-between text-caption text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ne,{className:"h-3 w-3"}),"생성: ",new Date(s.createdAt).toLocaleDateString("ko-KR")]}),e.jsxs("span",{children:["수정: ",new Date(s.updatedAt).toLocaleDateString("ko-KR")]})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(E,{className:"h-3 w-3"}),"옵션 ",s.productCount,"개"]})]})]}),e.jsx(I,{className:"my-3"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(o,{variant:"outline",size:"sm",className:"flex-1",disabled:a||r,onClick:()=>p(`/product-management/instant_coupon/${s.id}`),children:[e.jsx(re,{className:"mr-1.5 h-3.5 w-3.5"}),"수정"]}),e.jsxs(o,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>p(`/product-management/instant_coupon/${s.id}/logs`),children:[e.jsx(le,{className:"mr-1.5 h-3.5 w-3.5"}),"로그 기록"]}),k&&e.jsx(Y,{children:e.jsxs(ee,{children:[e.jsx(se,{asChild:!0,children:e.jsx("span",{className:"flex-1",children:e.jsxs(o,{variant:"outline",size:"sm",className:"w-full text-amber-600 hover:text-amber-700",disabled:S,onClick:D,children:[m.isPending?e.jsx(h,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx(ce,{className:"mr-1.5 h-3.5 w-3.5"}),"즉시 실행"]})})}),r&&e.jsx(te,{children:"이미 실행 중"})]})}),e.jsxs(o,{variant:"outline",size:"sm",className:"flex-1 text-red-500 hover:text-red-600",disabled:a||r,onClick:j,children:[e.jsx(oe,{className:"mr-1.5 h-3.5 w-3.5"}),"삭제"]})]})]})})}const P=6;function He(){const s=M(),{data:i=[],isLoading:C}=O(),w=U(),p=J(),{data:k}=Q(),m=k?.coupangVendorCode??"",[a,r]=g.useState(""),[d,S]=g.useState("all"),[f,c]=g.useState(1),j=i.filter(t=>t.isActive).length,D=i.reduce((t,n)=>t+n.productCount,0),x=g.useMemo(()=>{let t=i;if(a.trim()){const n=a.toLowerCase();t=t.filter(T=>T.title.toLowerCase().includes(n)||T.description.toLowerCase().includes(n))}return d==="active"?t=t.filter(n=>n.isActive):d==="inactive"&&(t=t.filter(n=>!n.isActive)),t},[i,a,d]),l=Math.max(1,Math.ceil(x.length/P)),u=Math.min(f,l),z=x.slice((u-1)*P,u*P);function R(){if(!m){V.error("업체코드를 먼저 등록해 주세요.",{description:"대시보드에서 쿠팡 인증 정보를 설정할 수 있습니다."});return}s("/product-management/instant_coupon/new")}function $(t){S(t),c(1)}function B(t){r(t.target.value),c(1)}function _(t,n){w.mutate({id:t,isActive:!n})}function F(t){p.mutate(t)}return C?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(h,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.jsxs("div",{className:"mx-auto mt-6 max-w-5xl space-y-5 md:mt-10",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h1",{className:"flex items-center gap-3 text-h3 leading-none",children:[e.jsx(de,{className:"size-7 text-primary"}),e.jsx("span",{children:"쿠폰관리"})]}),e.jsxs(o,{onClick:R,children:[e.jsx(me,{className:"mr-1 h-4 w-4"}),"쿠폰 캠페인 생성"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[e.jsx(v,{children:e.jsxs(y,{className:"flex items-center gap-3 px-4 py-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/30",children:e.jsx(h,{className:"h-4 w-4 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-caption text-muted-foreground",children:"전체 캠페인"}),e.jsx("p",{className:"text-h4",children:i.length})]})]})}),e.jsx(v,{children:e.jsxs(y,{className:"flex items-center gap-3 px-4 py-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-green-100 dark:bg-green-900/30",children:e.jsx(xe,{className:"h-4 w-4 text-green-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-caption text-muted-foreground",children:"동작 중"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("p",{className:"text-h4",children:j}),j>0&&e.jsx(h,{className:"h-3.5 w-3.5 animate-spin text-green-500"})]})]})]})}),e.jsx(v,{children:e.jsxs(y,{className:"flex items-center gap-3 px-4 py-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-purple-100 dar
1k:bg-purple-900/30",children:e.jsx(E,{className:"h-4 w-4 text-purple-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-caption text-muted-foreground",children:"적용 상품"}),e.jsx("p",{className:"text-h4",children:D})]})]})})]}),e.jsx(I,{}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs(Z,{value:d,onValueChange:$,className:"flex gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(L,{value:"all",id:"instant-coupon-filter-all"}),e.jsx(b,{htmlFor:"instant-coupon-filter-all",className:"text-body-sm cursor-pointer",children:"전체"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(L,{value:"active",id:"instant-coupon-filter-active"}),e.jsx(b,{htmlFor:"instant-coupon-filter-active",className:"text-body-sm cursor-pointer",children:"동작 중"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(L,{value:"inactive",id:"instant-coupon-filter-inactive"}),e.jsx(b,{htmlFor:"instant-coupon-filter-inactive",className:"text-body-sm cursor-pointer",children:"중지됨"})]})]}),e.jsxs("div",{className:"relative w-96 shrink-0",children:[e.jsx(ue,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(W,{value:a,onChange:B,placeholder:"캠페인 검색...",className:"pl-9"})]})]}),x.length===0?e.jsx("div",{className:"flex flex-col items-center justify-center gap-4 roun
1ded-lg border border-dashed py-16",children:e.jsx("p",{className:"text-body text-muted-foreground",children:i.length===0?"생성된 캠페인이 없습니다":"검색 결과가 없습니다"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:z.map(t=>e.jsx(ge,{campaign:t,userVendorCode:m,onToggle:_,onDelete:F},t.id))}),l>1&&e.jsxs("div",{className:"flex items-center justify-center gap-1 pt-2",children:[e.jsx(o,{variant:"ghost",size:"sm",disabled:u<=1,onClick:()=>c(t=>t-1),children:"이전"}),Array.from({length:l},(t,n)=>n+1).map(t=>e.jsx(o,{variant:t===u?"default":"ghost",size:"sm",className:"min-w-9",onClick:()=>c(t),children:t},t)),e.jsx(o,{variant:"ghost",size:"sm",disabled:u>=l,onClick:()=>c(t=>t+1),children:"다음"})]})]})]})}export{He as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.