PageSourceSearch

https://dash-rh.swile.com.br/_next/static/chunks/pages/orders/[ord…/[orderCode]/history-d214230d49100d5f.js

js swile.com.br collected 2026-10-04 20:56:09 UTC 16,238 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[934],{185:(e,t,r)=>{"use strict";function a(e){let{amount:t=0,type:r="pt-BR",currency:a="BRL"}=e;return(t||0).toLocaleString(r,{style:"currency",currency:a,maximumFractionDigits:2,minimumFractionDigits:2})}r.d(t,{v:()=>a})},11455:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__N_SSP:()=>H,default:()=>S});var a=r(37876),l=r(30121),s=r(58175),i=r(9649),n=r(48128),d=r(12239),o=r(53242),c=r(18482),u=r(82961);async function m(e){let[,t,r]=e,{data:a}=await c.r.get("private/order/items/".concat(t,"/details"),{params:{activeOnly:r}});return a}var p=r(14232),h=r(13326),v=r(37255),g=r(88699),x=r(24158);let f=e=>{let{order:t}=e,[r,l]=(0,p.useState)(!0),{code:i,corporateDocument:n,categoryPtBr:o}=t;return(0,a.jsxs)("div",{className:"grid gap-16 rounded-8 border border-border-default p-16",children:[(0,a.jsx)("div",{className:"flex gap-8",children:(0,a.jsxs)(s.o,{component:"button",variant:"headline",className:"text-content-default items-center gap-8 no-underline",onClick:()=>l(e=>!e),children:["Hist\xf3rico de edi\xe7\xf5es do item ",i,(0,a.jsx)(h.g,{size:24,icon:r?"chevron-down":"chevron-right"})]})}),r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.c,{}),(0,a.jsxs)("div",{className:"flex items-center gap-24",children:[(0,a.jsxs)(s.o,{variant:"callout",weight:"medium",className:"gap-4",children:["CNPJ",(0,a.jsx)(s.o,{variant:"callout",weight:"normal",className:"text-content-subdued",children:(0,g.T)(n)})]}),(0,a.jsxs)(s.o,{variant:"callout",weight:"medium",className:"gap-4",children:["ID do item",(0,a.jsx)(s.o,{variant:"callout",weight:"normal",className:"text-content-subdued",children:i})]}),(0,a.jsxs)(s.o,{variant:"callout",weight:"medium",className:"items-center gap-4",children:["Categoria",(0,a.jsx)(v.v,{label:o,colorSet:(0,x.E)(o)})]})]})]})]})};var j=r(51894),y=r(76438),b=r(56557),w=r.n(b),N=r(63152),V=r(45229),C=r(185),D=r(70673),O=r(92491);let I=e=>Object.values(e).reduce((e,t)=>(e[t.employeeId]={...t,wallets:t.wallets.reduce((e,t)=>(e[t.code]=t,e),{})},e),{}),E=e=>{let{before:t,after:r}=e,l=(0,p.useMemo)(()=>{let e=I(t),a=I(r);return a?Object.values(e).map(e=>{let t=a[e.employeeId],r=Object.entries(e.wallets).reduce((e,r)=>{let[a,l]=r,s=(null==t?void 0:t.wallets[a])||void 0;return e[a]={name:l.name,oldValue:l.value,newValue:(null==s?void 0:s.value)||0},e},{});return{...e,remove:!t,wallets:r}}):[]},[t,r]);return(0,a.jsxs)("div",{className:"grid gap-8",children:[(0,a.jsx)(V.A,{list:l}),(0,a.jsx)(D.A,{list:l.filter(N.x5)}),(0,a.jsx)(O.F,{severity:"success",className:"py-8",children:(0,a.jsxs)(s.o,{variant:"callout","data-testid":"credit-alert-text",children:[(0,a.jsx)("b",{children:"Reembolso gerado:"})," ",(0,C.v)({amount:(0,N.U5)(l)})]})})]})};async function k(e){let[,t,r]=e,{data:a}=await c.r.get("private/order/".concat(t,"/history"));return Object.values(a).reduce((e,t)=>t.orderMetadata?(t.idOrder!==r||e.wallets.push(t),e):(t.orderGroupMetadata&&e.dates.push(t),e),{wallets:[],dates:[]})}var M=r(53214);let _=e=>{let{before:t,after:r}=e;return(0,a.jsxs)("div",{className:"border border-border-default rounded-8",children:[(0,a.jsx)("div",{className:"bg-background-contrast rounded-t-8 py-8 px-16 border-b border-border-default",children:(0,a.jsx)(s.o,{variant:"callout",weight:"medium",children:"Hor\xe1rio alterado"})}),(0,a.jsxs)("div",{className:"p-16 flex gap-4",children:[(0,a.jsxs)(s.o,{variant:"callout",className:"line-through text-content-subdued",children:[(0,y.C)(t).formatDate()," \xe0s ",(0,y.C)(t).formatHour()]}),(0,a.jsx)(M.I,{name:"arrow-right",size:16,className:"svg-children:stroke-content-subdued"}),(0,a.jsxs)(s.o,{variant:"callout",children:[(0,y.C)(r).formatDate()," \xe0s ",(0,y.C)(r).formatHour()]})]})]})};async function $(e){let[,t]=e,{data:r}=await c.r.get("private/order/".concat(t,"/order-group"));return r}let A=e=>{var t;let{orderId:r,orderCode:i,orderGroupCode:n}=e,{data:o,isLoading:c}=((e,t)=>(0,u.Ay)(e?["getOrderGroup",e]:null,$,{...t,revalidateOnFocus:!1}))(n),m=null==o?void 0:o.orderList.find(e=>e.code===i),{data:v,isLoading:g}=(0,j.c)(i,{page:0,size:null!=(t=null==m?void 0:m.totalEmployees)?t:100},!!m),{data:x,isLoading:f}=((e,t,r)=>(0,u.Ay)(e?["getOrderHistory",e,t]:null,k,r||{}))(n,r),b=x?(e=>{let{wallets:t,dates:r}=e;return[...t.map((e,t)=>{var r;return{...e,initialIndex:t,editType:"wallet",items:(null==(r=e.orderMetadata)?void 0:r.items)||[]}}),...r.map((e,t)=>{var r;return{...e,initialIndex:t,creditDate:(null==(r=e.orderGroupMetadata)?void 0:r.scheduleDate)||"",editType:"date"}})].sort((e,t)=>
1w()(new Date(e.createdAt)).isBefore(new Date(t.createdAt))?1:-1)})(x):[],N=b.length-1,[V,C]=(0,p.useState)([N]),D=(0,p.useMemo)(()=>((null==v?void 0:v.employees)||[]).reduce((e,t)=>(e[t.employeeId]=t,e),{}),[v]);return c||g||f?(0,a.jsx)("div",{className:"flex justify-center items-center p-8 min-h-[300px]",children:(0,a.jsx)(l.F,{size:48})}):(0,a.jsx)("div",{className:"grid gap-8",children:b.map((e,t)=>{let r=(e=>{var t,r,a,l;let s=b[e];if(s&&x){if("wallet"===s.editType)return{items:(null==(r=x.wallets[s.initialIndex-1])||null==(t=r.orderMetadata)?void 0:t.items)||D};if("date"===s.editType)return{creditDate:(null==(l=x.dates[s.initialIndex-1])||null==(a=l.orderGroupMetadata)?void 0:a.scheduleDate)||(null==m?void 0:m.creditDate)||""}}})(t),l=t===N;return(0,a.jsxs)("div",{className:"border-b pb-16 border-b-border-default grid gap-8",children:[(0,a.jsxs)(s.o,{className:"flex gap-4 items-center justify-start pb-8 no-underline",variant:"headline",weight:"medium",component:"button",onClick:()=>(e=>{C(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])})(t),children:[(0,a.jsx)(h.g,{size:24,icon:V.includes(t)?"chevron-up":"chevron-right",className:"mr-8",colorSet:"contrast"}),l?"Pedido original":"Edi\xe7\xe3o ".concat(b.length-(t+1))]}),V.includes(t)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"bg-background-contrast rounded-8 px-16 py-8",children:[l&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,a.jsxs)("div",{className:"flex gap-16",children:[(0,a.jsx)(s.o,{variant:"callout",weight:"medium",children:"Data e hor\xe1rio de cria\xe7\xe3o:"}),(0,a.jsxs)(s.o,{variant:"callout",children:[(0,y.C)(null==o?void 0:o.creationDate).formatDate()," ","\xe0s"," ",(0,y.C)(null==o?void 0:o.creationDate).formatHour()]})]})}),(0,a.jsx)(d.c,{my:8})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2",children:[(0,a.jsxs)("div",{className:"flex gap-16",children:[(0,a.jsx)(s.o,{variant:"callout",weight:"medium",children:"Data e hor\xe1rio da edi\xe7\xe3o:"}),(0,a.jsxs)(s.o,{variant:"callout",children:[(0,y.C)(e.createdAt).formatDate()," \xe0s"," ",(0,y.C)(e.createdAt).formatHour()]})]}),e.editedBy&&(0,a.jsxs)("div",{className:"flex gap-16",children:[(0,a.jsx)(s.o,{variant:"callout",weight:"medium",children:"Editado por:"}),(0,a.jsx)(s.o,{variant:"callout",children:e.editedBy.toLocaleLowerCase()})]})]})]}),"wallet"===e.editType&&(null==r?void 0:r.items)&&(0,a.jsx)(E,{before:e.items,after:r.items}),"date"===e.editType&&(null==r?void 0:r.creditDate)&&(0,a.jsx)(_,{before:e.creditDate,after:r.creditDate})]})]},t)})})};var H=!0;let S=e=>{let{orderGroupCode:t,orderCode:r}=e,{data:c,isLoading:p}=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,u.Ay)(["getOrderItemDetails",e,t],m)}(r,!0);return p||!c?(0,a.jsx)(o.n,{gap:"medium",children:(0,a.jsxs)("div",{"data-testid":"edit-order-page-circular-loader",className:"flex flex-col items-center justify-center gap-8",children:[(0,a.jsx)(l.F,{size:48}),(0,a.jsx)(s.o,{variant:"body",children:"Carregando item..."})]})}):(0,a.jsxs)(o.n,{gap:"medium",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(i.B,{backButtonLabel:"Voltar para os pedidos",withBackButton:!0,children:[(0,a.jsx)(n.J,{href:"/orders",children:"Pedidos"}),(0,a.jsx)(n.J,{href:"/orders/".concat(t,"/edit"),children:"Detalhes do pedido"}),(0,a.jsx)(n.J,{href:"/orders/".concat(t,"/items/").concat(r,"/edit"),children:"Item"}),(0,a.jsx)(n.J,{children:"Hist\xf3rico de edi\xe7\xf5es"})]}),(0,a.jsx)(d.c,{mt:8})]}),(0,a.jsx)(f,{order:c}),(0,a.jsx)(A,{orderCode:c.code,orderId:c.id,orderGroupCode:t})]})}},24158:(e,t,r)=>{"use strict";function a(e){switch(e){case"Benef\xedcio":return"success";case"Pagamentos e premia\xe7\xf5es":return"primary";default:return"contrast"}}r.d(t,{E:()=>a})},32631:(e,t,r)=>{"use strict";r.d(t,{H:()=>s});var a=r(52495),l=r.n(a);let s=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce((e,t)=>l()(e).add(t).value,0)}},45229:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var a=r(37876),l=r(58175),s=r(53214),i=r(63152),n=r(185);let d=e=>{let{list:t,onRevert:r}=e,d=t.reduce((e,t)=>
1(0,i.x5)(t)?e:[...e,...Object.entries(t.wallets).map(e=>{let[r,a]=e;return{wallet:{code:r,...a},employee:{name:t.name,id:t.employeeId}}}).filter(e=>"number"==typeof e.wallet.newValue&&e.wallet.newValue!==e.wallet.oldValue)],[]);return d.length?(0,a.jsxs)("div",{className:"border border-border-default rounded-8",children:[(0,a.jsx)("div",{className:"bg-background-contrast rounded-t-8 py-8 px-16 border-b border-border-default",children:(0,a.jsx)(l.o,{variant:"callout",weight:"medium",children:"Valores alterados"})}),(0,a.jsx)("div",{className:"p-16 grid gap-8",children:d.map(e=>(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-8",children:[(0,a.jsx)(l.o,{variant:"callout",className:"self-center",children:e.employee.name}),(0,a.jsxs)("div",{className:"flex gap-6 items-center justify-end",children:[(0,a.jsx)(l.o,{variant:"callout",weight:"medium",children:e.wallet.name}),(0,a.jsxs)(l.o,{variant:"callout",className:"line-through text-content-subdued","data-testid":"old-value",children:[(0,n.v)({amount:e.wallet.oldValue}),(0,a.jsx)(s.I,{name:"arrow-right",size:14,className:"svg-children:stroke-content-subdued ml-6"})]}),(0,a.jsx)(l.o,{variant:"callout","data-testid":"new-value",children:(0,n.v)({amount:e.wallet.newValue||0})}),r&&(0,a.jsx)(l.o,{component:"button",variant:"callout",weight:"medium",className:"text-content-primary py-4",onClick:()=>r(e.employee.id,e.wallet.code),children:"Desfazer"})]})]},"".concat(e.employee.id,"-").concat(e.wallet.code)))})]}):null}},51894:(e,t,r)=>{"use strict";r.d(t,{c:()=>i});var a=r(18482),l=r(82961);async function s(e){let[,t,r]=e,{data:l}=await a.r.get("private/order/items/".concat(t,"/employees"),{params:r});return l}function i(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return(0,l.Ay)(r?["getOrderItemEmployees",e,t]:null,s)}},52495:function(e){e.exports=function(){function e(s,i){if(!(this instanceof e))return new e(s,i);var n=Math.pow(10,(i=Object.assign({},r,i)).precision);this.intValue=s=t(s,i),this.value=s/n,i.increment=i.increment||1/n,i.groups=i.useVedic?l:a,this.s=i,this.p=n}function t(t,r){var a=!(2<arguments.length)||void 0===arguments[2]||arguments[2],l=r.decimal,s=r.errorOnInvalid,i=r.fromCents,n=Math.pow(10,r.precision),d=t instanceof e;if(d&&i)return t.intValue;if("number"==typeof t||d)l=d?t.value:t;else if("string"==typeof t)s=RegExp("[^-\\d"+l+"]","g"),l=RegExp("\\"+l,"g"),l=(l=t.replace(/\((.*)\)/,"-$1").replace(s,"").replace(l,"."))||0;else{if(s)throw Error("Invalid Input");l=0}return i||(l=(l*n).toFixed(4)),a?Math.round(l):l}var r={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:function(e,t){var r=t.pattern,a=t.negativePattern,l=t.symbol,s=t.separator,i=t.decimal;t=t.groups;var n=(""+e).replace(/^-/,"").split("."),d=n[0];return n=n[1],(0<=e.value?r:a).replace("!",l).replace("#",d.replace(t,"$1"+s)+(n?i+n:""))},fromCents:!1},a=/(\d)(?=(\d{3})+\b)/g,l=/(\d)(?=(\d\d)+\d\b)/g;return e.prototype={add:function(r){var a=this.s,l=this.p;return e((this.intValue+t(r,a))/(a.fromCents?1:l),a)},subtract:function(r){var a=this.s,l=this.p;return e((this.intValue-t(r,a))/(a.fromCents?1:l),a)},multiply:function(t){var r=this.s;return e(this.intValue*t/(r.fromCents?1:Math.pow(10,r.precision)),r)},divide:function(r){var a=this.s;return e(this.intValue/t(r,a,!1),a)},distribute:function(t){var r=this.intValue,a=this.p,l=this.s,s=[],i=Math[0<=r?"floor":"ceil"](r/t),n=Math.abs(r-i*t);for(a=l.fromCents?1:a;0!==t;t--){var d=e(i/a,l);0<n--&&(d=d[0<=r?"add":"subtract"](1/a)),s.push(d)}return s},dollars:function(){return~~this.value},cents:function(){return~~(this.intValue%this.p)},format:function(e){var t=this.s;return"function"==typeof e?e(this,t):t.format(this,Object.assign({},t,e))},toString:function(){var e=this.s,t=e.increment;return(Math.round(this.intValue/this.p/t)*t).toFixed(e.precision)},toJSON:function(){return this.value}},e}()},53242:(e,t,r)=>{"use strict";r.d(t,{n:()=>i});var a=r(37876),l=r(3144);let s={small:"gap-24",medium:"gap-32",large:"gap-40"},i=e=>{let{gap:t="small",className:r,children:i}=e;return(0,a.jsx)("section",{className:(0,l.cn)("flex flex-1 flex-col justify-between p-16 rounded-16 bg-background-default md:p-32",s[t],r),children:i})}},63152:(e,t,r)=>{"use strict";r.d(t,{O9:()=>m,U5:()=>u,Y2:()=>d,lQ:()=>c,x5:()=>o});var a=r(52495),l=r.n(a),s=r(32631),i=r(34957);let n=e=>({...e,wallets:Object.fromEntries(e.wallets.map(e=>[e.code,{...e,oldValue:e.value,newValue:void 0}]))}),d=(0,i.vt)(e=>({employees:{},resetEmployees:()=>e({employees:{}}),updateWalletValue:t=>{let{employee:r,walletCode:a,newValue:l}=t;return e(e=>{var t;let s=null!=(t=e.employees[r.employeeId])?t:n(r);return s.wallets[a]={...s.wallets[a],newValue:l},{...e,employees:{...e.employees,[r.employeeId]:s}}})},revertWalletValue:(t,r)=>e(e=>{if(!e.employees[t])return e;let a=e.employees[t];return a.wallets[r]={...a.wallets[r],newValue:void 0},{...e,employees:{...e.employees,[t]:a}}}),removeEmployee:t=>e(e=>({...e,employees:{...e.employees,[t.employeeId]:{...n(t),remove:!0}}})),revertRemoveEmployee:t=>e(e=>{if(!e.employees[t])return e;let r=e.employees[t];
1return r.remove=!1,Object.keys(r.wallets).forEach(e=>{r.wallets[e]={...r.wallets[e],newValue:void 0}}),{...e,employees:{...e.employees,[t]:r}}})})),o=e=>{if(e.remove)return!0;let t=Object.values(e.wallets);return t.some(e=>"number"==typeof e.newValue&&e.newValue!==e.oldValue)&&t.every(e=>{var t;return(null!=(t=e.newValue)?t:e.oldValue)===0})},c=(e,t)=>t-e.filter(o).length<=1,u=e=>Object.values(e).reduce((e,t)=>{let r=Object.values(t.wallets).reduce((e,r)=>{if(t.remove)return(0,s.H)(e,r.oldValue);if("number"==typeof r.newValue){let t=l()(r.oldValue).subtract(r.newValue).value;return(0,s.H)(e,t)}return e},0);return(0,s.H)(e,r)},0),m=()=>d(e=>u(e.employees))},70673:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(37876),l=r(58175),s=r(185),i=r(32631);let n=e=>{let{list:t,onRevert:r}=e;return t.length?(0,a.jsxs)("div",{className:"border border-border-default rounded-8",children:[(0,a.jsx)("div",{className:"bg-background-critical rounded-t-8 py-8 px-16 border-b border-border-default",children:(0,a.jsx)(l.o,{variant:"callout",weight:"medium",children:"Colaboradores removidos"})}),(0,a.jsx)("div",{className:"p-16 grid gap-8",children:t.map(e=>(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-8",children:[(0,a.jsx)(l.o,{variant:"callout",className:"self-center","data-testid":"employee-removed",children:e.name}),(0,a.jsxs)("div",{className:"flex gap-6 items-center justify-end",children:[(0,a.jsx)(l.o,{variant:"callout",children:(0,s.v)({amount:Object.values(e.wallets).reduce((e,t)=>(0,i.H)(e,t.oldValue),0)})}),r&&(0,a.jsx)(l.o,{component:"button",variant:"callout",weight:"medium",className:"text-content-primary py-4",onClick:()=>r(e.employeeId),children:"Desfazer"})]})]},"".concat(e.employeeId)))})]}):null}},81362:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/orders/[orderGroupCode]/items/[orderCode]/history",function(){return r(11455)}])},88699:(e,t,r)=>{"use strict";function a(e){if(e){let t=e.replace(/\D/g,"");return 11===t.length?/^(\d{3})\.(\d{3})\.(\d{3})-(\d{2})$/.test(e)?e:String(t=t.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/,"$1.$2.$3-$4")):14!==t.length?String(e):/^(\d{2})\.(\d{3})\.(\d{3})\/(\d{4})-(\d{2})$/.test(e)?e:String(t=t.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/,"$1.$2.$3/$4-$5"))}return""}r.d(t,{T:()=>a})}},e=>{e.O(0,[5728,636,6593,8792],()=>e(e.s=81362)),_N_E=e.O()}]);
2//# sourceMappingURL=history-d214230d49100d5f.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.