feat: set allowed payment methods and max check months per product

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-16 09:25:44 +03:30
co-authored by Cursor
parent 188eb41eca
commit 72d407e38a
34 changed files with 76 additions and 33 deletions
@@ -1 +1 @@
import{A as e,ct as t,et as n,g as r,l as i}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{a}from"./http-CTjL79ty.js";import{B as o}from"./index-BbxghHSe.js";import{t as s}from"./BaseSwitch-Dz4ODUhf.js";function c(e=480){return new Promise(t=>{window.setTimeout(t,e)})}function l(e){let t=n(null),r=n(null),i=a();async function o(n,a){if(t.value)return a;let o=!a;if(!o&&e.confirmOff&&!await e.confirmOff())return a;t.value=n,r.value=null;let s=a;try{return await e.onPersist(o),i.success(e.successMessage?.(o)??(o?`وضعیت فعال شد.`:`وضعیت غیرفعال شد.`)),o}catch{return r.value=n,i.error(e.errorMessage??`به‌روزرسانی وضعیت انجام نشد.`),s}finally{t.value=null}}function s(e){return t.value===e}function c(e){return r.value===e}return{toggle:o,isLoading:s,hasError:c}}var u=r({__name:`ActiveSwitchCell`,props:{id:{},modelValue:{type:Boolean},entityName:{},entityType:{},persist:{type:Function}},emits:[`update:modelValue`],setup(n,{emit:r}){let a=n,u=r,{toggle:d,isLoading:f,hasError:p}=l({onPersist:async e=>{a.persist?await a.persist(a.id,e):await c()},successMessage:e=>e?`${a.entityType??`مورد`} «${a.entityName}» فعال شد.`:`${a.entityType??`مورد`} «${a.entityName}» غیرفعال شد.`});async function m(e){if(e===a.modelValue)return;let t=a.entityType??`مورد`;if(!await o({title:e?`فعال‌سازی ${t}`:`غیرفعال‌سازی ${t}`,message:e?`آیا از فعال کردن «${a.entityName}» مطمئن هستید؟`:`آیا از غیرفعال کردن «${a.entityName}» مطمئن هستید؟`,tone:e?`primary`:`danger`,confirmLabel:e?`فعال کردن`:`غیرفعال کردن`,cancelLabel:`انصراف`}))return;let n=await d(a.id,a.modelValue);u(`update:modelValue`,n)}return(r,a)=>(e(),i(s,{"model-value":n.modelValue,loading:t(f)(n.id),error:t(p)(n.id),"onUpdate:modelValue":m},null,8,[`model-value`,`loading`,`error`]))}});export{u as t};
import{A as e,ct as t,et as n,g as r,l as i}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{a}from"./http-CTjL79ty.js";import{B as o}from"./index-B8a4LU4h.js";import{t as s}from"./BaseSwitch-Dz4ODUhf.js";function c(e=480){return new Promise(t=>{window.setTimeout(t,e)})}function l(e){let t=n(null),r=n(null),i=a();async function o(n,a){if(t.value)return a;let o=!a;if(!o&&e.confirmOff&&!await e.confirmOff())return a;t.value=n,r.value=null;let s=a;try{return await e.onPersist(o),i.success(e.successMessage?.(o)??(o?`وضعیت فعال شد.`:`وضعیت غیرفعال شد.`)),o}catch{return r.value=n,i.error(e.errorMessage??`به‌روزرسانی وضعیت انجام نشد.`),s}finally{t.value=null}}function s(e){return t.value===e}function c(e){return r.value===e}return{toggle:o,isLoading:s,hasError:c}}var u=r({__name:`ActiveSwitchCell`,props:{id:{},modelValue:{type:Boolean},entityName:{},entityType:{},persist:{type:Function}},emits:[`update:modelValue`],setup(n,{emit:r}){let a=n,u=r,{toggle:d,isLoading:f,hasError:p}=l({onPersist:async e=>{a.persist?await a.persist(a.id,e):await c()},successMessage:e=>e?`${a.entityType??`مورد`} «${a.entityName}» فعال شد.`:`${a.entityType??`مورد`} «${a.entityName}» غیرفعال شد.`});async function m(e){if(e===a.modelValue)return;let t=a.entityType??`مورد`;if(!await o({title:e?`فعال‌سازی ${t}`:`غیرفعال‌سازی ${t}`,message:e?`آیا از فعال کردن «${a.entityName}» مطمئن هستید؟`:`آیا از غیرفعال کردن «${a.entityName}» مطمئن هستید؟`,tone:e?`primary`:`danger`,confirmLabel:e?`فعال کردن`:`غیرفعال کردن`,cancelLabel:`انصراف`}))return;let n=await d(a.id,a.modelValue);u(`update:modelValue`,n)}return(r,a)=>(e(),i(s,{"model-value":n.modelValue,loading:t(f)(n.id),error:t(p)(n.id),"onUpdate:modelValue":m},null,8,[`model-value`,`loading`,`error`]))}});export{u as t};
@@ -1 +1 @@
import{A as e,Ot as t,d as n,g as r,s as i,t as a}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{c as o,r as s}from"./index-BbxghHSe.js";var c=[`id`,`value`,`placeholder`,`disabled`],l=a(r({__name:`AdminCurrencyInput`,props:{modelValue:{default:null},placeholder:{default:``},disabled:{type:Boolean,default:!1},id:{},inputClass:{default:`admin-input`},allowEmpty:{type:Boolean,default:!0}},emits:[`update:modelValue`],setup(r,{emit:a}){let l=r,u=a,d=i(()=>l.modelValue==null||!Number.isFinite(l.modelValue)?``:o(l.modelValue));function f(e){let t=e.target,n=s(t.value);if(!n){u(`update:modelValue`,l.allowEmpty?null:0),t.value=``;return}let r=Number(n);u(`update:modelValue`,r),t.value=o(r)}return(i,a)=>(e(),n(`input`,{id:r.id,type:`text`,inputmode:`numeric`,dir:`ltr`,class:t([`admin-currency-input`,r.inputClass]),value:d.value,placeholder:r.placeholder,disabled:r.disabled,onInput:f},null,42,c))}}),[[`__scopeId`,`data-v-56435fc8`]]);export{l as t};
import{A as e,Ot as t,d as n,g as r,s as i,t as a}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{c as o,r as s}from"./index-B8a4LU4h.js";var c=[`id`,`value`,`placeholder`,`disabled`],l=a(r({__name:`AdminCurrencyInput`,props:{modelValue:{default:null},placeholder:{default:``},disabled:{type:Boolean,default:!1},id:{},inputClass:{default:`admin-input`},allowEmpty:{type:Boolean,default:!0}},emits:[`update:modelValue`],setup(r,{emit:a}){let l=r,u=a,d=i(()=>l.modelValue==null||!Number.isFinite(l.modelValue)?``:o(l.modelValue));function f(e){let t=e.target,n=s(t.value);if(!n){u(`update:modelValue`,l.allowEmpty?null:0),t.value=``;return}let r=Number(n);u(`update:modelValue`,r),t.value=o(r)}return(i,a)=>(e(),n(`input`,{id:r.id,type:`text`,inputmode:`numeric`,dir:`ltr`,class:t([`admin-currency-input`,r.inputClass]),value:d.value,placeholder:r.placeholder,disabled:r.disabled,onInput:f},null,42,c))}}),[[`__scopeId`,`data-v-56435fc8`]]);export{l as t};
@@ -1 +1 @@
import{A as e,At as t,N as n,O as r,Ot as i,P as a,V as o,W as s,a as c,c as l,d as u,et as d,g as f,h as p,jt as m,l as h,r as g,s as _,t as v,u as y,w as b}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{d as x,m as S,p as C}from"./http-CTjL79ty.js";import{L as w,M as T}from"./index-BbxghHSe.js";import{n as E,r as D,t as O}from"./selectOptionSearch-DqxHblYW.js";var k=[`id`],A=[`aria-label`,`aria-expanded`],j={class:`admin-select__trigger-content`},ee={class:`admin-select__value`},te={class:`admin-select__chevron`,"aria-hidden":`true`},M=[`aria-label`],N={key:0,class:`admin-select__search`,role:`presentation`},P=[`placeholder`],F={key:1,class:`admin-select__empty`,role:`presentation`},I=[`aria-selected`,`onClick`,`onKeydown`],L={class:`admin-select__option-label`},R=v(f({__name:`AdminSelect`,props:{modelValue:{},options:{},placeholder:{default:`انتخاب کنید`},ariaLabel:{default:`انتخاب`},block:{type:Boolean,default:!1},searchable:{type:Boolean,default:!0},searchPlaceholder:{default:`جستجو…`},id:{default:void 0}},emits:[`update:modelValue`],setup(f,{emit:v}){let R=f,z=v,B=d(!1),V=d(``),H=d(null),U=d(null),W=d(null),G=d({});T(H,()=>{B.value=!1,V.value=``},{ignore:[U]});let K=_(()=>R.options.find(e=>e.value===R.modelValue)),q=_(()=>K.value?.label??R.placeholder),J=_(()=>O(R.options,V.value));function Y(e){e.key===`ArrowDown`?(e.preventDefault(),D(U.value,`first`)):e.key===`ArrowUp`&&(e.preventDefault(),D(U.value,`last`))}function X(e,t){let n=e.currentTarget;e.key===`ArrowDown`?(e.preventDefault(),E(n,1)):e.key===`ArrowUp`?(e.preventDefault(),E(n,-1)):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),$(t))}function Z(){let e=H.value;if(!e)return;let t=e.getBoundingClientRect(),n=Math.min(320,window.innerHeight*.5),r=window.innerHeight-t.bottom-6,i=t.top-6,a=r<Math.min(160,n)&&i>r,o=Math.max(120,Math.min(n,a?i:r));G.value={position:`fixed`,left:`${Math.max(8,Math.min(t.left,window.innerWidth-Math.max(t.width,220)-8))}px`,width:`${Math.max(t.width,220)}px`,zIndex:`1100`,maxHeight:`${o}px`,...a?{top:`auto`,bottom:`${window.innerHeight-t.top+6}px`}:{top:`${t.bottom+6}px`,bottom:`auto`}}}function Q(e){e?(window.addEventListener(`resize`,Z),window.addEventListener(`scroll`,Z,!0)):(window.removeEventListener(`resize`,Z),window.removeEventListener(`scroll`,Z,!0))}async function ne(){B.value=!B.value,B.value&&(V.value=``,await b(),Z(),R.searchable&&(await b(),W.value?.focus()))}function $(e){z(`update:modelValue`,e),B.value=!1,V.value=``}return o(B,e=>{Q(e),e&&b(()=>Z())}),r(()=>{Q(!1)}),(r,o)=>(e(),u(`div`,{id:f.id,ref_key:`rootRef`,ref:H,class:i([`admin-select`,{"admin-select--open":B.value,"admin-select--block":f.block}])},[l(`button`,{type:`button`,class:`admin-select__trigger`,"aria-label":f.ariaLabel,"aria-expanded":B.value,"aria-haspopup":`listbox`,onClick:ne},[l(`span`,j,[a(r.$slots,`option-leading`,{option:K.value},void 0,!0),l(`span`,ee,m(q.value),1)]),l(`span`,te,[p(w,{name:`chevron-down`,size:16})])],8,A),(e(),h(c,{to:`body`},[B.value?(e(),u(`ul`,{key:0,ref_key:`menuRef`,ref:U,class:`admin-select__menu`,"data-select-menu":``,role:`listbox`,"aria-label":f.ariaLabel,style:t(G.value)},[f.searchable?(e(),u(`li`,N,[s(l(`input`,{ref_key:`searchInputRef`,ref:W,"onUpdate:modelValue":o[0]||=e=>V.value=e,type:`search`,class:`admin-select__search-input`,placeholder:f.searchPlaceholder,onClick:o[1]||=S(()=>{},[`stop`]),onKeydown:[o[2]||=C(S(e=>B.value=!1,[`stop`]),[`esc`]),Y]},null,40,P),[[x,V.value]])])):y(``,!0),J.value.length?y(``,!0):(e(),u(`li`,F,` موردی یافت نشد `)),(e(!0),u(g,null,n(J.value,t=>(e(),u(`li`,{key:t.value,role:`presentation`},[l(`button`,{type:`button`,class:i([`admin-select__option`,{"admin-select__option--active":t.value===f.modelValue}]),"data-select-option":``,role:`option`,"aria-selected":t.value===f.modelValue,onClick:e=>$(t.value),onKeydown:e=>X(e,t.value)},[l(`span`,L,[a(r.$slots,`option-leading`,{option:t},void 0,!0),l(`span`,null,m(t.label),1)]),t.value===f.modelValue?(e(),h(w,{key:0,name:`check`,size:16,class:`admin-select__check`})):y(``,!0)],42,I)]))),128))],12,M)):y(``,!0)]))],10,k))}}),[[`__scopeId`,`data-v-4ee349a1`]]);export{R as t};
import{A as e,At as t,N as n,O as r,Ot as i,P as a,V as o,W as s,a as c,c as l,d as u,et as d,g as f,h as p,jt as m,l as h,r as g,s as _,t as v,u as y,w as b}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{d as x,m as S,p as C}from"./http-CTjL79ty.js";import{L as w,M as T}from"./index-B8a4LU4h.js";import{n as E,r as D,t as O}from"./selectOptionSearch-CXDveuKM.js";var k=[`id`],A=[`aria-label`,`aria-expanded`],j={class:`admin-select__trigger-content`},ee={class:`admin-select__value`},te={class:`admin-select__chevron`,"aria-hidden":`true`},M=[`aria-label`],N={key:0,class:`admin-select__search`,role:`presentation`},P=[`placeholder`],F={key:1,class:`admin-select__empty`,role:`presentation`},I=[`aria-selected`,`onClick`,`onKeydown`],L={class:`admin-select__option-label`},R=v(f({__name:`AdminSelect`,props:{modelValue:{},options:{},placeholder:{default:`انتخاب کنید`},ariaLabel:{default:`انتخاب`},block:{type:Boolean,default:!1},searchable:{type:Boolean,default:!0},searchPlaceholder:{default:`جستجو…`},id:{default:void 0}},emits:[`update:modelValue`],setup(f,{emit:v}){let R=f,z=v,B=d(!1),V=d(``),H=d(null),U=d(null),W=d(null),G=d({});T(H,()=>{B.value=!1,V.value=``},{ignore:[U]});let K=_(()=>R.options.find(e=>e.value===R.modelValue)),q=_(()=>K.value?.label??R.placeholder),J=_(()=>O(R.options,V.value));function Y(e){e.key===`ArrowDown`?(e.preventDefault(),D(U.value,`first`)):e.key===`ArrowUp`&&(e.preventDefault(),D(U.value,`last`))}function X(e,t){let n=e.currentTarget;e.key===`ArrowDown`?(e.preventDefault(),E(n,1)):e.key===`ArrowUp`?(e.preventDefault(),E(n,-1)):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),$(t))}function Z(){let e=H.value;if(!e)return;let t=e.getBoundingClientRect(),n=Math.min(320,window.innerHeight*.5),r=window.innerHeight-t.bottom-6,i=t.top-6,a=r<Math.min(160,n)&&i>r,o=Math.max(120,Math.min(n,a?i:r));G.value={position:`fixed`,left:`${Math.max(8,Math.min(t.left,window.innerWidth-Math.max(t.width,220)-8))}px`,width:`${Math.max(t.width,220)}px`,zIndex:`1100`,maxHeight:`${o}px`,...a?{top:`auto`,bottom:`${window.innerHeight-t.top+6}px`}:{top:`${t.bottom+6}px`,bottom:`auto`}}}function Q(e){e?(window.addEventListener(`resize`,Z),window.addEventListener(`scroll`,Z,!0)):(window.removeEventListener(`resize`,Z),window.removeEventListener(`scroll`,Z,!0))}async function ne(){B.value=!B.value,B.value&&(V.value=``,await b(),Z(),R.searchable&&(await b(),W.value?.focus()))}function $(e){z(`update:modelValue`,e),B.value=!1,V.value=``}return o(B,e=>{Q(e),e&&b(()=>Z())}),r(()=>{Q(!1)}),(r,o)=>(e(),u(`div`,{id:f.id,ref_key:`rootRef`,ref:H,class:i([`admin-select`,{"admin-select--open":B.value,"admin-select--block":f.block}])},[l(`button`,{type:`button`,class:`admin-select__trigger`,"aria-label":f.ariaLabel,"aria-expanded":B.value,"aria-haspopup":`listbox`,onClick:ne},[l(`span`,j,[a(r.$slots,`option-leading`,{option:K.value},void 0,!0),l(`span`,ee,m(q.value),1)]),l(`span`,te,[p(w,{name:`chevron-down`,size:16})])],8,A),(e(),h(c,{to:`body`},[B.value?(e(),u(`ul`,{key:0,ref_key:`menuRef`,ref:U,class:`admin-select__menu`,"data-select-menu":``,role:`listbox`,"aria-label":f.ariaLabel,style:t(G.value)},[f.searchable?(e(),u(`li`,N,[s(l(`input`,{ref_key:`searchInputRef`,ref:W,"onUpdate:modelValue":o[0]||=e=>V.value=e,type:`search`,class:`admin-select__search-input`,placeholder:f.searchPlaceholder,onClick:o[1]||=S(()=>{},[`stop`]),onKeydown:[o[2]||=C(S(e=>B.value=!1,[`stop`]),[`esc`]),Y]},null,40,P),[[x,V.value]])])):y(``,!0),J.value.length?y(``,!0):(e(),u(`li`,F,` موردی یافت نشد `)),(e(!0),u(g,null,n(J.value,t=>(e(),u(`li`,{key:t.value,role:`presentation`},[l(`button`,{type:`button`,class:i([`admin-select__option`,{"admin-select__option--active":t.value===f.modelValue}]),"data-select-option":``,role:`option`,"aria-selected":t.value===f.modelValue,onClick:e=>$(t.value),onKeydown:e=>X(e,t.value)},[l(`span`,L,[a(r.$slots,`option-leading`,{option:t},void 0,!0),l(`span`,null,m(t.label),1)]),t.value===f.modelValue?(e(),h(w,{key:0,name:`check`,size:16,class:`admin-select__check`})):y(``,!0)],42,I)]))),128))],12,M)):y(``,!0)]))],10,k))}}),[[`__scopeId`,`data-v-4ee349a1`]]);export{R as t};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import{A as e,Ot as t,P as n,c as r,d as i,g as a,h as o,jt as s,t as c,u as l}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{L as u}from"./index-BbxghHSe.js";var d={class:`base-empty__icon`,"aria-hidden":`true`},f={class:`base-empty__title`},p={key:0,class:`base-empty__description`},m={key:1,class:`base-empty__actions`},h=c(a({__name:`BaseEmptyState`,props:{icon:{default:`file`},title:{},description:{},compact:{type:Boolean}},emits:[`action`,`secondary`],setup(a){return(c,h)=>(e(),i(`div`,{class:t([`base-empty`,{"base-empty--compact":a.compact}])},[r(`div`,d,[o(u,{name:a.icon,size:a.compact?28:36},null,8,[`name`,`size`])]),r(`h3`,f,s(a.title),1),a.description?(e(),i(`p`,p,s(a.description),1)):l(``,!0),c.$slots.default||c.$slots.secondary?(e(),i(`div`,m,[n(c.$slots,`default`,{},void 0,!0),n(c.$slots,`secondary`,{},void 0,!0)])):l(``,!0)],2))}}),[[`__scopeId`,`data-v-47ea81e4`]]);export{h as t};
import{A as e,Ot as t,P as n,c as r,d as i,g as a,h as o,jt as s,t as c,u as l}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{L as u}from"./index-B8a4LU4h.js";var d={class:`base-empty__icon`,"aria-hidden":`true`},f={class:`base-empty__title`},p={key:0,class:`base-empty__description`},m={key:1,class:`base-empty__actions`},h=c(a({__name:`BaseEmptyState`,props:{icon:{default:`file`},title:{},description:{},compact:{type:Boolean}},emits:[`action`,`secondary`],setup(a){return(c,h)=>(e(),i(`div`,{class:t([`base-empty`,{"base-empty--compact":a.compact}])},[r(`div`,d,[o(u,{name:a.icon,size:a.compact?28:36},null,8,[`name`,`size`])]),r(`h3`,f,s(a.title),1),a.description?(e(),i(`p`,p,s(a.description),1)):l(``,!0),c.$slots.default||c.$slots.secondary?(e(),i(`div`,m,[n(c.$slots,`default`,{},void 0,!0),n(c.$slots,`secondary`,{},void 0,!0)])):l(``,!0)],2))}}),[[`__scopeId`,`data-v-47ea81e4`]]);export{h as t};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,3 +1,3 @@
import{A as e,D as t,N as n,Q as r,U as i,W as a,c as o,d as s,et as c,g as l,h as u,jt as d,l as f,m as p,r as m,s as h,t as g}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{a as _,d as v,t as y}from"./http-CTjL79ty.js";import{S as b,V as x}from"./index-BbxghHSe.js";import{t as S}from"./AdminPageSkeleton-DacAHji8.js";import{t as C}from"./BaseEmptyState-l3F0gwHW.js";var w={class:`admin-page`},T={key:2,class:`admin-table`},E={dir:`ltr`},D=[`onClick`],O={class:`field`},k={class:`field`},A={class:`field`},j={class:`field`},M=[`disabled`],N=g(l({__name:`LevelsView`,setup(l){let g=c([]),N=c(!0),P=c(!1),F=c(null),I=_(),L=r({code:``,label:``,sortOrder:0,benefitsText:``}),R=h(()=>F.value?`ویرایش سطح`:`سطح جدید`);function z(e){return e.split(`
import{A as e,D as t,N as n,Q as r,U as i,W as a,c as o,d as s,et as c,g as l,h as u,jt as d,l as f,m as p,r as m,s as h,t as g}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{a as _,d as v,t as y}from"./http-CTjL79ty.js";import{S as b,V as x}from"./index-B8a4LU4h.js";import{t as S}from"./AdminPageSkeleton-DacAHji8.js";import{t as C}from"./BaseEmptyState-DuGjL3Tr.js";var w={class:`admin-page`},T={key:2,class:`admin-table`},E={dir:`ltr`},D=[`onClick`],O={class:`field`},k={class:`field`},A={class:`field`},j={class:`field`},M=[`disabled`],N=g(l({__name:`LevelsView`,setup(l){let g=c([]),N=c(!0),P=c(!1),F=c(null),I=_(),L=r({code:``,label:``,sortOrder:0,benefitsText:``}),R=h(()=>F.value?`ویرایش سطح`:`سطح جدید`);function z(e){return e.split(`
`).map(e=>e.trim()).filter(Boolean).map(e=>({title:e}))}async function B(){N.value=!0;try{g.value=await b.list()}catch(e){I.error(e instanceof y?e.message:`بارگذاری سطوح ناموفق بود`)}finally{N.value=!1}}function V(){F.value=null,Object.assign(L,{code:``,label:``,sortOrder:g.value.length+1,benefitsText:``}),P.value=!0}function H(e){F.value=e.id,Object.assign(L,{code:e.code,label:e.label,sortOrder:e.sortOrder,benefitsText:e.benefits.map(e=>e.title).join(`
`)}),P.value=!0}async function U(){try{let e={code:L.code.trim(),label:L.label.trim(),sortOrder:L.sortOrder,benefits:z(L.benefitsText)};F.value?await b.update(F.value,e):await b.create(e),P.value=!1,I.success(`ذخیره شد`),await B()}catch(e){I.error(e instanceof y?e.message:`ذخیره ناموفق بود`)}}return t(()=>{B()}),(t,r)=>(e(),s(`div`,w,[o(`header`,{class:`admin-page__head`},[r[5]||=o(`div`,null,[o(`h1`,null,`سطوح و مزایای مشتری`),o(`p`,null,`تعریف Level داخلی CRM و مزایای هر سطح (نمایش فقط در ادمین)`)],-1),o(`button`,{type:`button`,class:`admin-btn admin-btn--primary`,onClick:V},`سطح جدید`)]),N.value?(e(),f(S,{key:0,variant:`table`})):g.value.length?(e(),s(`table`,T,[r[6]||=o(`thead`,null,[o(`tr`,null,[o(`th`,null,`کد`),o(`th`,null,`عنوان`),o(`th`,null,`مزایا`),o(`th`,null,`مشتریان`),o(`th`)])],-1),o(`tbody`,null,[(e(!0),s(m,null,n(g.value,t=>(e(),s(`tr`,{key:t.id},[o(`td`,E,d(t.code),1),o(`td`,null,d(t.label),1),o(`td`,null,d(t.benefits.map(e=>e.title).join(`، `)||`—`),1),o(`td`,null,d(t.customersCount),1),o(`td`,null,[o(`button`,{type:`button`,class:`link`,onClick:e=>H(t)},`ویرایش`,8,D)])]))),128))])])):(e(),f(C,{key:1,title:`سطحی تعریف نشده`})),u(x,{open:P.value,title:R.value,onClose:r[4]||=e=>P.value=!1},{footer:i(()=>[o(`button`,{type:`button`,class:`admin-btn admin-btn--primary`,disabled:!L.code.trim()||!L.label.trim(),onClick:U},` ذخیره `,8,M)]),default:i(()=>[o(`label`,O,[r[7]||=p(`کد`,-1),a(o(`input`,{"onUpdate:modelValue":r[0]||=e=>L.code=e,class:`admin-input`,dir:`ltr`},null,512),[[v,L.code]])]),o(`label`,k,[r[8]||=p(`عنوان`,-1),a(o(`input`,{"onUpdate:modelValue":r[1]||=e=>L.label=e,class:`admin-input`},null,512),[[v,L.label]])]),o(`label`,A,[r[9]||=p(`ترتیب`,-1),a(o(`input`,{"onUpdate:modelValue":r[2]||=e=>L.sortOrder=e,type:`number`,class:`admin-input`},null,512),[[v,L.sortOrder,void 0,{number:!0}]])]),o(`label`,j,[r[10]||=p(` مزایا (هر خط یک مورد) `,-1),a(o(`textarea`,{"onUpdate:modelValue":r[3]||=e=>L.benefitsText=e,class:`admin-input`,rows:`4`},null,512),[[v,L.benefitsText]])])]),_:1},8,[`open`,`title`])]))}}),[[`__scopeId`,`data-v-44c7f808`]]);export{N as default};
@@ -1 +1 @@
import{A as e,W as t,c as n,ct as r,d as i,et as a,g as o,h as s,jt as c,m as l,s as u,t as d,u as f}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{a as p,d as m,l as h,m as g,u as _}from"./http-CTjL79ty.js";import{F as v,I as y,L as b,P as x,R as S,z as C}from"./index-BbxghHSe.js";var w={class:`login-page`},T={class:`login-page__form-wrap`},E={class:`login-page__card admin-card`},D={class:`login-page__header`},O={key:0,class:`login-page__mock-hint`},k={dir:`ltr`},A={dir:`ltr`},j={key:0,class:`admin-form__error`,role:`alert`},M={class:`admin-form__field`},N={class:`login-page__input-wrap`},P={class:`login-page__field-icon`,"aria-hidden":`true`},F={class:`admin-form__field`},I={class:`login-page__input-wrap login-page__input-wrap--password`},L={class:`login-page__field-icon`,"aria-hidden":`true`},R=[`type`],z=[`aria-label`],B={class:`login-page__remember`},V=[`disabled`],H={key:0,class:`admin-btn__spinner`,"aria-hidden":`true`},U=d(o({__name:`LoginView`,setup(o){let d=C(),U=S(),W=x(),G=p(),K=a(y()?v.phone:``),q=a(y()?v.password:``),J=a(!0),Y=a(!1),X=y(),Z=u(()=>K.value.trim().length>0&&q.value.length>0);function Q(e){return e.replace(/[۰-۹]/g,e=>String(`۰۱۲۳۴۵۶۷۸۹`.indexOf(e))).replace(/[٠-٩]/g,e=>String(`٠١٢٣٤٥٦٧٨٩`.indexOf(e)))}async function $(){if(!Z.value){W.error=`لطفاً شماره موبایل و رمز عبور را وارد کنید.`;return}if(!await W.login(Q(K.value.trim()),q.value,J.value))return;G.success(`خوش آمدید، ${W.fullName}`);let e=typeof U.query.redirect==`string`?U.query.redirect:`/`,t=`/admin/`.replace(/\/$/,``),n=e.startsWith(t)?e.slice(t.length)||`/`:e;await d.replace(n)}return(a,o)=>(e(),i(`div`,w,[n(`div`,T,[n(`div`,E,[n(`div`,D,[o[8]||=n(`h2`,{class:`login-page__title`},`ورود به پنل مدیریت`,-1),o[9]||=n(`p`,{class:`login-page__subtitle`},`برای ادامه، اطلاعات حساب کاربری خود را وارد کنید.`,-1),r(X)?(e(),i(`p`,O,[o[6]||=l(` حالت موک فعال است — `,-1),n(`span`,k,c(r(v).phone),1),o[7]||=l(` / `,-1),n(`span`,A,c(r(v).password),1)])):f(``,!0)]),n(`form`,{class:`admin-form login-page__form`,onSubmit:g($,[`prevent`])},[r(W).error?(e(),i(`p`,j,c(r(W).error),1)):f(``,!0),n(`div`,M,[o[10]||=n(`label`,{for:`login-phone`},`شماره موبایل`,-1),n(`div`,N,[n(`span`,P,[s(b,{name:`phone`,size:18})]),t(n(`input`,{id:`login-phone`,"onUpdate:modelValue":o[0]||=e=>K.value=e,type:`tel`,class:`admin-input login-page__input`,placeholder:`۰۹۱۲۱۱۱۱۲۲۲۲`,autocomplete:`username`,inputmode:`tel`,dir:`ltr`,onInput:o[1]||=e=>r(W).clearError()},null,544),[[m,K.value]])])]),n(`div`,F,[o[11]||=n(`label`,{for:`login-password`},`رمز عبور`,-1),n(`div`,I,[n(`span`,L,[s(b,{name:`lock`,size:18})]),t(n(`input`,{id:`login-password`,"onUpdate:modelValue":o[2]||=e=>q.value=e,type:Y.value?`text`:`password`,class:`admin-input login-page__input login-page__input--with-toggle`,placeholder:`رمز عبور`,autocomplete:`current-password`,onInput:o[3]||=e=>r(W).clearError()},null,40,R),[[_,q.value]]),n(`button`,{type:`button`,class:`login-page__toggle-password`,"aria-label":Y.value?`پنهان کردن رمز`:`نمایش رمز`,onClick:o[4]||=e=>Y.value=!Y.value},[s(b,{name:Y.value?`eye-off`:`eye`,size:18},null,8,[`name`])],8,z)])]),n(`label`,B,[t(n(`input`,{"onUpdate:modelValue":o[5]||=e=>J.value=e,type:`checkbox`},null,512),[[h,J.value]]),o[12]||=n(`span`,null,`مرا به خاطر بسپار`,-1)]),n(`button`,{type:`submit`,class:`admin-btn admin-btn--primary login-page__submit`,disabled:!Z.value||r(W).loading},[r(W).loading?(e(),i(`span`,H)):f(``,!0),o[13]||=l(` ورود به پنل `,-1)],8,V)],32)])]),n(`div`,{class:`login-page__brand`},[n(`div`,{class:`login-page__brand-inner`},[n(`img`,{src:`/admin/brand-logo.png`,alt:`نادمی تکس`,class:`login-page__brand-logo`}),o[14]||=n(`p`,{class:`login-page__brand-badge`},`پارچه`,-1),o[15]||=n(`h1`,{class:`login-page__brand-title`},`پنل مدیریت سفارش‌های عمده`,-1),o[16]||=n(`p`,{class:`login-page__brand-text`},` مدیریت سفارش‌ها، مشتریان، قیمت‌گذاری، چک‌ها و گزارش‌های فروش در یک محیط یکپارچه. `,-1)])])]))}}),[[`__scopeId`,`data-v-e708878f`]]);export{U as default};
import{A as e,W as t,c as n,ct as r,d as i,et as a,g as o,h as s,jt as c,m as l,s as u,t as d,u as f}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{a as p,d as m,l as h,m as g,u as _}from"./http-CTjL79ty.js";import{F as v,I as y,L as b,P as x,R as S,z as C}from"./index-B8a4LU4h.js";var w={class:`login-page`},T={class:`login-page__form-wrap`},E={class:`login-page__card admin-card`},D={class:`login-page__header`},O={key:0,class:`login-page__mock-hint`},k={dir:`ltr`},A={dir:`ltr`},j={key:0,class:`admin-form__error`,role:`alert`},M={class:`admin-form__field`},N={class:`login-page__input-wrap`},P={class:`login-page__field-icon`,"aria-hidden":`true`},F={class:`admin-form__field`},I={class:`login-page__input-wrap login-page__input-wrap--password`},L={class:`login-page__field-icon`,"aria-hidden":`true`},R=[`type`],z=[`aria-label`],B={class:`login-page__remember`},V=[`disabled`],H={key:0,class:`admin-btn__spinner`,"aria-hidden":`true`},U=d(o({__name:`LoginView`,setup(o){let d=C(),U=S(),W=x(),G=p(),K=a(y()?v.phone:``),q=a(y()?v.password:``),J=a(!0),Y=a(!1),X=y(),Z=u(()=>K.value.trim().length>0&&q.value.length>0);function Q(e){return e.replace(/[۰-۹]/g,e=>String(`۰۱۲۳۴۵۶۷۸۹`.indexOf(e))).replace(/[٠-٩]/g,e=>String(`٠١٢٣٤٥٦٧٨٩`.indexOf(e)))}async function $(){if(!Z.value){W.error=`لطفاً شماره موبایل و رمز عبور را وارد کنید.`;return}if(!await W.login(Q(K.value.trim()),q.value,J.value))return;G.success(`خوش آمدید، ${W.fullName}`);let e=typeof U.query.redirect==`string`?U.query.redirect:`/`,t=`/admin/`.replace(/\/$/,``),n=e.startsWith(t)?e.slice(t.length)||`/`:e;await d.replace(n)}return(a,o)=>(e(),i(`div`,w,[n(`div`,T,[n(`div`,E,[n(`div`,D,[o[8]||=n(`h2`,{class:`login-page__title`},`ورود به پنل مدیریت`,-1),o[9]||=n(`p`,{class:`login-page__subtitle`},`برای ادامه، اطلاعات حساب کاربری خود را وارد کنید.`,-1),r(X)?(e(),i(`p`,O,[o[6]||=l(` حالت موک فعال است — `,-1),n(`span`,k,c(r(v).phone),1),o[7]||=l(` / `,-1),n(`span`,A,c(r(v).password),1)])):f(``,!0)]),n(`form`,{class:`admin-form login-page__form`,onSubmit:g($,[`prevent`])},[r(W).error?(e(),i(`p`,j,c(r(W).error),1)):f(``,!0),n(`div`,M,[o[10]||=n(`label`,{for:`login-phone`},`شماره موبایل`,-1),n(`div`,N,[n(`span`,P,[s(b,{name:`phone`,size:18})]),t(n(`input`,{id:`login-phone`,"onUpdate:modelValue":o[0]||=e=>K.value=e,type:`tel`,class:`admin-input login-page__input`,placeholder:`۰۹۱۲۱۱۱۱۲۲۲۲`,autocomplete:`username`,inputmode:`tel`,dir:`ltr`,onInput:o[1]||=e=>r(W).clearError()},null,544),[[m,K.value]])])]),n(`div`,F,[o[11]||=n(`label`,{for:`login-password`},`رمز عبور`,-1),n(`div`,I,[n(`span`,L,[s(b,{name:`lock`,size:18})]),t(n(`input`,{id:`login-password`,"onUpdate:modelValue":o[2]||=e=>q.value=e,type:Y.value?`text`:`password`,class:`admin-input login-page__input login-page__input--with-toggle`,placeholder:`رمز عبور`,autocomplete:`current-password`,onInput:o[3]||=e=>r(W).clearError()},null,40,R),[[_,q.value]]),n(`button`,{type:`button`,class:`login-page__toggle-password`,"aria-label":Y.value?`پنهان کردن رمز`:`نمایش رمز`,onClick:o[4]||=e=>Y.value=!Y.value},[s(b,{name:Y.value?`eye-off`:`eye`,size:18},null,8,[`name`])],8,z)])]),n(`label`,B,[t(n(`input`,{"onUpdate:modelValue":o[5]||=e=>J.value=e,type:`checkbox`},null,512),[[h,J.value]]),o[12]||=n(`span`,null,`مرا به خاطر بسپار`,-1)]),n(`button`,{type:`submit`,class:`admin-btn admin-btn--primary login-page__submit`,disabled:!Z.value||r(W).loading},[r(W).loading?(e(),i(`span`,H)):f(``,!0),o[13]||=l(` ورود به پنل `,-1)],8,V)],32)])]),n(`div`,{class:`login-page__brand`},[n(`div`,{class:`login-page__brand-inner`},[n(`img`,{src:`/admin/brand-logo.png`,alt:`نادمی تکس`,class:`login-page__brand-logo`}),o[14]||=n(`p`,{class:`login-page__brand-badge`},`پارچه`,-1),o[15]||=n(`h1`,{class:`login-page__brand-title`},`پنل مدیریت سفارش‌های عمده`,-1),o[16]||=n(`p`,{class:`login-page__brand-text`},` مدیریت سفارش‌ها، مشتریان، قیمت‌گذاری، چک‌ها و گزارش‌های فروش در یک محیط یکپارچه. `,-1)])])]))}}),[[`__scopeId`,`data-v-e708878f`]]);export{U as default};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
.products-page__filters[data-v-87b603ef]{flex-wrap:wrap;align-items:center;gap:12px;margin-bottom:16px;padding:12px 14px;display:flex}.products-page__search[data-v-87b603ef]{min-width:200px;color:var(--color-text-muted);flex:1;align-items:center;gap:10px;display:flex}.products-page__search-input[data-v-87b603ef]{background:0 0;border:none;outline:none;flex:1;font-size:.875rem}.products-page__catalog-filter[data-v-87b603ef]{width:min(260px,100%)}.admin-form__hint[data-v-87b603ef]{color:var(--color-text-muted);margin:6px 0 0;font-size:.75rem;line-height:1.5}.products-page__table[data-v-87b603ef]{overflow:hidden}.product-thumb[data-v-87b603ef]{background:#e8eceb 50%/cover no-repeat;border-radius:8px;width:44px;height:36px;display:block}.product-thumb--empty[data-v-87b603ef]{background:#eef1f0}.color-variants__hint[data-v-87b603ef]{color:var(--color-text-muted);margin:0 0 10px;font-size:.75rem;line-height:1.6}.general-images[data-v-87b603ef],.color-variants[data-v-87b603ef]{flex-direction:column;gap:10px;display:flex}.product-media-row[data-v-87b603ef]{border:1px solid var(--color-border);background:var(--color-elevated,#fff);border-radius:14px;grid-template-columns:1fr auto;align-items:center;gap:12px 14px;padding:12px 14px;display:grid;box-shadow:0 1px 2px #0f172a0a}.product-media-row--color[data-v-87b603ef]{grid-template-columns:auto 1fr auto;align-items:center}.product-media-row[data-v-87b603ef] .image-picker{min-width:0}.product-media-row__input[data-v-87b603ef]{min-width:0;height:44px}.product-media-row__delete[data-v-87b603ef]{width:40px;height:40px;color:var(--color-text-muted);cursor:pointer;background:0 0;border:1px solid #0000;border-radius:12px;flex-shrink:0;justify-content:center;align-items:center;padding:0;transition:color .15s,background .15s,border-color .15s;display:inline-flex}.product-media-row__delete[data-v-87b603ef]:hover{color:#c53030;background:#c5303014;border-color:#c530302e}.product-media-row__delete[data-v-87b603ef]:focus-visible{outline:2px solid var(--color-primary,#2d6a4f);outline-offset:2px}.product-media-add[data-v-87b603ef]{justify-content:center;align-self:stretch}@media (width<=520px){.product-media-row--color[data-v-87b603ef]{grid-template-rows:auto auto;grid-template-columns:1fr auto}.product-media-row--color[data-v-87b603ef] .image-picker{grid-column:1/-1}.product-media-row--color .product-media-row__delete[data-v-87b603ef]{grid-area:2/2}.product-media-row--color .product-media-row__input[data-v-87b603ef]{grid-area:2/1}}
+1
View File
@@ -0,0 +1 @@
.products-page__filters[data-v-275860c0]{flex-wrap:wrap;align-items:center;gap:12px;margin-bottom:16px;padding:12px 14px;display:flex}.products-page__search[data-v-275860c0]{min-width:200px;color:var(--color-text-muted);flex:1;align-items:center;gap:10px;display:flex}.products-page__search-input[data-v-275860c0]{background:0 0;border:none;outline:none;flex:1;font-size:.875rem}.products-page__catalog-filter[data-v-275860c0]{width:min(260px,100%)}.admin-form__hint[data-v-275860c0]{color:var(--color-text-muted);margin:6px 0 0;font-size:.75rem;line-height:1.5}.products-page__table[data-v-275860c0]{overflow:hidden}.product-thumb[data-v-275860c0]{background:#e8eceb 50%/cover no-repeat;border-radius:8px;width:44px;height:36px;display:block}.product-thumb--empty[data-v-275860c0]{background:#eef1f0}.color-variants__hint[data-v-275860c0]{color:var(--color-text-muted);margin:0 0 10px;font-size:.75rem;line-height:1.6}.general-images[data-v-275860c0],.color-variants[data-v-275860c0]{flex-direction:column;gap:10px;display:flex}.product-media-row[data-v-275860c0]{border:1px solid var(--color-border);background:var(--color-elevated,#fff);border-radius:14px;grid-template-columns:1fr auto;align-items:center;gap:12px 14px;padding:12px 14px;display:grid;box-shadow:0 1px 2px #0f172a0a}.product-media-row--color[data-v-275860c0]{grid-template-columns:auto 1fr auto;align-items:center}.product-media-row[data-v-275860c0] .image-picker{min-width:0}.product-media-row__input[data-v-275860c0]{min-width:0;height:44px}.product-media-row__delete[data-v-275860c0]{width:40px;height:40px;color:var(--color-text-muted);cursor:pointer;background:0 0;border:1px solid #0000;border-radius:12px;flex-shrink:0;justify-content:center;align-items:center;padding:0;transition:color .15s,background .15s,border-color .15s;display:inline-flex}.product-media-row__delete[data-v-275860c0]:hover{color:#c53030;background:#c5303014;border-color:#c530302e}.product-media-row__delete[data-v-275860c0]:focus-visible{outline:2px solid var(--color-primary,#2d6a4f);outline-offset:2px}.product-media-add[data-v-275860c0]{justify-content:center;align-self:stretch}@media (width<=520px){.product-media-row--color[data-v-275860c0]{grid-template-rows:auto auto;grid-template-columns:1fr auto}.product-media-row--color[data-v-275860c0] .image-picker{grid-column:1/-1}.product-media-row--color .product-media-row__delete[data-v-275860c0]{grid-area:2/2}.product-media-row--color .product-media-row__input[data-v-275860c0]{grid-area:2/1}}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import{A as e,D as t,N as n,Q as r,U as i,W as a,c as o,d as s,et as c,g as l,h as u,jt as d,l as f,m as p,r as m,s as h,t as g}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{a as _,d as v,t as y}from"./http-CTjL79ty.js";import{E as b,V as x,j as S,y as C}from"./index-BbxghHSe.js";import{t as w}from"./AdminPageSkeleton-DacAHji8.js";import{t as T}from"./BaseEmptyState-l3F0gwHW.js";import{t as E}from"./AdminSelect-B8-q-_Pq.js";var D={class:`admin-page`},O={class:`admin-page__head`},k={key:2,class:`admin-table`},A={class:`muted`,dir:`ltr`},j=[`onClick`],M={class:`field`},N={class:`field`},P={class:`field`},F=[`disabled`],I=g(l({__name:`SuggestionsView`,setup(l){let g=c([]),I=c(!0),L=c([]),R=c([]),z=c(!1),B=_(),V=r({customerId:``,productId:``,note:``}),H=h(()=>L.value.map(e=>({value:e.id,label:e.name?.trim()||e.phone}))),U=h(()=>R.value.map(e=>({value:e.id,label:`${e.name} (${e.productCode})`})));async function W(){I.value=!0;try{let[e,t,n]=await Promise.all([S.list(),C.list(),b.list()]);g.value=e,L.value=t,R.value=n}catch(e){B.error(e instanceof y?e.message:`بارگذاری ناموفق بود`)}finally{I.value=!1}}async function G(){try{await S.create({customerId:V.customerId,productId:V.productId,note:V.note.trim()||void 0}),z.value=!1,V.note=``,B.success(`پیشنهاد ثبت شد`),await W()}catch(e){B.error(e instanceof y?e.message:`ثبت ناموفق بود`)}}async function K(e){try{await S.setActive(e.id,!e.isActive),await W()}catch(e){B.error(e instanceof y?e.message:`به‌روزرسانی ناموفق بود`)}}return t(()=>{W()}),(t,r)=>(e(),s(`div`,D,[o(`header`,O,[r[5]||=o(`div`,null,[o(`h1`,null,`پیشنهاد محصول`),o(`p`,null,`پیشنهاد دستی محصول به مشتری`)],-1),o(`button`,{type:`button`,class:`admin-btn admin-btn--primary`,onClick:r[0]||=e=>z.value=!0},`پیشنهاد جدید`)]),I.value?(e(),f(w,{key:0,variant:`table`})):g.value.length?(e(),s(`table`,k,[r[6]||=o(`thead`,null,[o(`tr`,null,[o(`th`,null,`مشتری`),o(`th`,null,`محصول`),o(`th`,null,`یادداشت`),o(`th`,null,`وضعیت`),o(`th`)])],-1),o(`tbody`,null,[(e(!0),s(m,null,n(g.value,t=>(e(),s(`tr`,{key:t.id},[o(`td`,null,d(t.customerName),1),o(`td`,null,[p(d(t.productName)+` `,1),o(`span`,A,`(`+d(t.productCode)+`)`,1)]),o(`td`,null,d(t.note||`—`),1),o(`td`,null,d(t.isActive?`فعال`:`غیرفعال`),1),o(`td`,null,[o(`button`,{type:`button`,class:`link`,onClick:e=>K(t)},d(t.isActive?`غیرفعال`:`فعال`),9,j)])]))),128))])])):(e(),f(T,{key:1,title:`پیشنهادی ثبت نشده`})),u(x,{open:z.value,title:`پیشنهاد محصول`,onClose:r[4]||=e=>z.value=!1},{footer:i(()=>[o(`button`,{type:`button`,class:`admin-btn admin-btn--primary`,disabled:!V.customerId||!V.productId,onClick:G},` ثبت `,8,F)]),default:i(()=>[o(`label`,M,[r[7]||=p(`مشتری `,-1),u(E,{modelValue:V.customerId,"onUpdate:modelValue":r[1]||=e=>V.customerId=e,options:H.value},null,8,[`modelValue`,`options`])]),o(`label`,N,[r[8]||=p(`محصول `,-1),u(E,{modelValue:V.productId,"onUpdate:modelValue":r[2]||=e=>V.productId=e,options:U.value},null,8,[`modelValue`,`options`])]),o(`label`,P,[r[9]||=p(`یادداشت`,-1),a(o(`textarea`,{"onUpdate:modelValue":r[3]||=e=>V.note=e,class:`admin-input`,rows:`3`},null,512),[[v,V.note]])])]),_:1},8,[`open`])]))}}),[[`__scopeId`,`data-v-56e3e728`]]);export{I as default};
import{A as e,D as t,N as n,Q as r,U as i,W as a,c as o,d as s,et as c,g as l,h as u,jt as d,l as f,m as p,r as m,s as h,t as g}from"./_plugin-vue_export-helper-vx-p5QAT.js";import{a as _,d as v,t as y}from"./http-CTjL79ty.js";import{E as b,V as x,j as S,y as C}from"./index-B8a4LU4h.js";import{t as w}from"./AdminPageSkeleton-DacAHji8.js";import{t as T}from"./BaseEmptyState-DuGjL3Tr.js";import{t as E}from"./AdminSelect-C3DgMRX7.js";var D={class:`admin-page`},O={class:`admin-page__head`},k={key:2,class:`admin-table`},A={class:`muted`,dir:`ltr`},j=[`onClick`],M={class:`field`},N={class:`field`},P={class:`field`},F=[`disabled`],I=g(l({__name:`SuggestionsView`,setup(l){let g=c([]),I=c(!0),L=c([]),R=c([]),z=c(!1),B=_(),V=r({customerId:``,productId:``,note:``}),H=h(()=>L.value.map(e=>({value:e.id,label:e.name?.trim()||e.phone}))),U=h(()=>R.value.map(e=>({value:e.id,label:`${e.name} (${e.productCode})`})));async function W(){I.value=!0;try{let[e,t,n]=await Promise.all([S.list(),C.list(),b.list()]);g.value=e,L.value=t,R.value=n}catch(e){B.error(e instanceof y?e.message:`بارگذاری ناموفق بود`)}finally{I.value=!1}}async function G(){try{await S.create({customerId:V.customerId,productId:V.productId,note:V.note.trim()||void 0}),z.value=!1,V.note=``,B.success(`پیشنهاد ثبت شد`),await W()}catch(e){B.error(e instanceof y?e.message:`ثبت ناموفق بود`)}}async function K(e){try{await S.setActive(e.id,!e.isActive),await W()}catch(e){B.error(e instanceof y?e.message:`به‌روزرسانی ناموفق بود`)}}return t(()=>{W()}),(t,r)=>(e(),s(`div`,D,[o(`header`,O,[r[5]||=o(`div`,null,[o(`h1`,null,`پیشنهاد محصول`),o(`p`,null,`پیشنهاد دستی محصول به مشتری`)],-1),o(`button`,{type:`button`,class:`admin-btn admin-btn--primary`,onClick:r[0]||=e=>z.value=!0},`پیشنهاد جدید`)]),I.value?(e(),f(w,{key:0,variant:`table`})):g.value.length?(e(),s(`table`,k,[r[6]||=o(`thead`,null,[o(`tr`,null,[o(`th`,null,`مشتری`),o(`th`,null,`محصول`),o(`th`,null,`یادداشت`),o(`th`,null,`وضعیت`),o(`th`)])],-1),o(`tbody`,null,[(e(!0),s(m,null,n(g.value,t=>(e(),s(`tr`,{key:t.id},[o(`td`,null,d(t.customerName),1),o(`td`,null,[p(d(t.productName)+` `,1),o(`span`,A,`(`+d(t.productCode)+`)`,1)]),o(`td`,null,d(t.note||`—`),1),o(`td`,null,d(t.isActive?`فعال`:`غیرفعال`),1),o(`td`,null,[o(`button`,{type:`button`,class:`link`,onClick:e=>K(t)},d(t.isActive?`غیرفعال`:`فعال`),9,j)])]))),128))])])):(e(),f(T,{key:1,title:`پیشنهادی ثبت نشده`})),u(x,{open:z.value,title:`پیشنهاد محصول`,onClose:r[4]||=e=>z.value=!1},{footer:i(()=>[o(`button`,{type:`button`,class:`admin-btn admin-btn--primary`,disabled:!V.customerId||!V.productId,onClick:G},` ثبت `,8,F)]),default:i(()=>[o(`label`,M,[r[7]||=p(`مشتری `,-1),u(E,{modelValue:V.customerId,"onUpdate:modelValue":r[1]||=e=>V.customerId=e,options:H.value},null,8,[`modelValue`,`options`])]),o(`label`,N,[r[8]||=p(`محصول `,-1),u(E,{modelValue:V.productId,"onUpdate:modelValue":r[2]||=e=>V.productId=e,options:U.value},null,8,[`modelValue`,`options`])]),o(`label`,P,[r[9]||=p(`یادداشت`,-1),a(o(`textarea`,{"onUpdate:modelValue":r[3]||=e=>V.note=e,class:`admin-input`,rows:`3`},null,512),[[v,V.note]])])]),_:1},8,[`open`])]))}}),[[`__scopeId`,`data-v-56e3e728`]]);export{I as default};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import{l as e}from"./index-BbxghHSe.js";function t(t){return e(t).toLowerCase().replace(/ي/g,`ی`).replace(/ك/g,`ک`).normalize(`NFKC`).trim()}function n(e,n){let r=t(n);return!r||t(e).includes(r)}function r(e,t){let r=t.trim();return r?e.filter(e=>n(e.label,r)):e}function i(e,t){if(!e)return;let n=e.querySelectorAll(`[data-select-option]`);(t===`first`?n[0]:n[n.length-1])?.focus()}function a(e,t){let n=e.closest(`[data-select-menu]`);if(!n)return;let r=[...n.querySelectorAll(`[data-select-option]`)],i=r.indexOf(e);i<0||r[i+t]?.focus()}export{a as n,i as r,r as t};
import{l as e}from"./index-B8a4LU4h.js";function t(t){return e(t).toLowerCase().replace(/ي/g,`ی`).replace(/ك/g,`ک`).normalize(`NFKC`).trim()}function n(e,n){let r=t(n);return!r||t(e).includes(r)}function r(e,t){let r=t.trim();return r?e.filter(e=>n(e.label,r)):e}function i(e,t){if(!e)return;let n=e.querySelectorAll(`[data-select-option]`);(t===`first`?n[0]:n[n.length-1])?.focus()}function a(e,t){let n=e.closest(`[data-select-menu]`);if(!n)return;let r=[...n.querySelectorAll(`[data-select-option]`)],i=r.indexOf(e);i<0||r[i+t]?.focus()}export{a as n,i as r,r as t};