Replace standalone customer create and meeting report pages with overlays, add TimeInput, remove opaque input backgrounds app-wide, improve desktop layouts/skeletons, and refresh shopping, customer, and reminder screens.
1 line
6.8 KiB
JavaScript
1 line
6.8 KiB
JavaScript
import{A as e,C as ee,Ct as t,D as te,Et as n,L as r,M as ne,N as i,O as a,P as o,R as s,St as c,Tt as re,Y as l,Z as u,_ as d,g as ie,it as f,j as p,mt as m,n as ae,q as oe,tt as se,w as h,z as g}from"./BasicIcon-C6boaehV.js";import{o as _}from"./format-BHJptHdF.js";import{i as ce,s as le,y as ue}from"./index-DzzUgmYT.js";import{t as de}from"./IconChevronBack-DORV2H0q.js";import{t as fe}from"./IconMoreVertical-BPkOm_2U.js";import{t as pe}from"./PageSkeleton-uO-jhbNm.js";import{t as me}from"./crm-CtglbPsN.js";import{t as he}from"./useGoBack-CgNp0uP9.js";var ge={class:`page reminders-page`},_e={class:`top`},v={class:`top__actions`},y={class:`page__scroll page__scroll--with-nav reminders-scroll`},b={class:`filters`},x=[`onClick`],S={key:0,class:`count-badge`},C={key:1},w={key:2,class:`create-panel`},T={key:0,class:`create-error`},E=[`value`],D={class:`create-row`},O={class:`create-actions`},k=[`disabled`],A={key:3,class:`summary`},j={class:`summary__head`},M={class:`summary__label`},N={class:`summary__count`},P=[`onClick`],F={class:`time`},I=[`onClick`],L={class:`reminder-card__body`},ve={class:`reminder-card__top`},ye={class:`customer`},be={class:`contact`},xe={class:`desc`},R=ae(g({__name:`RemindersView`,setup(ae){let g=ie(),R=d(),{goBack:z}=he(`/`),B=me(),V=e(()=>String(g.query.filter??`today`)),H=m([]),U=m([]),W=m(!0),G=m(null),K=m(!1),q=m(!1),J=m({customerId:``,title:``,date:``,time:`10:00`,note:``}),Se=[{id:`all`,label:`همه`},{id:`today`,label:`امروز`},{id:`week`,label:`هفته آینده`},{id:`past`,label:`گذشته`}],Y=e(()=>H.value.filter(e=>!e.completed)),X=e(()=>H.value.filter(e=>e.completed)),Ce=e(()=>Y.value.length),Z=e(()=>X.value.length);async function Q(){W.value=!0,G.value=null;try{H.value=await B.loadReminders(V.value)}catch(e){G.value=e instanceof Error?e.message:`بارگذاری یادآورها ناموفق بود.`,H.value=[]}finally{W.value=!1}}oe(Q),se(V,Q);function $(e){R.replace({path:`/reminders`,query:{filter:e}})}async function we(e){try{await B.markReminderComplete(e),await Q()}catch(e){G.value=e instanceof Error?e.message:`تکمیل یادآور ناموفق بود.`}}function Te(e){return e===`in_person`?`ملاقات حضوری`:e===`call`?`تماس تلفنی`:e===`message`?`پیام`:`یادداشت`}function Ee(e){return e===`in_person`?`tag--green`:e===`call`?`tag--blue`:`tag--purple`}let De=e(()=>V.value===`today`?`پیگیریهای امروز`:V.value===`week`?`پیگیریهای هفته آینده`:V.value===`past`?`پیگیریهای گذشته`:`پیگیریهای باز`);async function Oe(){K.value=!0,G.value=null;try{if(U.value=await B.loadCustomers(),!J.value.customerId&&U.value[0]&&(J.value.customerId=U.value[0].id),!J.value.date){let e=new Date;J.value.date=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}}catch(e){G.value=e instanceof Error?e.message:`بارگذاری مشتریان ناموفق بود.`}}async function ke(){if(!J.value.customerId||!J.value.title.trim()||!J.value.date||!J.value.time){G.value=`مشتری، عنوان، تاریخ و ساعت الزامی است.`;return}q.value=!0,G.value=null;try{await B.createReminder({customerId:J.value.customerId,title:J.value.title.trim(),date:J.value.date,time:J.value.time,note:J.value.note.trim()||void 0,description:J.value.note.trim()||void 0}),K.value=!1,J.value.title=``,J.value.note=``,await Q()}catch(e){G.value=e instanceof Error?e.message:`ثبت یادآور ناموفق بود.`}finally{q.value=!1}}return(e,d)=>(l(),o(`div`,ge,[p(`header`,_e,[p(`button`,{type:`button`,class:`icon-btn`,"aria-label":`بازگشت`,onClick:d[0]||=(...e)=>c(z)&&c(z)(...e)},[s(de,{size:20})]),d[9]||=p(`h1`,null,`یادآورها`,-1),p(`div`,v,[s(ce,{variant:`inline`}),p(`button`,{type:`button`,class:`icon-btn`,"aria-label":`اعلانها`,onClick:d[1]||=e=>c(R).push(`/profile/notifications`)},[s(le,{size:18})])])]),p(`div`,y,[p(`div`,b,[(l(),o(a,null,u(Se,e=>p(`button`,{key:e.id,type:`button`,class:t([`filter`,{"filter--active":V.value===e.id}]),onClick:ee=>$(e.id)},[r(n(e.label)+` `,1),e.id===`past`&&Z.value?(l(),o(`span`,S,n(Z.value.toLocaleString(`fa-IR`)),1)):i(``,!0)],10,x)),64))]),W.value?(l(),ne(pe,{key:0,variant:`list`})):G.value&&!K.value?(l(),o(`p`,C,n(G.value),1)):i(``,!0),K.value?(l(),o(`section`,w,[d[16]||=p(`h3`,null,`یادآور جدید`,-1),G.value?(l(),o(`p`,T,n(G.value),1)):i(``,!0),p(`label`,null,[d[11]||=r(` مشتری `,-1),f(p(`select`,{"onUpdate:modelValue":d[2]||=e=>J.value.customerId=e},[d[10]||=p(`option`,{disabled:``,value:``},`انتخاب مشتری`,-1),(l(!0),o(a,null,u(U.value,e=>(l(),o(`option`,{key:e.id,value:e.id},n(e.name||e.contactName),9,E))),128))],512),[[ee,J.value.customerId]])]),p(`label`,null,[d[12]||=r(` عنوان `,-1),f(p(`input`,{"onUpdate:modelValue":d[3]||=e=>J.value.title=e,type:`text`,placeholder:`مثلاً پیگیری نمونه`},null,512),[[h,J.value.title]])]),p(`div`,D,[p(`label`,null,[d[13]||=r(` تاریخ `,-1),f(p(`input`,{"onUpdate:modelValue":d[4]||=e=>J.value.date=e,type:`date`},null,512),[[h,J.value.date]])]),p(`label`,null,[d[14]||=r(` ساعت `,-1),f(p(`input`,{"onUpdate:modelValue":d[5]||=e=>J.value.time=e,type:`time`},null,512),[[h,J.value.time]])])]),p(`label`,null,[d[15]||=r(` یادداشت `,-1),f(p(`textarea`,{"onUpdate:modelValue":d[6]||=e=>J.value.note=e,rows:`2`,placeholder:`اختیاری`},null,512),[[h,J.value.note]])]),p(`div`,O,[p(`button`,{type:`button`,class:`btn-cancel`,onClick:d[7]||=e=>K.value=!1},`انصراف`),p(`button`,{type:`button`,class:`btn-save`,disabled:q.value,onClick:ke},n(q.value?`در حال ثبت...`:`ثبت یادآور`),9,k)])])):!W.value&&!G.value?(l(),o(`section`,A,[p(`div`,j,[p(`span`,M,n(De.value),1)]),p(`div`,N,[p(`strong`,null,n(c(_)(Ce.value)),1),d[17]||=p(`span`,null,`مورد`,-1)]),d[18]||=p(`p`,{class:`summary__sub`},`یادآورهای شما برای پیگیری مشتریان`,-1)])):i(``,!0),(l(!0),o(a,null,u(Y.value,e=>(l(),o(`article`,{key:e.id,class:`reminder-card`,onClick:ee=>c(R).push({path:`/reminder`,query:{id:e.id}})},[p(`span`,F,n(e.time),1),p(`button`,{type:`button`,class:`check`,"aria-label":`تکمیل`,onClick:te(ee=>we(e.id),[`stop`])},null,8,I),p(`div`,L,[p(`div`,ve,[p(`strong`,null,n(e.title),1),s(fe,{size:16})]),p(`span`,{class:t([`tag`,Ee(e.interactionType)])},n(Te(e.interactionType)),3),p(`p`,ye,n(e.customerName),1),p(`p`,be,n(e.contactName),1),p(`p`,xe,n(e.description),1)]),p(`div`,{class:`avatar`,style:re({background:e.avatarColor})},n(e.avatarLetter),5)],8,P))),128)),p(`button`,{type:`button`,class:`completed-bar`,onClick:d[8]||=e=>$(`past`)},[d[19]||=r(` یادآورهای تکمیلشده `,-1),p(`span`,null,n(c(_)(X.value.length)),1)]),p(`button`,{type:`button`,class:`new-btn`,onClick:Oe},[s(ue,{size:20,color:`#fff`}),d[20]||=r(` یادآور جدید `,-1)])])]))}}),[[`__scopeId`,`data-v-5f336dcc`]]);export{R as default}; |