1import{_ as w,M as X,B as M,b as p,c as h,a as t,g as l,e as s,F as y,r as v,p as x,j as k,o as _,i as d,w as m,s as u,t as F}from"./index.js";import{F as I}from"./Field.js";import"./ValidationMessage.js";const S={components:{Button:M,Field:I,Modal:X},data(){return{me:{},accounts:[],creationForm:this.createForm(),editForm:null}},async created(){[this.me,this.accounts]=await Promise.all([this.createForm().get("/api/me"),this.fetchPromotionAccounts()])},methods:{fetchPromotionAccounts(){return this.createForm().get("/api/promotion_accounts/")},async create(){await this.creationForm.post("/api/promotion_accounts/"),this.$refs.creationModal.hide(),this.accounts=await this.fetchPromotionAccounts(),this.showGlobalMessage("ããã¢ã¼ã·ã§ã³ã¢ã«ã¦ã³ãã使ãã¾ãã")},openEditModal(i){this.editForm=this.createForm({...i}),this.$refs.editModal.show()},async edit(){const i=this.editForm.model.id;await this.editForm.put(`/api/promotion_accounts/${i}/`),this.$refs.editModal.hide(),this.accounts=await this.fetchPromotionAccounts(),this.showGlobalMessage("ããã¢ã¼ã·ã§ã³ã¢ã«ã¦ã³ãæ
å ±ãæ´æ°ãã¾ãã")},async deleteAccount(i){window.confirm(`ã${i.name}ããåé¤ãã¾ããããããã§ããï¼`)&&(await this.createForm().delete(`/api/promotion_accounts/${i.id}/`),this.accounts=await this.fetchPromotionAccounts(),this.showGlobalMessage("ããã¢ã¼ã·ã§ã³ã¢ã«ã¦ã³ããåé¤ãã¾ãã"))}}},g=i=>(x("data-v-552c399b"),i=i(),k(),i),A={class:"main"},B=g(()=>t("h1",null,"ããã¢ã¼ã·ã§ã³ã¢ã«ã¦ã³ã",-1)),C={class:"flex justify-content-flex-end"},V={class:"accounts"},G=g(()=>t("thead",null,[t("th",{style:{width:"20%"}}," ã¢ã«ã¦ã³ãå "),t("th",{style:{width:"20%"}}," Googleã¢ã«ã¦ã³ãIDå "),t("th",{style:{width:"10%"}})],-1));function P(i,r,D,U,e,a){const n=p("Button"),c=p("Field"),f=p("Modal");return _(),h("div",A,[B,t("div",C,[l(n,{onClick:r[0]||(r[0]=o=>i.$refs.creationModal.show()),disabled:!e.me.is_owner},{default:s(()=>[d(" 使ãã ")]),_:1},8,["disabled"]),l(f,{ref:"creationModal",title:"ããã¢ã¼ã·ã§ã³ã¢ã«ã¦ã³ãã使ãã",onSubmit:a.create,onHide:r[3]||(r[3]=o=>e.creationForm.clear())},{actions:s(()=>[l(n,{submit:""},{default:s(()=>[d(" 使ãã ")]),_:1})]),default:s(()=>[l(c,{label:"ã¢ã«ã¦ã³ãå",error:e.creationForm.$errors.name},{default:s(()=>[m(t("input",{class:"form-control",type:"text","onUpdate:modelValue":r[1]||(r[1]=o=>e.creationForm.model.name=o),placeholder:"ã¢ã«ã¦ã³ãå"},null,512),[[u,e.creationForm.model.name]])]),_:1},8,["error"]),l(c,{label:"Googleã¢ã«ã¦ã³ãID",error:e.creationForm.$errors.google_customer_id},{default:s(()=>[m(t("input",{class:"form-control",type:"text","onUpdate:modelValue":r[2]||(r[2]=o=>e.creationForm.model.google_customer_id=o),placeholder:"XXX-XXX-XXXX"},null,512),[[u,e.creationForm.model.google_customer_id]])]),_:1},8,["error"])]),_:1},8,["onSubmit"])]),t("table",V,[G,t("tbody",null,[(_(!0),h(y,null,v(e.accounts,o=>(_(),h("tr",{key:o.id},[t("td",null,F(o.name),1),t("td",null,F(o.google_customer_id),1),t("td",null,[l(n,{onClick:b=>a.openEditModal(o),disabled:!e.me.is_owner},{default:s(()=>[d(" ç·¨é ")]),_:2},1032,["onClick","disabled"]),l(n,{color:"danger",onClick:b=>a.deleteAccount(o),disabled:!e.me.is_owner},{default:s(()=>[d(" åé¤ ")]),_:2},1032,["onClick","disabled"])])]))),128))])]),l(f,{ref:"editModal",title:"ããã¢ã¼ã·ã§ã³ã¢ã«ã¦ã³ãæ
å ±æ´æ°",onSubmit:a.edit,onHide:r[6]||(r[6]=o=>e.editForm.clear())},{actions:s(()=>[l(n,{submit:""},{default:s(()=>[d(" æ´æ°ãã ")]),_:1})]),default:s(()=>[l(c,{label:"ã¢ã«ã¦ã³ãå",error:e.editForm.$errors.name},{default:s(()=>[m(t("input",{class:"form-control",type:"text","onUpdate:modelValue":r[4]||(r[4]=o=>e.editForm.model.name=o),placeholder:"ã¢ã«ã¦ã³ãå"},null,512),[[u,e.editForm.model.name]])]),_:1},8,["error"]),l(c,{label:"Googleã¢ã«ã¦ã³ãID",error:e.editForm.$errors.google_customer_id},{default:s(()=>[m(t("input",{class:"form-control",type:"text","onUpdate:modelValue":r[5]||(r[5]=o=>e.editForm.model.google_customer_id=o),placeholder:"XXX-XXX-XXXX"},null,512),[[u,e.editForm.model.google_customer_id]])]),_:1},8,["error"])]),_:1},8,["onSubmit"])])}const H=w(S,[["render",P],["__scopeId","data-v-552c399b"]]);export{H 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.