1import{a6 as H,j as e,r as c,E as _,aC as I}from"./vendor-CRX6iD7N.js";import{c as V,an as A,ca as F,aV as y,I as L,a4 as M,B as S,_ as s,cb as R,g as P,cc as $,cd as k}from"./index-UVktE5bE.js";import"./vendor_yup-BHFUDH6h.js";import"./vendor_marked-Ds7eXWqI.js";import{S as z}from"./seller-account-top-B28rZL2I.js";import"./vendor_datefns-Cni7y5m9.js";import"./vendor_lodash-HReYwCFr.js";import"./vendor_rpc-DdcAxShe.js";const T="_addRow_1epeu_1",W="_phoneField_1epeu_8",q="_state_1epeu_13",K="_idCell_1epeu_18",G="_actionsHeader_1epeu_23",J="_actionsCell_1epeu_27",O="_removeButton_1epeu_31",l={addRow:T,phoneField:W,state:q,idCell:K,actionsHeader:G,actionsCell:J,removeButton:O};function Q(){const{storeId:o}=H({from:"/authLayout/cabinet/seller/$sellerId/stores/$storeId/settings"});return e.jsx(U,{storeId:o},o)}function U({storeId:o}){const N=V(),h=A(),[i,m]=c.useState(null),[p,g]=c.useState(""),[x,f]=c.useState(!1),[u,v]=c.useState(!1),[E,w]=c.useState(0),d=c.useRef(!1),r=c.useRef(!1);c.useEffect(()=>{let t=!0;return r.current=!0,v(!1),m(null),F(o).then(a=>{t&&m(a)}).catch(a=>{t&&(v(!0),h(a,"Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑов"))}),()=>{t=!1,r.current=!1}},[o,h,E]);const C=async()=>{if(d.current||i==null||u)return;const t=p.replace(/\D/g,"");if((t.length===11&&t.startsWith("8")?"7"+t.slice(1):t).length!==11){N({type:"error",data:{text:"ÐведиÑе Ð½Ð¾Ð¼ÐµÑ ÑелеÑона полноÑÑÑÑ"}});return}d.current=!0,f(!0);try{const n=await $(o,p);if(!r.current)return;m(D=>{const b=D??[];return b.some(j=>j.id===n.id)?b.map(j=>j.id===n.id?n:j):[...b,n]}),g(""),N({type:"success",data:{text:"ÐÐµÐ½ÐµÐ´Ð¶ÐµÑ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½"}})}catch(n){r.current&&h(n,"Ðе ÑдалоÑÑ Ð´Ð¾Ð±Ð°Ð²Ð¸ÑÑ Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑа")}finally{d.current=!1,r.current&&f(!1)}},B=async t=>{if(!(d.current||i==null||u)){d.current=!0,f(!0);try{if(await k(o,t),!r.current)return;m(a=>(a??[]).filter(n=>n.id!==t)),N({type:"success",data:{text:"ÐÐµÐ½ÐµÐ´Ð¶ÐµÑ ÑдалÑн"}})}catch(a){r.current&&h(a,"Ðе ÑдалоÑÑ ÑдалиÑÑ Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑа")}finally{d.current=!1,r.current&&f(!1)}}};return e.jsxs(e.Fragment,{children:[e.jsx(z,{}),e.jsxs(y.Root,{children:[e.jsx(y.Title,{children:"ÐенеджеÑÑ"}),e.jsx(y.Divider,{}),e.jsxs("div",{className:l.addRow,children:[e.jsx(L,{className:l.phoneField,type:"tel",placeholder:"+7 900 000 00 00",value:p,onChange:t=>g(M(t.currentTarget.value)),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),C())},disabled:x||i==null||u}),e.jsx(S,{icon:"plus-big",square:!0,"aria-label":"ÐобавиÑÑ Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑа",title:"ÐобавиÑÑ Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑа",onClick:()=>{C()},loading:x,disabled:x||i==null||u||p.replace(/\D/g,"").length===0})]}),u?e.jsxs("div",{className:l.state,children:["Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑов.",e.jsx(S,{onClick:()=>w(t=>t+1),children:"ÐовÑоÑиÑÑ"})]}):i==null?e.jsx("p",{className:l.state,children:"ÐагÑÑжаемâ¦"}):i.length===0?e.jsx("p",{className:l.state,children:"Ðока Ð½ÐµÑ Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑов. ÐобавÑÑе полÑзоваÑÐµÐ»Ñ Ð¿Ð¾ номеÑÑ ÑелеÑона, ÑÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð¼Ñ Ð¿Ñи его ÑегиÑÑÑаÑии."}):e.jsx("div",{className:s.tableWrapper,children:e.jsxs("table",{className:s.table,children:[e.jsx("thead",{className:s.tableHead,children:e.jsxs("tr",{children:[e.jsx("th",{className:s.headerCell,children:"ID"}),e.jsx("th",{className:s.headerCell,children:"ТелеÑон"}),e.jsx("th",{className:s.headerCell,children:"ÐмÑ"}),e.jsx("th",{className:_(s.headerCell,l.actionsHeader)})]})}),e.jsx("tbody",{className:s.tableBody,children:i.map(t=>{const a=[t.firstName,t.lastName].filter(Boolean).join(" ").trim();return e.jsxs("tr",{className:s.row,children:[e.jsx("td",{className:s.cell,children:e.jsx("span",{className:_(s.textValue,l.idCell),children:t.id})}),e.jsx("td",{className:s.cell,children:e.jsx("span",{className:s.textValue,children:R(t.phone)})}),e.jsx("td",{className:s.cell,children:e.jsx("span",{className:s.textValue,children:a||"â"})}),e.jsx("td",{className:_(s.cell,l.actionsCell),children:e.jsx("button",{type:"button",className:l.removeButton,"aria-label":`УдалиÑÑ Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑа ${a||R(t.phone)}`,title:"УдалиÑÑ Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑа",disabled:x,onClick:()=>{B(t.id)},children:e.jsx(P,{name:"trash",size:20})})})]},t.id)})})]})})]})]})}const re=I("/authLayout/cabinet/seller/$sellerId/stores/$storeId/settings")({component:Q});
1export{re as Route};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.