Files
appco_dist/.output/public/_nuxt/cO4pf5dS.js
T
2025-08-24 13:00:31 +03:30

14 lines
10 KiB
JavaScript

import{B as Q}from"./D-ODqOh1.js";import{d as R,h as le,o as K,e as oe,r as y,a4 as j,ah as E,L as ne,H as P,F as X,z as w,D as S,A as g,C as s,N as ae,$ as ie,I as d,E as se,B as F,ar as W,V as x,S as U,u as re,y as T,a7 as de,U as ue,a5 as Y,a6 as G,cf as ce,bt as fe}from"./BYv1load.js";import{u as me,c as ve,g as be,_ as ge,a as he,d as pe}from"./DbATxdtq.js";import{B as ye}from"./QnL3siKh.js";import{_ as _e}from"./C-adtJJC.js";import{B as A}from"./B3A7H1Au.js";import{I as Se}from"./gBeNTMcq.js";import{B as Ce}from"./866GWx42.js";import{Q as M,D as Oe}from"./BOmXLZko.js";import{_ as Be}from"./DlAUqK2U.js";import"./DiPeGZ7r.js";import"./BdncHQdI.js";import"./CscEAC8U.js";import"./DyrRsFZC.js";/*!
* VueQuill @vueup/vue-quill v1.2.0
* https://vueup.github.io/vue-quill/
*
* Includes quill v1.3.7
* https://quilljs.com/
*
* Copyright (c) 2023 Ahmad Luthfi Masruri
* Released under the MIT license
* Date: 2023-05-12T08:44:03.742Z
*/const J={essential:[[{header:[1,2,3,4,5,6,!1]}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"},{align:[]}],["blockquote","code-block","link"],[{color:[]},"clean"]],minimal:[[{header:1},{header:2}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"},{align:[]}]],full:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["link","video","image"],["clean"]]},ke=R({name:"QuillEditor",inheritAttrs:!1,props:{content:{type:[String,Object]},contentType:{type:String,default:"delta",validator:l=>["delta","html","text"].includes(l)},enable:{type:Boolean,default:!0},readOnly:{type:Boolean,default:!1},placeholder:{type:String,required:!1},theme:{type:String,default:"snow",validator:l=>["snow","bubble",""].includes(l)},toolbar:{type:[String,Array,Object],required:!1,validator:l=>typeof l=="string"&&l!==""?l.charAt(0)==="#"?!0:Object.keys(J).indexOf(l)!==-1:!0},modules:{type:Object,required:!1},options:{type:Object,required:!1},globalOptions:{type:Object,required:!1}},emits:["textChange","selectionChange","editorChange","update:content","focus","blur","ready"],setup:(l,r)=>{K(()=>{n()}),oe(()=>{e=null});let e,u;const c=y(),n=()=>{var t;if(c.value){if(u=O(),l.modules)if(Array.isArray(l.modules))for(const o of l.modules)M.register(`modules/${o.name}`,o.module);else M.register(`modules/${l.modules.name}`,l.modules.module);e=new M(c.value,u),q(l.content),e.on("text-change",m),e.on("selection-change",v),e.on("editor-change",p),l.theme!=="bubble"&&c.value.classList.remove("ql-bubble"),l.theme!=="snow"&&c.value.classList.remove("ql-snow"),(t=e.getModule("toolbar"))===null||t===void 0||t.container.addEventListener("mousedown",o=>{o.preventDefault()}),r.emit("ready",e)}},O=()=>{const t={};if(l.theme!==""&&(t.theme=l.theme),l.readOnly&&(t.readOnly=l.readOnly),l.placeholder&&(t.placeholder=l.placeholder),l.toolbar&&l.toolbar!==""&&(t.modules={toolbar:(()=>{if(typeof l.toolbar=="object")return l.toolbar;if(typeof l.toolbar=="string")return l.toolbar.charAt(0)==="#"?l.toolbar:J[l.toolbar]})()}),l.modules){const o=(()=>{var a,I;const L={};if(Array.isArray(l.modules))for(const V of l.modules)L[V.name]=(a=V.options)!==null&&a!==void 0?a:{};else L[l.modules.name]=(I=l.modules.options)!==null&&I!==void 0?I:{};return L})();t.modules=Object.assign({},t.modules,o)}return Object.assign({},l.globalOptions,l.options,t)},f=t=>typeof t=="object"&&t?t.slice():t,_=t=>Object.values(t.ops).some(o=>!o.retain||Object.keys(o).length!==1);let h;const C=t=>{if(typeof h==typeof t){if(t===h)return!0;if(typeof t=="object"&&t&&typeof h=="object"&&h)return!_(h.diff(t))}return!1},m=(t,o,a)=>{h=f(b()),C(l.content)||r.emit("update:content",h),r.emit("textChange",{delta:t,oldContents:o,source:a})},k=y(),v=(t,o,a)=>{k.value=!!e?.hasFocus(),r.emit("selectionChange",{range:t,oldRange:o,source:a})};j(k,t=>{t?r.emit("focus",c):r.emit("blur",c)});const p=(...t)=>{t[0]==="text-change"&&r.emit("editorChange",{name:t[0],delta:t[1],oldContents:t[2],source:t[3]}),t[0]==="selection-change"&&r.emit("editorChange",{name:t[0],range:t[1],oldRange:t[2],source:t[3]})},i=()=>c.value,B=()=>{var t;return(t=e?.getModule("toolbar"))===null||t===void 0?void 0:t.container},$=()=>{if(e)return e;throw`The quill editor hasn't been instantiated yet,
make sure to call this method when the editor ready
or use v-on:ready="onReady(quill)" event instead.`},b=(t,o)=>l.contentType==="html"?z():l.contentType==="text"?D(t,o):e?.getContents(t,o),q=(t,o="api")=>{const a=t||(l.contentType==="delta"?new Oe:"");l.contentType==="html"?N(a):l.contentType==="text"?H(a,o):e?.setContents(a,o),h=f(a)},D=(t,o)=>{var a;return(a=e?.getText(t,o))!==null&&a!==void 0?a:""},H=(t,o="api")=>{e?.setText(t,o)},z=()=>{var t;return(t=e?.root.innerHTML)!==null&&t!==void 0?t:""},N=t=>{e&&(e.root.innerHTML=t)},Z=(t,o="api")=>{const a=e?.clipboard.convert(t);a&&e?.setContents(a,o)},ee=()=>{e?.focus()},te=()=>{E(()=>{var t;!r.slots.toolbar&&e&&((t=e.getModule("toolbar"))===null||t===void 0||t.container.remove()),n()})};return j(()=>l.content,t=>{if(!e||!t||C(t))return;const o=e.getSelection();o&&E(()=>e?.setSelection(o)),q(t)},{deep:!0}),j(()=>l.enable,t=>{e&&e.enable(t)}),{editor:c,getEditor:i,getToolbar:B,getQuill:$,getContents:b,setContents:q,getHTML:z,setHTML:N,pasteHTML:Z,focus:ee,getText:D,setText:H,reinit:te}},render(){var l,r;return[(r=(l=this.$slots).toolbar)===null||r===void 0?void 0:r.call(l),le("div",{ref:"editor",...this.$attrs})]}}),we={flex:"","justify-center":"","items-center":"","flex-col":"","p-2":""},xe={class:"flex justify-center"},Te={"mt-3":"","font-semibold":""},je={class:"absolute end-0"},Ee={class:"max-h-85vh overflow-y-auto px-2 mt3 pb-10"},$e={class:"flex justify-center"},qe={dir:"ltr"},Ie=R({__name:"BrandAddEdit",props:{open:{type:Boolean,default:!1},isEdit:{type:Boolean,default:!1},data:{}},emits:["update:open","update:isEdit","success"],setup(l,{emit:r}){const e=ne({}),u=y([]),c=y(),n=P(),O=y(null),f=l,_=r,h=()=>{u.value=[],Object.assign(e,{title:"",image:null,active:!0})},C=()=>{console.log(f.data),Object.assign(e,f.data),e.image?.length&&(u.value=[],u.value.push({src:W(e.image),thumbUrl:W(e.image)}))},m=async()=>{c.value.validateFields().then(async()=>{try{if(console.log("brandImage.value ===>",u.value),x.value=!0,e.image=u.value[0]?.subUrl,f.isEdit&&f.data){const p=f.data;await me(p.id,e),_("update:isEdit",!1),U.success(n.useString("editedSuccessfully"))}else await ve(e),U.success(n.useString("addedSuccessfully"));_("update:visible",!1),_("success"),await v()}catch(p){x.value=!1,console.log("error",p),U.error(n.useString("errorInSubmittingData"))}})};j(f,p=>{p.open?k():v(),f.isEdit?C():h()});async function k(){await E(),await O.value?.setOpen()}async function v(){await E(),await O.value?.setClose(),_("update:open",!1)}return(p,i)=>{const B=ie,$=ae;return w(),X(ye,{title:"",ref_key:"sheetRef",ref:O,headerCls:"",closeOnClickOutside:"",onOnClickOutside:i[5]||(i[5]=b=>_("update:open",!1)),onOnClose:i[6]||(i[6]=b=>_("update:open",!1))},{header:S(()=>[g("div",we,[i[7]||(i[7]=g("div",{"bg-gray-500":"","h-2px":"","w-2.5rem":""},null,-1)),g("div",xe,[g("div",Te,F(p.isEdit?d(n).useString("editBrand"):d(n).useString("addBrand")),1),g("div",je,[s(_e,{class:"w-1rem mt-2 me-5",onClick:v})])])])]),default:S(()=>[g("div",Ee,[s($,{model:e,ref_key:"formRef",ref:c},{default:S(()=>[s(B,{label:d(n).useString("image")},{default:S(()=>[g("div",$e,[s(Se,{"file-list":u.value,"onUpdate:fileList":i[0]||(i[0]=b=>u.value=b)},null,8,["file-list"])])]),_:1},8,["label"]),s(B,{label:d(n).useString("title"),name:"title"},{default:S(()=>[s(A,{value:e.title,"onUpdate:value":i[1]||(i[1]=b=>e.title=b),"place-holder":d(n).useString("title")},null,8,["value","place-holder"])]),_:1},8,["label"]),s(B,{name:"seo_title",label:d(n).useString("seoTitle")},{default:S(()=>[s(A,{"place-holder":d(n).useString("seoTitle"),value:e.seo_title,"onUpdate:value":i[2]||(i[2]=b=>e.seo_title=b)},null,8,["place-holder","value"])]),_:1},8,["label"]),s(B,{name:"meta",label:d(n).useString("meta")},{default:S(()=>[s(A,{"place-holder":d(n).useString("meta"),value:e.meta,"onUpdate:value":i[3]||(i[3]=b=>e.meta=b)},null,8,["place-holder","value"])]),_:1},8,["label"]),s(B,{class:"mt-3",label:d(n).useString("description"),key:"description"},{default:S(()=>[g("div",qe,[s(d(ke),{content:e.description,"onUpdate:content":i[4]||(i[4]=b=>e.description=b),theme:"snow",contentType:"html",toolbar:"full"},null,8,["content"])])]),_:1},8,["label"])]),_:1},8,["model"]),s(Ce,{type:"primary",block:"",onClick:m},{default:S(()=>[se(F(d(n).useString("submit")),1)]),_:1})])]),_:1},512)}}}),Le=Object.assign(Be(Ie,[["__scopeId","data-v-74dbaf3f"]]),{__name:"BrandAddEdit"}),Ue={class:"px-4 flex items-center justify-between"},Ae={class:"flex gap-5 py-3"},Me={class:"font-semibold"},Fe={class:"pt-3rem px-2 pb40"},Re={key:0},et=R({__name:"index",setup(l){const r=re(),e=P();y({y:720});const u=y(!1),c=y(!1);y(null);const n=y([]),O=y({});async function f(){x.value=!0,n.value=await be(),x.value=!1}const _=C=>{O.value=C,c.value=!0,u.value=!0},h=async C=>{await fe(e.useString("areYouSureToDeleteThisBrand"),C??"",pe,f)};return K(async()=>{await f()}),(C,m)=>{const k=ce;return w(),T("div",null,[g("div",{class:de([" fixed w-full top-0 z-2",d(e).isNightStore?"bg-header-color-dark ":"bg-header-color"])},[g("div",Ue,[g("div",Ae,[s(Q,{icon:d(e).isRTL?"vuesax-linear:arrow-right":"vuesax-linear:arrow-left",onClick:m[0]||(m[0]=v=>d(r).back())},null,8,["icon"]),g("div",Me,F(d(e).useString("brands")),1)]),m[4]||(m[4]=g("div",null,null,-1))])],2),g("div",Fe,[(w(!0),T(Y,null,G(n.value,(v,p)=>(w(),X(ge,{key:p,item:v,onEdit:_,onDelete:h},null,8,["item"]))),128)),d(x)?(w(),T("div",Re,[(w(),T(Y,null,G(10,v=>s(he)),64))])):ue("",!0)]),s(k,{shape:"circle",type:"primary",onClick:m[1]||(m[1]=v=>u.value=!0),class:"bottom-10vh w-3rem h-3rem"},{default:S(()=>[s(Q,{icon:"vuesax-linear:add"})]),_:1}),s(Le,{open:u.value,"onUpdate:open":m[2]||(m[2]=v=>u.value=v),"is-edit":c.value,"onUpdate:isEdit":m[3]||(m[3]=v=>c.value=v),data:O.value,onSuccess:f},null,8,["open","is-edit","data"])])}}});export{et as default};