PageSourceSearch

https://cdn.showone.ru/www/sites/showone-prod/assets/seller-account-product-in-sp-card.lazy-Db_tyqZ2.js

js showone.ru collected 2026-09-25 09:35:06 UTC 24,212 bytes, 1 lines download raw bytes

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.