PageSourceSearch

https://www.penskeenergy.com/r/dashboard/static/assets/index-BoA0UInR.js

js penskeenergy.com collected 2026-10-08 09:56:43 UTC 5,100 bytes, 1 lines download raw bytes

1import{j as o,d8 as C,bD as O,cL as P,bW as v,as as x,bN as F}from"./index-DFvmoh3l.js";import{c as L,R as E,r as D,f as w}from"./vendor-CRt72Tw2.js";import{E as G}from"./Edit-DzSipBja.js";import{D as I}from"./Delete-DonRL-x8.js";import{a as N}from"./index-CXH7Ksdf.js";import{d as k,u as M,a as $,b as B,f as V}from"./actions-B0Po0SZL.js";import{L as Y}from"./index-DC027i2A.js";import{E as _}from"./ErrorDialog-D5sK6SPQ.js";import{R as q}from"./RemoveDialog-D0Gz6yge.js";import{F as z}from"./index-C_7XuIqw.js";import"./ArrowDropDown-DQn-abNA.js";import"./FormGroup--ncm3W3X.js";import"./index-DXKdv01A.js";import"./index.esm-B_Yt8iIe.js";import"./DateTimePicker-BjFyd-6u.js";import"./Tabs-DTFQyeoq.js";import"./Switch-U65K0JF6.js";import"./Card-pwnN_m2G.js";import"./CardHeader-CfRFQ4y9.js";import"./AlertDialog-DshwutBD.js";const u={cannotEditDefaultRegion:"You can only define if Region is default or not upon creating a new Region, if you want this Region to be default, we suggest you to delete it and create a new one",cannotAddDefaultRegionOnAdd:"A default Region already exists, in order to create a new default Region, please delete the existing one.",canAddDefaultRegionOnAdd:"You can only define if this Region is default or not now, you won't be able to change it later",addTitleBeforeLanguages:"Please add a title to your Region before choosing Languages",defineDefaultLanguageNow:"Please define your default Language now, as you won't be able to do so when editing it",cannotAddDefaultLanguage:"You can only define if a Language is default or not upon creating a new Region, if you want to change the current status of default language, we suggest you to delete the Region and create a new one"};function U({regions:e,editableRegion:n,roarId:i,addRegion:l,updateRegion:g,closeEdit:f,denyAddRegion:c}){const[d,r]=E.useState(n.languageList||[]),[p,R]=E.useState(n?.languageList?.find(t=>t.default)?.code||""),m=e.find(t=>t.default),s=!!n.id,T=t=>{const a=K(t.target.value,d);if(a.add){const y={code:a.language,default:null};r([...d,y])}else r(y=>y.filter(S=>S.code!=a.language))},j=t=>{const a=J(t,i,s);s?g(a,n,d):A(e,a)?c("Region exists, please create a Region with a different title"):l(a,d,p)},h={fontSize:"12px",padding:"5px"};return o.jsx(N,{component:C,title:s?"Edit Region":"Add Region",onClose:()=>{f()},initialData:n,onSave:j,open:!0,fields:[{name:"title",type:"text",label:"Title",required:!0,validator:t=>!A(e,{id:n.id,title:t}),helperText:"Region exists, please create a Region with a different title"},{name:"mirrored",type:"switchField",label:"Mirrored",onValueGet:t=>t.mirrored??!1},{name:"default",type:"switchField",label:"Default",tooltip:s?u.cannotEditDefaultRegion:m?u.cannotAddDefaultRegionOnAdd:u.canAddDefaultRegionOnAdd,tooltipStyle:h,readonly:s?!0:!!m,onValueGet:t=>t.default??!1},{widget:t=>o.jsx(Y,{onChange:a=>T(a),shrink:!!s,label:"Languages",multiple:!0,name:"language",tooltip:s||t.title?null:u.addTitleBeforeLanguages,tooltipStyle:h,readonly:!t.title,value:d.map(a=>a.code)})},{label:"Select default language",name:"default_language",type:"select",items:d.map(t=>({name:O.find(a=>a.title==t.code)?.names[0]||null,value:t.code||null})),tooltip:s?u.cannotAddDefaultLanguage:u.defineDefaultLanguageNow,tooltipStyle:h,onValueSet:(t,a)=>{R(a),t.default_language=a},onValueGet:()=>p,readonly:!!s}]},"region")}const W=e=>({regions:e.regions.regions,roarId:e.config.roar_site?.id}),H={addRegion:$,updateRegion:M,denyAddRegion:k},b=L(W,H)(U),J=(e,n,i)=>{const l={title:e.title,mirrored:e.mirrored||!1};return i||(l.default=e.default||!1,l.siteId=n,l.slug=P(e.title)),l},K=(e,n)=>{let i={};return e.length>n.length?(i.add=!0,i.language=e[e.length-1]):(i.add=!1,i.language=n.map(l=>l.code).filter((l=>g=>g!==e[l]||!++l)(0))[0]),i},A=(e,n)=>e.some(i=>i.id!==n.id&&i.title===n.title);function Q({errorMessageRegions:e,regions:n,fetchRegions:i,deleteRegion:l,loading:g}){const[f,c]=D.useState(),[d,r]=D.useState();D.useEffect(()=>{i()},[]);const p=s=>o.jsx(x,{onClick:()=>r(s),children:o.jsx(I,{})}),R=s=>o.jsx(x,{onClick:()=>c({...s}),children:o.jsx(G,{})},"edit");function m(){l(d.id),r(null)}return o.jsxs(o.Fragment,{children:[o.jsx(v,{title:"Regions",loading:g,source:n,size:"small",columns:[{title:"Title",handler:"title"},{title:"Edit",handler:R,styles:{width:"10%"}},{title:"Delete",handler:p,styles:{width:"10%"}}],enhancedToolbarProps:{isEnabled:!0}}),e?o.jsx(_,{errorTitle:"Something went wrong",errorMsg:e||"Error adding language, this language has already been used for this Region Name"}):null,o.jsx(z,{onClick:()=>c({})}),f&&o.jsx(b,{editableRegion:f,closeEdit:()=>c(null)}),d&&o.jsx(q,{isOpen:!0,onClick:m,onClose:()=>r(null),question:`Are you sure you want to delete "${d.title}"?`,yesButtonText:"YES, DELETE REGION"})]})}const X=e=>({regions:e.regions.regions,loading:e.regions.loading,errorMessageRegions:e.regions.errorMessage}),Z={fetchRegions:V,deleteRegion:B},ee=L(X,Z)(Q);function Ee(){return o.jsxs(F,{children:[o.jsx(w,{path:"/regions",component:ee}),o.jsx(w,{exact:!0,path:"/regions/edit/:editableId",component:b})]})}
1export{Ee as default};

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.