2 lines
7.5 KiB
JavaScript
2 lines
7.5 KiB
JavaScript
import{b as z,d as oe,i as r,c as a,g as t,p as ne,e as u,o as n,n as P,A as le,t as s,j as p,h as w,f,F as V,k as X,l as i,r as U,x as N,z as b,C as ae}from"./index-uaIxISOz.js";import{a as se,b as v,X as re}from"./model-B7iFcNBm.js";import{_ as q}from"./TooltipBtn.vue_vue_type_script_setup_true_lang-gQaA9IXi.js";import{p as ie,j as de}from"./filters-cD_YPaih.js";import{_ as ue}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./icons-B6PIngjD.js";import"./UnorderedListOutlined-4JxTobYT.js";import"./TeamOutlined-BvXnAQvF.js";import"./CreditCardOutlined-CC5aStCK.js";import"./index-DW596JTc.js";function ce(){const d=new se("admin/orders/list","لیست سفارش های تک فروشی");d.add(new v("id","شماره").filterNumber()),d.add(new v("customer.fname","نام مشتری").filterKey("customer.fullName").filterText()),d.add(new v("customer.lname","نام خانوادگی").filterKey("customer.fullName").filterText()),d.add(new v("total_price","جمع کل سفارش").renderSlot("total_price").filterText()),d.add(new v("items","تعداد آیتم ها").renderSlot("items_len").noSort()),d.add(new v("caj","تاریخ ثبت").filterKey("createdAt").filterDate().noSort()),d.add(new v("uaj","تاریخ ویرایش").hidden().filterKey("updatedAt").filterDate().noSort()),d.add(new v("user","ثبت کننده").renderSlot("user").noSort());const $=z();return $.roles&&$.roles.includes("order.tamin.state")&&(d.add(new v("sts_str","وضعیت").renderSlot("sts").noSort()),d.add(new v("branch.name","نام شعبه").filterText().noSort())),d.add(new v("opt","عملیات").noSort().renderSlot("opt")),d}const _e={id:"page-user-list"},fe={class:"flex"},pe={key:0},ve={key:0},me={key:1},ye={key:0},ke=["onClick"],we={key:1},be={class:"flex flex-col"},ge={key:0},he={class:"flex"},Ce={class:"flex-1"},Se={key:1,class:"flex items-center"},xe={key:2},Ue={key:0},$e={class:"flex justify-between"},je=oe({__name:"List",setup(d){const $=z(),y=l=>!!$.hasPermission(l),A=ce(),j=U(null),c=U(void 0),g=U(!1),h=U(!1),S=U(!1),I=ne(()=>ae()),T=l=>l?de(l):"";function M(l){return l.proceed?"green":"gray"}async function O(l){l.branch_id||(c.value=await B(l.id),h.value=!0)}async function B(l){const{data:o}=await N.get(`admin/orders/${l}`);return o}async function R(l){var o;try{await N.post("single/order-sts/edit",l),h.value=!1,b.info("ویرایش موفق آمیز"),(o=j.value)==null||o.fetch()}catch{b.error("خطا در ویرایش")}}async function E(l){var o;try{l.remove=!0,await N.post("single/order-sts/edit",l),h.value=!1,b.info("ویرایش موفق آمیز"),(o=j.value)==null||o.fetch()}catch{b.error("خطا در ویرایش")}}async function G(){var l;try{S.value=!S.value,g.value=!g.value,b.info("ویرایش موفق آمیز"),(l=j.value)==null||l.fetch()}catch{b.error("خطا در ویرایش")}}async function H(l){c.value=await B(l.id),g.value=!0}async function J(l){b.warning("خروجی PDF هنوز در بکاند جدید پیادهسازی نشده است")}return(l,o)=>{const C=u("a-tag"),x=u("a-button"),Q=u("a-popconfirm"),W=u("a-input"),Y=u("a-timeline-item"),Z=u("a-timeline"),D=u("a-modal"),m=u("a-descriptions-item"),L=u("a-descriptions"),F=u("a-input-number"),ee=u("a-divider"),K=u("a-card"),te=u("a-empty");return n(),r("div",_e,[a(K,{title:I.value?"لیست سفارش":"لیست سفارش های تک فروشی"},{default:t(()=>[a(re,{ref_key:"tbl",ref:j,model:P(A)},{opt:t(({record:e})=>[w("div",fe,[y("order.list.view")?(n(),f(q,{key:0,"icon-class":"w-5 h-5 text-primary",class:"mr-3",icon:"ListIcon",title:"مشاهده سفارش",onClick:_=>H(e)},null,8,["onClick"])):p("",!0),y("order.list.pdf")?(n(),f(q,{key:1,"icon-class":"w-5 h-5 text-danger",class:"mr-3",icon:"FileIcon",title:"دانلود pdf",onClick:_=>J(e.id)},null,8,["onClick"])):p("",!0)])]),items_len:t(({text:e})=>[e?(n(),r("div",pe,s(e.length),1)):p("",!0)]),user:t(({text:e,record:_})=>[e?(n(),r("div",ve,s(e.name),1)):(n(),r("div",me,s(_.customer.fname+" "+_.customer.lname),1))]),total_price:t(({text:e})=>[e?(n(),r("div",ye,s(P(ie)(e)),1)):p("",!
|