PageSourceSearch

https://netconv.com/packs/js/9228-a9144829c54fc473e9b2.js

js netconv.com collected 2026-10-04 02:48:22 UTC 25,818 bytes, 3 lines download raw bytes

1/*! For license information please see 9228-a9144829c54fc473e9b2.js.LICENSE.txt */
2"use strict";(self.webpackChunknetconv=self.webpackChunknetconv||[]).push([[5321,9228,19592,22011,40620,65689],{59683:function(e,t,n){n.d(t,{a:function(){return r}});var r=(0,n(96540).createContext)()},33546:function(e,t,n){n.d(t,{A:function(){return o}});var r=n(96540),a=["as","className","children"];var l=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")};function o(e){var t=e.as,n=void 0===t?"section":t,o=e.className,c=e.children,i=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,a);return r.createElement(n,Object.assign({className:l("panel-page",o)},i),c)}},45882:function(e,t,n){function r(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,{h:function(){return s}});var l=Object.freeze(["ai_chat_seen_favorite_ids","netconv:panel:franchise-switch","ril_action_modes","ril_sidebar_collapsed","ril_theme"]),o=Object.freeze(["netconv:panel-theme:v1:","ril_search_history:v2:"]),c=Object.freeze(["netconv:panel:support-view","ril_uix_session_id","sensitive_token_expires_at_v1","sensitive_token_v1"]),i=Object.freeze(["netconv:panel-workspace:v1:"]);function u(e,t,n){if(!e||"function"!==typeof e.removeItem)return[];var a=r(new Set([].concat(r(t),r(function(e,t){if(!e||"function"!==typeof e.key)return[];for(var n=[],r=Number(e.length||0),a=function(){var r=e.key(l);r&&t.some(function(e){return r.startsWith(e)})&&n.push(r)},l=0;l<r;l+=1)a();return n}(e,n)))));return a.forEach(function(t){return e.removeItem(t)}),a}function s(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).storage,t=void 0===e?"undefined"===typeof window?null:window:e;if(!t)return{local:[],session:[]};try{return{local:u(t.localStorage,l,o),session:u(t.sessionStorage,c,i)}}catch(n){return{local:[],session:[]}}}},74462:function(e,t,n){n.d(t,{v:function(){return a},x:function(){return r}});var r="MESSAGE_ALERT",a="MESSAGE_NOTICE"},27113:function(e,t,n){n.d(t,{JX:function(){return i},K:function(){return d},K5:function(){return a},Lo:function(){return l},Lt:function(){return m},Vq:function(){return o},YK:function(){return v},aC:function(){return s},aP:function(){return y},ab:function(){return c},i3:function(){return u},nM:function(){return f},r3:function(){return _},sX:function(){return p},so:function(){return E},vT:function(){return b},xs:function(){return r}});var r="FETCH_SUPPLY_LINKS",a="CREATE_SUPPLY_LINK",l="UPDATE_SUPPLY_LINK",o="DELETE_SUPPLY_LINK",c="FETCH_EXTERNAL_DEMAND_PROFILES",i="CREATE_EXTERNAL_DEMAND_PROFILE",u="UPDATE_EXTERNAL_DEMAND_PROFILE",s="DELETE_EXTERNAL_DEMAND_PROFILE",d="FETCH_EXTERNAL_STOCK_SNAPSHOTS",f="FETCH_SUPPLY_REPLENISHMENTS",m="FETCH_SMART_REPLENISHMENTS",p="FETCH_SUPPLY_TRANSFERS",E="FETCH_SUPPLIER_RANKINGS",y="FETCH_LOT_ANALYSES",_="FETCH_SUPPLY_ORDERS",v="CREATE_SUPPLY_ORDER",b="UPDATE_SUPPLY_ORDER"},92369:function(e,t,n){n.d(t,{Wm:function(){return y},dF:function(){return E},tH:function(){return p},vd:function(){return m}});var r=n(84166),a=n(45882),l=n(74462),o=n(27113);function c(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function l(n,r,a,l){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return i(s,"_invoke",function(n,r,a){var l,c,i,u=0,s=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return l=t,c=0,i=e,f.n=n,o}};function m(n,r){for(c=n,i=r,t=0;!d&&u&&!a&&t<s.length;t++){var a,l=s[t],m=f.p,p=l[2];n>3?(a=p===r)&&(i=l[(c=l[4])?5:(c=3,3)],l[4]=l[5]=e):l[0]<=m&&((a=n<2&&m<l[1])?(c=0,f.v=r,f.n=l[1]):m<p&&(a=n<3||l[0]>r||r>p)&&(l[4]=n,l[5]=r,f.n=p,c=0))}if(a||n>1)return o;throw d=!0,r}return function(a,s,p){if(u>1)throw TypeError("Generator is already running");for(d&&1===s&&m(s,p),c=s,i=p;(t=c<2?e:i)||!d;){l||(c?c<3?(c>1&&(f.n=-1),m(c,i)):f.n=i:f.v=i);try{if(u=2,l){if(c||(a="next"),t=l[a]){if(!(t=t.call(l,i)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;i=t.value,c<2&&(c=0)}else 1===c&&(t=l.return)&&t.call(l),c<2&&(i=TypeError("The iterator does not provide a '"+a+"' method"),c=1);l=e}else if((t=(d=f.n<0)?i:n.call(r,f))!==o)break}catch(t){l=e,c=1,i=t}finally{u=1}}return{value:t,done:d}}}(n,a,l),!0),s}var o={};function u(){}function s(){}function d(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),m=d.prototype=u.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=d,i(m,"constructor",d),i(d,"constructor",s),s.displayName="GeneratorFunction",i(d,a,"GeneratorFunction"),i(m),i(m,a,"Generator"),i(m,r,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),(c=function(){return{w:l,m:p}})()}function i(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}i=function(e,t,n,r){function l(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(l("next",0),l("throw",1),l("return",2))},i(e,t,n,r)}function u(e,t,n,r,a,l,o){try{var c=e[l](o),i=c.value}catch(e){return void n(e)}c.done?t(i):Promise.resolve(i).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var l=e.apply(t,n);function o(e){u(l,r,a,o,c,"next",e)}function c(e){u(l,r,a,o,c,"throw",e)}o(void 0)})}}var d="",f=function(e,t){var n,o,c=null===t||void 0===t||null===(n=t.response)||void 0===n?void 0:n.status;if(401!==c){var i=(null===t||void 0===t||null===(o=t.response)||void 0===o?void 0:o.data)||{message:(null===t||void 0===t?void 0:t.message)||"Unexpected request error"};e(500===c?{type:l.x,payload:i}:{type:l.v,payload:i})}else{(0,a.h)();try{delete r.A.defaults.headers.common.Authorization}catch(u){}window.location.assign("/admin")}},m=function(){var e=s(c().m(function e(t){var n,a;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,r.A.get("".concat(d,"/panel/v1/external_demand_profiles"));case 1:n=e.v,t({type:o.ab,payload:n.data}),e.n=3;break;case 2:e.p=2,a=e.v,console.error("fetchExternalDemandProfiles >>",a),f(t,a);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),p=function(){var e=s(c().m(function e(t){var n,a;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,r.A.get("".concat(d,"/panel/v1/external_stock_snapshots"));case 1:n=e.v,t({type:o.K,payload:n.data}),e.n=3;break;case 2:e.p=2,a=e.v,console.error("fetchExternalStockSnapshots >>",a),f(t,a);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),E=function(){var e=s(c().m(function e(t){var n,a;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,r.A.get("".concat(d,"/panel/v1/supply_replenishments/smart"));case 1:n=e.v,t({type:o.Lt,payload:n.data}),e.n=3;break;case 2:e.p=2,a=e.v,console.error("fetchSmartReplenishments >>",a),f(t,a);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=s(c().m(function e(t){var n,a;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,r.A.get("".concat(d,"/panel/v1/supply_transfers"));case 1:n=e.v,t({type:o.sX,payload:n.data}),e.n=3;break;case 2:e.p=2,a=e.v,console.error("fetchSupplyTransfers >>",a),f(t,a);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}()},9228:function(e,t,n){n.r(t),n.d(t,{default:function(){return R}});var r=n(96540),a=n(33546),l=n(59683),o=n(47767),c=n(92369),i=n(65567),u=n(48848),s=n(20963),d=n(9333);function f(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||v(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function l(n,r,a,l){var i=r&&r.prototype instanceof c?r:c,u=Object.create(i.prototype);return p(u,"_invoke",function(n,r,a){var l,c,i,u=0,s=a||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return l=t,c=0,i=e,f.n=n,o}};function m(n,r){for(c=n,i=r,t=0;!d&&u&&!a&&t<s.length;t++){var a,l=s[t],m=f.p,p=l[2];n>3?(a=p===r)&&(i=l[(c=l[4])?5:(c=3,3)],l[4]=l[5]=e):l[0]<=m&&((a=n<2&&m<l[1])?(c=0,f.v=r,f.n=l[1]):m<p&&(a=n<3||l[0]>r||r>p)&&(l[4]=n,l[5]=r,f.n=p,c=0))}if(a||n>1)return o;throw d=!0,r}return function(a,s,p){if(u>1)throw TypeError("Generator is already running");for(d&&1===s&&m(s,p),c=s,i=p;(t=c<2?e:i)||!d;){l||(c?c<3?(c>1&&(f.n=-1),m(c,i)):f.n=i:f.v=i);try{if(u=2,l){if(c||(a="next"),t=l[a]){if(!(t=t.call(l,i)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;i=t.value,c<2&&(c=0)}else 1===c&&(t=l.return)&&t.call(l),c<2&&(i=TypeError("The iterator does not provide a '"+a+"' method"),c=1);l=e}else if((t=(d=f.n<0)?i:n.call(r,f))!==o)break}catch(t){l=e,c=1,i=t}finally{u=1}}return{value:t,done:d}}}(n,a,l),!0),u}var o={};function c(){}function i(){}function u(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),d=u.prototype=c.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,p(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return i.prototype=u,p(d,"constructor",u),p(u,"constructor",i),i.displayName="GeneratorFunction",p(u,a,"GeneratorFunction"),p(d),p(d,a,"Generator"),p(d,r,function(){return this}),p(d,"toString",function(){return"[object Generator]"}),(m=function(){return{w:l,m:f}})()}function p(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}p=function(e,t,n,r){function l(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(l("next",0),l("throw",1),l("return",2))},p(e,t,n,r)}function E(e,t,n,r,a,l,o){try{var c=e[l](o),i=c.value}catch(e){return void n(e)}c.done?t(i):Promise.resolve(i).then(r,a)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var l=e.apply(t,n);function o(e){E(l,r,a,o,c,"next",e)}function c(e){E(l,r,a,o,c,"throw",e)}o(void 0)})}}function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,l,o,c=[],i=!0,u=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;i=!1}else for(;!(i=(r=l.call(n)).done)&&(c.push(r.value),c.length!==t);i=!0);}catch(e){u=!0,a=e}finally{try{if(!i&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw a}}return c}}(e,t)||v(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var h={CRITICAL:"#dc3545",HIGH:"#fd7e14",MEDIUM:"#0dcaf0",LOW:"#0d6efd",NONE:"#6c757d"},g={DEFICIT:"#dc3545",SURPLUS:"#198754",BALANCED:"#6c757d"};function S(e){var t=e.label,n=e.active,a=e.onClick;return r.createElement("button",{type:"button",onClick:a,"aria-current":n?"page":void 0,className:n?"is-active":""},t)}function N(e){var t=e.level;return r.createElement("span",{style:{background:h[t]||"#6c757d",color:"#fff",borderRadius:4,padding:"2px 8px",fontSize:11,fontWeight:700}},t)}function x(e){var t=e.status;return r.createElement("span",{style:{background:g[t]||"#6c757d",color:"#fff",borderRadius:4,padding:"2px 8px",fontSize:11,fontWeight:700}},t)}function A(e){var t=e.state,n=e.dispatch,a=(t.supply_brain||{}).external_demand_profiles;return(0,r.useEffect)(function(){(0,c.vd)(n)},[]),r.createElement("div",null,r.createElement("h5",null,"Perfis de Demanda Externa"),a&&0!==a.length?r.createElement("table",{className:"table table-sm table-striped"},r.createElement("thead",null,r.createElement("tr",null,r.createElement("th",
2null,"Produto"),r.createElement("th",null,"Consumo m\xe9dio/dia"),r.createElement("th",null,"M\xedn. dias"),r.createElement("th",null,"M\xe1x. dias"),r.createElement("th",null,"Tipo"))),r.createElement("tbody",null,a.map(function(e){return r.createElement("tr",{key:e.id},r.createElement("td",null,e.product_name||e.product_id),r.createElement("td",null,Number(e.avg_daily_demand).toFixed(2)),r.createElement("td",null,e.min_stock_days),r.createElement("td",null,e.max_stock_days),r.createElement("td",null,r.createElement("span",{className:"badge badge-info"},e.demand_type)))}))):r.createElement("p",{className:"text-muted"},"Nenhum perfil de demanda cadastrado."))}function k(e){var t=e.state,n=e.dispatch,a=(t.supply_brain||{}).external_stock_snapshots;return(0,r.useEffect)(function(){(0,c.tH)(n)},[]),r.createElement("div",null,r.createElement("h5",null,"Snapshots de Estoque"),a&&0!==a.length?r.createElement("table",{className:"table table-sm table-striped"},r.createElement("thead",null,r.createElement("tr",null,r.createElement("th",
2null,"Produto"),r.createElement("th",null,"Estoque estimado"),r.createElement("th",null,"Consumo/dia"),r.createElement("th",null,"Data"),r.createElement("th",null,"Fonte"))),r.createElement("tbody",null,a.map(function(e){return r.createElement("tr",{key:e.id},r.createElement("td",null,e.product_name||e.product_id),r.createElement("td",null,Number(e.estimated_stock).toFixed(2)),r.createElement("td",null,Number(e.avg_daily_consumption).toFixed(2)),r.createElement("td",null,e.snapshot_date),r.createElement("td",null,r.createElement("span",{className:"badge badge-secondary"},e.source)))}))):r.createElement("p",{className:"text-muted"},"Nenhum snapshot dispon\xedvel."))}var w={CRITICAL:0,HIGH:1,MEDIUM:2,LOW:3,NONE:4};function P(e){return e.risk?r.createElement("span",{style:{background:"#dc3545",color:"#fff",borderRadius:4,padding:"2px 6px",fontSize:10,fontWeight:700}},"\u26a0 Desperd."):r.createElement("span",{style:{background:"#198754",color:"#fff",borderRadius:4,padding:"2px 6px",fontSize:10,fontWeight:700}},"OK")}function T(e){var t=e.state,n=e.dispatch,a=e.onCreateRequest,l=(t.supply_brain||{}).smart_replenishments,o=_((0,r.useState)(!1),2),i=o[0],u=o[1],s=function(){var e=y(m().m(function e(){return m().w(function(e){for(;;)switch(e.n){case 0:return u(!0),e.n=1,(0,c.dF)(n);case 1:u(!1);case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();(0,r.useEffect)(function(){s()},[]);var d=f(l||[]).sort(function(e,t){var n,r;return(null!==(n=w[e.urgency_level])&&void 0!==n?n:9)-(null!==(r=w[t.urgency_level])&&void 0!==r?r:9)});return r.createElement("div",null,r.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12}},r.createElement("h5",{style:{margin:0}},"Motor de Reposi\xe7\xe3o \u2014 Painel de Decis\xe3o"),r.createElement("button",{className:"btn btn-sm btn-outline-secondary",onClick:s,disabled:i},i?"...":"\u21ba Recalcular")),d&&0!==d.length?r.createElement("div",{style:{overflowX:"auto"}},r.createElement("table",{className:"table table-sm",style:{fontSize:12}},r.createElement("thead",{style:{background:"#f8f9fa"}}
2,r.createElement("tr",null,r.createElement("th",null,"Produto"),r.createElement("th",null,"Urg\xeancia"),r.createElement("th",{style:{textAlign:"right"}},"Estoque"),r.createElement("th",{style:{textAlign:"right"}},"Cons/dia"),r.createElement("th",{style:{textAlign:"right"}},"Dias rest."),r.createElement("th",{style:{textAlign:"right"}},"Previs\xe3o\xb9"),r.createElement("th",{style:{textAlign:"right"}},"Qtd sugerida"),r.createElement("th",null,"Fornecedor sugerido"),r.createElement("th",null,"Lote / Risco"),r.createElement("th",null))),r.createElement("tbody",null,d.map(function(e){var t="CRITICAL"===e.urgency_level?"#fff5f5":"HIGH"===e.urgency_level?"#fff8f0":void 0;return r.createElement("tr",{key:e.product_id,style:{background:t}},r.createElement("td",{style:{fontWeight:600,maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},e.product_name),r.createElement("td",null,r.createElement(N,{level:e.urgency_level})),r.createElement("td",{style:{textAlign:"right"}},e.estimated_stock.toFixed(1)),r.createElement("td",{style:{textAlign:"right"}},e.avg_daily_consumption.toFixed(2)),r.createElement("td",{style:{textAlign:"right",fontWeight:Number(e.days_left)<=0?700:400,color:Number(e.days_left)<=0?"#dc3545":void 0}},Number(e.days_left)<=0?"ESGOTADO":e.days_left.toFixed(1)),r.createElement("td",{style:{textAlign:"right",color:"#198754"}},null!=e.forecast_days_after_delivery?"".concat(e.forecast_days_after_delivery,"d"):"\u2014"),r.createElement("td",{style:{textAlign:"right",fontWeight:700}},e.suggested_quantity.toFixed(2)),r.createElement("td",{style:{maxWidth:160}},e.best_supplier?r.createElement("span",{title:"Score: ".concat(e.best_supplier.composite_score," \xb7 Lead: ").concat(e.best_supplier.lead_time_days,"d")},r.createElement("strong",null,e.best_supplier.supplier_name),r.createElement("span",{style:{color:"#6c757d",marginLeft:4}},"(",e.best_supplier.lead_time_days,"d)")):r.createElement("span",{className:"text-muted"},"\u2014")),r.createElement("td",null,e.best_lot?r.createElement("span",{title:"Vence: ".concat(e.best_lot.expires_at," \xb7 ").concat(e.best_lot.days_until_expiry,"d")},r.createElement(P,{risk:e.best_lot.waste_risk}),r.createElement("span",{style:{color:"#6c757d",marginLeft:4,fontSize:11}},e.best_lot.days_until_expiry,"d")):r.createElement("span",{className:"text-muted"},"\u2014")),r.createElement("td",null,r.createElement("button",{className:"btn btn-xs btn-primary",onClick:function(){return function(e){var t;a&&a({product_id:e.product_id,product_name:e.product_name,suggested_quantity:e.suggested_quantity,supply_link_id:(null===(t=e.best_supplier)||void 0===t?void 0:t.supply_link_id)||""})}(e)},title:"Usar esta evid\xeancia para preparar uma solicita\xe7\xe3o manual"},"Preparar solicita\xe7\xe3o")))}))),r.createElement("p",{style:{fontSize:11,color:"#6c757d",marginTop:4}},"\xb9 Previs\xe3o de dias de estoque ap\xf3s entrega do pedido sugerido.")):r.createElement("p",{className:"text-muted"},i?"Carregando...":"Configure perfis de demanda e snapshots de estoque para ver sugest\xf5es."))}function O(e){var t=e.state,n=e.dispatch,a=t.supply_brain||{},l=a.unit_statuses||[],o=a.suggestions||[],i=_((0,r.useState)(!1),2),u=i[0],s=i[1],d=function(){var e=y(m().m(function e(){return m().w(function(e){for(;;)switch(e.n){case 0:return s(!0),e.n=1,(0,c.Wm)(n);case 1:s(!1);case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return(0,r.useEffect)(function(){d()},[]),r.createElement("div",null,r.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:12}},r.createElement("h5",{style:{margin:0}},"Transfer\xeancias entre Unidades"),r.createElement("button",{className:"btn btn-sm btn-outline-secondary",onClick:d,disabled:u},u?"...":"\u21ba Recalcular")),l.length>0&&r.createElement(r.Fragment,null,r.createElement("h6",{className:"text-muted"},"Status das Unidades"),r.createElement("table",{className:"table table-sm table-bordered mb-4"},r.createElement("thead",null,r.createElement("tr",null,r.createElement("th",
2null,"Unidade"),r.createElement("th",null,"Tipo"),r.createElement("th",null,"Estoque"),r.createElement("th",null,"Consumo/dia"),r.createElement("th",null,"Dias restantes"),r.createElement("th",null,"Status"))),r.createElement("tbody",null,l.map(function(e,t){return r.createElement("tr",{key:t},r.createElement("td",null,e.franchise_name),r.createElement("td",null,r.createElement("span",{className:"badge badge-info"},e.franchise_type)),r.createElement("td",null,Number(e.estimated_stock).toFixed(2)),r.createElement("td",null,Number(e.avg_daily_consumption).toFixed(2)),r.createElement("td",null,Number(e.days_left).toFixed(1)),r.createElement("td",null,r.createElement(x,{status:e.status})))})))),o.length>0?r.createElement(r.Fragment,null,r.createElement("h6",{className:"text-muted"},"Transfer\xeancias Sugeridas"),r.createElement("table",{className:"table table-sm table-striped"},r.createElement("thead",null,r.createElement("tr",null,r.createElement("th",null,"Produto"),r.createElement("th",null,"De"),r.createElement("th",null,"Para"),r.createElement("th",
2null,"Qtd."),r.createElement("th",null,"Dias antes (de/para)"),r.createElement("th",null,"Dias depois (de/para)"),r.createElement("th",{title:"Dispon\xedvel na FASE 7"},"A\xe7\xe3o"))),r.createElement("tbody",null,o.map(function(e,t){return r.createElement("tr",{key:t},r.createElement("td",null,e.product_name),r.createElement("td",null,e.from_franchise_name),r.createElement("td",null,e.to_franchise_name),r.createElement("td",null,r.createElement("strong",null,Number(e.transfer_quantity).toFixed(2))),r.createElement("td",null,Number(e.from_days_left_before).toFixed(1)," / ",Number(e.to_days_left_before).toFixed(1)),r.createElement("td",null,Number(e.from_days_left_after).toFixed(1)," / ",Number(e.to_days_left_after).toFixed(1)),r.createElement("td",null,r.createElement("button",{className:"btn btn-xs btn-success",disabled:!0,title:"Dispon\xedvel na FASE 7"},"Confirmar")))})))):r.createElement("p",{className:"text-muted"},"Nenhuma transfer\xeancia sugerida no momento."))}function R(){var e,t,n,c,f,m=(0,r.useContext)(l.a),p=m.state,E=m.dispatch,y=(0,o.LG)(),v=(y||{}).business||(null===(e=p.businesses)||void 0===e?void 0:e.business)||{},b=(null===v||void 0===v?void 0:v.franchise_type)||"",h="distributor"===b,g=(null===y||void 0===y||null===(t=y.current_permission)||void 0===t?void 0:t.capabilities)||{},N=d.a.includes(b)&&(0,s.p0)(g,s.$8.SUPPLY_INTELLIGENCE_READ),x=N&&(0,s.p0)(g,s.$8.REPLENISHMENT_MANAGE),w=null===y||void 0===y||null===(n=y.current_permission)||void 0===n||null===(n=n.operational_features)||void 0===n?void 0:n.rde_sbc_supply_connect_v1,P=!0===w||!0===(null===w||void 0===w?void 0:w.enabled),R=null===y||void 0===y||null===(c=y.current_permission)||void 0===c||null===(c=c.operational_features)||void 0===c?void 0:c.rde_sbc_supply_commerce_v1,L=!0===R||!0===(null===R||void 0===R?void 0:R.enabled),C=[s.$8.SUPPLY_REQUESTS_READ,s.$8.SUPPLY_OFFERS_READ,s.$8.SUPPLY_ORDERS_READ,s.$8.SUPPLY_RECEIPTS_MANAGE].some(function(e){return(0,s.p0)(g,e)}),F=_((0,r.useState)(null),2),I=F[0],D=F[1],j=[{key:"supply_links",label:"Rede privada",show:!0},{key:"commerce",label:"Com\xe9rcio B2B",show:C},{key:"demand_profiles",label:"Perfis de Demanda",show:x&&!h},{key:"stock_snapshots",label:"Snapshots",show:N},{key:"replenishment",label:"Reposi\xe7\xe3o",show:N&&!h},{key:"transfers",label:"Transfer\xeancias",show:N&&h}].filter(function(e){return e.show}),U=_((0,r.useState)((null===(f=j[0])||void 0===f?void 0:f.key)||"supply_links"),2),M=U[0],G=U[1],H=function(e){D({supply_link_id:e.supply_link_id,notes:"Evid\xeancia operacional: ".concat(e.product_name),lines:[{consumer_product_id:e.product_id,requested_units:Math.max(1,Math.ceil(Number(e.suggested_quantity)||1))}]}),G("commerce")};return r.createElement(a.A,{className:"sbc-workspace","aria-labelledby":"sbc-workspace-title"},r.createElement("header",{className:"sbc-workspace__header"},r.createElement("div",null,r.createElement("span",{className:"ds-kicker"},"Intelig\xeancia \xb7 abastecimento"),r.createElement("h1",{id:"sbc-workspace-title",className:"ds-display"},"Supply Brain Connect"),r.createElement("p",null,"Rede privada, consentimento e identidades de produtos entre empresas."))),r.createElement("nav",{className:"sbc-workspace__tabs","aria-label":"\xc1reas do Supply Brain"},j.map(function(e){return r.createElement(S,{key:e.key,label:e.label,active:M===e.key,onClick:function(){return G(e.key)}})})),r.createElement("section",{className:["supply_links","commerce"].includes(M)?"sbc-workspace__connect":"sbc-workspace__legacy"},function(){switch(M){case"supply_links":return r.createElement(u.A,{enabled:P});case"commerce":return r.createElement(i.A,{enabled:L,prefill:I});case"demand_profiles":return r.createElement(A,{state:p,dispatch:E});case"stock_snapshots":return r.createElement(k,{state:p,dispatch:E});case"replenishment":return r.createElement(T,{state:p,dispatch:E,onCreateRequest:H});case"transfers":return r.createElement(O,{state:p,dispatch:E});default:return null}}()))}}}]);
3//# sourceMappingURL=9228-a9144829c54fc473e9b2.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.