1import{d as N,r as n,i as P,k as z,w as q,e,b as y,a as k,g as v,v as A,V as p,t as Z,P as E,Q as K,o as g,G as V,$ as h}from"./index-DbpIxVVg.js";import{P as U}from"./PageContent-CaO1rUex.js";import{_ as F}from"./ErrorView.vue_vue_type_script_setup_true_lang-rTuR_K5N.js";import{F as w}from"./FormHorizontalSeparator-YmnZb4LI.js";/* empty css */import{Z as H}from"./Zone-B11tA2dI.js";import{Z as Q}from"./ZoneService-DSqzE2hY.js";import{S as J}from"./StopService-BhxaPd7K.js";import{h as I}from"./Stop-8NKSpgr4.js";import{c as $}from"./SearchService-CvvzWgdB.js";import{_ as L}from"./TransitEntitySelect.vue_vue_type_script_setup_true_lang-Cl4izas8.js";import"./ErrorContent.vue_vue_type_script_setup_true_lang--XFDxIpt.js";import"./RoundedBadge-zDfp8xRL.js";import"./ArrowTopRightOnSquareIcon-Bwi8lzNJ.js";import"./ChevronRightIcon-CKGSa4-R.js";import"./disclosure-DbKVSJYz.js";import"./keyboard-C910qfwt.js";import"./ZoneResult-BCcwIQtm.js";import"./WFCheckIn-C1ZIiw9D.js";import"./PointOfInterest-Buj-zZdX.js";import"./AbstractVehicleResult-8ISW0izZ.js";import"./MapVehicleAnnotation-Bkrf91WN.js";import"./MapAnnotation-Cz1h2O1h.js";/* empty css */import"./RouteGroup-C9eTeiZ3.js";import"./SearchPaletteItem.vue_vue_type_script_setup_true_lang-4nHU3J_8.js";import"./RouteGlyph.vue_vue_type_script_setup_true_lang-CZS1VAaM.js";import"./combobox-Bf1jGWS7.js";import"./form-BG81DLzL.js";import"./calculate-active-index-Bo9BYas1.js";import"./use-tree-walker-DlTPShXD.js";const O={key:1,class:"text-center my-5"},W={action:"#",method:"post"},X={class:"md:grid md:grid-cols-3 md:gap-6"},Y={class:"mt-5 md:mt-0 md:col-span-2"},ee={class:"shadow sm:rounded-md"},te={key:0,class:"px-4 py-5 bg-white dark:bg-gray-800 space-y-6 sm:p-6"},oe={class:"text-sm font-medium text-gray-700 dark:text-gray-300"},se={class:"px-4 py-5 text-sm text-gray-600 dark:text-gray-400"},ne={class:"px-4 py-5 bg-white dark:bg-gray-800 space-y-6 sm:p-6"},re={class:"mt-1"},ae={class:"flex justify-end"},ie=["disabled"],de=["disabled"],le={key:2,action:"#",method:"post"},me={class:"md:grid md:grid-cols-3 md:gap-6"},ue={class:"mt-5 md:mt-0 md:col-span-2"},ce={class:"shadow sm:rounded-md"},pe={class:"px-4 py-5 bg-white dark:bg-gray-800 space-y-6 sm:p-6"},ge={class:"flex justify-end"},fe=["disabled"],ye={class:"px-4 sm:px-0"},ve={class:"flex justify-end"},Le=N({__name:"TrackworkTaskZoneManageView",props:{stopGtfsId:{type:String,required:!0},countryCode:{type:String,required:!0},regionCode:{type:String,required:!0}},setup(x){const m=x,_=n(),u=n(),r=n(),a=n(),j=n(!1),i=n(!1),d=n(),f=new Q,B=new J,c=n();P(async()=>{try{await G()}catch(o){d.value=o}});async function G(){const o={gtfsId:m.stopGtfsId,regionCode:m.regionCode,countryCode:m.countryCode},t=await B.findByGtfsId(o,!0);if(!t)throw new Error("Invalid stop");_.value=t;let s=null;try{if(s=await f.findByStopGtfsIdAndRegion(o),r.value=s,s){const l=new $;l.zone=s.stopZone,l.title=s.name,l.key=s.key,c.value=l}}catch(l){console.log(l)}const b=await f.findByKeys([o.gtfsId]);b.length&&(!s||b[0].key!==s.key)&&(a.value=b[0])}async function R(){u.value=null,await S()}async function S(){i.value=!0,d.value=null;try{const o=V.fromKey(m);await f.move(_.value,u.value,o),await h.go(-1)}catch(o){d.value=o}finally{i.value=!1}}async function M(){i.value=!0,d.value=null;try{const o=V.fromKey(m);r.value.stopZone.name=r.value.name,await f.commit(r.value,o),await h.go(-1)}catch(o){d.value=o}finally{i.value=!1}}async function T(){h.go(-1)}function D(){const o=new $;o.zone=I.fromZone(a.value),o.title=a.value.name,o.key=a.value.key,c.value=o,C()}function C(){const o=c.value;if(!o){u.value=null;return}o.entity instanceof I&&(u.value=H.fromStopZone(o.entity))}return(o,t)=>(g(),z(U,null,{default:q(()=>[t[13]||(t[13]=e("div",{class:"my-2 px-4 sm:px-0"},[e("h1",{class:"text-3xl font-extrabold tracking-tight text-gray-900 dark:text-gray-100"},[e("span",null,"Manage zone")])],-1)),d.value?(g(),z(F,{key:0,error:d.value,thing:"zone"},null,8,["error"])):y("",!0),j.value&&!u.value?(g(),k("div",O,t[7]||(t[7]=[e("p",{class:"lead"},[e("i",{class:"fa fa-spinner fa-spin"}),e("span",{class:"ml-3"},"Updating...")],-1)]))):y("",!0),e("form",W,[v(w),e("div",X,[t[10]||(t[10]=e("div",{class:"md:col-span-1"},[e("div",{class:"px-4 sm:px-0"},[e("h3",{class:"text-lg font-medium leading-6 text-gray-900 dark:text-gray-100"},"Zone details"),e("p",{class:"mt-1 text-sm text-gray-600 dark:text-gray-400"},"Attach to a zone")])],-1)),e("div",Y,[e("div",ee,[a.value?(g(),k("div",te,[e("div",oe,[t[8]||(t[8]=e("div",{class:"text-sm font-medium text-gray-700 dark:text-gray-300"}," This stop has it's own zone - would you like to re-attach it? ",-1)),e("div",se,[e("button",{type:"submit",class:"ml-3 mr-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-orange-600 hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500",onClick:t[0]||(t[0]=p(s=>D(),["prevent"]))}," Select "),A(" "+Z(a.value.name)+" ("+Z(a.value.key)+") ",1)])])])):y("",!0),e("div",ne,[e("div",null,[t[9]||(t[9]=e("label",{for:"zone-name",class:"block text-sm font-medium text-gray-700 dark:text-gray-300"}," Select a zone ",-1)),e("div",re,[v(L,{modelValue:c.value,"onUpdate:modelValue":[t[1]||(t[1]=s=>c.value=s),C],placeholder:"Select a zone","region-code":x.regionCode,"country-code":x.countryCode,"entity-types":["zone"],"role-keys":["bus_marshal_capture"],children:!1}
1,null,8,["modelValue","region-code","country-code"])])]),e("div",ae,[e("button",{type:"submit",disabled:i.value,class:"ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-orange-600 hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500",onClick:t[2]||(t[2]=p(s=>R(),["prevent"]))}," Detach ",8,ie),e("button",{type:"submit",disabled:i.value,class:"ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-orange-600 hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500",onClick:t[3]||(t[3]=p(s=>S(),["prevent"]))}," Attach to zone ",8,de)])])])])]),v(w)]),r.value?(g(),k("form",le,[e("div",me,[t[12]||(t[12]=e("div",{class:"md:col-span-1"},[e("div",{class:"px-4 sm:px-0"},[e("p",{class:"mt-1 text-sm text-gray-600 dark:text-gray-400"},"Rename zone")])],-1)),e("div",ue,[e("div",ce,[e("div",pe,[e("div",null,[t[11]||(t[11]=e("label",{for:"zone-name",class:"block text-sm font-medium text-gray-700 dark:text-gray-300"}," Rename zone ",-1)),E(e("input",{"onUpdate:modelValue":t[4]||(t[4]=s=>r.value.name=s),type:"text",class:"rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-black pr-4 shadow-sm focus:border-orange-500 focus:outline-none focus:ring-1 focus:ring-orange-500 sm:text-sm pl-2 py-2 w-full"},null,512),[[K,r.value.name]])]),e("div",ge,[e("button",{type:"submit",disabled:i.value,class:"ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-orange-600 hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500",onClick:t[5]||(t[5]=p(s=>M(),["prevent"]))}," Rename ",8,fe)])])])])]),v(w),e("div",ye,[e("div",ve,[e("button",{type:"button",class:"bg-white dark:bg-black py-2 px-4 border border-gray-300 dark:border-gray-700 rounded-md shadow-sm text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-900 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500",onClick:t[6]||(t[6]=p(s=>T(),["prevent"]))}," Cancel ")])])])):y("",!0)]),_:1,__:[13]}))}});export{Le 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.