1import{j as t,r as c,E as O,aC as He}from"./vendor-CRX6iD7N.js";import{a as D,s as Oe,b as xe,an as V,M as Y,_ as r,B as Q,I as G,d as Ce,bf as Ke,bg as b,c as Ue,u as ze,bh as Ve,au as We,bi as Xe,bc as Ye,bj as Je,bk as pe,bl as L,$ as H,b9 as Ze,ba as et,bd as tt,b6 as st,a8 as ye,g as F,bm as nt,bn as at,bo as rt,bp as it,bq as ot,b3 as lt,br as ct,bs as dt,bt as ut,bu as mt,bv as ht,bw as pt,bx as yt,by as bt,bz as xt,bA as Ct,bB as ft,b2 as gt,bC as St,bD as jt,bE as Nt,bF as Pt}from"./index-UVktE5bE.js";import"./vendor_yup-BHFUDH6h.js";import{R as J}from"./radio-Le9ouRj2.js";import{D as be}from"./input.date-Bz8BhAGM.js";import"./vendor_marked-Ds7eXWqI.js";import{S as Bt}from"./status-badge-CpjB_1bD.js";import{s as fe}from"./warehouse-stocks-slice.selectors-DXHn2ect.js";import"./vendor_datefns-Cni7y5m9.js";import"./vendor_lodash-HReYwCFr.js";import"./vendor_rpc-DdcAxShe.js";function Z(i,a){return a.map(x=>i.attributeValues?.[x]).filter(Boolean).join(", ")}function _t(i,a){const x=a?.sku.find(_=>_.id===i);if(!x||!a)return i;const C=Z(x,a.skuAttributeIds);return[i,x.externalId,C].filter(Boolean).join(", ")}const ge=i=>i.sellerProductInSPCardPage.item?.groupBuy??null,Se=i=>i.sellerProductInSPCardPage.item?.product??null,kt=i=>i.sellerProductInSPCardPage.seller,vt="_deleteModal_q5rs6_4",It="_deleteModalDescription_q5rs6_8",wt="_deleteModalButton_q5rs6_15",Mt="_titleRow_q5rs6_21",Rt="_title_q5rs6_21",At="_productNameRow_q5rs6_36",Gt="_productStatus_q5rs6_43",qt="_productName_q5rs6_36",Dt="_detailsSection_q5rs6_58",Tt="_sectionHeading_q5rs6_67",Et="_sectionHeadingTitle_q5rs6_73",Qt="_addConditionButton_q5rs6_77",Ft="_conditionsGrid_q5rs6_96",Lt="_headerCellHighlight_q5rs6_108",$t="_headerCellWithHint_q5rs6_112",Ht="_infoIconButton_q5rs6_118",Ot="_infoModalText_q5rs6_129",Kt="_profitCell_q5rs6_133",Ut="_deleteConditionButton_q5rs6_137",zt="_conditionsRow_q5rs6_152",Vt="_skuItemsList_q5rs6_157",Wt="_skuItemRow_q5rs6_163",Xt="_skuItemArticle_q5rs6_169",Yt="_skuItemQuantity_q5rs6_174",Jt="_deleteSkuItemButton_q5rs6_179",Zt="_detailsBlock_q5rs6_196",es="_detailsPhotoColumn_q5rs6_207",ts="_detailsPhoto_q5rs6_207",ss="_detailsPhotoImg_q5rs6_225",ns="_detailsInfo_q5rs6_232",as="_fieldRow_q5rs6_247",rs="_togglesRow_q5rs6_255",is="_fieldLabel_q5rs6_259",os="_datesBar_q5rs6_263",ls="_datesBarPicker_q5rs6_279",n={deleteModal:vt,deleteModalDescription:It,deleteModalButton:wt,titleRow:Mt,t
1itle:Rt,productNameRow:At,productStatus:Gt,productName:qt,detailsSection:Dt,sectionHeading:Tt,sectionHeadingTitle:Et,addConditionButton:Qt,conditionsGrid:Ft,headerCellHighlight:Lt,headerCellWithHint:$t,infoIconButton:Ht,infoModalText:Ot,profitCell:Kt,deleteConditionButton:Ut,conditionsRow:zt,skuItemsList:Vt,skuItemRow:Wt,skuItemArticle:Xt,skuItemQuantity:Yt,deleteSkuItemButton:Jt,detailsBlock:Zt,detailsPhotoColumn:es,detailsPhoto:ts,detailsPhotoImg:ss,detailsInfo:ns,fieldRow:as,togglesRow:rs,fieldLabel:is,datesBar:os,datesBarPicker:ls},cs="_modal_168oo_2",ds={modal:cs};function us(){const{visible:i}=D(Oe("spSkuPickerModal"));return i?t.jsx(ms,{}):null}function ms(){const i=xe(),a=V(),x=D(Se),C=D(ge),_=x?.sku??[],e=D(fe),h=c.useMemo(()=>x?.skuAttributeIds??[],[x?.skuAttributeIds]),[w,q]=c.useState(null),[u,S]=c.useState(""),[j,N]=c.useState(!1),f=c.useMemo(()=>{const l=new Set((C?.skuItems??[]).map(m=>m.skuId));return _.filter(m=>!l.has(m.id))},[_,C?.skuItems]),k=c.useMemo(()=>{const l=u.trim().toLowerCase();return l?f.filter(m=>m.id.toLowerCase().includes(l)||m.externalId.toLowerCase().includes(l)||Z(m,h).toLowerCase().includes(l)):f},[f,u,h]),P=()=>{i(Ce.closeModal("spSkuPickerModal"))},M=async()=>{if(!(!w||!C||j)){N(!0);try{const l=await Ke(C.id,w);i(b.setGroupBuy(l)),P()}catch(l){a(l,"Ðе ÑдалоÑÑ Ð´Ð¾Ð±Ð°Ð²Ð¸ÑÑ SKU в СÐ")}finally{N(!1)}}};return t.jsx(Y,{isOpen:!0,onClose:P,title:"ÐÑбеÑиÑе SKU",header:t.jsx(G,{type:"search",rounded:!0,icon:"search",placeholder:"ÐведиÑе Ñ
аÑакÑеÑиÑÑикÑ, аÑÑикÑл или внеÑний аÑÑикÑл",value:u,onChange:l=>S(l.target.value)}),className:ds.modal,footer:t.jsx(Q,{size:"m",onClick:M,disabled:w===null||!C||j,children:"ÐÑбÑаÑÑ SKU"}),children:f.length===0?t.jsx("div",{children:"ÐÐµÑ Ð´Ð¾ÑÑÑпнÑÑ
SKU"}):k.length===0?t.jsx("div",{children:"SKU не найденÑ"}):t.jsx("div",{className:r.tableWrapper,children:t.jsxs("table",{className:r.table,children:[t.jsx("thead",{className:r.tableHead,children:t.jsxs("tr",{children:[t.jsx("th",{className:r.headerCell,"aria-label":""}),t.jsx("th",{className:r.headerCell,children:"ÐÑÑикÑл"}),t.jsx("th",{className:r.headerCell,children:"ÐнеÑний аÑÑикÑл"}),t.jsx("th",{className:r.headerCell,children:"ÐÑÑаÑки"}),t.jsx("th",{className:r.headerCell,children:"ХаÑакÑеÑиÑÑики"})]})}),t.jsx("tbody",{className:r.tableBody,children:k.map(l=>{const m=e[l.id]??0;return t.jsxs("tr",{className:r.row,onClick:()=>q(l.id),children:[t.jsx("td",{className:r.cell,children:t.jsx(J,{name:"sp-sku-picker",checked:w===l.id,onChange:()=>q(l.id),onClick:R=>R.stopPropagation()})}),t.jsx("td",{className:r.cell,children:t.jsx("span",{className:r.textValue,children:l.id})}),t.jsx("td",{className:r.cell,children:t.jsx("span",{className:r.textValue,children:l.externalId||"â"})}),t.jsx("td",{className:r.cell,children:t.jsx("span",{className:r.textValue,children:m})}),t.jsx("td",{className:r.cell,children:t.jsx("span",{className:r.textValue,children:Z(l,h)||"â"})})]},l.id)})})]})})})}function hs(i){const{condition:a,index:x,groupBuyId:C,basePrice:_,partnerCommissionPercent:e,sellerCommissionPercent:h,previousMinCount:w,isDeleting:q,isEditable:u,onDelete:S,onGroupBuyUpdate:j}=i,N=V(),[f,k]=c.useState(a.discountPercent?String(a.discountPercent):""),[P,M]=c.useState(a.minCount?String(a.minCount):"");c.useEffect(()=>{k(a.discountPercent?String(a.discountPercent):"")},[a.discountPercent]),c.useEffect(()=>{M(a.minCount?String(a.minCount):"")},[a.minCount]);const l={min:0,max:bt},m={min:w},R=L(f,l),K=L(P,m),U=async p=>{if(!u)return;const B=Number(p.trim());if(!(L(B,l)||B===a.discountPercent))try{const A=await jt(C,a.id,B);j(A)}catch(A){N(A,"Ðе ÑдалоÑÑ ÑоÑ
ÑаниÑÑ ÑÑловие СÐ")}},W=async p=>{if(!u)return;const B=Number(p.trim());if(!(L(B,m)||B===a.minCount))try{const A=await Nt(C,a.id,B);j(A)}catch(A){N(A,"Ðе ÑдалоÑÑ ÑоÑ
ÑаниÑÑ Ð¿Ð¾Ñог ÑÑловиÑ")}},$=Math.round(_*a.discountPercent/100),T=_-$,E=Math.round(T*e/100),g=Math.round(T*h/100),v=T-E-g;return t.jsxs("tr",{className:O(r.row,n.conditionsRow),children:[t.jsx("td",{className:r.cell,children:t.jsx("span",{className:r.textValue,children:x+1})}),t.jsx("td",{className:r.cell,children:t.jsx(G,{type:"number",placeholder:"0",value:f,error:R,disabled:!u,onChange:p=>k(p.target.value),onBlur:p=>{U(p.target.value)},onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.blur()}})}),t.jsx("td",{className:r.cell,children:t.jsx(G,{type:"number",placeholder:"0",value:P,error:K,disabled:!u,onChange:p=>M(p.target.value),onBlur:p=>{W(p.target.value)},onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.blur()}})}),t.jsx("td",{className:r.cell,children:t.jsx("span",{className:r.textValue,children:T?`${T} â½`:"â"})}),t.jsx("td",{className:r.cell,children:t.jsx("span",{className:r.textValue,children:E?`${E} â½`:"â"})}),t.jsx("td",{className:r.cell,children:t.jsx("span",{className:r.textValue,children:g?`${g} â½`:"â"})}),t.jsx("td",{className:r.cell,children:t.jsx("span",{className:O(r.textValue,n.profitCell),
1children:v?`${v} â½`:"â"})}),t.jsx("td",{className:r.cell,children:t.jsx("button",{type:"button",className:n.deleteConditionButton,onClick:()=>S(a.id),disabled:!u||q,"aria-label":"УдалиÑÑ ÑÑловие",children:t.jsx(F,{name:"trash",size:20})})})]})}function ps(i){return Object.values(i.quantityByWarehouse).reduce((a,x)=>a+x,0)}function ys({item:i,groupBuyId:a,articleLabel:x,freeStock:C,isDeleting:_,isEditable:e,onDelete:h,onSaved:w}){const q=V(),u=ps(i),S=C+u,j=S===0,[N,f]=c.useState(u?String(u):"");c.useEffect(()=>{f(u?String(u):"")},[u]);const k=Number(N.trim()),P=N.trim()!==""&&Number.isFinite(k)&&k>S?`ÐакÑимÑм ${S}`:void 0,M=async l=>{if(!e)return;const m=Number(l.trim());if(!(m>S)){if(!Number.isInteger(m)||m<=0||m===u){f(u?String(u):"");return}try{const R=await Pt(a,i.skuId,m);w(R)}catch(R){f(u?String(u):""),q(R,"Ðе ÑдалоÑÑ ÑоÑ
ÑаниÑÑ ÐºÐ¾Ð»Ð¸ÑеÑÑво ÑоваÑа в СÐ")}}};return t.jsxs("div",{className:n.skuItemRow,children:[t.jsx(G,{className:n.skuItemArticle,label:"SKU",value:x,disabled:!0,readOnly:!0,onChange:()=>{}}),t.jsx(G,{className:n.skuItemQuantity,label:"ÐолиÑеÑÑво",type:"number",placeholder:"0",hint:j?"ÐÐµÑ Ð¾ÑÑаÑков":`ÐоÑÑÑпно ${S}`,error:P,value:N,disabled:!e||j,onChange:l=>f(l.target.value),onBlur:l=>{M(l.target.value)},onKeyDown:l=>{l.key==="Enter"&&l.currentTarget.blur()}}),t.jsx("button",{type:"button",className:n.deleteSkuItemButton,onClick:()=>h(i.skuId),disabled:!e||_,"aria-label":"УдалиÑÑ SKU",children:t.jsx(F,{name:"trash",size:20})})]})}function bs(){const i=xe(),a=V(),x=Ue(),{session:C}=ze(),_=C?.user?.isAdmin??!1,e=D(ge),h=D(Se),w=D(kt),q=D(fe),u=w?.seller?.commissionPercent??0,S=c.useMemo(()=>{if(!h)return;const s=Ve(h,(e?.skuItems??[]).map(o=>o.skuId)).at(0);return s&&We(s.assetId,"preview")},[e?.skuItems,h]),[j,N]=c.useState(e?.startAt??""),[f,k]=c.useState(e?.endAt??""),P=new Date,M=j?new Date(j):void 0,l=M&&!Number.isNaN(M.getTime())?new Date(M.getTime()+6e4):P,[m,R]=c.useState(e?.basePrice?String(e.basePrice):""),[K,U]=c.useState(e?.partnerCommissionPercent?String(e.partnerCommissionPercent):""),[W,$]=c.useState(e?.maxQuantityOfProducts?String(e.maxQuantityOfProducts):""),[T,E]=c.useState(e?.minCountForSuccess?String(e.minCountForSuccess):""),[g,v]=c.useState(!1),[p,B]=c.useState(!1),[A,ee]=c.useState(!1),[te,se]=c.useState(null),[ne,ae]=c.useState(null),[je,re]=c.useState(!1),[ie,oe]=c.useState(!1),z=Xe(e?.tierMetric??"products"),Ne=e?Ye(e):0,le=e?Je(e,Ne):void 0,ce=!!e&&e.status!=="draft",de=e?.status==="draft"||e?.status==="scheduled",d=e?.status==="draft",X=e?.deleted??!1,Pe=!X&&(e?.status==="draft"||e?.status==="cancelled"),ue=e&&!ce?pe(e,P):void 0,Be=!!(d&&e?.startAt&&new Date(e.startAt).getTime()<=P.getTime()),_e=async()=>{if(!(!e||ie||!de)){if(e.status==="draft"){const s=pe(e);if(s){x({type:"error",data:{text:s}});return}}oe(!0);try{const s=e.status==="scheduled"?await rt(e.id):await it(e.id);i(b.setGroupBuy(s))}catch(s){a(s,e.status==="scheduled"?"Ðе ÑдалоÑÑ Ð²ÐµÑнÑÑÑ Ð¡Ð Ð² ÑеÑновик":"Ðе ÑдалоÑÑ Ð·Ð°Ð¿Ð»Ð°Ð½Ð¸ÑоваÑÑ Ð¡Ð")}finally{oe(!1)}}},ke=async()=>{if(!(!e||!d||A)){ee(!0);try{const s=await Ct(e.id);i(b.setGroupBuy(s))}catch(s){a(s,"Ðе ÑдалоÑÑ Ð´Ð¾Ð±Ð°Ð²Ð¸ÑÑ ÑÑловие СÐ")}finally{ee(!1)}}},ve=async s=>{if(!(!e||!d||te)){se(s);try{const o=await xt(e.id,s);i(b.setGroupBuy(o))}catch(o){a(o,"Ðе ÑдалоÑÑ ÑдалиÑÑ ÑÑловие СÐ")}finally{se(null)}}},Ie=async s=>{if(!(!e||!d||ne)){ae(s);try{const o=await ft(e.id,s);i(b.setItem(o))}catch(o){a(o,"Ðе ÑдалоÑÑ ÑдалиÑÑ SKU из СÐ")}finally{ae(null)}}};c.useEffect(()=>{N(e?.startAt??""),k(e?.endAt??"")},[e?.startAt,e?.endAt]),c.useEffect(()=>{R(e?.basePrice?String(e.basePrice):""),U(e?.partnerCommissionPercent?String(e.partnerCommissionPercent):""),$(e?.maxQuantityOfProducts?String(e.maxQuantityOfProducts):""),E(e?.minCountForSuccess?String(e.minCountForSuccess):"")},[e?.basePrice,e?.partnerCommissionPercent,e?.maxQuantityOfProducts,e?.minCountForSuccess]);const we=async s=>{if(!(!e||!d||!s||s===e.startAt))try{const o=await nt(e.id,s);i(b.setGroupBuy(o))}catch(o){a(o,"Ðе ÑдалоÑÑ ÑоÑ
ÑаниÑÑ Ð²ÑÐµÐ¼Ñ ÑÑаÑÑа СÐ")}},Me=async s=>{if(!(!e||!d||!s||s===e.endAt))try{const o=await at(e.id,s);i(b.setGroupBuy(o))}catch(o){a(o,"Ðе ÑдалоÑÑ ÑоÑ
ÑаниÑÑ Ð²ÑÐµÐ¼Ñ Ð¾ÐºÐ¾Ð½ÑÐ°Ð½Ð¸Ñ Ð¡Ð")}},me={min:0,max:St(u)},Re=L(K,me),Ae=L(m,{min:0}),Ge=async s=>{if(!e||!d)return;const o=Number(s.trim());if(!(!Number.isFinite(o)||o<=0||o===e.basePrice))try{const y=await mt(e.id,o);i(b.setGroupBuy(y))}catch(y){a(y,"Ðе ÑдалоÑÑ ÑоÑ
ÑаниÑÑ Ð±Ð°Ð·Ð¾Ð²ÑÑ ÑенÑ")}},qe=async s=>{if(!e||!d)return;const o=s.trim(),y=o===""?0:Number(o);if(!Number.isInteger(y)||y<0){$(e.maxQuantityOfProducts?String(e.maxQuantityOfProducts):"");return}if(y!==e.maxQuantityOfProducts)try{const I=await ht(e.id,y);i(b.setGroupBuy(I))}catch(I){a(I,"Ðе ÑдалоÑÑ ÑоÑ
ÑаниÑÑ Ð¼Ð°ÐºÑималÑное колиÑеÑÑво ÑоваÑов")}},De=async s=>{if(!e||!d)return;const o=s.trim(),y=o===""?0:Number(o);if(!Number.isInteger(y)||y<0){E(e.minCountForSuccess?String(e.minCountForSuccess):"");return}if(y!==e.minCountForSuccess)try{const I=await pt(e.id,y);i(b.setGroupBuy(I))}catch(I){a(I,"Ðе ÑдалоÑÑ ÑоÑ
ÑаниÑÑ Ð¿Ð¾Ñог ÑоÑÑоÑÑелÑноÑÑи")}},he=async s=>{if(!(!e||!d||e.tierMetric===s))try{const o=await ut(e.id,s);i(b.setGroupBuy(o))}catch(o){a(o,"Ðе ÑдалоÑÑ ÑмениÑÑ Ð¼ÐµÑÑÐ¸ÐºÑ Ð¡Ð")}},Te=async()=>
1{if(!(!e||!d&&e.status!=="scheduled"))try{const s=await ot(e.id,!e.allowReturns);i(b.setGroupBuy(s))}catch(s){a(s,"Ðе ÑдалоÑÑ Ð¸Ð·Ð¼ÐµÐ½Ð¸ÑÑ Ð²Ð¾Ð·Ð²ÑаÑноÑÑÑ Ð¡Ð")}},Ee=async()=>{if(!(!e||g)){v(!0);try{const s=await ct(e.id);i(b.setGroupBuy(s))}catch(s){a(s,"Ðе ÑдалоÑÑ Ð·Ð°Ð²ÐµÑÑиÑÑ Ð¡Ð")}finally{v(!1)}}},Qe=async()=>{if(!(!e||g)){v(!0);try{const s=await dt(e.id);i(b.setGroupBuy(s))}catch(s){a(s,"Ðе ÑдалоÑÑ Ð¾ÑмениÑÑ Ð¡Ð")}finally{v(!1)}}},Fe=async()=>{if(!(!e||g)){v(!0);try{const s=await gt(e.id);i(b.setGroupBuy(s)),B(!1)}catch(s){a(s,"Ðе ÑдалоÑÑ ÑдалиÑÑ Ð¡Ð")}finally{v(!1)}}},Le=async()=>{if(!(!e||g)){v(!0);try{const s=await lt(e.id);i(b.setGroupBuy(s))}catch(s){a(s,"Ðе ÑдалоÑÑ Ð²Ð¾ÑÑÑановиÑÑ Ð¡Ð")}finally{v(!1)}}},$e=async s=>{if(!e||!d)return;const o=Number(s.trim());if(!(o<=0||L(o,me)||o===e.partnerCommissionPercent))try{const y=await yt(e.id,o);i(b.setGroupBuy(y))}catch(y){a(y,"Ðе ÑдалоÑÑ ÑоÑ
ÑаниÑÑ Ð²Ð¾Ð·Ð½Ð°Ð³Ñаждение паÑÑнÑÑÑ")}};return t.jsxs("div",{className:H.adminPageWrapper,children:[t.jsxs("section",{className:H.adminPageSection,children:[t.jsxs("div",{className:n.titleRow,children:[t.jsx("h1",{className:n.title,children:"СовмеÑÑÐ½Ð°Ñ Ð¿Ð¾ÐºÑпка"}),e&&Pe&&!X&&t.jsx(Q,{type:"button",variant:"danger-outline",size:"m",disabled:g,onClick:()=>B(!0),children:"УдалиÑÑ Ð¡Ð"})]}),t.jsxs("div",{className:n.datesBar,children:[t.jsx(be,{className:n.datesBarPicker,inputProps:{label:"СÑаÑÑ Ð¡Ð",showRequired:!0,disabled:!d,error:Be?"ÐаÑа ÑÑаÑÑа Ñже пÑоÑла":void 0},timePicker:!0,timePickerLabel:"ÐÑÐ±Ð¾Ñ Ð²Ñемени ÑÑаÑÑа СÐ",title:"ÐÑÐ±Ð¾Ñ Ð´Ð°ÑÑ Ð¸ вÑемени ÑÑаÑÑа СÐ",minDateTime:P,value:j,onChange:s=>N(s??""),onSave:we}),t.jsx(be,{className:n.datesBarPicker,inputProps:{label:"ÐконÑание СÐ",showRequired:!0,disabled:!d},timePicker:!0,timePickerLabel:"ÐÑÐ±Ð¾Ñ Ð²Ñемени оконÑÐ°Ð½Ð¸Ñ Ð¡Ð",title:"ÐÑÐ±Ð¾Ñ Ð´Ð°ÑÑ Ð¸ вÑемени оконÑÐ°Ð½Ð¸Ñ Ð¡Ð",minDateTime:l,value:f,onChange:s=>k(s??""),onSave:Me})]})]}),t.jsxs("section",{className:`${H.adminPageSection} ${n.detailsSection}`,children:[t.jsxs("div",{className:n.productNameRow,children:[t.jsx("h3",{className:n.productName,children:h?.name}),t.jsxs("div",{className:n.productStatus,children:[t.jsx("span",{className:n.fieldLabel,children:"СÑаÑÑÑ:"}),e?t.jsx(Bt,{variant:et(e.status)?"live":"neutral",children:Ze(e.status)}):t.jsx("span",{children:"â"})]})]}),t.jsxs("div",{className:n.detailsBlock,children:[t.jsxs("div",{className:n.detailsPhotoColumn,children:[t.jsx("div",{className:n.detailsPhoto,children:S&&t.jsx("img",{src:S,alt:h?.name,className:n.detailsPhotoImg})}),h&&t.jsx(tt,{rating:h.rating,commentsCount:h.commentsCount})]}),t.jsxs("div",{className:n.detailsInfo,children:[t.jsxs("div",{className:O(n.fieldRow,n.togglesRow),children:[t.jsx(st,{content:ue,children:t.jsx(ye,{checked:ce,disabled:!de||ie||ue!==void 0,onChange:()=>{_e()},children:"СРгоÑово к ÑаÑпÑодаже"})}),e&&(d||e.status==="scheduled")&&t.jsx(ye,{checked:e.allowReturns,onChange:()=>{Te()},children:"РазÑеÑиÑÑ Ð²Ð¾Ð·Ð²ÑаÑÑ (по ÑмолÑÐ°Ð½Ð¸Ñ Ð¡Ð Ð½ÐµÐ²Ð¾Ð·Ð²ÑаÑна)"})]}),e&&!d&&e.status!=="scheduled"&&t.jsxs("div",{className:n.fieldRow,children:[t.jsx("span",{className:n.fieldLabel,children:"ÐÑогÑеÑÑ:"}),t.jsxs("span",{children:[e.soldQuantity," Ñов. · ",e.soldBuyersCount," ","покÑп.",le?` · ÑекÑÑÐ°Ñ Ñкидка ${le.discountPercent}%`:" · Ñкидка пока не доÑÑигнÑÑа",e.minCountForSuccess>0&&!e.result&&` · минимÑм: ${e.minCountForSuccess} ${z}`]})]}),e?.result&&t.jsxs("div",{className:n.fieldRow,children:[t.jsx("span",{className:n.fieldLabel,children:"ÐÑог:"}),t.jsx("span",{children:e.result.succeeded?`СРÑоÑÑоÑлаÑÑ: ${e.result.finalCount} ${z}, Ñкидка ${e.result.achievedDiscountPercent}%`:`СРне ÑоÑÑоÑлаÑÑ (${e.result.finalCount} из ${e.minCountForSuccess} ${z}) â ÑÑаÑÑникам возвÑаÑÐµÐ½Ñ Ð´ÐµÐ½Ñги`})]}),e&&X&&t.jsxs("div",{className:n.fieldRow,children:[t.jsx("span",{className:n.fieldLabel,children:"СРÑдалена â покÑпаÑелÑм она не видна."}),t.jsx(Q,{type:"button",disabled:g,onClick:()=>{Le()},children:"ÐоÑÑÑановиÑÑ"})]}),_&&e?.status==="in_progress"&&t.jsxs("div",{className:n.fieldRow,children:[t.jsx(Q,{type:"button",disabled:g,onClick:()=>{Ee()},children:"ÐавеÑÑиÑÑ Ð´Ð¾ÑÑоÑно"}),t.jsx(Q,{type:"button",disabled:g,onClick:()=>{window.confirm("ÐваÑÐ¸Ð¹Ð½Ð°Ñ Ð¾Ñмена: вÑе Ð·Ð°ÐºÐ°Ð·Ñ Ð¡Ð Ð±ÑдÑÑ Ð¾ÑÐ¼ÐµÐ½ÐµÐ½Ñ Ñ Ð¿Ð¾Ð»Ð½Ñм возвÑаÑом. ÐÑодолжиÑÑ?")&&Qe()},children:"ÐваÑийно оÑмениÑÑ"})]}),t.jsxs("div",{className:n.sectionHeading,children:[t.jsx(F,{name:"question",size:20}),t.jsx("h2",{className:O(H.adminPageTitle,n.sectionHeadingTitle),children:"УÑÐ»Ð¾Ð²Ð¸Ñ Ð¡Ð"})]}),t.jsxs("div",{className:n.fieldRow,children:[t.jsx("span",{className:n.fieldLabel,children:"Скидка ÑаÑÑÑÑ Ð¾Ñ:"}),t.jsx(J,{name:"tierMetric",checked:(e?.tierMetric??"products")==="products",disabled:!d,onChange:()=>{he("products")},children:"колиÑеÑÑва вÑкÑпленнÑÑ
ÑоваÑов"}),t.jsx(J,{name:"tierMetric",checked:e?.tierMetric==="buyers",disabled:!d,onChange:()=>{he("buyers")},children:"колиÑеÑÑва покÑпаÑелей"})]}),t.jsxs("div",{className:n.conditionsGrid,children:[t.jsx(G,{label:"ÐÐ°Ð·Ð¾Ð²Ð°Ñ Ñена",showRequired:!0,type:"number",placeholder:"0 â½",value:m,error:Ae,disabled:!d,onChange:s=>R(s.target.value),onBlur:s=>{Ge(s.target.value)},onKeyDown:s=>{s.key==="Enter"&&s.currentTarget.blur()}}),t.jsx(G,{label:"ÐакÑималÑное колиÑеÑÑво ÑоваÑов",type:"number",placeholder:"Ðез огÑаниÑений",value:W,disabled:!d,onChange:s=>$(s.target.value),onBlur:s=>{qe(s.target.value)},onKeyDown:s=>{s.key==="Enter"&&s.currentTarget.blur()}}),t.jsx(G,{label:`ÐинимÑм Ð´Ð»Ñ ÑоÑÑоÑÑелÑноÑÑи (${z})`,type:"number",placeholder:"Ðез поÑога",hint:"Ðе набÑали к закÑÑÑÐ¸Ñ â СРне ÑоÑÑоиÑÑÑ, вÑем ÑÑаÑÑникам веÑнÑÑÑÑ Ð¿Ð¾Ð»Ð½Ð°Ñ ÑÑмма",value:T,disabled:!d,onChange:s=>E(s.target.value),onBlur:s=>{De(s.target.value)},onKeyDown:s=>{s.key==="Enter"&&s.currentTarget.blur()}}),t.jsx(G,{label:"ÐознагÑаждение паÑÑнÑÑÑ, % (CPS)",showRequired:!0,type:"number",placeholder:"0",value:K,error:Re,hint:`ÐмеÑÑе Ñ ÐºÐ¾Ð¼Ð¸ÑÑией плаÑÑоÑÐ¼Ñ (${u}%) не болÑÑе 100% â инаÑе вознагÑаждение пÑодавÑа ÑйдÑÑ Ð² минÑÑ`,disabled:!d,onChange:s=>U(s.target.value),onBlur:s=>{$e(s.target.value)},onKeyDown:s=>{s.key==="Enter"&&s.currentTarget.blur()}})]}),t.jsx("div",{className:r.tableWrapper,children:t.jsxs("table",{className:r.table,children:[t.jsx("thead",{className:r.tableHead,children:t.jsxs("tr",{children:[t.jsx("th",{className:r.headerCell,children:"ÐÑап СÐ"}),t.jsx("th",{className:r.headerCell,children:"УÑловие СÐ, %"}),t.jsx("th",{className:r.headerCell,children:t.jsxs("span",{className:n.headerCellWithHint,children:[e?.tierMetric==="buyers"?"ÐÑ ÐºÐ¾Ð»-ва покÑпаÑелей":"ÐÑ ÐºÐ¾Ð»-ва ÑоваÑов",t.jsx("button",{type:"button",className:n.infoIconButton,onClick:()=>re(!0),"aria-label":"ÐодÑказка",children:t.jsx(F,{name:"question",size:16})})]})}),t.jsx("th",{className:r.headerCell,children:"Цена пÑодажи ед"}),t.jsx("th",{className:r.headerCell,children:e?.partnerCommissionPercent?t.jsxs(t.Fragment,{children:["CPS"," ",t.jsxs("span",{className:n.headerCellHighlight,children:["(",e.partnerCommissionPercent,"%)"]})]}):"CPS (%)"}),t.jsx("th",{className:r.headerCell,children:"ÐомиÑÑиÑ"}),t.jsx("th",{className:r.headerCell,children:"ÐÑибÑÐ»Ñ ÐµÐ´"}),t.jsx("th",{className:r.headerCell,"aria-label":""})]})}
1),t.jsx("tbody",{className:r.tableBody,children:(e?.conditions??[]).map((s,o,y)=>t.jsx(hs,{condition:s,index:o,groupBuyId:e.id,basePrice:e?.basePrice??0,partnerCommissionPercent:e?.partnerCommissionPercent??0,sellerCommissionPercent:u,previousMinCount:y[o-1]?.minCount??0,isDeleting:te!==null,isEditable:d,onDelete:I=>{ve(I)},onGroupBuyUpdate:I=>{i(b.setGroupBuy(I))}},s.id))})]})}),t.jsxs("button",{type:"button",className:n.addConditionButton,onClick:()=>{ke()},disabled:!d||A,children:["ÐобавиÑÑ ÑÑловие",t.jsx(F,{name:"plus-small",size:20})]}),t.jsxs("div",{className:n.sectionHeading,children:[t.jsx(F,{name:"question",size:20}),t.jsx("h2",{className:O(H.adminPageTitle,n.sectionHeadingTitle),children:"СодеÑжание СÐ"})]}),(e?.skuItems??[]).length>0&&t.jsx("div",{className:n.skuItemsList,children:(e?.skuItems??[]).map(s=>t.jsx(ys,{item:s,groupBuyId:e.id,articleLabel:_t(s.skuId,h),freeStock:q[s.skuId]??0,isDeleting:ne!==null,isEditable:d,onDelete:Ie,onSaved:o=>{i(b.setItem(o))}},s.skuId))}),t.jsxs("button",{type:"button",className:n.addConditionButton,onClick:()=>{i(Ce.openModal({id:"spSkuPickerModal",data:{productId:h?.id}}))},disabled:!h||!d,children:["ÐобавиÑÑ SKU",t.jsx(F,{name:"plus-small",size:20})]})]})]})]}),t.jsx(Y,{isOpen:je,onClose:()=>re(!1),title:e?.tierMetric==="buyers"?"ÐÑ ÐºÐ¾Ð»-ва покÑпаÑелей":"ÐÑ ÐºÐ¾Ð»-ва ÑоваÑов",children:t.jsx("p",{className:n.infoModalText,children:e?.tierMetric==="buyers"?"УÑловие СРвÑÑÑÐ¿Ð°ÐµÑ Ð² ÑилÑ, когда в СРвÑÑÑÐ¿Ð¸Ñ (оплаÑиÑ) Ñказанное ÑиÑло ÑникалÑнÑÑ
покÑпаÑелей. Скидка ÑÑапа наÑÐ¸Ð½Ð°ÐµÑ Ð´ÐµÐ¹ÑÑвоваÑÑ Ñ ÑÑого ÑиÑла.":"УÑловие СРвÑÑÑÐ¿Ð°ÐµÑ Ð² ÑилÑ, когда покÑпаÑели ÑовмеÑÑно набеÑÑÑ Ñказанное колиÑеÑÑво ÑоваÑов. Скидка ÑÑапа наÑÐ¸Ð½Ð°ÐµÑ Ð´ÐµÐ¹ÑÑвоваÑÑ Ñ ÑÑого колиÑеÑÑва."})}),t.jsx(Y,{isOpen:p,onClose:()=>B(!1),title:"УдалиÑÑ Ð¡Ð?",contentClassName:n.deleteModal,header:t.jsxs("p",{className:n.deleteModalDescription,children:["СовмеÑÑÐ½Ð°Ñ Ð¿Ð¾ÐºÑпка «",h?.name,"» бÑÐ´ÐµÑ Ñдалена. ÐабÑониÑованнÑй под Ð½ÐµÑ ÑÑок веÑнÑÑÑÑ Ð² ÑвободнÑй оÑÑаÑок. СРоÑÑанеÑÑÑ Ð² ÑпиÑке каÑÑоÑек â ÐµÑ Ð¼Ð¾Ð¶Ð½Ð¾ бÑÐ´ÐµÑ Ð²Ð¾ÑÑÑановиÑÑ."]}),footer:t.jsxs(t.Fragment,{children:[t.jsx(Q,{variant:"outline",onClick:()=>B(!1),disabled:g,className:n.deleteModalButton,children:"ÐÑмениÑÑ"}),t.jsx(Q,{variant:"danger",onClick:()=>{Fe()},disabled:g,className:n.deleteModalButton,children:"УдалиÑÑ"})]})}),t.jsx(us,{})]})}const vs=He("/authLayout/cabinet/seller/$sellerId/stores/$storeId/products-in-sp/$groupBuyId")({component:bs});export{vs 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.