1"use strict";(self.webpackChunksmarty_crm_frontend=self.webpackChunksmarty_crm_frontend||[]).push([[9222],{7924(e,t,i){i.d(t,{h:()=>a});var n,l=i(96540);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},s.apply(null,arguments)}const a=e=>l.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",width:7,height:14,viewBox:"0 0 7 14"},e),n||(n=l.createElement("g",{fill:"none",fillRule:"evenodd",stroke:"#201600",strokeWidth:2},l.createElement("path",{d:"m1 4.2 2.5-2.6L6 4.2M6 9l-2.5 2.6L1 9"}))));i.p},9222(e,t,i){i.r(t),i.d(t,{default:()=>I});var n=i(64467),l=i(69733),s=i(20053),a=i(94152),o=i(7059),d=i(34389),c=i(96540),r=i(43375),f=i(43627),p=i(74979),h=i(3157),b=i(24463),u=i(46376),m=i(1529),C=i(80646),x=i(3055),v=i(25503),w=i(32034),g=i(41217),j=i(65231),y=i(19118),A=i(98491),k=i(2298),N=i(50330),_=i(57347),O=i(99784),F=i(16249);const E={wrapper:"wrapper--bd726df6bb4687e87adb","modal-content":"modal-content--ec0449d8d46f4a9d2253","select-label":"select-label--f2c3839af03cd01c19c1",templateName:"templateName--b2f8a6817a2996564a9d",select:"select--d340486034c26fe91955",actions:"actions--ca733ff547ccdd475f11","items-content-box":"items-content-box--d6306b6fa347d2d36f21","items-content-checkbox":"items-content-checkbox--a464dc134e78c08ce64a",selectAllButton:"selectAllButton--ce27eb46142a46050f5b",field:"field--dfc1e000b308faeb710c",addFields:"addFields--ab7600aaf49baeb908cb",checkboxWrapper:"checkboxWrapper--c35c303520d31cf618dd",checkboxList:"checkboxList--fc725a868fc6845c83bf",fieldTitle:"fieldTitle--eb695a7cdd9a9716d416",buttons:"buttons--dfa999d39d9c1783ee52",actionsBetween:"actionsBetween--d081605e5101c40a213b",search:"search--c8070312d88c7a7d6878",close:"close--e22f2db41f4602ac716b",content:"content--eac8ea01c5a7355f4763"};var M=i(74848);function D(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function P(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?D(Object(i),!0).forEach(function(t){(0,n.A)(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):D(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}const B=[{_id:"isImportant",title:"Тип обÑекÑа"},{_id:"_groupId",title:"ÐÑÑппа"},{_id:"stage",title:"ÐÑап"},{_id:"_createdBy",title:"СоздаÑелÑ"},{_id:"_createdOn",title:"ÐаÑа и вÑÐµÐ¼Ñ ÑозданиÑ"},{_id:"marks",title:"Теги"},{_id:"responsibles",title:"ÐÑвеÑÑÑвеннÑе"},{_id:"subscribres",title:"ÐаблÑдаÑели"},{_id:"shortId",title:"ID"}],L=e=>{let{id:t,field:i,section:n,onDeleteField:l}=e;const{attributes:o,listeners:d,setNodeRef:c,transform:r,transition:b,isDragging:u}=(0,f.gl)({id:t}),{formatMessage:m}=(0,y.tz)(),C={transform:p.Ks.Transform.toString(r),transition:b};return(0,M.jsxs)("div",P(P(P({ref:c,style:C},o),d),{},{className:(0,s.A)(E.field,{[E.isDragging]:u}),children:[(0,M.jsxs)("div",{className:(0,s.A)(E.fieldTitle),children:[(0,M.jsxs)("svg",{width:"8",height:"20",viewBox:"0 0 8 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,M.jsx)("path",{d:"M1 2C1.55228 2 2 1.55228 2 1C2 0.447715 1.55228 0 1 0C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2Z",fill:"#C0CFDC"}),(0,M.jsx)("path",{d:"M1 8C1.55228 8 2 7.55228 2 7C2 6.44772 1.55228 6 1 6C0.447715 6 0 6.44772 0 7C0 7.55228 0.447715 8 1 8Z",fill:"#C0CFDC"}),(0,M.jsx)("path",{d:"M1 14C1.55228 14 2 13.5523 2 13C2 12.4477 1.55228 12 1 12C0.447715 12 0 12.4477 0 13C0 13.5523 0.447715 14 1 14Z",fill:"#C0CFDC"}),(0,M.jsx)("path",{d:"M1 20C1.55228 20 2 19.5523 2 19C2 18.4477 1.55228 18 1 18C0.447715 18 0 18.4477 0 19C0 19.5523 0.447715 20 1 20Z",fill:"#C0CFDC"}),(0,M.jsx)("path",{d:"M7 2C7.55228 2 8 1.55228 8 1C8 0.447715 7.55228 0 7 0C6.44772 0 6 0.447715 6 1C6 1.55228 6.44772 2 7 2Z",fill:"#C0CFDC"}),(0,M.jsx)("path",{d:"M7 8C7.55228 8 8 7.55228 8 7C8 6.44772 7.55228 6 7 6C6.44772 6 6 6.44772 6 7C6 7.55228 6.44772 8 7 8Z",fill:"#C0CFDC"}),(0,M.jsx)("path",{d:"M7 14C7.55228 14 8 13.5523 8 13C8 12.4477 7.55228 12 7 12C6.44772 12 6 12.4477 6 13C6 13.5523 6.44772 14 7 14Z",fill:"#C0CFDC"}),(0,M.jsx)("path",{d:"M7 20C7.55228 20 8 19.5523 8 19C8 18.4477 7.55228 18 7 18C6.44772 18 6 18.4477 6 19C6 19.5523 6.44772 20 7 20Z",fill:"#C0CFDC"})]}),(0,M.jsx)("span",{children:m({id:null!=i&&i.title?null==i?void 0:i.title:"ÐаÑвки"===n.label?N.nl[i]:N.Ms[i]})})]}),(0,M.jsx)("div",{children:(0,M.jsx)(h.A,{icon:a.h,className:(0,s.A)("box-row align-middle",E.close),onClick:e=>{e.stopPropagation(),l(i)}})})]}))},I=e=>{let{template:t,templates:i,collectionName:n}=e;const[a,p]=(0,c.useState)(""),[h,D]=(0,c.useState)(1),[P,I]=(0,c.useState)({}),[S,W]=(0,c.useState)([]),[Z,R]=(0,c.useState)([]),[q,H]=(0,c.useState)(""),[K,V]=(0,c.useState)(""),[T,z]=(0,c.useState)(!0),G=(0,l.d4)((0,v.iX)("fields")),{formatMessage:U}=(0,y.tz)(),X=(0,l.wA)();(0,c.useEffect)(()=>{null!=t&&t._id&&X((0,w.dO)(null==t?void 0:t._id)).then(e=>{const i=e.payload.result;"requisitions"===i.collectionName?I({label:"ÐаÑвки",value:0}):I({label:"ÐонÑакÑÑ",value:1}),p(i.title);const n=G.filter(e=>!!t.fields.find(t=>e._id===t||e.innerField===t)),l=B.filter(e=>!!t.fields.find(t=>e._id===t)),s=t.fields.map(e=>{const t=n.find(t=>t.innerField===e),i=n.find(t=>t._id===e),s=l.find(t=>t._id===e);return t?e:i||s?i||s:void 0});W(s)}),n&&I("requisitions"===n?{label:"ÐаÑвки",value:0}:{label:"ÐонÑакÑÑ",value:1})},[t,n]),(0,c.useEffect)(()=>{"ÐаÑвки"!==P.label||T?P.label&&!T&&W(k.Fn.map(e=>e._id).concat(B)):W(k.cF.map(e=>e._id).concat(B)),T&&z(!1)},[P,T]);const $=(0,c.useCallback)(()=>
1{if(!a.trim().length)return void V("isEmpty");const e=i.find(e=>e.title===a);if(e&&(null==t||!t._id)||e&&null!=t&&t._id&&e._id!==(null==t?void 0:t._id))return void V("nameExist");const n="ÐаÑвки"===P.label?"requisitions":"contacts",l=S.map(e=>null!=e&&e._id?null==e?void 0:e._id:e);null!=t&&t._id?X((0,w.d5)(n,l,a,null==t?void 0:t._id)).then(()=>X((0,A.Vc)({type:j.bv6.CONFIRM}))):X((0,w.mn)(n,l,a)).then(e=>X((0,A.Vc)({type:j.bv6.CONFIRM,template:e.payload.result})))},[a,P,S,t,i]),J=(0,c.useCallback)(()=>{const e=[...S].concat(Z);W(e),R([]),D(1),H("")},[Z,S]),Q=(0,c.useCallback)((e,t)=>{if(e){const e=[...Z,t.innerField?t.innerField:t];R(e)}else{const e=Z.filter(e=>e!==t.innerField&&(null==e?void 0:e._id)!==t._id);R(e)}},[Z]),Y=(0,c.useCallback)(e=>{const t=S.filter(t=>e._id?t._id!==e._id:t!==e);W(t)},[S]),ee=(0,c.useCallback)(()=>{X((0,w.I7)(null==t?void 0:t._id)).then(()=>X((0,A.Vc)({type:j.bv6.CONFIRM})))},[t,X]),te=(0,c.useCallback)(e=>{e.trim().length?V(!1):V("isEmpty"),p(e)},[]),ie=(0,c.useCallback)(e=>{let t;return"ÐаÑвки"===P.label?(t=k.cF.find(t=>t._id===e.innerField),!!t):"ÐонÑакÑÑ"===P.label?(t=k.Fn.find(t=>t._id===e.innerField),!!t):void 0},[P]);return(0,M.jsx)(M.Fragment,{children:h&&1===h?(0,M.jsx)(M.Fragment,{children:(0,M.jsx)(g.A,{className:(0,s.A)("nowrap",E.wrapper),title:U({id:null!=t&&t._id?"ÐаÑÑÑойка Ñаблона":"Создание Ñаблона"}),contentClassName:(0,s.A)(E.content),children:(0,M.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",height:"100%",flexDirection:"column",paddingRight:"20px"},children:[(0,M.jsxs)("div",{className:(0,s.A)("box-col nowrap",E["items-content"]),children:[(0,M.jsx)(x.A,{className:(0,s.A)(E.templateName),title:"ÐведиÑе название",value:a,onChange:e=>te(e),error:(0,F.A)(()=>"isEmpty"===K?U({id:"Ðоле должно бÑÑÑ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¾"}):"nameExist"===K&&U({id:"Шаблон Ñ Ñаким названием Ñже ÑÑÑеÑÑвÑеÑ"}),(0,_.A)(j.Hgq.default)),onBlur:e=>!e.target.value.trim()&&V("isEmpty"),info:(0,O.A)(j.Hgq.default)}),(0,M.jsx)("b",{style:{marginBottom:P.label?"19px":"0"},children:"ÐÑбеÑиÑе даннÑе, коÑоÑÑе Ñ
оÑиÑе ÑкÑпоÑÑиÑоваÑÑ"}),(0,M.jsx)(b.A,{className:(0,s.A)(E.select),label:U({id:"Раздел"}),value:P.label?P:"",options:[{label:"ÐаÑвки",value:0},{label:"ÐонÑакÑÑ",value:1}],onChange:e=>I(e),noOptionsMessage:U({id:"nothingFound"})}),(0,M.jsx)("div",{style:{minHeight:"0",maxHeight:"calc(100vh - 480px)"},className:(0,s.A)("box-col scrollable"),children:(0,M.jsx)(r.Mp,{collisionDetection:r.y$,onDragEnd:e=>{let{active:t,over:i}=e;if(!i||t.id===i.id)return;const n=S.findIndex(e=>((null==e?void 0:e._id)||e)===t.id),l=S.findIndex(e=>((null==e?void 0:e._id)||e)===i.id);W((0,f.be)(S,n,l))},children:(0,M.jsx)(f.gB,{items:S.map(e=>(null==e?void 0:e._id)||e),strategy:f._G,children:(0,M.jsx)("div",{children:S.length?S.map(e=>(0,M.jsx)(L,{id:(null==e?void 0:e._id)||e,field:e,section:P,onDeleteField:Y},(null==e?void 0:e._id)||e)):(0,M.jsx)(M.Fragment,{})})})})}),P.label&&(0,M.jsxs)("div",{className:(0,s.A)(E.addFields),onClick:()=>D(2),children:[(0,M.jsx)(o.h,{}),(0,M.jsx)("div",{children:"ÐобавиÑÑ"})]})]}),(0,M.jsxs)("div",{className:(0,s.A)("box-row space-between align-middle",E.buttons),children:[(null==t?void 0:t._id)&&(0,M.jsxs)("div",{className:(0,s.A)("box-row align-middle"),style:{cursor:"pointer",gap:"8px",maxWidth:"150px"},onClick:()=>D(3),children:[(0,M.jsx)(d.h,{}),(0,M.jsx)("span",{children:"УдалиÑÑ Ñаблон"})]}),(0,M.jsxs)("div",{className:(0,s.A)("box-row",null!=t&&t._id?E.actions:E.actionsBetween),children:[(0,M.jsx)(u.A,{kind:"secondary",onClick:()=>X((0,A.Vc)({type:j.bv6.CANCEL})),className:(0,s.A)(E.selectAllButton),"data-name":"chooseAllBtn",children:U({id:"tasksCancel"})}),(0,M.jsx)(u.A,{disabled:!a||!P.label,onClick:()=>$(),children:U({id:"optSave"})})]})]})]})})}):2===h?(0,M.jsx)(g.A,{className:(0,s.A)(E.nowrap),title:U({id:"Ðобавление ÑÑолбÑов"}),children:(0,M.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",height:"100%",flexDirection:"column"},children:[(0,M.jsx)(m.A,{className:(0,s.A)(E.search),value:q,placeholder:U({id:"centerSidebarHintSearch"}),onChange:e=>H(e)}),(0,M.jsx)("div",{className:(0,s.A)("box-col nowrap scrollable",E.checkboxList),children:G.concat(B).filter(e=>null!=e&&e.title&&!S.find(t=>e.title===t.title||e.innerField===t)?!q.toLowerCase()||e.title.toLowerCase().includes(q.toLowerCase().trim()):q?!S.find(t=>e.title===t.title||e.innerField===t)&&U({id:null==e?void 0:e.innerField}).toLowerCase().includes(q.toLowerCase().trim())&&ie(e):!S.find(t=>e.title===t.title||e.innerField===t)&&ie(e)).length?G.concat(B).filter(e=>null!=e&&e.title&&!S.find(t=>e.title===t.title||e.innerField===t)?!q.toLowerCase()||e.title.toLowerCase().includes(q.toLowerCase().trim()):q?!S.find(t=>e.title===t.title||e.innerField===t)&&U({id:null==e?void 0:e.innerField}).toLowerCase().includes(q.toLowerCase().trim())&&ie(e):!S.find(t=>e.title===t.title||e.innerField===t)&&ie(e)).map((e,t)=>(0,M.jsxs)("div",{className:(0,s.A)(E.checkboxWrapper),children:[(0,M.jsx)(C.A,{checked:Z.find(t=>t===(null==e?void 0:e.innerField)||t._id===(null==e?void 0:e._id)),onChange:t=>Q(t,e)}),(0,M.jsx)("div",{children:null!=e&&e.title?U({id:null==e?void 0:e.title}):U({id:"ÐаÑвки"===P.label?N.nl[e.innerField]:N.Ms[e.innerField]})})]},t)):(0,M.jsx)("div",{className:(0,s.A)("box-row"),style:{height:"200px"},children:(0,M.jsx)("div",{style:{margin:"auto",opacity:"50%"},children:"ÐÐµÑ Ð¿Ð¾Ð»ÐµÐ¹ Ð´Ð»Ñ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ"})})}),(0,M.jsxs)("div",{className:(0,s.A)("box-row space-between",E.buttons),children:[(0,M.jsx)(u.A,{kind:"secondary",onClick:()=>{D(1),H("")},className:(0,s.A)(E.selectAllButton),"data-name":"chooseAllBtn",children:U({id:"tasksCancel"})}),(0,M.jsx)(u.A,{label:"".concat(U({id:"add"})," ").concat(Z.length?Z.length:""),onClick:()=>J()})]})]})}):(0,M.jsx)(g.A,{className:(0,s.A)(E.nowrap),title:U({id:"УдалиÑÑ"}),children:(0,M.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",height:"100%",flexDirection:"column"},children:[(0,M.jsxs)("div",{style:{marginBottom:"36px"},children:["ÐÑ ÑвеÑенÑ, ÑÑо Ñ
оÑиÑе ÑдалиÑÑ Ñаблон ",(0,M.jsx)("b",{children:null==t?void 0:t.t
1itle}),"?"]}),(0,M.jsxs)("div",{className:(0,s.A)("box-row space-between",E.buttons),children:[(0,M.jsx)(u.A,{kind:"secondary",onClick:()=>D(1),className:(0,s.A)(E.selectAllButton),"data-name":"chooseAllBtn",children:U({id:"tasksCancel"})}),(0,M.jsx)(u.A,{onClick:()=>ee(),children:U({id:"УдалиÑÑ"})})]})]})})})}},41217(e,t,i){i.d(t,{A:()=>j,M:()=>g});var n=i(80045),l=i(64467),s=i(96540),a=i(20053),o=i(69733),d=i(60794),c=i(7924),r=i(38327),f=i(94152),p=i(68263),h=i(3157),b=i(98491),u=i(65231),m=i(95844),C=i(74848);const x=["className","contentClassName","titleClassName","children","title","hideCloseIcon","isWhiteCloseIcon","showExpandButton","isExpanded","onExpandClick","isNotExpanded","isChoiceCountry","isLastModal","onCloseClick","onEnterPress","popModalWindow"];function v(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function w(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?v(Object(i),!0).forEach(function(t){(0,l.A)(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}class g extends s.PureComponent{constructor(){super(...arguments),(0,l.A)(this,"handleKeyPress",e=>{const{isLastModal:t,onEnterPress:i}=this.props;(0,p.A)(e,"enter")&&e.shiftKey||i&&(0,p.A)(e,"enter")&&t&&(e.preventDefault(),i())}),(0,l.A)(this,"handleCloseClick",()=>{this.props.onCloseClick&&this.props.onCloseClick(),this.props.popModalWindow({type:u.bv6.CANCEL})})}componentDidMount(){window.addEventListener("keypress",this.handleKeyPress)}componentWillUnmount(){window.removeEventListener("keypress",this.handleKeyPress)}render(){const e=this.props,{className:t,contentClassName:i,titleClassName:l,children:s,title:o,hideCloseIcon:p,isWhiteCloseIcon:b,showExpandButton:u,isExpanded:v,onExpandClick:g,isNotExpanded:j,isChoiceCountry:y,isLastModal:A,onCloseClick:k,onEnterPress:N,popModalWindow:_}=e,O=(0,n.A)(e,x);return(0,C.jsxs)("div",w(w({className:(0,a.A)("box-col nowrap radius-4",m.A["widget-universal-window"],{[m.A.expanded]:v},{[m.A["not-expanded"]]:j},{[m.A["choice-country"]]:y},t)},O),{},{children:[!!o&&(0,C.jsx)("b",{className:(0,a.A)("flex-auto",m.A.title,l),children:o}),(0,C.jsx)("div",{className:(0,a.A)("box-col nowrap no-overflow scrollable",m.A.content,i),children:s}),u&&(0,C.jsx)(h.A,{icon:v?d.h:c.h,className:(0,a.A)("box-row align-middle",m.A.wide),onClick:g}),p||(0,C.jsx)(h.A,{icon:b?r.h:f.h,className:(0,a.A)("box-row align-middle",m.A.close),onClick:this.handleCloseClick})]}))}}(0,l.A)(g,"defaultProps",{className:"",contentClassName:"",titleClassName:"",title:"",children:null,isLastModal:!0,hideCloseIcon:!1,showExpandButton:!1,isWhiteCloseIcon:!1,isExpanded:!1,isNotExpanded:!1,isChoiceCountry:!1,onExpandClick:()=>{},onCloseClick:()=>{},onEnterPress:()=>{},popModalWindow:()=>{}});const j=(0,o.Ng)(null,{popModalWindow:b.Vc})(g)},60794(e,t,i){i.d(t,{h:()=>a});var n,l=i(96540);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},s.apply(null,arguments)}const a=e=>l.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",width:7,height:13,viewBox:"0 0 7 13"},e),n||(n=l.createElement("g",{fill:"none",fillRule:"evenodd",stroke:"#201600",strokeWidth:2},l.createElement("path",{d:"M6 1.6 3.5 4.2 1 1.6M1 11.6 3.5 9 6 11.6"}))));i.p},95844(e,t,i){i.d(t,{A:()=>n});const n={"widget-universal-window":"widget-universal-window--d29897e046a4da5d30b9","modal-confirm":"modal-confirm--f5b17f1a97a6deeac1b8","modal-info":"modal-info--ff91f439a4a702d7ce1c",primaryBtn:"primaryBtn--e0ddfdb572d57dc52f1f","bot-files":"bot-files--acc6cddd694b26bfc656","attention-phone":"attention-phone--c8ada1f310438e858af7",expanded:"expanded--b8f51efd7713ae16c959",content:"content--b4295a848b4d8922676a","add-info":"add-info--fb37f9c9a94c0774691d",info:"info--e73d3534c032eeb5cf22",error:"error--d9bf690af3392b8b2949",close:"close--f8805b5c06f4721f49cc",wide:"wide--a9c0a8b6529089796590",body:"body--df9e0889cf59f298549e",title:"title--e105e180e39563de930f","notify-body":"notify-body--ed1209feb181c45
172a67",img:"img--abf02e2c5586d0cacfa4","notify-message":"notify-message--bf341a46f3def1cce614","hover-title":"hover-title--e47c6138044924aec389","contact-card":"contact-card--b76ab55272b081b388d8","confirm-desc":"confirm-desc--e35533a20ff389282622","info-text":"info-text--f2910fde6bc6893cddfb",actions:"actions--d7ad7b9fbfcaf55e27cc",inputName:"inputName--a0fae178fec7690a5487",withoutCancel:"withoutCancel--f7ca1f671814912cf35d"}}}]); 2//# sourceMappingURL=9222.d6560bb1ce921dce7bb8.js.map
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.