PageSourceSearch

https://app.sortly.com/scripts/itemsSummary-CmcZffUq_bundle.js

js sortly.com collected 2026-10-01 10:20:25 UTC 12,512 bytes, 48 lines download raw bytes

1import{dQ as Ce,b7 as x,aE as V,r as n,ah as Be,a$ as ue,ak as Pe,j as t,bL as N,bV as z,b5 as Re,cl as G,bK as _e,R as Ne,de as Fe,cn as ke,ao as Le,aA as Oe,cg as Ue,b4 as De,dE as Ve}from"./vendor-BBNELK6W_bundle.js";import{dA as me,dB as pe,gS as se,u as Q,e as R,J as H,k as W,eq as We,gk as oe,a9 as K,a as ve,et as $e,H as _,a2 as X,df as he,gg as He,e1 as Ge,X as J,T as ye,F as Y,qF as ae,ic as Ye,qE as qe,g3 as ze,g4 as Qe,d9 as Ke,gK as Xe,gj as Je,dv as Ze,tt as q,dx as et,qf as tt,nv as st,A as M,om as ot,at,aG as re,dP as rt,bx as nt,pR as it,jt as dt,l7 as lt}from"./registration-8fW6h2tH_bundle.js";import{jO as ct,jP as ut,bI as mt,jQ as pt,ar as ht,T as yt,P as gt,bt as St,bH as ft,jR as xt,af as bt,jS as jt,jT as Et,ae as It,jU as ge,jV as wt,bo as U,cp as Tt,bv as At,cq as Mt,cs as Ct,jW as Bt,bm as Pt,C as Rt,jX as Se,jY as _t,W as Nt}from"./index-yTdTJQbB_bundle.js";import{a0 as fe,C as ne}from"./slackIntegration-CyZu6SDu_bundle.js";import{N as ie,C as Ft}from"./CollapsibleLayout-CB8TVCaq_bundle.js";import{S as kt,a as Lt}from"./ui-D4vR1_Nh_bundle.js";import{O as Ot}from"./OpenSideFilterButton-CI6uuSz2_bundle.js";import"./moment-Dt2i7U-U_bundle.js";import{Q as Ut}from"./QRLabels-7LKsTs4F_bundle.js";import{I as Dt}from"./ItemGroupAttributes-BEKav5ct_bundle.js";import{S as Vt}from"./SummaryInfo-sQd2ZBuU_bundle.js";import{P as Wt}from"./index-sTJyyYug_bundle.js";import"./sentry-Bq-jBV13_bundle.js";import"./datadog-DxmyjtSX_bundle.js";import"./stripe-rL9tfl_U_bundle.js";import"./speedboat-vendor-DJ0pA_pR_bundle.js";import"./ui-aAhEq_9D_bundle.js";import"./ui-DK3p70xC_bundle.js";import"./attributes-D44-1vp2_bundle.js";import"./index-bUxGbv20_bundle.js";const de=async e=>{try{return await(await(await me()).transaction(pe.ITEMS_SUMMARY,"readwrite")).store.put(e,"summarySettings")}catch{return null}},vt=async()=>{try{return await(await(await me()).transaction(pe.ITEMS_SUMMARY,"readonly")).store.get("summarySettings")}catch{return ct}},$t=N.div`
2  width: 100%;
3  overflow: hidden;
4  ${Ge};
5`,Ht=N.div`
6  margin-bottom: 120px;
7  background-color: ${({theme:e})=>e.bg.white};
8  border: 1px solid ${e=>e.theme.delimiter.neutral100};
9  border-radius: 8px;
10  box-shadow: 0 5px 20px 0 rgba(60, 64, 88, 0.03);
11`,Gt=e=>{const[s,{width:a}]=Ce(),{columnsToRender:m,tableWidth:r}=ut({source:"itemGroupAndSummary",customAttributesSelector:se,isDefaultSummaryView:!0}),g=r>a?r:a,l=Q(),{items:u,itemsById:b,selectedEntities:C,paginationInfo:{totalCount:F=0}={},searchMode:B,descendantIds:P}=R(i=>({selectedEntities:x([],["bulk","selectedEntities"],i),items:x([],["itemsSummary","groupBySid",e.sid,"descendantBucketsIds"],i),itemsById:x({},["nodes","bucketsById"],i),paginationInfo:V(["nodes","pagination","itemSummary"],i),searchMode:i.search.searchMode,descendantIds:x([],["itemsSummary","groupBySid",e.sid,"descendantIds"],i)})),d=i=>l(He(i)),k=()=>l(ft),p=n.useMemo(()=>H(u)||H(b)?[]:Be((i,I)=>{const E=ue({},I,b);return W(E)?Pe(We(E),i):i},[],u),[u,b]),h=n.useCallback((i,I)=>l(mt(i,I)),[l]),S=n.useCallback(i=>h(oe.MANUAL,i),[h]),f=()=>h(oe.ALL_NODES,P),{fetchSummaryItems:A}=K(),{renderContentAboveRow:j}=pt(),{locationPush:L}=ve(),v=n.useCallback(i=>{const I=$e(i.original);L(I)},[L]);return t.jsxs(_,{relative:!0,id:"table-wrapper",left:40,right:40,top:22,children:[t.jsx(X,{when:A,children:t.jsx(he,{largeRed:!0,height:"100%",size:"74px",styleType:"light",width:"100%"})}),t.jsx(ht,{bulkSelectEntities:S,clearSelection:k,selectAllEntities:f,selectedIds:C,selectMode:"summary",toggleEntitySelection:d,children:t.jsx($t,{"data-testid":"table-inner-wrapper",children:t.jsxs(Ht,{ref:s,children:[t.jsx(yt,{enableColumnsFilter:!0,enableRowSelection:!0,overflowed:!0,afterBulkRemove:e.onBulkRemoveSuccess,columns:m,customAttributesSelector:se,data:p||[],initialState:e.initialTableState,isSubRowCondition:()=>!1,renderContentAboveRow:j,requestPageMeta:e.requestPageMeta,source:"itemGroupAndSummary",width:g,onRowClick:v,onSort:e.handleSort}),t.jsx(gt,{tableMode:!0,totalCount:F,values:St({isSearch:B}),onChange:e.handlePaginationChange})]})})})]})},Yt=N.div`
12  display: flex;
13  flex-direction: column;
14  justify-content: center;
15  align-items: center;
16
17  width: 100%;
18  height: 312px;
19  max-width: 464px;
20
21  border: 1px solid ${({theme:e})=>e.delimiter.neutral200};
22  border-radius: 4px;
23
24  background-color: ${({theme:e})=>e.bg.neutral50};
25  cursor: ${e=>e.showPointer?"pointer":"unset"};
26`,qt=({onClick:e=J,...s})=>t.jsx(Yt,{"data-testid":"photo-placeholder",showPointer:s.showPointer,onClick:e,children:t.jsx(xt,{description:s.description,info:s.info})}),zt=N(Y)`
27  max-width: 460px;
28`,le=N.div`
29  margin-top: 5px;
30  padding: 9px 16px;
31  border-radius: 5px;
32  overflow: visible;
33  position: relative;
34  border: 1px solid ${({theme:e})=>e.bg.neutral100};
35
36  ${e=>e.disabled&&_e`
37      cursor: not-allowed;
38    `}
39`,ce=N.span`
40  font-size: 12px;
41  line-height: 16px;
42  color: ${({theme:e})=>e.text.neutral500};
43  left: 16px;
44  position: absolute;
45  top: -9px;
46  background-color: ${e=>e.theme.bg.white};
47`,Qt=({tags:e=[]})=>{const{t:s}=G();return W(e)?t.jsxs(le,{"data-testid":"tags-wrapper",children:[t.jsx(ce,{children:s("item.tags")}),t.jsx(bt,{staticLayout:!0,tags:e})]}):t.jsxs(le,{disabled:!0,"data-testid":"tags-wrapper",children:[t.jsx(ce,{children:s("item.tags")}),t.jsx(ye,{neutral400:!0,"data-testid":"tags",size:"14px",children:"–"})]})},Kt=({currentBucket:e={},initialValues:s})=>{const a=z(),{folders:m}=Re.parse(a.search),g=(e?.variantOptionValues??[]).map(u=>({id:u.option,label:u.option,variantOptionLabel:u.name})),l={...s,name:e.name};return t.jsxs(zt,{column:!0,children:[t.jsx(Dt,{disabled:!0,folderId:m,name:e.name,options:g,uid:e.itemGroupUid}),t.jsx(Qt,{tags:e.tags}),t.jsx(_,{bottom:20,top:50,children:t.jsx(Ut,{hideEmptySlot:!0,form:"ItemSummaryFields",formValues:l,node:e})})]})},Xt=({photos:e})=>{const{t:s}=G(),a=n.useMemo(()=>{const m=jt(e);return qe(m)},[e]);return W(a)?t.jsx(Et,{disabled:!0,hideSliderThumb:!0,showFullscreen:!0,slides:a}):t.jsx(qt,{description:s("item.no_photo")})},Jt=({currentBucket:e})=>{const{getItemSummary:s}=K(),a=n.useMemo(()=>({labelUrl:{uri:e?.labelUrl??null,type:e?.labelUrlType??null},labelUrlExtra:{uri:e?.labelUrlExtra??null,type:e?.labelUrlExtraType??null}}),[e]);return t.jsxs(Y,{relative:!0,justifyContent:"space-between",children:[t.jsx(X,{when:s,children:t.jsx(he,{largeRed:!0,noOverlap:!0,height:"100%",size:"74px",styleType:"light",width:"100%"})}),t.jsx(ae,{outside:!0,right:16,children:t.jsx(Kt,{currentBucket:e,initialValues:a})}),t.jsxs(ae,{outside:!0,left:16,children:[t.jsx(Xt,{photos:e.photos}),t.jsx(Ye,{})]})]})},Zt=({currentBucket:e})=>{const{t:s}=G(),a=ze(),{quantity:m,priceMin:r,priceMax:g,value:l,unitName:u="units",name:b,nodesCount:C}=e,F=R(j=>It(j)(u)),B=`${Qe(m)} ${Ke(F,m)}`,P=Xe({minPrice:a(r),maxPrice:a(g),skipFormatting:!0}),d=a(l),{nodesById:k,firstBucket:p}=R(j=>({nodesById:V(["navigation","byId"],j),firstBucket:ge(j)(V(["descendantBucketsIds","0"],e))})),h=Je({nodesById:k,nodeId:p.parentNodeId,appendCurrentNode:!0,bucketNode:e}),{actions:S}=wt({bucket:e,source:"item summary",synchronous:!0}),f=ue({action:{onClick:J}},U.MOVE,S),A=n.useMemo(()=>Ze([{element:{label:s("item_group.details_fields.items"),details:C},include:!0},{element:{label:s("item_group.details_fields.quantity"),details:B},include:!0},{element:{label:s("item_group.details_fields.price"),details:P},include:!q(r)||!q(g)},{element:{label:s("item_group.details_fields.value"),details:d},include:!q(l)}]),[C,B,P,d,r,g,l]);return t.jsxs(Ne.Fragment,{children:[t.jsxs(fe.DefaultHeader,{innerDelimiter:!0,white:!0,offsets:{pt:0,pl:0,pr:0},children:[t.jsx(Tt,{children:t.jsx(At,{items:h})}),t.jsxs(Mt,{alignItems:"flex-end",justifyContent:"space-between",children:[t.jsx(ye,{as:"h1","data-testid":"name",offsets:{mt:26,mb:9},children:b}),t.jsx(_,{bottom:9,children:t.jsxs(Y,{children:[t.jsx(X,{when:f.available,children:t.jsx(Ct,{"data-testid":f.action["data-testid"],hint:s("card.tooltip.move"),onClick:f.action.onClick,children:f.action.icon})}),t.jsx(_,{left:16,children:t.jsx(Bt,{show:!0,synchronous:!0,bucket:e,DropdownActionsAnchor:Pt,dropdownActionsList:[U.EXPORT,U.LABELS,U.SET_ALERTS,U.DELETE],source:"item summary"})})]})})]})]}),t.jsx(Vt,{data:A})]})},D={keyword:"",sortBy:"name",direction:"descending"},es=({currentBucket:e,sid:s,showContentPlaceholder:a})=>{const{t:m}=G(),r=Q(),{stopSearchByScanning:g,active:l}=Rt(),[u,b]=n.useState(!1),C=Fe({defaultValues:D,mode:"onChange"}),{control:F,getFieldState:B,register:P,setValue:d,watch:k}=C,{keyword:p="",sortBy:h,direction:S}=ke({control:F}),{debouncedValue:f}=et(p,500),[A,j]=n.useState(!1),{currentPage:L,perPage:v}=tt(),i=n.useMemo(()=>A?1:L,[A,L]),I=R(o=>ge(o)(V(["descendantBucketsIds","0"],e))),E=x([],["parentFolders"],e),Z=n.useMemo(()=>st("id")(E),[E]),[w,$]=n.useState(Z),[xe,be]=n.useState(Z),je=R(o=>x({},["itemsSummary","groupBySid","fieldsToShow"],o)),ee=z(),T=n.useCallback((o,c=!1)=>(c||r({type:M.GET_ITEM_SUMMARY_REQUEST,payload:{sid:s,folders:o.folders||E,afterAll:o.afterAll}}),r({type:M.FETCH_SUMMARY_ITEMS_REQUEST,payload:{sid:s,folders:o.folders||E,sortBy:o.sortBy||h,direction:o.direction||S,keyword:o.keyword||p,pageNumber:o.pageNumber||i,pageLimit:o.pageLimit||v}})),[r,s,E,h,S,p,i,v]);n.useEffect(()=>{const o=ot(),c=Se(ee.search),y=W(c)?c:w;W(c)&&($(y),be(y)),vt().then((O=_t)=>{d("sortBy",O.sortBy),d("direction",O.direction),r({type:M.CHANGE_ITEM_SUMMARY_HEADER_FORM,payload:{sortBy:O.sortBy,direction:O.direction,folders:y}}),T({folders:y,...O,pageLimit:o,pageNumber:1},!0),b(!0)})},[s,r,ee.search]),n.useEffect(()=>{const o=Le(f);(o===0||o>2)&&u&&T({keyword:f,pageNumber:1,folders:w},!0)},[f]);const Ee=n.useCallback(o=>{$(o),d("folders",o),r({type:M.CHANGE_ITEM_SUMMARY_HEADER_FORM,payload:{folders:o}})}
47,[r,$,d]),Ie={sortBy:h,direction:S,setFields:je,folders:w},we=n.useCallback(({perPage:o=20,currentPage:c=1})=>{at({nodesPerPageLimit:o}),T({pageNumber:c,pageLimit:o,folders:w,sortBy:h,direction:S,keyword:p},!0)},[T,w,h,S,p]),Te=n.useCallback(o=>{if(H(o))return;const c=x(D.sortBy,[0,"id"],o);let y=o;Oe(Array,o)&&(y={sortBy:c,direction:V([0,"desc"],o)?"descending":"ascending",pageNumber:1,keyword:p,folders:w}),de({sortBy:y.sortBy,direction:y.direction}),d("sortBy",y.sortBy),d("direction",y.direction),r({type:M.CHANGE_ITEM_SUMMARY_HEADER_FORM,payload:{sortBy:y.sortBy,direction:y.direction}}),T(y,!0)},[T,p,w,d,r]),Ae=n.useCallback(o=>{$(o.folders);const c={sortBy:x(D.sortBy,["sortBy"],o),direction:x(D.direction,["direction"],o)};return de(c),d("sortBy",c.sortBy),d("direction",c.direction),r({type:M.CHANGE_ITEM_SUMMARY_HEADER_FORM,payload:{sortBy:c.sortBy,direction:c.direction,folders:o.folders}}),T({sid:s,folders:o.folders,...c,pageNumber:1,keyword:p})},[T,s,p,d,r]),te=()=>{j(!1),d("keyword","")};Ue(()=>te());const Me=()=>{A||j(!0)};return a?t.jsxs(ne,{$direction:"row",children:[t.jsx(ie,{activeNodeId:I.parentNodeId||re}),t.jsx(kt,{})]}):t.jsxs(ne,{$direction:"row",children:[t.jsx(ie,{activeNodeId:I.parentNodeId||re}),t.jsxs(Ft,{white:!0,children:[t.jsx(Zt,{currentBucket:e,sid:s}),t.jsx(fe.Body,{$customStyle:{position:"relative",flexGrow:1,margin:0},bottom:40,left:40,maxWidth:1192,right:40,top:20,children:t.jsxs(Y,{column:!0,children:[t.jsx(Jt,{currentBucket:e}),t.jsx(_,{children:t.jsxs(Lt,{wrap:!0,alignItems:"center",id:"action-bar-controls",isSearchMode:l,justifyContent:"flex-start",children:[t.jsx(_,{right:24,children:t.jsx(Nt,{getFieldState:B,isScannerApplicable:!0,isScanningInProcess:l,name:"keyword",placeHolder:m("search.keyword"),register:P,setValue:d,watch:k,onClear:te,onFocus:Me,onKeyDown:l?g:J})}),t.jsx(Ot,{additionalData:{setLocalSelectedNodes:Ee,enabledNodes:E},data:Ie,defaultState:De(D,{folders:xe}),exposedFields:["sortBy"],filterType:rt.SUMMARY,submitFilterValues:Ae})]})})]})}),t.jsx(Gt,{handlePaginationChange:we,handleSort:Te,initialTableState:{sortBy:[{id:h,desc:S==="descending"}]},requestPageMeta:{pageName:nt.summary,selectedNodes:w,sid:s,sortBy:h,direction:S,itemsSummary:{sid:s}},sid:s}),t.jsx(Wt,{node:{sid:s,type:"master"}})]})]})},js=e=>{it();const s=Q(),{id:a}=Ve(),m=R(x({},["itemsSummary","groupBySid",a])),{getItemSummary:r}=K(),g=z(),l=r||H(m),u=dt(a);return n.useEffect(()=>{const b=Se(g.search);u!==a&&s({type:M.GET_ITEM_SUMMARY_REQUEST,payload:{sid:a,folders:b}})},[a,u,s,g.search]),t.jsx(lt,{hidden:!0,children:t.jsx(es,{currentBucket:m,showContentPlaceholder:l,sid:a})})};export{js as default};
48//# sourceMappingURL=itemsSummary-CmcZffUq_bundle.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.