PageSourceSearch

https://admin.postcoder.com/build/assets/usage-Bhka0nDo.js

js postcoder.com collected 2026-10-03 23:58:02 UTC 4,294 bytes, 1 lines download raw bytes

1import{b as U,r as i,c as n,d as p,f as l,e as d,w as m,k as g,g as t,j as b,l as _,t as v,_ as x,i as k}from"./main-w-Krg8vg.js";import{_ as S}from"./acl-input-DY5cwVEo.js";import{_ as h}from"./acl-switch-DRoRukfK.js";import{_ as $}from"./acl-multiselect-D2ncXBtt.js";import{F as Z}from"./form-tWFZXdcT.js";import{e as y,w as A,s as E}from"./ACLToast-dVktgNUV.js";import"./acl-fieldset-Cw75S0Y_.js";import"./alert-vWQ7ET8u.js";import"./info-BXRFBhMf.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./label-D-IcObCm.js";import"./keyboard-BQKysGUw.js";import"./use-resolve-button-type-D0jn7M1o.js";import"./hidden-D2lqFij_.js";import"./description-BpzDFF2s.js";import"./alertCircle-B2KOPOcx.js";const F={"data-matomo-category":"usage alerts"},B={class:"flex flex-col gap-3 mb-6"},N={class:"flex flex-col gap-4"},C={class:"flex flex-col gap-3"},D={class:"flex flex-col gap-4"},H={key:0,class:"w-72"},M={class:"multiselect-single-label"},P=["src"],R=["src"],T={class:"mt-8 flex gap-4 items-center col-span-2"},te={__name:"usage",props:["usage_alert","usage_alert_active","zero_use_alert"],emits:["updated"],setup(u,{emit:V}){const c=i(),o=i(!1),w=V,a=U({usage_alert_active:i(u.usage_alert_active==="y"),usage_alert:i(u.usage_alert),zero_use_alert:i(u.zero_use_alert),showZeroUsage:i(u.zero_use_alert>0)}),f=[];for(let s=1;s<15;s++){let e=s===1?"day":"days";f.push({value:s,name:`${s} ${e}`})}const z=()=>{c.value.reportValidity()&&(o.value=!0,a.transform(s=>{const e=s.showZeroUsage===!1?0:s.zero_use_alert;return s.usage_alert_active===!1&&delete s.usage_alert,{...s,zero_use_alert:e}}).post("/account-settings/alerts/usage",{preserveScroll:!0,onSuccess:s=>{s.props.flash.http_error?y("Something went wrong. Please try again, or contact us."):(E("Usage alerts updated successfully"),w("updated",s.props.flash.result.updatedData))},onError:s=>{console.error(s),s[0]=="server_error"?y("Whoops, something went wrong on our servers. Please try again, or contact us."):A("The form has errors")},onFinish:()=>{o.value=!1}}))};return(s,e)=>(n(),p("section",F,[e[10]||(e[10]=l("header",null,[l("h2",null,"Usage alerts")],-1)),l("form",{ref_key:"formRef",ref:c,onSubmit:k(z,["prevent"])},[l("fieldset",B,[e[7]||(e[7]=l("label",{class:"cursor-pointer font-bold"}," High usage alerts ",-1)),l("div",N,[d(h,{id:"usage_alert_active",modelValue:t(a).usage_alert_active,"onUpdate:modelValue":e[0]||(e[0]=r=>t(a).usage_alert_active=r),name:"usage_alert_active",class:"!mb-0",disabled:o.value},{default:m(()=>[...e[6]||(e[6]=[g(" Add a high usage alert? ",-1)])]),_:1},8,["modelValue","disabled"]),t(a).usage_alert_active?(n(),b(S,{key:0,id:"usage_alert",modelValue:t(a).usage_alert,"onUpdate:modelValue":[e[1]||(e[1]=r=>t(a).usage_alert=r),e[2]||(e[2]=r=>t(a).clearErrors("usage_alert"))],name:"usage_alert",disabled:o.value,"error-bag":t(a).errors,type:"number",placeholder:"Enter a percentage number",label:"High usage alert %",hint:"You will be sent an email if usage reaches this percentage of your average use. Minimum value = 110."},null,8,["modelValue","disabled","error-bag"])):_("",!0)])]),l("fieldset",C,[e[9]||(e[9]=l("label",{class:"cursor-pointer font-bold"}," Zero usage alerts ",-1)),l("div",D,[d(h,{id:"zeroUsageAlerts",modelValue:t(a).showZeroUsage,"onUpdate:modelValue":e[3]||(e[3]=r=>t(a).showZeroUsage=r),name:"zeroUsageAlerts",disabled:o.value,class:"!mb-0"},{default:m(()=>[...e[8]||(e[8]=[g(" Add a zero usage alert? ",-1)])]),_:1},8,["modelValue","disabled"]),t(a).showZeroUsage?(n(),p("div",H,[d($,{id:"zero_use_alert",modelValue:t(a).zero_use_alert,"onUpdate:modelValue":[e[4]||(e[4]=r=>t(a).zero_use_alert=r),e[5]||(e[5]=r=>t(a).clearErrors("zero_use_alert"))],name:"zero_use_alert",options:f,placeholder:"Select a threshold",label:"Zero use alert threshold",class:"!mb-0",disabled:o.value,"error-bag":t(a).errors},{singlelabel:m(({value:r})=>[l("div",M,[l("img",{class:"character-label-icon",src:r.icon},null,8,P),g(" "+v(r.name),1)])]),option:m(({option:r})=>[l("img",{class:"character-option-icon",src:r.icon},null,8,R),g(" "+v(r.name),1)]),_:1},8,["modelValue","disabled","error-bag"])])):_("",!0)])]),l("div",T,[d(x,{type:"submit",colour:"green",text:"Save",disabled:o.value},null,8,["disabled"]),o.value?(n(),b(Z,{key:0})):_("",!0)])],544)]))}};export{te 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.