2 lines
8.3 KiB
JavaScript
2 lines
8.3 KiB
JavaScript
import{_ as X}from"./BasicModal.vue_vue_type_style_index_0_lang-a6cc267c.js";import{_ as K,u as Q}from"./useBaseTable-762f56d8.js";import{_ as Y}from"./button.vue_vue_type_style_index_0_lang-62481535.js";import{I as P}from"./Icon-166d9c4c.js";import{t as Z}from"./useDataTime-82b121cb.js";import{g as $}from"./convert-67c23be8.js";import{_ as q}from"./TextPreview.vue_vue_type_script_setup_true_lang-5caf890f.js";import{_ as D}from"./CustomTag.vue_vue_type_script_setup_true_lang-402527ac.js";import{b as a,d as ee,g as m,r as te,v as ae,l as oe,o as F,c as j,a as _,w as r,e as ie,j as c,G as le,k as ne,D as p,I as se}from"./index-9b2aca11.js";import{g as O}from"./index-bde41c1e.js";import{a as re,u as ue,c as ce,d as de}from"./brand-62ac341c.js";import{l as pe}from"./lodash-9fea1ac7.js";import{M as me,_ as fe}from"./index-9916c906.js";import{I as _e,_ as ge}from"./index-69d53d78.js";import{_ as ve,F as he}from"./index-c94144d7.js";import{U as be}from"./index-abebb28b.js";import{T as N}from"./isSymbol-9eff7f5f.js";import"./index-ecb41e0b.js";import"./vnode-65e3b720.js";import"./_plugin-vue_export-helper-96a0f382.js";import"./fa_IR-12dc9a45.js";import"./toArray-394e9dc6.js";import"./FormItemContext-e07dfdfb.js";import"./pickAttrs-ae094907.js";import"./useState-a25657a6.js";import"./css-449c90b8.js";import"./DialogWrap-ece2a7c9.js";import"./index-a1d1833b.js";import"./styleChecker-5b614c47.js";import"./textUtils-c37780ad.js";import"./isPlainObject-20c67e3b.js";import"./_flatRest-d8db1f92.js";import"./Col-408b2030.js";import"./useRefs-cbb314fe.js";const xe=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:t=>t.index+1},{title:"تصویر ",dataIndex:"image",key:"image",customRender:t=>{const C=$(t.record.image);return a("img",{src:C,width:60},null)}},{title:"عنوان",dataIndex:"title",key:"title"},{title:"توضیحات",dataIndex:"description",key:"description",width:500,customRender:t=>a(q,{text:t.record.description},null)},{title:"وضعیت ",dataIndex:"active",key:"active",type:"Boolean",width:100,customRender:t=>a("div",{class:"flex justify-center"},[a(D,{class:"px-3 font-bold py-1",textColor:t!=null&&t.record.active?"#65a30d":"#dc2626",bgColor:t!=null&&t.record.active?"#ecfccb":"#fee2e2"},{default:()=>[t!=null&&t.record.active?"فعال":"غیر فعال"]})])},{title:"وضعیت دسترسی ",dataIndex:"public",key:"public",filterField:"public",type:"Boolean",width:150,customRender:t=>a("div",{class:"flex justify-center"},[a(D,{class:"px-3 font-bold py-1",textColor:t!=null&&t.record.public?"#0d6fa3":"#333333",bgColor:t!=null&&t.record.public?"#cbe9fc":"#eaeaea"},{default:()=>[t!=null&&t.record.public?"عمومی":"خصوصی"]})])},{title:"زمان ایجاد",dataIndex:"created_at",key:"created_at",customRender:t=>Z(t.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}],ye={class:"flex justify-between items-center mb-4"},ke=_("h2",null,"برند ها",-1),we={class:"gap-2 flex justify-center"},Ie=_("span",null,"حذف",-1),Be=_("span",null,"ویرایش",-1),Ce={class:"grid grid-cols-3 gap-4"},Ue={key:0},Te=_("div",{style:{"margin-top":"8px"}},"آپلود",-1),ut=ee({__name:"index",setup(t){`${O()||localStorage.getItem("tamin_token")||""}`;const[C,M]=Q(),E=m({columns:xe,api:re,defaultPageLimit:20}),h=m(!1),k=m(!1),w=m(null),V=m([]),b=m(0),I=m(0),n=te({title:"",active:!0,image:void 0,owner_id:void 0,id:void 0,description:void 0,public:void 0});let z=pe.cloneDeep(n);m();const g=m([]);function S(){V.value=[],k.value=!1,w.value=null,h.value=!0}function R(){Object.assign(n,z),g.value=[],h.value=!1}function W(l){return l.type.startsWith("image/")?l.size/1024/1024<5?!0:(p.error("حجم تصویر باید کمتر از 5MB باشد"),!1):(p.error("فقط فایلهای تصویری مجاز است"),!1)}async function A(l){const{file:e,onSuccess:d,onError:u,onProgress:x}=l,f=new FormData;f.append("file",e);const B=`${se}/upload/machartaa-img`;I.value=0,b.value++,await new Promise((U,y)=>{const s=new XMLHttpReque
|