PageSourceSearch

https://app.empireflippers.com/assets/index-B-iaGHx1.js

js empireflippers.com collected 2026-10-09 22:12:22 UTC 18,689 bytes, 2 lines download raw bytes

1import{W as pe,k as he,a6 as j,w as re,a as le,r as P,j as e,ap as _,J as T,K as A,L as ye,M as ne,a8 as U,B as q,b as u,n as ie,ai as xe,N as de,ab as F,m as fe,ar as ge,as as N,at as ve,au as be,av as je,aw as Ce,I as Te,ax as ke,ay as Ne}from"./base-components-C_FoBiEZ.js";import{aq as we,ar as oe,as as ce,_ as Q,at as J,a3 as _e,h as Se,b as Pe,au as Ae,F as Ue,a as Be,L as Fe}from"./index-RH5lj1ot.js";import{u as ue,a as Me}from"./show-DB5AnTbl.js";import{P as X,u as $e}from"./PreviewAction-ryjH4Pb1.js";import"./Action-DPAP5MVj.js";try{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="65d61c29-dfd2-4260-9cd1-aae21b98684a",t._sentryDebugIdIdentifier="sentry-dbid-65d61c29-dfd2-4260-9cd1-aae21b98684a")}catch{}const ze=async({queryKey:t})=>{const[,n]=t;return(await he(["get","/api/v1/admin/listings/price-update-preview"],n)).data},Le=(t,n={})=>pe({queryKey:["adminListingsPriceUpdatePreview",t],queryFn:ze,...n}),V=t=>typeof t=="number"?t:we(t),De=new oe().addPropertyMapping({from:"listingNumber",to:"listingNumber"}).addMapping(function(t,n){const g=j(t,"selectedTaskModulesArray"),m=j(t,"selectedTaskTemplatesArray"),c=j(t,"stage"),x=j(t,"priceUpdateMonth")?Number(j(t,"priceUpdateMonth"))+1:null,y=j(t,"priceUpdateYear"),s=[...g.map(d=>{var b,h,k;return{taskName:d.taskName,stage:c,type:d.type,...c==="price_updates"?{priceUpdateMonth:x,priceUpdateYear:y}:{},...V((b=t[d.id])===null||b===void 0?void 0:b.newPrice)?{newPrice:V(t[d.id].newPrice)}:{},...(h=t[d.id])!==null&&h!==void 0&&h.forBuyers?{forBuyers:!0}:{},...(k=t[d.id])!==null&&k!==void 0&&k.forSellers?{forSellers:!0}:{}}}),...m.map(d=>{var b,h;return{taskName:d.taskName,taskTemplateId:d.id,stage:c,...c==="price_updates"?{priceUpdateMonth:x,priceUpdateYear:y}:{},...(b=t[d.id])!==null&&b!==void 0&&b.forBuyers?{forBuyers:!0}:{},...(h=t[d.id])!==null&&h!==void 0&&h.forSellers?{forSellers:!0}:{}}})];return ce(n,"tasks",s),n}),O=t=>t==null?"-":_e(t,0),G=t=>{const{selectedTaskTemplatesArray:n,selectedTaskModulesArray:g,priceUpdateTasks:m,combinedBuyerSellerModules:c,combinedBuyerSellerTemplates:x,listingNumber:y,stage:s,priceUpdateMonth:d,priceUpdateYear:b,values:h,setFieldValue:k}=t,r=le(),{mutate:M,isPending:R}=ue(),{data:i,isError:E}=Le({listingNumber:y},{enabled:!!y&&m.length>0}),l=i?.defaultNewPrice,S=i?.pendingAnnualNetProfit,B=S>0,$=P.useCallback(a=>{a?.preventDefault(),l!=null&&m.forEach(p=>{k(`${p.id}.newPrice`,l)})},[l]),z=P.useRef(!1);P.useEffect(()=>{!i||z.current||(z.current=!0,$())},[i]);const v=a=>{var p;const o=V((p=h[a.id])===null||p===void 0?void 0:p.newPrice);return!o||!B?null:o/S},C=async()=>{M(De.map({...h,selectedTaskTemplatesArray:n,selectedTaskModulesArray:g,stage:s,priceUpdateMonth:d,priceUpdateYear:b}),{onSuccess:()=>{ie("success","Tasks added successfully"),r.replace(`/admin/tasks?q=${y}`)}})},L=a=>{var p;return!(V((p=h[a.id])===null||p===void 0?void 0:p.newPrice)>0)||!B},D=a=>{var p,o;return!((p=h[a.id])!==null&&p!==void 0&&p.forBuyers)&&!((o=h[a.id])!==null&&o!==void 0&&o.forSellers)},I=P.useMemo(()=>m.map(L).includes(!0)||c.map(D).includes(!0)||x.map(D).includes(!0),[h,i]);return e.jsxs("form",{"data-sentry-component":"FinalizeAddTasksView","data-sentry-source-file":"FinalizeAddTasks.tsx",children:[e.jsx("p",{children:"Please fill in the required extra details for the following tasks:"}),m.map(a=>e.jsx(_,{close:!0,children:e.jsxs(T,{children:[e.jsx(A,{children:a.title}),a.taskName==="price_update"&&e.jsxs("div",{children:[E&&e.jsx(Q,{customStyles:{marginBottom:"1rem"},children:"Couldn't load the pending figures for this listing, so a price update task can't be created right now. Reload the page to try again."}),!!i&&!B&&e.jsx(Q,{customStyles:{marginBottom:"1rem"},children:"This listing has no positive pending annual net profit to price against, so a price update task can't be created for it."}),e.jsxs(Ve,{children:[e.jsxs("div",{children:[e.jsx("span",{className:"label",children:"Current Price:"})," ",e.jsx("span",{className:"value",children:O(i?.currentPrice)})]}),e.jsx("div",{}),e.jsxs("div",{children:[e.jsx("span",{className:"label",children:"Current Multiple:"})," ",e.jsx("span",{className:"value",children:J(i?.currentAnnualMultiple)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"label",children:"Pending Multiple:"})," ",e.jsx("span",{className:"value",children:J(v(a))})]}),e.jsxs("div",{children:[e.jsx("span",{className:"label",children:"Current Profit:"})," ",e.jsx("span",{className:"value",children:O(i?.currentAnnualNetProfit)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"label",children:"Pending Profit:"})," ",e.jsx("span",{className:"value",children:O(i?.pendingAnnualNetProfit)})]})]}),e.jsxs(T,{children:[e.jsx(A,{htmlFor:`${a.id}.newPrice`,children:e.jsxs(Ye,{children:[e.jsx("span",{children:"New Price"}),e.jsx(ye,{onClick:$,disabled:l==null,children:"Reset to current multiple"})]})}),e.jsx(ne,{small:!0,maskName:"usdWithoutDecimal",placeholder:"$0",autoComplete:"off",maxLength:20,name:`${a.id}.newPrice`})]})]})]})},a.id)),c.map(a=>e.jsx(_,{close:!0,children:e.jsxs(T,{children:[e.jsx(A,{children:a.title}),a.forBuyers&&a.forSellers&&e.jsxs(Z,{children:[e.jsx(U,{name:`${a.id}.forBuyers`,children:"Create for Buyer"}),e.jsx(U,{name:`${a.id}.forSellers`,children:"Create for Seller"})]})]})},a.id)),x.map(a=>e.jsx(_,{close:!0,children:e.jsxs(T,{children:[e.jsx(A,{children:a.title}),a.forBuyers&&a.forSellers&&e.jsxs(Z,{children:[e.jsx(U,{name:`${a.id}.forBuyers`,children:"Create for Buyer"}),e.jsx(U,{name:`${a.id}.forSellers`,children:"Create for Seller"})]})]})},a.id)),e.jsx(_,{"data-sentry-element":"Row","data-sentry-source-file":"FinalizeAddTasks.tsx",children:e.jsx(q,{type:"button",disabled:I,small:!0,primary:!0,fullWidth:!0,isLoading:R,onClick:C,"data-sentry-element":"Button","data-sentry-source-file":"FinalizeAddTasks.tsx",children:"Save"})})]})};G.displayName="FinalizeAddTasksView";
1G.displayName="FinalizeAddTasksView";const Ie=re({displayName:"FinalizeAddTasksForm",handleSubmit:()=>{}})(G),Z=u.div.withConfig({displayName:"FinalizeAddTasks__ExtraDataContainer"})(["display:flex;*:not(:last-child){margin-bottom:0;margin-right:1rem;}"]),Ve=u.div.withConfig({displayName:"FinalizeAddTasks__StyledPriceUpdateSummary"})(["display:grid;gap:1rem;grid-template-columns:1fr 1fr;margin-bottom:1rem;.label{color:",";}"],t=>t.theme.colors.darkerGray),Ye=u.label.withConfig({displayName:"FinalizeAddTasks__StyledPriceUpdatesLabel"})(["display:flex;justify-content:space-between;"]),ee=50,Y=t=>{const{title:n}=t;return e.jsx("div",{"data-sentry-component":"TasksTitle","data-sentry-source-file":"TasksTitle.tsx",children:n.length>ee?e.jsx(xe,{content:e.jsx("span",{children:n}),maxWidth:"28rem",children:e.jsx("span",{children:n.slice(0,ee)+"..."})}):n})};Y.displayName="TasksTitle";Y.displayName="TasksTitle";const W=t=>{const{taskModules:n,taskTemplates:g}=t,{values:m,setValues:c}=de(),x=s=>{c({...m,selectedTaskModules:{...m.selectedTaskModules,[s.target.name]:s.target.checked}})},y=s=>{c({...m,selectedTaskTemplates:{...m.selectedTaskTemplates,[s.target.name]:s.target.checked}})};return!n||!g?e.jsx("p",{children:"Loading..."}):e.jsx(Re,{"data-sentry-element":"Container","data-sentry-component":"Table","data-sentry-source-file":"index.tsx",children:e.jsxs(Ee,{"data-sentry-element":"TableContainer","data-sentry-source-file":"index.tsx",children:[e.jsxs(He,{"data-sentry-element":"TableHeader","data-sentry-source-file":"index.tsx",children:[e.jsx(w,{"data-sentry-element":"TableHeaderCell","data-sentry-source-file":"index.tsx"}),e.jsx(w,{"data-sentry-element":"TableHeaderCell","data-sentry-source-file":"index.tsx",children:"Preview"}),e.jsx(w,{"data-sentry-element":"TableHeaderCell","data-sentry-source-file":"index.tsx",children:"Title"}),e.jsx(w,{"data-sentry-element":"TableHeaderCell","data-sentry-source-file":"index.tsx",children:"User"}),e.jsx(w,{"data-sentry-element":"TableHeaderCell","data-sentry-source-file":"index.tsx",children:"Department"}),e.jsx(w,{"data-sentry-element":"TableHeaderCell","data-sentry-source-file":"index.tsx",children:"Module"}),e.jsx(w,{"data-sentry-element":"TableHeaderCell","data-sentry-source-file":"index.tsx",children:"Type"})]}),e.jsx(Oe,{"data-sentry-element":"TableBody","data-sentry-source-file":"index.tsx"}),n.map(s=>e.jsxs(te,{children:[e.jsx(f,{children:e.jsx(ae,{children:e.jsx(U,{small:!0,name:s.id,onChange:x})})}),e.jsx(f,{children:e.jsx(X,{taskTemplate:s,iconOnly:!0})}),e.jsx(f,{children:e.jsx(Y,{title:s.title})}),e.jsx(f,{children:s.userType}),e.jsx(f,{children:F(s.department)}),e.jsx(f,{children:F(s.taskName)}),e.jsx(f,{children:e.jsx(se,{children:s.moduleOrTemplate.toUpperCase()})})]},s.id)),g.map(s=>e.jsxs(te,{children:[e.jsx(f,{children:e.jsx(ae,{children:e.jsx(U,{small:!0,name:s.id,onChange:y})})}),e.jsx(f,{children:e.jsx(X,{taskTemplate:s,iconOnly:!0})}),e.jsx(f,{children:e.jsx(Y,{title:s.internalTitle||s.title})}),e.jsx(f,{children:s.userType}),e.jsx(f,{children:F(s.department)}),e.jsx(f,{children:F(s.taskName)}),e.jsx(f,{children:e.jsx(se,{template:!0,children:s.moduleOrTemplate.toUpperCase()})})]},s.id))]})})};W.displayName="Table";W.displayName="Table";const Re=u.div.withConfig({displayName:"Table__Container"})(["width:100%;"]),Ee=u.div.withConfig({displayName:"Table__TableContainer"})(["width:100%;display:table;"]),He=u.div.withConfig({displayName:"Table__TableHeader"})(["display:table-header-group;color:",";"],t=>t.theme.colors.mediumGray),w=u.div.withConfig({displayName:"Table__TableHeaderCell"})(["display:table-cell;padding:1rem;font-weight:bold;text-align:justify;"]),Oe=u.div.withConfig({displayName:"Table__TableBody"})(["display:table-row-group;"]),te=u.div.withConfig({displayName:"Table__TableRow"})(["display:table-row;&:nth-child(even){background-color:",";}"],t=>t.theme.colors.lightGray),f=u.div.withConfig({displayName:"Table__TableBodyCell"})(["display:table-cell;padding:1rem;"]),ae=u.div.withConfig({displayName:"Table__CheckboxContainer"})(["transform:translateY(-0.95rem);"]),se=u.div.withConfig({displayName:"Table__Badge"})(["display:inline;padding:0.3rem;color:",";border:1px solid ",";border-radius:",";"],t=>t.template?t.theme.colors.secondary:t.theme.colors.mediumGray4,t=>t.template?t.theme.colors.secondary:t.theme.colors.mediumGray4,t=>t.theme.sizes.borderRadiusSmall),qe=new oe().addPropertyMapping({from:"listingNumber",to:"listingNumber"}).addMapping(function(t,n){const g=j(t,"selectedTaskModulesArray"),m=j(t,"selectedTaskTemplatesArray"),c=j(t,"stage"),x=j(t,"priceUpdateMonth")?Number(j(t,"priceUpdateMonth"))+1:null,y=j(t,"priceUpdateYear"),s=[...g.map(d=>({taskName:d.taskName,stage:c,type:d.type,...c==="price_updates"?{priceUpdateMonth:x,priceUpdateYear:y}:{}})),...m.map(d=>({taskName:d.taskName,taskTemplateId:d.id,stage:c,...c==="price_updates"?{priceUpdateMonth:x,priceUpdateYear:y}:{}}))];return ce(n,"tasks",s),n}),Ge={stage:{label:"Initial",value:"initial"},selectedTaskModules:{},selectedTaskTemplates:{}},K=()=>{var t,n,g,m,c,x,y,s;const d=le(),b=fe(),{showAlert:h,closeAlert:k}=Se(),{values:r,setFieldValue:M}=de(),R={page:parseInt(b.page)||1,limit:(t=r.limit)===null||t===void 0?void 0:t.value,q:r.search||void 0,taskName:((n=r.taskName)===null||n===void 0?void 0:n.value)||void 0,department:((g=r.department)===null||g===void 0?void 0:g.value)||void 0,sort:r.sort?ge.decamelize(r.sort):void 0,order:r.order,context:"add_tasks",isCreateTaskList:!0},{mutate:i,isPending:E}=ue(),{data:l}=$e(R),{data:S}=Me({listingNumber:Number(r.listingNumber)},{enabled:/^\d{2,8}$/.test(String(r.listingNumber))}),B={count:l?.count,pages:l?.pages,page:l?.page,limit:l?.limit};Pe("listingNumber",v=>{var C;(C=v.listingNumber)!==null&&C!==void 0&&C.length&&M("listingNumber",v.listingNumber)}),P.useEffect(()=>{if(S){const v=S.listing.currentTaskStage;v&&M("stage",Ae(v,F(v)))}},[r.listingNumber,S]),P.useEffect(()=>{Number(b.page)>1&&d.replace("/admin/tasks/create")},[r.search,r.order,r.sort]);const $=async()=>{const v=l.taskModules.filter(o=>r.selectedTaskModules[o.id]===!0),C=l.taskTemplates.filter(o=>r.selectedTaskTemplates[o.id]===!0),L=v.filter(o=>o.taskName==="price_update"),D=v.filter(o=>o.forSellers&&o.forBuyers),I=C.filter(o=>o.forSellers&&o.forBuyers);if(L.length||I.length)h({title:"Finalize Add Tasks",Component:()=>{var o,H;return e.jsx(Ie,{selectedTaskModulesArray:v,selectedTaskTemplatesArray:C,priceUpdateTasks:L,combinedBuyerSellerModules:D,combinedBuyerSellerTemplates:I,listingNumber:r.listingNumber,stage:r.stage.value,priceUpdateMonth:(o=r.priceUpdateMonth)===null||o===void 0?void 0:o.value,priceUpdateYear:(H=r.priceUpdateYear)===null||H===void 0?void 0:H.value,closeAlert:k})},width:"50rem"});else{var a,p;i(qe.map({...r,selectedTaskTemplatesArray:C,selectedTaskModulesArray:v,stage:r.stage.value,priceUpdateMonth:(a=r.priceUpdateMonth)===null||a===void 0?void 0:a.value,priceUpdateYear:(p=r.priceUpdateYear)===null||p===void 0?void 0:p.value}),{onSuccess:()=>{ie("success","Tasks added successfully"),d.replace(`/admin/tasks?q=${r.listingNumber}`)}})}},z=!Object.values(r.selectedTaskModules).includes(!0)&&!Object.values(r.selectedTaskTemplates).includes(!0)||!r.listingNumber||!((m=r.stage)!==null&&m!==void 0&&m.value)||((c=r.stage)===null||c===void 0?void 0:c.value)==="price_updates"&&(!((x=r.priceUpdateMonth)!==null&&x!==void 0&&x.value)||!((y=r.priceUpdateYear)!==null&&y!==void 0&&y.value));return e.jsx(Ue,{"data-sentry-element":"FormProvider","data-sentry-component":"ControllerVie
1w","data-sentry-source-file":"Controller.tsx",children:e.jsxs(Ke,{"data-sentry-element":"StyledController","data-sentry-source-file":"Controller.tsx",children:[e.jsxs(Qe,{"data-sentry-element":"Container","data-sentry-source-file":"Controller.tsx",children:[e.jsx("h1",{children:"Add Tasks"}),e.jsxs("div",{children:[e.jsxs(_,{"data-sentry-element":"Row","data-sentry-source-file":"Controller.tsx",children:[e.jsx(N,{size:.5,"data-sentry-element":"Column","data-sentry-source-file":"Controller.tsx",children:e.jsx(T,{"data-sentry-element":"FormBlock","data-sentry-source-file":"Controller.tsx",children:e.jsx(ne,{name:"listingNumber",placeholder:"Enter Listing #",maxLength:20,small:!0,"data-sentry-element":"Field","data-sentry-source-file":"Controller.tsx"})})}),e.jsx(N,{size:.5,"data-sentry-element":"Column","data-sentry-source-file":"Controller.tsx",children:e.jsx(T,{"data-sentry-element":"FormBlock","data-sentry-source-file":"Controller.tsx",children:e.jsx(ve,{small:!0,name:"stage",noPortal:!0,menuPosition:"fixed","data-sentry-element":"SelectTaskStage","data-sentry-source-file":"Controller.tsx"})})})]}),((s=r.stage)===null||s===void 0?void 0:s.value)==="price_updates"&&e.jsxs(_,{children:[e.jsx(N,{size:.5,children:e.jsxs(T,{children:[e.jsx(A,{htmlFor:"priceUpdateMonth",children:"Price Updates Month"}),e.jsx(ke,{small:!0,noPortal:!0,isClearable:!0,menuPosition:"fixed",name:"priceUpdateMonth"})]})}),e.jsx(N,{size:.5,children:e.jsxs(T,{children:[e.jsx(A,{htmlFor:"priceUpdateYear",children:"Price Updates Year"}),e.jsx(Ne,{small:!0,noPortal:!0,isClearable:!0,menuPosition:"fixed",count:20,name:"priceUpdateYear"})]})})]}),e.jsx(Ze,{"data-sentry-element":"Divider","data-sentry-source-file":"Controller.tsx"}),e.jsxs(_,{"data-sentry-element":"Row","data-sentry-source-file":"Controller.tsx",children:[e.jsx(N,{size:.5,"data-sentry-element":"Column","data-sentry-source-file":"Controller.tsx",children:e.jsx(Xe,{"data-sentry-element":"SearchbarContainer","data-sentry-source-file":"Controller.tsx",children:e.jsx(be,{placeholder:"Search",maxLength:1e3,"data-sentry-element":"FieldSearch","data-sentry-source-file":"Controller.tsx"})})}),e.jsx(N,{size:.2,"data-sentry-element":"Column","data-sentry-source-file":"Controller.tsx",children:e.jsx(Je,{"data-sentry-element":"SelectWrapper","data-sentry-source-file":"Controller.tsx",children:e.jsx(je,{name:"department",header:!0,small:!0,isClearable:!0,noPortal:!0,isSearchable:!1,placeholder:"Task Department","data-sentry-element":"SelectTaskDepartment","data-sentry-source-file":"Controller.tsx"})})}),e.jsx(N,{size:.3,"data-sentry-element":"Column","data-sentry-source-file":"Controller.tsx",children:e.jsx(Ce,{name:"taskName",header:!0,small:!0,isClearable:!0,noPortal:!0,placeholder:"Module","data-sentry-element":"SelectTaskModules","data-sentry-source-file":"Controller.tsx"})})]})]}),e.jsx("div",{children:e.jsx(W,{taskModules:l?.taskModules,taskTemplates:l?.taskTemplates,metadata:B,"data-sentry-element":"Table","data-sentry-source-file":"Controller.tsx"})})]}),e.jsxs(et,{"data-sentry-element":"ActionsBar","data-sentry-source-file":"Controller.tsx",children:[e.jsx(q,{type:"button",small:!0,to:"/admin/tasks","data-sentry-element":"Button","data-sentry-source-file":"Controller.tsx",children:"Cancel"}),e.jsxs(q,{type:"button",small:!0,primary:!0,isLoading:E,onClick:$,disabled:z,"data-sentry-element":"Button","data-sentry-source-file":"Controller.tsx",children:["Add Tasks",e.jsx(Te,{name:"check",size:"1.5rem",ml:"0.75rem","data-sentry-element":"Icon","data-sentry-source-file":"Controller.tsx"})]})]})]})})};K.displayName="ControllerView";K.displayName="ControllerView";const We=re({displayName:"TaskTemplatesIndexForm",handleSubmit:()=>{},mapPropsToValues:()=>Ge})(K),Ke=u.div.withConfig({displayName:"Controller__StyledController"})(["display:flex;justify-content:center;flex:1;background-color:",";"],t=>t.theme.colors.white),Qe=u.div.withConfig({displayName:"Controller__Container"})(["width:100%;padding:0 5rem 6rem;"]),Je=u.div.withConfig({displayName:"Controller__SelectWrapper"})(["margin-right:1.5rem;"]),Xe=u.div.withConfig({displayName:"Controller__SearchbarContainer"})(["display:flex;flex:1;
1"]),Ze=u.div.withConfig({displayName:"Controller__Divider"})(["height:1px;width:100%;margin:0 auto 1.5rem;background-color:",";"],t=>t.theme.colors.lightGrayRowSeparator),et=u.div.withConfig({displayName:"Controller__ActionsBar"})(["position:fixed;bottom:0;width:100%;background-color:",";border-top:2px solid ",";font-weight:bold;padding:1rem 5rem;display:flex;justify-content:space-between;"],t=>t.theme.colors.white,t=>t.theme.colors.lightGrayRowSeparator),me=()=>(Be({title:"Add Tasks",withDefaultSuffix:!0}),e.jsx(Fe,{skipPadding:!0,skipMenu:!0,skipFooter:!0,"data-sentry-element":"Layout","data-sentry-component":"PageCreateTasks","data-sentry-source-file":"index.tsx",children:e.jsx(We,{"data-sentry-element":"Controller","data-sentry-source-file":"index.tsx"})}));me.displayName="PageCreateTasks";me.displayName="PageCreateTasks";export{me as default};
2//# sourceMappingURL=index-B-iaGHx1.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.