PageSourceSearch

https://sollentunacentrum.se/dist/client/assets/OpeningHoursController-DtmpBLhX.js

js sollentunacentrum.se collected 2026-09-26 14:25:34 UTC 16,471 bytes, 1 lines download raw bytes

1import{a as U}from"./index-BX4p_2E3.js";import{m as D,i as P}from"./index-Brwi4r46.js";import{L as $}from"./LoadingSpinner-BysyIPFJ.js";import{E as G,C as N,c as j}from"./controller-components-DIgrgCRR.js";import{u as B,f as A}from"./use-i18n-hBPy9l0p.js";import{E as W}from"./ErrorWrapper-DtIfsEag.js";import{C as R}from"./CheckBox-Jwm4IGc-.js";import{D as z}from"./DatePicker-Cvlwfgrg.js";import{I as q}from"./InputField-NK19VCkE.js";import{R as J}from"./RichTextEditor-C7hYTWM2.js";import{S as K}from"./SelectField-CPCB6FWj.js";import{T as Q}from"./ToggleSelect-CW7pp8cK.js";import X from"./DailyFootfall-VicClBlH.js";import{_ as V}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{r as u,c as p,o as r,p as y,m as c,a as i,b as h,t as l,l as b,F as H,d as L,n as M,q as C,w as F,z as Y,E as Z}from"./runtime-dom.esm-bundler-DjT8oBXG.js";import{M as _}from"./use-modals-DN_P8Uce.js";import{p as O}from"./index-Bclanzmk.js";import{m as x}from"./error-mapper-zAf1Hr3T.js";import{O as ee}from"./OpeningHoursModal-wb9ju82D.js";import"./HubIcon-DH8D8TrY.js";import"./entry-client-B9_6MISb.js";import"react-dom/client";import"react";import"react/jsx-runtime";import"./debounce-B64wGVAr.js";import"./use-preview-BHWk1XYy.js";import"./index-Dr74XzEq.js";import"./date-locale-CjCK-9h-.js";import"./index-Cau7slPW.js";import"./index-4nUR4sHy.js";import"./HubButton-uaeG4rLF.js";import"./index-DIOrrkEg.js";import"./index-B45z67GA.js";import"./index-B24KBrnw.js";import"./urls-nEGNqRkH.js";import"./WindowModalWrapper-Du9u7k7x.js";import"./SelectedFilterTag-KqtVGWwM.js";import"./index-DlrhC3lK.js";import"./TextareaField-DLIz83CS.js";import"./index-CwJfxRRh.js";const I=e=>Math.max(0,Math.min(100,parseInt(e,10))),oe={components:{DailyFootfall:X,ToggleSelect:Q},props:{footfall:Object,modelValue:Object,errorMessages:Object},emits:["update:modelValue"],setup(){return{i18n:B()}},computed:{showFootFallOptions(){return[{value:!0,label:`${this.i18n.itemEditor.show} Footfall`},{value:!1,label:`${this.i18n.itemEditor.hide} Footfall`}]},lowLevelBracket(){return Math.max(0,this.modelValue.businessLevelMedium-1)},midLevelBracket(){return Math.max(this.modelValue.businessLevelMedium,this.modelValue.businessLevelHigh-1)}},watch:{businessLevelHigh(){this.modelValue.businessLevelHigh<this.modelValue.businessLevelMedium&&this.emitInput("businessLevelHigh",this.modelValue.businessLevelMedium+1)}},methods:{emitInput(e,o){this.$emit("update:modelValue",{...this.modelValue,[e]:o})},emitNumericInput(e,o){this.emitInput(e,o.target.valueAsNumber)},updateBusinessLevelMedium(e){let o=I(e.target.value);const n=this.businessLevelHigh;o>=n&&(o=Math.max(1,n-1)),this.emitInput("businessLevelMedium",o)},updateBusinessLevelHigh(e){const o=this.businessLevelMedium;let n=I(e.target.value);n<=o&&(n=Math.min(99,o+1)),this.emitInput("businessLevelHigh",n)}}},ie={class:"opening-hours-sidebar"},ne={class:"form-group margin-bottom"},te={class:"extra-margin"},se={class:"margin-bottom"},le={class:"form-group margin-bottom form-group--grid"},re={class:"extra-margin"},ae={class:"form-row form-row--line-sm"},de={for:"visitorCapacity",class:"label"},ue=["value"],me={class:"form-row form-row--line-sm"},pe={for:"visitorThreshold",class:"label"},he=["value"],ge={class:"form-group form-group--grid margin-bottom"},fe={class:"extra-margin"},ve={class:"form-row form-row--line-sm"},be={class:"label"},ye={class:"footfall-editor__business"},ce={class:"form-row form-row--line-sm"},Ee={for:"businessMedium",class:"label"},He=["value"],Fe={class:"footfall-editor__business"},we={class:"form-row form-row--line-sm"},Me={for:"businessHigh",class:"label"},Be=["value"];function Ve(e,o,n,s,f,m){const g=u("DailyFootfall"),v=u("ToggleSelect");return r(),p("div",ie,[n.footfall&&n.modelValue.showFootFallGraph?(r(),y(g,{key:0,"show-heading":"",i18n:n.footfall.i18n.dailyFootfall,"center-id":n.footfall.centerId,endpoint:n.footfall.endpoint,"max-days-ahead":n.footfall.maxDaysAhead,"open-days-ahead":n.footfall.openDaysAhead},null,8,["i18n","center-id","endpoint","max-days-ahead","open-days-ahead"])):c("",!0),i("fieldset",ne,[i("legend",te,l(s.i18n.itemEditor.footfallEditorHideGraph),1),h(v,{"model-value":n.modelValue.showFootFallGraph,options:m.showFootFallOptions,"onUpdate:modelValue":o[0]||(o[0]=d=>
1m.emitInput("showFootFallGraph",d))},null,8,["model-value","options"])]),i("h3",se,l(s.i18n.itemEditor.footfallEditorHeading),1),i("fieldset",le,[i("legend",re,l(s.i18n.itemEditor.footfallEditorVisitorHeading),1),i("div",ae,[i("label",de,l(s.i18n.itemEditor.footfallEditorVisitorCapacity),1),i("div",null,[i("input",{id:"visitorCapacity",class:"input-small input-small--short",type:"number",min:0,value:n.modelValue.visitorCapacity,onBlur:o[1]||(o[1]=d=>m.emitNumericInput("visitorCapacity",d))},null,40,ue)])]),i("div",me,[i("label",pe,l(s.i18n.itemEditor.footfallEditorVisitorThreshold),1),i("div",null,[i("input",{id:"visitorThreshold",class:"input-small input-small--micro",type:"number",min:0,max:100,value:n.modelValue.visitorThreshold,onBlur:o[2]||(o[2]=d=>m.emitNumericInput("visitorThreshold",d))},null,40,he),o[5]||(o[5]=i("span",null,"%",-1))])])]),i("fieldset",ge,[i("legend",fe,l(s.i18n.itemEditor.footfallEditorBusinessHeading),1),i("div",ve,[i("div",be,l(s.i18n.itemEditor.footfallEditorBusinessLow),1),i("div",null,[o[6]||(o[6]=i("div",{class:"footfall-editor__business"}," 0 ",-1)),o[7]||(o[7]=b("  – ")),i("div",ye,l(m.lowLevelBracket),1),b(l(s.i18n.itemEditor.footfallEditorBusinessPercent),1)])]),i("div",ce,[i("label",Ee,l(s.i18n.itemEditor.footfallEditorBusinessMedium),1),i("div",null,[i("input",{id:"businessMedium",class:"input-small input-small--micro footfall-editor__business",type:"number",min:0,max:100,value:n.modelValue.businessLevelMedium,onBlur:o[3]||(o[3]=(...d)=>m.updateBusinessLevelMedium&&m.updateBusinessLevelMedium(...d))},null,40,He),o[8]||(o[8]=b("  – ")),i("div",Fe,l(m.midLevelBracket),1),b(l(s.i18n.itemEditor.footfallEditorBusinessPercent),1)])]),i("div",we,[i("label",Me,l(s.i18n.itemEditor.footfallEditorBusinessHigh),1),i("div",null,[i("input",{id:"businessHigh",class:"input-small input-small--micro footfall-editor__business",type:"number",min:0,max:100,value:n.modelValue.businessLevelHigh,onBlur:o[4]||(o[4]=(...d)=>m.updateBusinessLevelHigh&&m.updateBusinessLevelHigh(...d))},null,40,Be),o[9]||(o[9]=b("  – ")),o[10]||(o[10]=i("div",{class:"footfall-editor__business"}," 100 ",-1)),b(l(s.i18n.itemEditor.footfallEditorBusinessPercent),1)])])])])}const Le=V(oe,[["render",Ve]]),Oe={name:"OpeningHoursTable",props:{modelValue:Array,highlight:Boolean},setup(){return{i18n:B()}}};function Ie(e,o,n,s,f,m){return r(),p("table",{class:M(["opening-hours-list",n.highlight?"opening-hours-list--highlight":""])},[(r(!0),p(H,null,L(n.modelValue,(g,v)=>(r(),p("tr",{key:v,class:M(["opening-hours-list__item",g.isException?"opening-hours-list__item--highlight":""])},[i("td",null,l(g.label),1),i("td",null,[g.isClosed?(r(),p(H,{key:0},[b(l(s.i18n.itemEditor.closed),1)],64)):g.hours.length===0?(r(),p(H,{key:1},[b(l(s.i18n.itemEditor.twentyFourSeven),1)],64)):(r(!0),p(H,{key:2},L(g.hours,(d,E)=>(r(),p("div",{key:E},l(d.from)+" – "+l(d.to),1))),128))])],2))),128))],2)}const Ce=V(Oe,[["render",Ie]]),Te=C({name:"OpeningHoursEditor",components:{SelectField:K,DatePicker:z,CheckBox:R,EditorBlock:G,OpeningHoursTable:Ce,OpeningHoursSidebar:Le,InputField:q,ErrorWrapper:W,RichTextEditor:J},props:{openingHoursDisplay:Object,banner:Object,mainIntro:String,mainBody:String,hasFootFall:Boolean,footfall:Object,showFootFallGraph:Boolean,visitorCapacity:Number,visitorThreshold:Number,businessLevelMedium:Number,businessLevelHigh:Number,errorMessages:Object},emits:["edit","update:mainIntro","update:mainBody","update:showFootFallGraph","update:showFootFallGraph","update:visitorCapacity","update:visitorThreshold","update:businessLevelMedium","update:businessLevelHigh","update:banner"],setup(){return{i18n:B(),ModalType:_}},computed:{OpeningHoursBannerVariant(){return A},dateI18n(){return{save:this.i18n.itemEditor.save,never:this.i18n.itemEditor.never,now:this.i18n.itemEditor.now}},from:{get(){return this.banner?.from&&O(this.banner.from)},set(e){this.$emit("update:banner",{...this.banner,from:e?.toISOString()})}},to:{get(){return this.banner?.to&&O(this.banner.to)},set(e){this.$emit("update:banner",{...this.banner,to:e?.toISOString()})}},showFrontpageBanner:{get(){return this.banner&&this.banner.from!==null},set(e){e?this.$emit("update:banner",{...this.banner,from:new Date().toISOString()}):this.$emit("update:banner",{...this.banner,from:null,to:null})}}
1,openingHoursMeta:{get(){return{showFootFallGraph:this.showFootFallGraph,visitorCapacity:this.visitorCapacity,visitorThreshold:this.visitorThreshold,businessLevelMedium:this.businessLevelMedium,businessLevelHigh:this.businessLevelHigh}},set(e){for(const[o,n]of Object.entries(e))this[o]!==n&&this.$emit(`update:${o}`,n)}}}}),ke={class:"main-content"},Se={class:"margin-bottom"},Ue={class:"margin-bottom"},De={key:0,class:"margin-top--sm"},Pe={class:"u-flex u-gap"},$e={class:"u-relative margin-bottom--md"},Ge={key:0},Ne={class:"margin-bottom"},je={class:"u-relative margin-bottom--lg"};function Ae(e,o,n,s,f,m){const g=u("CheckBox"),v=u("DatePicker"),d=u("SelectField"),E=u("InputField"),w=u("OpeningHoursTable"),t=u("EditorBlock"),T=u("RichTextEditor"),k=u("ErrorWrapper"),S=u("OpeningHoursSidebar");return r(),p("div",ke,[i("div",{class:M({"grid-cols grid-cols--8-4 grid-cols--lg-padding":e.hasFootFall})},[i("div",{class:M({"grid-col":e.hasFootFall})},[i("h1",Se,l(e.i18n.itemEditor.openingHours),1),i("div",Ue,[h(g,{modelValue:e.showFrontpageBanner,"onUpdate:modelValue":o[0]||(o[0]=a=>e.showFrontpageBanner=a),label:e.i18n.itemEditor.showOpeningHoursBanner},null,8,["modelValue","label"]),e.showFrontpageBanner?(r(),p("div",De,[i("div",Pe,[h(v,{modelValue:e.from,"onUpdate:modelValue":o[1]||(o[1]=a=>e.from=a),label:e.i18n.itemEditor.fromDate,i18n:e.dateI18n,"hide-time":"",format:"dd.MM.yyyy"},null,8,["modelValue","label","i18n"]),h(v,{modelValue:e.to,"onUpdate:modelValue":o[2]||(o[2]=a=>e.to=a),label:e.i18n.itemEditor.toDate,i18n:e.dateI18n,"hide-time":"",format:"dd.MM.yyyy"},null,8,["modelValue","label","i18n"]),h(d,{options:[{value:e.OpeningHoursBannerVariant.Default,label:e.i18n.itemEditor.light},{value:e.OpeningHoursBannerVariant.Dark,label:e.i18n.itemEditor.dark}],"model-value":e.banner.variant,label:e.i18n.itemEditor.colorVariant,"onUpdate:modelValue":o[3]||(o[3]=a=>e.$emit("update:banner",{...e.banner,variant:a}))},null,8,["options","model-value","label"])]),h(E,{size:"large",class:"margin-bottom","full-width":"","model-value":e.banner.text,placeholder:e.i18n.itemEditor.openingHoursBannerPlaceholder,"error-message":e.errorMessages&&e.errorMessages.bannerText,"onUpdate:modelValue":o[4]||(o[4]=a=>e.$emit("update:banner",{...e.banner,text:a}))},null,8,["model-value","placeholder","error-message"])])):c("",!0)]),i("div",$e,[h(t,{class:"opening-hours-table",onEdit:o[5]||(o[5]=a=>e.$emit("edit",e.ModalType.OpeningHours))},{default:F(()=>[e.openingHoursDisplay?(r(),p(H,{key:0},[e.openingHoursDisplay.isClosed?(r(),p("div",Ge,l(e.i18n.itemEditor.closed),1)):(r(),y(w,{key:1,"model-value":e.openingHoursDisplay.weekDays},null,8,["model-value"]))],64)):c("",!0)]),_:1})]),i("h2",Ne,l(e.i18n.itemEditor.specialOpeningHours),1),i("div",je,[h(t,{class:"opening-hours-table",onEdit:o[6]||(o[6]=a=>e.$emit("edit",e.ModalType.OpeningHours))},{default:F(()=>[e.openingHoursDisplay?(r(),y(w,{key:0,"model-value":e.openingHoursDisplay.exceptions,highlight:""},null,8,["model-value"])):c("",!0)]),_:1})]),h(E,{align:"center",size:"large",class:"margin-bottom","full-width":"","model-value":e.mainIntro,placeholder:e.i18n.itemEditor.centerOpeningHoursMainIntroPlaceholder,"error-message":e.errorMessages&&e.errorMessages.mainIntro,"onUpdate:modelValue":o[7]||(o[7]=a=>e.$emit("update:mainIntro",a))},null,8,["model-value","placeholder","error-message"]),h(k,{message:e.errorMessages&&e.errorMessages.mainBody},{default:F(()=>[h(T,{"model-value":e.mainBody,immediate:"",placeholder:e.i18n.itemEditor.centerOpeningHoursMainBodyPlaceholder,"show-counter":"","onUpdate:modelValue":o[8]||(o[8]=a=>e.$emit("update:mainBody",a))},null,8,["model-value","placeholder"])]),_:1},8,["message"])],2),e.hasFootFall?(r(),y(S,{key:0,modelValue:e.openingHoursMeta,"onUpdate:modelValue":o[9]||(o[9]=a=>e.openingHoursMeta=a),footfall:e.footfall,"error-messages":e.errorMessages,class:"grid-col grid-col--border-left"},null,8,["modelValue","footfall","error-messages"])):c("",!0)],2)])}const We=V(Te,[["render",Ae]]),Re=C({name:"OpeningHoursController",components:{...N,OpeningHoursEditor:We,OpeningHoursModal:ee,LoadingSpinner:$},props:{id:[Number,String]},emits:["update:viewTitle","update:contentId","update:publishedUrl"],setup(e,{emit:o}){const n=B();return{i18n:n,...j(e,o,"openinghours",!0,{title(){const s=n.itemEditor.openingHours,f=n.listPage.edit.toLowerCase();return`${s} (${f})`},prePublishValidate(s){const f={};return s.banner?.from&&!s.banner?.text&&(f.bannerText=n.itemEditor.required),f}})}},data(){return{footfall:null}},computed:{...D({centerId:e=>e.centerId,culture:e=>e.culture}),footfallUrl(){return this.content?.displayFootfallForHub?`/api/hub/${this.culture}/${this.centerId}/dashboard/footfall?preview=true`:null},errorMessages(){return x(this.validationErrors,["mainIntro","mainBody","showFootFallGraph","visitorCapacity","visitorThreshold","businessLevelMedium","businessLevelHigh","bannerText"])}},watch:{"content.openingHours":async function(e,o){o==null||P(e,o)||await this.saveContent()},footfallUrl:{handler:"loadFootfall",immediate:!0}},methods:{async loadFootfall(e){if(e)try{const o=await U.get(e);this.footfall=o.data,this.footfall.openDaysAhead=this.content.openingHoursDisplay.weekDays.map(n=>!n.isClosed)}catch{console.warn("Unable to load footfall.")}}}});function ze(e,o,n,s,f,m){const g=u("OpeningHoursEditor"),v=u("EditorWrapper"),d=u("LoadingSpinner"),E=u("OpeningHoursModal"),w=u("ControllerWrapper");return r(),y(w,{loading:!e.loaded,"preview-url":e.previewUrl,onClosePreview:o[10]||(o[10]=t=>e.previewUrl=null)},{default:F(()=>[e.loaded?(r(),p(H,{key:0},[e.modal?c("",!0):(r(),y(v,{key:0,"content-id":e.id,heading:e.localI18n.heading,intro:e.localI18n.intro,"has-unsaved-changes":e.hasUnsavedChanges,"has-unpublished-changes":e.hasUnpublishedChanges,"last-saved-timestamp":e.lastSavedMilliseconds,saving:e.saving,loading:!e.loaded,onPublish:e.publish,onPreview:e.preview,onShare:e.share,onSave:e.save,onReset:e.reset,onClose:e.close},{default:F(()=>[h(g,{"main-intro":e.content.mainIntro,"onUpdate:mainIntro":o[0]||(o[0]=t=>e.content.mainIntro=t),"main-body":e.content.mainBody,"onUpdate:mainBody":o[
11]||(o[1]=t=>e.content.mainBody=t),"show-foot-fall-graph":e.content.showFootFallGraph,"onUpdate:showFootFallGraph":o[2]||(o[2]=t=>e.content.showFootFallGraph=t),"visitor-capacity":e.content.visitorCapacity,"onUpdate:visitorCapacity":o[3]||(o[3]=t=>e.content.visitorCapacity=t),"visitor-threshold":e.content.visitorThreshold,"onUpdate:visitorThreshold":o[4]||(o[4]=t=>e.content.visitorThreshold=t),"business-level-medium":e.content.businessLevelMedium,"onUpdate:businessLevelMedium":o[5]||(o[5]=t=>e.content.businessLevelMedium=t),"business-level-high":e.content.businessLevelHigh,"onUpdate:businessLevelHigh":o[6]||(o[6]=t=>e.content.businessLevelHigh=t),banner:e.content.banner,"onUpdate:banner":o[7]||(o[7]=t=>e.content.banner=t),"opening-hours-display":e.content.openingHoursDisplay,footfall:e.footfall,"has-foot-fall":e.content.displayFootfallForHub,"error-messages":e.errorMessages,onEdit:o[8]||(o[8]=t=>e.modal=t)},null,8,["main-intro","main-body","show-foot-fall-graph","visitor-capacity","visitor-threshold","business-level-medium","business-level-high","banner","opening-hours-display","footfall","has-foot-fall","error-messages"])]),_:1},8,["content-id","heading","intro","has-unsaved-changes","has-unpublished-changes","last-saved-timestamp","saving","loading","onPublish","onPreview","onShare","onSave","onReset","onClose"])),e.modal&&!e.content?(r(),y(d,{key:1,class:"loader--fullscreen"})):e.modal===e.ModalType.OpeningHours?(r(),y(E,Y({key:2,modelValue:e.content.openingHours,"onUpdate:modelValue":o[9]||(o[9]=t=>e.content.openingHours=t),saving:e.saving},Z(e.modalEvents())),null,16,["modelValue","saving"])):c("",!0)],64)):c("",!0)]),_:1},8,["loading","preview-url"])}const ko=V(Re,[["render",ze]]);export{ko 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.