import{a as h}from"./apiAdmin-CiAsr8eb.js";import{_ as k,d as D,e as C,w as a,g as t,i as u,t as m,b as I,a0 as O,a as E,o as B,u as M,k as T}from"./app-CgV11GBz.js";import{I as U}from"./index-CJx7RGCD.js";import{_ as A,F as q}from"./index-DX5UyTUL.js";import{B as F}from"./useFlexGapSupport-CWWB0EO1.js";import{M as N}from"./index-CNlVDwHo.js";import{S as P}from"./SaveOutlined-NNV7kkji.js";import{P as V}from"./index-B7-RTJOc.js";import{_ as W,a as z}from"./index-CyQQxPex.js";import{_ as L}from"./index-BQTtg983.js";import{_ as R}from"./TextArea-CiAld6jk.js";import{_ as j,a as G}from"./RadioButton-BPv4-qI8.js";const H=D({props:["formData","data","visible","url","addEditType","pageTitle","successMessage"],components:{PlusOutlined:V,LoadingOutlined:O,SaveOutlined:P},setup(e,{emit:o}){const{addEditRequestAdmin:n,loading:p,rules:s}=h(),{appSetting:c,permsArray:_}=E();return{loading:p,rules:s,onClose:()=>{s.value={},o("closed")},onSubmit:()=>{n({url:e.url,data:e.formData,successMessage:e.successMessage,success:r=>{o("addEditSuccess",r.xid)}})},appSetting:c,permsArray:_,drawerWidth:window.innerWidth<=991?"90%":"45%"}}});function J(e,o,n,p,s,c){const _=U,d=A,i=z,r=W,g=L,w=R,f=G,b=j,S=q,$=I("SaveOutlined"),v=F,y=N;return B(),C(y,{open:e.visible,closable:!1,centered:!0,title:e.pageTitle,onOk:e.onSubmit},{footer:a(()=>[t(v,{key:"submit",type:"primary",loading:e.loading,onClick:e.onSubmit},{icon:a(()=>[t($)]),default:a(()=>[u(" "+m(e.addEditType=="add"?e.$t("common.create"):e.$t("common.update")),1)]),_:1},8,["loading","onClick"]),t(v,{key:"back",onClick:e.onClose},{default:a(()=>[u(m(e.$t("common.cancel")),1)]),_:1},8,["onClick"])]),default:a(()=>[t(S,{layout:"vertical"},{default:a(()=>[t(r,{gutter:16},{default:a(()=>[t(i,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[t(d,{label:e.$t("award.name"),name:"name",help:e.rules.name?e.rules.name.message:null,validateStatus:e.rules.name?"error":null,class:"required"},{default:a(()=>[t(_,{value:e.formData.name,"onUpdate:value":o[0]||(o[0]=l=>e.formData.name=l),placeholder:e.$t("common.placeholder_default_text",[e.$t("award.name")])},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),t(r,{gutter:16},{default:a(()=>[t(i,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[t(d,{label:e.$t("award.award_price"),name:"award_price",help:e.rules.award_price?e.rules.award_price.message:null,validateStatus:e.rules.award_price?"error":null},{default:a(()=>[t(g,{value:e.formData.award_price,"onUpdate:value":o[1]||(o[1]=l=>e.formData.award_price=l),placeholder:e.$t("common.placeholder_default_text",[e.$t("award.award_price")]),style:{width:"100%"}},{addonBefore:a(()=>[u(m(e.appSetting.currency.symbol),1)]),_:1},8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),t(r,{gutter:16},{default:a(()=>[t(i,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[t(d,{label:e.$t("award.description"),name:"description",help:e.rules.description?e.rules.description.message:null,validateStatus:e.rules.description?"error":null},{default:a(()=>[t(w,{value:e.formData.description,"onUpdate:value":o[2]||(o[2]=l=>e.formData.description=l),placeholder:e.$t("common.placeholder_default_text",[e.$t("award.description")]),rows:4},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),t(r,{gutter:16},{default:a(()=>[t(i,{xs:24,sm:24,md:12,lg:12},{default:a(()=>[t(d,{label:e.$t("award.active"),name:"active",help:e.rules.active?e.rules.active.message:null,validateStatus:e.rules.active?"error":null},{default:a(()=>[t(b,{value:e.formData.active,"onUpdate:value":o[3]||(o[3]=l=>e.formData.active=l),"button-style":"solid",size:"small"},{default:a(()=>[t(f,{value:1},{default:a(()=>[u(m(e.$t("common.yes")),1)]),_:1}),t(f,{value:0},{default:a(()=>[u(m(e.$t("common.no")),1)]),_:1})]),_:1},8,["value"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1})]),_:1})]),_:1},8,["open","title","onOk"])}const re=k(H,[["render",J]]),se=()=>{const e="awards?fields=id,xid,name,description,award_price,active",o="awards",{t:n}=M(),p={name:"",description:"",award_price:"",active:1},s=T([{title:n("award.name"),dataIndex:"name"},{title:n("award.description"),dataIndex:"description"},{title:n("award.award_price"),dataIndex:"award_price"},{title:n("award.active"),dataIndex:"active"}]),c=[{key:"name",value:n("common.name")}];return{url:e,addEditUrl:o,initData:p,columns:s,filterableColumns:c}};export{re as A,se as f};
