1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7671],{5976:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/cards-catalogue-management",function(){return a(9060)}])},24812:function(e,t,a){"use strict";a.d(t,{b:function(){return i}});var n=a(90948);let i=(0,n.ZP)("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1})},77270:function(e,t,a){"use strict";a.d(t,{Z:function(){return PriceBadge}});var n=a(85893),i=a(15861),s=a(25675),r=a.n(s);let l={BIG:32,SMALL:20},o={BIG:"h3",SMALL:"h4"};function PriceBadge(e){let{points:t,size:a="SMALL"}=e;return(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(i.Z,{variant:o[a],className:"font-bold",children:t}),(0,n.jsx)(r(),{className:"ml-1",src:"/fenox_bonus_icon.svg",width:l[a],height:l[a],alt:"fenox bonus icon"})]})}},94182:function(e,t,a){"use strict";var n=a(85893),i=a(25675),s=a.n(i),r=a(77270),l=a(15861),o=a(62023),d=a(93946),c=a(41733),h=a(77957);a(67294);var u=a(65594),m=a(21461);t.Z=e=>{let{card:t,onDelete:a,onEdit:i,additionalButton:g,onAddToCart:x,size:p="BIG",rounded:b}=e,{isMobileDeviceBreakpoint:f}=(0,u.Z)(),j={width:{BIG:356,SMALL:f?233:304},height:{BIG:204,SMALL:f?140:166}};return(0,n.jsxs)("div",{className:{BIG:"w-[356px]",SMALL:f?"w-[233px]":"w-[304px]"}[p],children:[(0,n.jsxs)("div",{className:"relative mb-3",children:[(0,n.jsx)(s(),{width:j.width[p],height:j.height[p],src:t.image?"https://storage.yandexcloud.net/fenoxbonus/"+t.image:"/gift_card_default.png",alt:(t.image,"ÐеÑолÑное изобÑажение подаÑоÑной каÑÑÑ"),className:b?"rounded-2xl":""}),(null!=a?a:i)&&(0,n.jsxs)(o.Z,{className:"absolute right-0 top-0",children:[a&&(0,n.jsx)(d.Z,{size:"small",onClick:a,className:"bg-grey4 text-white hover:bg-red",children:(0,n.jsx)(c.Z,{className:"h-5 w-5"})}),i&&(0,n.jsx)(d.Z,{size:"small",onClick:i,className:"bg-grey4 text-white hover:bg-red",children:(0,n.jsx)(h.Z,{className:"h-5 w-5"})})]}),x&&(0,n.jsx)("button",{className:"flex items-center justify-center absolute bottom-2.5 lg:bottom-4 right-2.5 lg:right-4 bg-red rounded-full w-8 h-8 lg:w-11 lg:h-11 border border-solid border-white cursor-pointer hover:bg-grey3 p-0",onClick:x,children:(0,n.jsx)(m.Z,{})})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[t.points&&(0,n.jsx)(r.Z,{points:t.points,size:"BIG"}),g]}),(0,n.jsx)(l.Z,{variant:"subtitle1",children:t.name})]},t.id)}},25163:function(e,t,a){"use strict";var n=a(85893),i=a(37645),s=a(31425),r=a(64666),l=a(93946),o=a(50594),d=a(4813),c=a(14705),h=a(6514);t.Z=e=>{let{isOpen:t,onClose:a,onCancel:u,onConfirm:m,title:g,content:x,confirmText:p="Ðа",cancelText:b="ÐеÑ",isLoading:f,showControls:j=!0}=e;return(0,n.jsxs)(r.Z,{open:t,onClose:a,"aria-labelledby":"confirmation-dialog-title","aria-describedby":"confirmation-dialog-description",PaperProps:{className:"p-10 relative w-[400px]"},children:[(0,n.jsxs)(i.Z,{id:"confirmation-dialog-title",variant:"h4",className:"text-center p-0",children:[(0,n.jsx)(l.Z,{onClick:a,className:"w-8 h-8 absolute top-6 right-6",children:(0,n.jsx)(o.Z,{})}),g]}),x&&(0,n.jsx)(h.Z,{className:"mt-3 p-0",children:x}),j&&(0,n.jsxs)(s.Z,{className:"flex justify-center p-0 mt-6",children:[(0,n.jsx)(d.Z,{variant:"LIGHT",onClick:null!=u?u:a,className:"w-full",children:b}),(0,n.jsx)(c.Z,{loading:f,onClick:m,className:"w-full",children:p})]})]})}},6165:function(e,t,a){"use strict";a.d(t,{Z:function(){return ImageUploader}});var n=a(85893),i=a(24812),s=a(4813),r=a(25675),l=a.n(r),o=a(67294),ui_ImageFromBase64=e=>{let{image:t,className:a}=e,[i,s]=(0,o.useState)("");return(0,o.useEffect)(()=>{if(!t)return;let e=new FileReader;e.onload=()=>{let t=e.result.split(",")[1];s(t)},e.onerror=e=>{console.error("File reading error:",e)},e.readAsDataURL(t)},[t]),(0,n.jsx)("img",{src:"data:image/png;base64,".concat(i),className:a,alt:"Base64 Image"})},d=a(83321),c=a(41733),h=a(96540);function ImageUploader(e){let{images:t=[],multiple:a=!1,imagesMax:r=1,className:u,onImageUpdate:m,width:g=362,height:x=100,sizeClasses:p="min-h-[62px] h-[62px] max-h-[62px]"}=e,[b,f]=(0,o.useState)(0),handleChange=e=>{e&&e.length+t.length<=r?m([...t,...e]):alert("ÐакÑималÑное колиÑеÑÑво каÑÑинок Ð´Ð»Ñ Ð·Ð°Ð³ÑÑзки ".concat(r))},handleDelete=e=>{f(0),m(Array.from(t).filter((t,a)=>a!==e))},j=(0,o.useMemo)(()=>t.length?t[b]instanceof File?t[b]:"string"==typeof t[b]?t[b]:t[b].url:"",[t,b]);return(0,n.jsxs)("div",{className:u,children:[!!j&&(0,n.jsxs)("div",{className:"relative flex items-center justify-center rounded-none border border-solid border-grey2",children:["string"==typeof j?(0,n.jsx)(l(),{src:"https://storage.yandexcloud.net/fenoxbonus/"+j,width:g,height:x,alt:"image-upload",className:"object-cover w-full"}):(0,n.jsx)(ui_ImageFromBase64,{image:j,className:"".concat(p," w-full object-cover")}),(0,n.jsx)(d.Z,{onClick:e=>{e.stopPropagation(),handleDelete(b)},variant:"outlined",sx:{position:"absolute",zIndex:2,backgroundColor:"white",":hover":{backgroundColor:"white",borderColor:"#E51C2F"},top:"10px",right:"10px",padding:"0px",height:"32px",width:"32px",minWidth:"32px",borderColor:"#C2C2C2",borderRadius:"100%"},children:(0,n.jsx)(c.Z,{className:"text-red"})})]}),r>1&&!!t.length&&(0,n.jsxs)("div",{className:"flex gap-4 overflow-hidden",children:[Array.from(t).map((e,t)=>(0,n.jsxs)("div",{className:"".concat(b===t&&"border-2 border-solid border-grey3"," relative box-content max-h-[62px] min-h-[62px] min-w-[127.5px] max-w-[127.5px] cursor-pointer"),onClick:()=>f(t),children:[e instanceof File?(0,n.jsx)(ui_ImageFromBase64,{image:e,className:"max-h-[62px] min-h-[62px] min-w-[127.5px] max-w-[127.5px]"}):(0,n.jsx)(l(),{src:"https://storage.yandexcloud.net/fenoxbonus/"+("str
1ing"==typeof e?e:e.url),width:127.5,height:62,alt:"image-upload"}),(0,n.jsx)(d.Z,{onClick:e=>{e.stopPropagation(),handleDelete(t)},variant:"outlined",sx:{position:"absolute",zIndex:2,backgroundColor:"white",":hover":{backgroundColor:"white"},top:"2px",right:"2px",padding:"0px",height:"32px",width:"32px",minWidth:"32px",borderColor:"#C2C2C2",borderRadius:"100%"},children:(0,n.jsx)(c.Z,{className:"text-red"})})]},t)),(0,n.jsxs)(s.Z,{disabled:3===t.length,component:"label",className:"h-[62px] w-full border !border-dashed border-grey3 bg-transparent !text-grey3 hover:!text-white",children:[(0,n.jsx)(h.Z,{}),(0,n.jsx)(i.b,{onChange:e=>{let t=e.target.files;handleChange(t)},type:"file",multiple:a,accept:"image/png, image/jpg, image/jpeg"})]})]}),r>t.length&&(0,n.jsxs)(s.Z,{disabled:3===t.length,component:"label",className:"".concat(p," w-full border !border-dashed border-grey3 bg-transparent !text-grey3 hover:!text-white rounded-none"),children:[(0,n.jsx)(h.Z,{}),(0,n.jsx)(i.b,{onChange:e=>{let t=e.target.files;handleChange(t)},type:"file",multiple:a,accept:"image/png, image/jpg, image/jpeg"})]})]})}},21461:function(e,t,a){"use strict";var n=a(85893);t.Z=()=>(0,n.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)("path",{d:"M12 5V19M5 12H19",stroke:"white",strokeWidth:"1.5",strokeLinecap:"square",strokeLinejoin:"round"})})},4813:function(e,t,a){"use strict";var n=a(85893),i=a(83321);t.Z=e=>{let{children:t,onClick:a,variant:s="DARK",small:r,className:l="",type:o="button",disabled:d,href:c,component:h=c?"a":"button"}=e,u="enabled:cursor-pointer enabled:hover:bg-red ".concat("button"!==h?"hover:bg-red":""," rounded-lg ").concat(r?"h-9 px-3 py-2.5":"h-12 px-5 py-4");return(0,n.jsx)(i.Z,{component:h,href:c,type:o,disabled:d,onClick:a,className:"".concat(l," ").concat("disabled:bg-grey2 disabled:border-none disabled:text-white"," ").concat(u," ").concat({DARK:"bg-grey4 text-white border-none",LIGHT:"bg-white text-grey4 enabled:hover:text-white ".concat(r?"":"border-solid border border-grey4 hover:border-red"),GRAY:"bg-grey2 border-none text-grey4 enabled:hover:text-white"}[s]),children:t})}},21321:function(e,t,a){"use strict";var n=a(85893),i=a(87357),s=a(98456);t.Z=e=>{let{color:t="#E51C2F",size:a=40}=e;return(0,n.jsx)(i.Z,{sx:{display:"flex",width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(s.Z,{sx:{color:t},size:a})})}},14705:function(e,t,a){"use strict";var n=a(85893),i=a(31812);t.Z=e=>{let{loading:t,disabled:a,onClick:s,small:r,className:l,children:o,component:d="button",type:c="button",variant:h="contained"}=e;return(0,n.jsx)(i.Z,{variant:h,component:d,loading:t,disabled:a,onClick:s,type:c,sx:{backgroundColor:"contained"===h?"#1E2023":"white",color:"contained"===h?"white":"#1E2023",borderColor:"#1E2023",borderRadius:"8px",height:r?"36px":"48px","&:hover":{backgroundColor:"#E51C2F",color:"white"}},className:l,children:o})}},86284:function(e,t,a){"use strict";var n=a(85893),i=a(45843);a(67294),t.Z=e=>{let{text:t,disabled:a,checked:s,onChange:r,id:l}=e;return(0,n.jsxs)("div",{className:"flex items-center",children:[t&&(0,n.jsx)("span",{className:"text-subtitle2",children:t}),(0,n.jsx)(i.Z,{id:l,name:"visible",color:"error",disabled:a,checked:s,onChange:e=>r(e.target.checked)})]})}},65594:function(e,t,a){"use strict";a.d(t,{Z:function(){return useGetCurrentBreakpoint}});var n=a(67294);let i={md:600,lg:1440};function useGetCurrentBreakpoint(){let[e,t]=(0,n.useState)({width:0,height:0}),handleResize=()=>{t({width:window.innerWidth,height:window.innerHeight})};(0,n.useEffect)(()=>(handleResize(),window.addEventListener("resize",handleResize),()=>window.removeEventListener("resize",handleResize)),[]);let a=(0,n.useMemo)(()=>Object.keys(i).find(t=>i[t]>=e.width),[e]),s=e.width<1440,r=e.width<=600;return{currentBreakpoint:a,dimensions:e,isMobileDeviceBreakpoint:s,isMobileBreakpoint:r}}},62542:function(e,t,a){"use strict";a.d(t,{u:function(){return s},v:function(){return i}});var n=a(70385);let i={OZON:"Ozon",KOMUS:"ÐомÑÑ"},s=[n.GiftCardBrand.OZON,n.GiftCardBrand.KOMUS]},9060:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return S}});var n=a(85893),i=a(69481),s=a(67294),r=a(4813),l=a(96540),o=a(28119),d=a(5917),c=a(21321),h=a(15861),u=a(64666),m=a(93946),g=a(50594),x=a(6165),p=a(82175),b=a(50135),f=a(58843),j=a(45843),v=a(53457
1),w=a(14705),C=a(23599),Z=a(62542);let N={name:"",image:"",brand:null,points:0,visible:!1};var dialogs_AddGiftCardDialog=e=>{let{open:t,onClose:a,refetchCatalogue:i,selectedGiftCard:l}=e,[o,c]=(0,s.useState)(""),[y,k]=(0,s.useState)({...N}),[L,I]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(l){let e={...l};delete e.id,delete e.createdAt,delete e.updatedAt,k({...e})}},[l]);let handleClose=()=>{a(),c(""),P.setErrors({}),P.resetForm(),k({...N})},{mutate:S,isLoading:E}=d.h.giftCards.create.useMutation({onSuccess:()=>{i(),handleClose()}}),{mutate:B,isLoading:G}=d.h.giftCards.update.useMutation({onSuccess:()=>{i(),handleClose()}}),submitGiftCard=(e,t)=>{I(!1);let a={name:e.name,points:+e.points,image:t,visible:e.visible,brand:e.brand};l?B({...a,id:l.id}):S(a)},P=(0,p.TA)({initialValues:y,enableReinitialize:!0,validate:e=>{let t={};return e.name||(t.name="ÐбÑзаÑелÑно к заполнениÑ"),e.brand||(t.brand="ÐбÑзаÑелÑно к заполнениÑ"),e.points||(t.points="ÐбÑзаÑелÑно к заполнениÑ"),t},onSubmit:async(e,t)=>{let{setSubmitting:a}=t;if(c(""),a(!1),l&&l.name===e.name&&l.brand===e.brand&&l.points===e.points&&l.visible===e.visible&&l.image===y.image)return;I(!0);let n=new FormData;n.append("bucket","gift_cards"),(null==l?void 0:l.image)&&(y.image instanceof File||""===y.image)?(n.append("key",l.image),await fetch("/api/upload",{method:"DELETE",body:n}).then(async()=>{y.image?(n.append("file",y.image),await fetch("/api/upload",{method:"POST",body:n}).then(e=>e.json()).then(t=>{submitGiftCard(e,t.urls[0])}).catch(()=>{I(!1),c(" ÐÑоизоÑла оÑибка пÑи загÑÑзке ÑоÑогÑаÑий. ÐопÑобÑйÑе еÑÑ Ñаз.")})):submitGiftCard(e,"")})):y.image instanceof File?(n.append("file",y.image),await fetch("/api/upload",{method:"POST",body:n}).then(e=>e.json()).then(t=>{submitGiftCard(e,t.urls[0])}).catch(()=>{I(!1),c(" ÐÑоизоÑла оÑибка пÑи загÑÑзке ÑоÑогÑаÑий. ÐопÑобÑйÑе еÑÑ Ñаз.")})):submitGiftCard(e,y.image)}});return(0,n.jsxs)(u.Z,{open:t,onClose:handleClose,PaperProps:{sx:{padding:5,width:"460px"}},children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)(h.Z,{variant:"h4",children:[l?"РедакÑиÑоваÑÑ":"ÐобавиÑÑ"," каÑÑÑ"]}),(0,n.jsx)(m.Z,{onClick:handleClose,className:"absolute -right-6 -top-6 h-8 w-8",children:(0,n.jsx)(g.Z,{})})]}),(0,n.jsx)(x.Z,{height:196,sizeClasses:"min-h-[196px] h-[196px] max-h-[196px]",className:"my-4",images:y.image?[y.image]:[],onImageUpdate:e=>{k({...P.values,image:e&&e.length?e[0]:""})}}),(0,n.jsxs)("form",{onSubmit:P.handleSubmit,className:"flex h-full flex-col justify-between space-y-4",children:[(0,n.jsx)(b.Z,{fullWidth:!0,id:"name",name:"name",label:"Ðазвание каÑÑÑ",value:P.values.name,onChange:e=>k({...y,name:e.target.value}),onBlur:P.handleBlur,error:P.touched.name&&!!P.errors.name,helperText:P.touched.name&&P.errors.name,InputProps:{className:"text-subtitle1 h-12"},InputLabelProps:{className:"text-subtitle1"}}),(0,n.jsx)(b.Z,{fullWidth:!0,select:!0,id:"brand",name:"brand",label:"ÐÑенд",value:P.values.brand,onChange:e=>k({...y,brand:e.target.value}),onBlur:P.handleBlur,error:P.touched.brand&&!!P.errors.brand,helperText:P.touched.brand&&P.errors.brand,InputProps:{className:"text-subtitle1 h-12"},InputLabelProps:{className:"text-subtitle1",shrink:!!y.brand},children:Z.u.map(e=>(0,n.jsx)(C.Z,{value:e,className:"text-subtitle2",children:Z.v[e]},e))}),(0,n.jsx)(b.Z,{fullWidth:!0,id:"points",name:"points",label:"СÑоимоÑÑÑ (баллÑ)",value:P.values.points,onChange:e=>k({...y,points:+e.target.value}),onBlur:P.handleBlur,error:P.touched.points&&!!P.errors.points,helperText:P.touched.points&&P.errors.points,InputProps:{className:"text-subtitle1 h-12"},InputLabelProps:{className:"text-subtitle1"}}),(0,n.jsxs)(v.Z,{children:[(0,n.jsx)(f.Z,{control:(0,n.jsx)(j.Z,{checked:P.values.visible,onChange:e=>k({...y,visible:e.target.checked}),id:"visible",name:"visible",color:"error"}),label:(0,n.jsx)("span",{className:"text-subtitle1",children:"ÐкÑивнÑй"})}),(0,n.jsx)(h.Z,{children:"ÐкÑивнÑй ÑÐ¾Ð²Ð°Ñ Ð±ÑÐ´ÐµÑ Ð¾ÑобÑажаÑÑÑÑ Ð¿Ð¾Ð»ÑзоваÑÐµÐ»Ñ Ð² каÑалоге, неакÑивнÑе ÑоваÑÑ Ð²Ð¸Ð´Ð½Ñ ÑолÑко админиÑÑÑаÑоÑÑ ÐºÐ°Ñалога"})]}),o&&(0,n.jsx)("p",{className:"text-red",children:o}),(0,n.jsxs)("div",{className:"mt-5 flex justify-end space-x-4",children:[(0,n.jsx)(r.Z,{variant:"LIGHT",className:"w-[110px]",onClick:handleClose,children:"ÐÑмениÑÑ"}),(0,n.jsx)(w.Z,{className:"w-[110px]",type:"submit",loading:E||G||L,children:l?"СоÑ
ÑаниÑÑ":"ÐобавиÑÑ"})]})]})]})},y=a(26303),k=a(25163),L=a(94182),I=a(86284);let CardsCatalogueManagementPage=()=>
1{let[e,t]=(0,s.useState)(!1),[a,o]=(0,s.useState)(null),[u,m]=(0,s.useState)(!1),{data:g=[],isLoading:x,refetch:p}=d.h.giftCards.getAll.useQuery(),{mutate:b,isLoading:f}=d.h.giftCards.update.useMutation({onSuccess:async()=>{o(null),await p()}}),{mutate:j}=d.h.giftCards.delete.useMutation({onSuccess:async()=>{await p()}}),onEdit=e=>{o(e),t(!0)},handleGiftCardDelete=async()=>{if(a){if(a.image){let e=new FormData;e.append("bucket","gift_cards"),e.append("key",a.image),await fetch("/api/upload",{method:"DELETE",body:e})}j(a.id),m(!1),o(null)}},onDelete=e=>{o(e),m(!0)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.Z,{title:"ÐаÑалог подаÑков: ÐодаÑоÑнÑе каÑÑÑ"}),(0,n.jsxs)("div",{className:"p-5",children:[(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsxs)(r.Z,{onClick:()=>{t(!0)},children:[(0,n.jsx)(l.Z,{className:"mr-2"}),"ÐобавиÑÑ ÐºÐ°ÑÑÑ"]})}),(0,n.jsx)("div",{className:"mt-5 flex flex-wrap gap-5",children:x?(0,n.jsx)(c.Z,{}):g.length?g.map(e=>(0,n.jsx)(L.Z,{card:e,onEdit:()=>onEdit(e),onDelete:()=>onDelete(e),additionalButton:(0,n.jsx)(I.Z,{id:"visibility-"+e.id,disabled:f&&(null==a?void 0:a.id)===e.id,text:e.visible?"ÐкÑивнÑй":"ÐеакÑивнÑй",checked:e.visible,onChange:t=>{o(e),b({...e,visible:t})}})},e.id)):(0,n.jsx)(h.Z,{variant:"subtitle1",children:"ÐодаÑоÑнÑе каÑÑÑ Ð½Ðµ бÑли добавленÑ"})})]}),(0,n.jsx)(k.Z,{isOpen:u,onClose:()=>{m(!1),o(null)},onConfirm:handleGiftCardDelete,title:"ÐÑ ÑвеÑенÑ, ÑÑо Ñ
оÑиÑе ÑдалиÑÑ ÑÑÑ ÐºÐ°ÑÑÑ?"}),(0,n.jsx)(dialogs_AddGiftCardDialog,{open:e,onClose:()=>{t(!1),o(null)},refetchCatalogue:p,selectedGiftCard:a})]})};CardsCatalogueManagementPage.getLayout=e=>(0,n.jsx)(o.Z,{children:e}),CardsCatalogueManagementPage.auth={roles:[y.vX.ADMIN]};var S=CardsCatalogueManagementPage}},function(e){e.O(0,[4241,2346,1812,3647,135,385,3911,2175,4917,6091,2844,9774,2888,179],function(){return e(e.s=5976)}),_N_E=e.O()}]);
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.