Files
tehran_taj/apps/admin-panel/dist/assets/cityList-Cc1Z6hFj.js
T
mahmoodandClaude Sonnet 5.5 6514b05d18 fix(money,orders): wage/gram-debt parity, atomic document confirm, expert edit, made-to-order, QA fixes
- Rial wage and gram-debt arithmetic matched to the reference; order corrections keep debt in sync
- Document confirm/un-confirm is a compare-and-swap (no double-applied cache under concurrency)
- Settlement document and expert inputs validated (400 instead of 500)
- Expert: edit / activate-deactivate own customers, adjust raw weights only
- Made-to-order flow in the app, PreOrder.quantity migration
- Order grids: customer column, sort keys; panel select search; pre-order quantity save
- Rebuilt release artifacts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 18:09:02 +03:30

2 lines
4.5 KiB
JavaScript

import{a as z,b as c,X as A}from"./model-mwiDYd1J.js";import{_ as G}from"./ListPageHeader.vue_vue_type_script_setup_true_lang-YlEXklTr.js";import{_ as H}from"./createCity.vue_vue_type_script_setup_true_lang-DCWOwlVG.js";import{d as J,u as K,b as R,c as a,w as o,r as s,o as k,h as x,a as U,E as j,i as N,G as q,p as F,f as S,t as C,m as d,z as I,y as T,J as B}from"./index-CpVArufm.js";import{u as Q}from"./useDeleteHandler-K9FWNrnm.js";import{_ as W}from"./CityTreeSelect.vue_vue_type_script_setup_true_lang-BtBj3fof.js";import"./filters-CoNJlguG.js";import"./index-DjZc5EYL.js";import"./SettingOutlined-E4OknxY2.js";import"./BaseFormModal.vue_vue_type_style_index_0_lang-B4iVMhZt.js";function Y(){const r=new z("admin/misc/cities/list","لیست شهر ها");return r.add(new c("title","نام شهر").filterKey("name").filterText()),r.add(new c("parent_title","والد").renderSlot("parent_title").noSort()),r.add(new c("percent","درصد مشتری عمده").renderSlot("percent").noSort()),r.add(new c("percent_aux","درصد کارشناس فروش").renderSlot("percent_aux").noSort()),r.add(new c("opt","عملیات").noSort().renderSlot("opt")),r}const Z={id:"page-user-list"},pe=J({__name:"cityList",setup(r){const D=K(),$=n=>!!D.hasPermission(n),E=Y(),m=d(null),b=d(!1),_=d(!1),y=d(void 0),l=I({title:"",parent:void 0,percent:null,percent_aux:null}),g=d([]);async function O(n){y.value=n,l.title=n.title??"",l.parent=n.parent??void 0,l.percent=n.percent===null||n.percent===void 0?null:Number(n.percent),l.percent_aux=n.percent_aux===null||n.percent_aux===void 0?null:Number(n.percent_aux);try{const{data:e}=await T.post("cities/list");g.value=e.rows??[]}catch(e){console.log(e)}_.value=!0}async function V(){var n,e,p,f;try{await T.put(`cities/${(n=y.value)==null?void 0:n.id}`,{title:l.title,parent:l.parent??null,percent:l.percent,percent_aux:l.percent_aux}),B.success("تغییرات ثبت شد"),_.value=!1,(e=m.value)==null||e.fetch()}catch(u){B.error(((f=(p=u==null?void 0:u.response)==null?void 0:p.data)==null?void 0:f.message)??"خطا در ثبت تغییرات")}}const{remove:X}=Q({onSuccess:()=>{var n;return(n=m.value)==null?void 0:n.fetch()},successMessage:"شهر حذف شد",fallbackErrorMessage:"خطا در حذف شهر"});return(n,e)=>{const p=s("a-tooltip"),f=s("a-popconfirm"),u=s("a-input"),v=s("a-form-item"),w=s("a-input-number"),M=s("a-form"),L=s("a-modal"),P=s("a-card");return k(),R("div",Z,[a(P,{title:"لیست شهر ها",class:"page-card"},{default:o(()=>[a(A,{ref_key:"citiesTable",ref:m,model:x(E),"mobile-cards":""},{add:o(()=>[a(G,{rid:"cities.create","add-label":"افزودن شهر",onAdd:e[0]||(e[0]=t=>b.value=!0)})]),parent_title:o(({text:t})=>[S(C(t??"—"),1)]),percent:o(({text:t})=>[S(C(t??"-"),1)]),percent_aux:o(({text:t})=>[S(C(t??"-"),1)]),opt:o(({record:t})=>[$("cities.list.view.edit")?(k(),U(p,{key:0,title:"ویرایش"},{default:o(()=>[a(x(j),{class:"cursor-pointer mx-1 text-primary",onClick:i=>O(t)},null,8,["onClick"])]),_:2},1024)):N("",!0),$("cities.list.remove")?(k(),U(p,{key:1,title:"حذف"},{default:o(()=>[a(f,{placement:"top","ok-text":"بله","cancel-text":"خیر",onConfirm:i=>x(X)(`cities/${t.id}`)},{title:o(()=>[...e[8]||(e[8]=[F("p",null,"آیا مطمئن به حذف شهر مورد نظر هستید ؟",-1)])]),default:o(()=>[a(x(q),{class:"cursor-pointer mx-1 text-danger"})]),_:1},8,["onConfirm"])]),_:2},1024)):N("",!0)]),_:1},8,["model"]),a(L,{open:_.value,"onUpdate:open":e[5]||(e[5]=t=>_.value=t),title:"ویرایش شهر",onOk:V},{default:o(()=>[a(M,{layout:"vertical"},{default:o(()=>[a(v,{label:"نام شهر"},{default:o(()=>[a(u,{value:l.title,"onUpdate:value":e[1]||(e[1]=t=>l.title=t)},null,8,["value"])]),_:1}),a(v,{label:"والد",help:"خالی = سرشاخه، مثل کشور"},{default:o(()=>{var t;return[a(W,{value:l.parent,"onUpdate:value":e[2]||(e[2]=i=>l.parent=i),cities:g.value,"parent-picker":"","exclude-id":(t=y.value)==null?void 0:t.id,placeholder:"والد را انتخاب کنید"},null,8,["value","cities","exclude-id"])]}),_:1}),a(v,{label:"درصد مشتری عمده"},{default:o(()=>[a(w,{value:l.percent,"onUpdate:value":e[3]||(e[3]=t=>l.percent=t),class:"w-full",step:.1},null,8,["value"])]),_:1}),a(v,{label:"درصد کارشناس فروش"},{default:o(()=>[a(w,{value:l.percent_aux,"onUpdate:value":e[4]||(e[4]=t=>l.percent_aux=t),class:"w-full",step:.1},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["open"]),a(H,{open:b.value,"onUpdate:open":e[6]||(e[6]=t=>b.value=t),onSuccess:e[7]||(e[7]=t=>{var i;return(i=m.value)==null?void 0:i.fetch()})},null,8,["open"])]),_:1})])}}});export{pe as default};