1import{_ as N}from"./BgYlC6kX.js";import{e as O,d as m,f as F,c as T,j as E}from"./C_MIU5t0.js";import{_ as B,c as a,a as e,y as c,b as _,d as g,w,t as i,F as v,E as k,G as I,Z as x,q as L,v as y,C as V,B as H,o as u}from"./B3DH6OY8.js";function f(s,t){return s&&s.data&&(s.data.statusMessage||s.data.message)||s&&(s.statusMessage||s.message)||t}function C(s){const t=s.schedule&&s.schedule.start;return E(t)?t:"9999-99-99"}function S(s){for(const t of[s.completedAt,s.updatedAt,s.publishedAt])if(typeof t=="string"&&t)return t;return""}function A(s){return s.slice().sort((t,r)=>{const h=t.status==="closed",n=r.status==="closed";if(h!==n)return h?1:-1;if(h){const o=S(t),d=S(r);if(o!==d)return o<d?1:-1}else{const o=C(t),d=C(r);if(o!==d)return o<d?-1:1;const l=String(t.apartmentName||"").localeCompare(String(r.apartmentName||""),"ko");if(l!==0)return l}return String(t.slug||"").localeCompare(String(r.slug||""))})}function M(s){const t=String(s||"").replace(/[,\s]/g,"").replace(/ì¸ë$/,"");if(!/^\d+$/.test(t))return null;const r=Number(t);return r>=1&&r<=999999?r:null}const P={data(){return{loading:!0,loadError:"",missing:!1,readError:!1,items:[],search:"",progressFilter:"",statusFilter:"",message:"",messageOk:!0,savedNotice:"",busySlug:""}},computed:{filteredItems(){const s=this.search.trim().toLowerCase();return this.items.filter(t=>{if(s){const r=t.region||{};if(![t.apartmentName,r.sido,r.sigungu,r.gu].filter(Boolean).join(" ").toLowerCase().includes(s))return!1}return!(this.progressFilter==="open"&&this.isClosed(t)||this.progressFilter==="closed"&&!this.isClosed(t)||this.statusFilter==="published"&&!t.published||this.statusFilter==="draft"&&t.published)})},savedItem(){return this.savedNotice&&this.items.find(s=>s.slug===this.savedNotice)||null},savedLabel(){const s=this.savedItem;return s&&s.apartmentName?`${s.apartmentName} (${s.slug})`:this.savedNotice}},async mounted(){const s=V();s.query.saved&&(this.savedNotice=String(s.query.saved),H().replace({path:"/__admin__/groupbuy"})),await this.load()},methods:{async load(){this.loading=!0,this.loadError="";try{const s=await $fetch("/api/admin/groupbuy");this.items=A(s.file&&s.file.items||[]),this.missing=!!s.missing,this.readError=!!s.readError}catch(s){this.loadError=f(s,"ë¶ë¬ì¤ê¸° ì¤í¨")}finally{this.loading=!1}},resetFilters(){this.search="",this.progressFilter="",this.statusFilter=""},isClosed(s){return s.status==="closed"},hasBody(s){return!!String(s.bodyHtml||"").trim()},regionText(s){return T(s.region||{})||"-"},householdsText(s){return m(s)||"-"},scheduleText(s){const t=s.schedule;return t&&t.start&&F(t)||"-"},progressLabel(s){if(!this.isClosed(s))return"ì§íì¤";const t=m(s.completedHouseholds);return t?`ìë£ Â· ${t}`:"ìë£"},nameOf(s){return s.apartmentName||s.slug},async remove(s){const t=this.isClosed(s)?` 2ìë£ ì²ë¦¬ë í목ì´ë¼ ì¤ì íì´ì§(/portfolio)ì ì¹´ëë í¨ê» ì¬ë¼ì§ëë¤.`:"";if(window.confirm(`ì´ ê³µë구매를 ìì íìê² ìµëê¹? 3 4ìíí¸: ${this.nameOf(s)} 5ì¬ë¬ê·¸: ${s.slug} 6 7ìì íë©´ ëë릴 ì ììµëë¤.${t}`)){this.message="",this.busySlug=s.slug;try{await $fetch(`/api/admin/groupbuy/items/${encodeURIComponent(s.slug)}`,{method:"DELETE"}),this.message=`ìì ìë£: ${this.nameOf(s)}`,this.messageOk=!0,await this.load()}catch(r){this.message=f(r,"ìì ì¤í¨"),this.messageOk=!1}finally{this.busySlug=""}}},async togglePublish(s){const t=!s.published,r=t?"ë°í":"ë¹ê³µê° ì í",h=t&&!this.hasBody(s)?` 8 9â» ë¨ì§ ìê° ë³¸ë¬¸ì´ ë¹ì´ ììµëë¤.`:"";if(window.confirm(`ì´ ê³µë구매를 ${r} íìê² ìµëê¹? 10 11ìíí¸: ${this.nameOf(s)} 12ì¬ë¬ê·¸: ${s.slug}${h}`)){this.message="",this.busySlug=s.slug;try{await $fetch("/api/admin/groupbuy/items",{method:"POST",body:{mode:"update",item:{...s,published:t}}}),this.message=`${r} ìë£: ${this.nameOf(s)}`,this.messageOk=!0,await this.load()}catch(n){this.message=f(n,"ìí ë³ê²½ ì¤í¨"),this.messageOk=!1}finally{this.busySlug=""}}},async complete(s){const t=this.nameOf(s),r=` 13 14ìíí¸: ${t} 15ë¨ì§ ì¸ëì: ${this.householdsText(s.households)}`;let h=`ê³µë구매 ì°¸ì¬ ì¸ëì를 ì«ìë¡ ì ë ¥íì¸ì.${r}`,n="",o=null;for(;;){const b=window.prompt(h,n);if(b===null)return;if(o=M(b),o!==null)break;h=`1 ì´ìì ì«ì(ì ì)ë§ ì ë ¥í ì ììµëë¤. ë¤ì ì ë ¥íì¸ì. 16 17ê³µë구매 ì°¸ì¬ ì¸ëì를 ì«ìë¡ ì ë ¥íì¸ì.${r}`,n=b}const d=typeof s.households=="number"&&o>s.households?` 18 19â» ì ë ¥í ì°¸ì¬ ì¸ëìê° ë¨ì§ ì¸ëìë³´ë¤ ë§ìµëë¤. ì«ì를 ë¤ì íì¸íì¸ì.`:"",l=O({completedHouseholds:o}),p=s.published?"":` 20 21â» ìì§ ì´ì(ë¹ê³µê°)ì´ë¼ ì¬ì´í¸ìë ë°íí ë¤ì íìë©ëë¤.`;if(window.confirm(`ì´ ê³µë구매를 ìë£ ì²ë¦¬íìê² ìµëê¹? 22 23ìíí¸: ${t} 24ì°¸ì¬ ì¸ëì: ${m(o)} 25 26ìë£ ì²ë¦¬íë©´ ì¬ì´í¸ ìì¸ íì´ì§ì '${l}' ë¬¸êµ¬ê° íìëê³ , ì¤ì íì´ì§(/portfolio) ì¬ì ì ê² ì¹¸ìë ì¹´ëë¡ íìë©ëë¤.${p}${d}`)){this.message="",this.busySlug=s.slug;try{await $fetch("/api/admin/groupbuy/complete",{method:"POST",body:{slug:s.slug,completedHouseholds:o}}),this.message=`ìë£ ì²ë¦¬: ${t} · ${m(o)}`,this.messageOk=!0,await this.load()}catch(b){this.message=f(b,"ìë£ ì²ë¦¬ ì¤í¨"),this.messageOk=!1}finally{this.busySlug=""}}},async reopen(s){if(window.confirm(`ìë£ ì²ë¦¬ë¥¼ ì·¨ìíê³ ë¤ì 'ì§íì¤' ì¼ë¡ ëë립ëë¤. ê³ìí ê¹ì? 27 28ìíí¸: ${this.nameOf(s)}`)){this.message="",this.busySlug=s.slug;try{await $fetch("/api/admin/groupbuy/reopen",{method:"POST",body:{slug:s.slug}}),this.message=`ìë£ ì·¨ì: ${this.nameOf(s)} â ë¤ì 'ì§íì¤' ì¼ë¡ íìë©ëë¤.`,this.messageOk=!0,await this.load()}catch(t){this.message=f(t,"ìë£ ì·¨ì ì¤í¨"),this.messageOk=!1}finally{this.busySlug=""}}}},head(){return{title:"ê³µë구매 ê´ë¦¬ · Admin",meta:[{name:"robots",content:"noindex,nofollow"}]}}},D={class:"groupbuy-list"},G={class:"gl-head"},R={key:0,class:"gl-status gl-status--top gl-status--success"},U={key:1,class:"gl-status gl-status--top gl-status--error"},$={class:"gl-filters"},j={class:"gl-filter"},q={class:"gl-filter"},K={class:"gl-filter"},z={key:2,class:"gl-status"},Z={key:3,class:"gl-status gl-status--error"},J={class:"gl-count"}
28,Q={key:0,class:"gl-count__missing"},W={class:"gl-table-wrap"},X={class:"gl-table"},Y={key:0},ss={class:"gl-thumb"},ts=["src","alt"],es={key:1,class:"gl-thumb__empty"},ls={class:"gl-slug"},os={key:0,class:"gl-subtitle"},ns={class:"gl-nowrap"},rs={class:"gl-nowrap"},as={class:"gl-stack"},us={key:0,class:"gl-warn-badge",title:"ë¨ì§ ìê° ë³¸ë¬¸ì´ ë¹ì´ ììµëë¤"},is={class:"gl-nowrap"},ds={class:"gl-actions"},gs=["disabled","onClick"],hs=["disabled","onClick"],cs=["disabled","onClick"],ps=["disabled","onClick"];function bs(s,t,r,h,n,o){const d=N;return u(),a("div",D,[e("div",G,[t[5]||(t[5]=e("div",null,[e("h1",{class:"admin-page-title"},"ê³µë구매 ê´ë¦¬"),e("p",{class:"admin-page-desc"},[g(" ìíí¸ ì¬ì ì ê² ê³µë구매 ì§í íí©ì ë±ë¡Â·ìì ·ìë£ ì²ë¦¬í©ëë¤. ì ì¥í ë´ì©ì "),e("code",null,"data/groupbuy.json"),g(" ì ë°ìë©ëë¤. "),e("br"),g("ë°íë íëª©ë§ ì¬ì´í¸(/groupbuy)ì ë
¸ì¶ëë©°, ìë£ ì²ë¦¬í í목ì ì¤ì íì´ì§(/portfolio) ì¬ì ì ê² ì¹¸ìë ì¹´ëë¡ íìë©ëë¤. ")])],-1)),_(d,{to:"/__admin__/groupbuy/new",class:"gl-btn gl-btn--primary"},{default:w(()=>[...t[4]||(t[4]=[g("+ ì ê³µë구매 ë±ë¡",-1)])]),_:1})]),n.savedNotice?(u(),a("div",R,[t[6]||(t[6]=g(" ê³µëêµ¬ë§¤ê° ì ì¥ëììµëë¤: ",-1)),e("strong",null,i(o.savedLabel),1),o.savedItem&&!o.savedItem.published?(u(),a(v,{key:0},[g(" · ìì§ ì´ìì
ëë¤. 목ë¡ì 'ë°í' ë²í¼ì ëë¬ì¼ ì¬ì´í¸ì ê³µê°ë©ëë¤. ")],64)):c("",!0)])):c("",!0),n.readError?(u(),a("div",U," ê³µë구매 ë°ì´í°ë¥¼ ì½ì§ 못íìµëë¤(ì¼ìì ì¤ë¥ì¼ ì ìì). ìë¡ê³ 침 í ë¤ì ìëíì¸ì. ì´ ìíììë ì ì¥Â·ìì ·ìë£ ì²ë¦¬ê° ìë²ìì ì íë©ëë¤. ")):c("",!0),e("div",$,[e("label",j,[t[7]||(t[7]=e("span",null,"ê²ì(ìíí¸ ì´ë¦Â·ì§ì)",-1)),k(e("input",{type:"text",class:"gl-input","onUpdate:modelValue":t[0]||(t[0]=l=>n.search=l),placeholder:"ìíí¸ ì´ë¦ ëë ì§ìì¼ë¡ ê²ì"},null,512),[[I,n.search]])]),e("label",q,[t[9]||(t[9]=e("span",null,"ì§í ìí",-1)),k(e("select",{class:"gl-input","onUpdate:modelValue":t[1]||(t[1]=l=>n.progressFilter=l)},[...t[8]||(t[8]=[e("option",{value:""},"ì ì²´",-1),e("option",{value:"open"},"ì§íì¤",-1),e("option",{value:"closed"},"ìë£",-1)])],512),[[x,n.progressFilter]])]),e("label",K,[t[11]||(t[11]=e("span",null,"ë°í ìí",-1)),k(e("select",{class:"gl-input","onUpdate:modelValue":t[2]||(t[2]=l=>n.statusFilter=l)},[...t[10]||(t[10]=[e("option",{value:""},"ì ì²´",-1),e("option",{value:"published"},"ë°í",-1),e("option",{value:"draft"},"ì´ì",-1)])],512),[[x,n.statusFilter]])]),e("button",{type:"button",class:"gl-btn gl-filter-reset",onClick:t[3]||(t[3]=(...l)=>o.resetFilters&&o.resetFilters(...l))},"íí° ì´ê¸°í")]),n.loading?(u(),a("div",z,"ë¶ë¬ì¤ë ì¤â¦")):n.loadError?(u(),a("div",Z,i(n.loadError),1)):(u(),a(v,{key:4},[e("div",J,[t[12]||(t[12]=g(" ì´ ",-1)),e("strong",null,i(n.items.length),1),t[13]||(t[13]=g("ê±´ · íí° í ",-1)),e("strong",null,i(o.filteredItems.length),1),t[14]||(t[14]=g("ê±´ ",-1)),n.missing?(u(),a("span",Q,"· ìì§ ì ì¥ë ê³µë구매 íì¼ì´ ììµëë¤")):c("",!0)]),e("div",W,[e("table",X,[t[17]||(t[17]=e("thead",null,[e("tr",null,[e("th",{style:{width:"56px"}}),e("th",null,"ìíí¸"),e("th",{style:{width:"150px"}},"ì§ì"),e("th",{style:{width:"90px"}},"ì¸ëì"),e("th",{style:{width:"150px"}},"ì¬ì ì ê² ì¼ì "),e("th",{style:{width:"120px"}},"ìí"),e("th",{style:{width:"90px"}},"ë°í"),e("th",{style:{width:"110px"}},"ê²ìì¼"),e("th",{style:{width:"280px"}},"ìì
")])],-1)),e("tbody",null,[o.filteredItems.length?c("",!0):(u(),a("tr",Y,[...t[15]||(t[15]=[e("td",{colspan:"9",class:"gl-empty"},"íìí ê³µëêµ¬ë§¤ê° ììµëë¤.",-1)])])),(u(!0),a(v,null,L(o.filteredItems,l=>(u(),a("tr",{key:l.slug},[e("td",null,[e("div",ss,[l.thumbnail?(u(),a("img",{key:0,src:l.thumbnail,alt:l.alt||l.apartmentName},null,8,ts)):(u(),a("span",es,"-"))])]),e("td",null,[_(d,{to:`/__admin__/groupbuy/${l.slug}`,class:"gl-title"},{default:w(()=>[g(i(l.apartmentName||"(ìíí¸ ì´ë¦ ìì)"),1)]),_:2},1032,["to"]),e("div",ls,i(l.slug),1),l.title?(u(),a("div",os,i(l.title),
281)):c("",!0)]),e("td",null,i(o.regionText(l)),1),e("td",ns,i(o.householdsText(l.households)),1),e("td",rs,i(o.scheduleText(l)),1),e("td",null,[e("span",{class:y(["gl-badge",o.isClosed(l)?"gl-badge--done":"gl-badge--open"])},i(o.progressLabel(l)),3)]),e("td",null,[e("div",as,[e("span",{class:y(["gl-badge",l.published?"gl-badge--pub":"gl-badge--draft"])},i(l.published?"ë°í":"ì´ì"),3),o.hasBody(l)?c("",!0):(u(),a("span",us,"본문 ìì"))])]),e("td",is,i(l.publishedAt||"-"),1),e("td",ds,[e("button",{type:"button",class:y(["gl-row-btn",l.published?"":"gl-row-btn--pub"]),disabled:n.busySlug===l.slug,onClick:p=>o.togglePublish(l)},i(l.published?"ë¹ê³µê°":"ë°í"),11,gs),o.isClosed(l)?(u(),a("button",{key:1,type:"button",class:"gl-row-btn",disabled:n.busySlug===l.slug,onClick:p=>o.reopen(l)}," ìë£ ì·¨ì ",8,cs)):(u(),a("button",{key:0,type:"button",class:"gl-row-btn gl-row-btn--done",disabled:n.busySlug===l.slug,onClick:p=>o.complete(l)}," ìë£ ",8,hs)),_(d,{to:`/__admin__/groupbuy/${l.slug}`,class:"gl-row-btn"},{default:w(()=>[...t[16]||(t[16]=[g("ìì ",-1)])]),_:1},8,["to"]),e("button",{type:"button",class:"gl-row-btn gl-row-btn--danger",disabled:n.busySlug===l.slug,onClick:p=>o.remove(l)}," ìì ",8,ps)])]))),128))])])]),n.message?(u(),a("p",{key:0,class:y(["gl-status",{"gl-status--success":n.messageOk,"gl-status--error":!n.messageOk}])},i(n.message),3)):c("",!0)],64))])}const _s=B(P,[["render",bs],["__scopeId","data-v-7617ebbe"]]);export{_s 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.