PageSourceSearch

https://app.anyhelpnow.com/assets/LocationList-Du97M8Ba.js

js anyhelpnow.com collected 2026-10-04 19:43:44 UTC 12,004 bytes, 1 lines download raw bytes

1import{u as T}from"./resource-tPbLBW6G.js";import{u as V}from"./useBackNavigation-yMD1PNZO.js";import{k as g,h as N,o as i,c as a,a as e,t as c,C as O,a9 as p,aO as v,aY as U,aa as M,b as B,G as A,l as k,q as H,F as I,r as Z,n as E,f as w,d as h,m as R,e as G}from"./index-CxAbz3jj.js";import{u as _,T as C,a as q}from"./useProductTour-ggGgh47D.js";import"./resourceService-9V9v9ARe.js";const F={class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},K={class:"w-full max-w-lg rounded-lg bg-white shadow-xl max-h-[90vh] flex flex-col"},P={class:"flex items-center justify-between border-b border-gray-200 px-6 py-4 flex-shrink-0"},J={class:"text-lg font-semibold text-gray-900"},Y={class:"grid grid-cols-2 gap-4"},Q={class:"space-y-2"},W={class:"flex items-center gap-2"},X={class:"flex items-center gap-2"},ee={class:"flex justify-end gap-3 border-t border-gray-200 px-6 py-4 flex-shrink-0"},te=["disabled"],se={__name:"LocationModal",props:{isOpen:Boolean,editMode:Boolean,initialData:Object},emits:["close","save"],setup(x,{emit:b}){const y=x,f=b,s=g({name:"",address:"",city:"",postalCode:"",timezone:"Europe/Berlin",isActive:!0,isDefault:!1}),m=g(!1);N(()=>y.initialData,r=>{r&&(s.value={...r})},{immediate:!0});const d=async()=>{m.value=!0;try{const r={name:s.value.name,address:s.value.address,city:s.value.city,postalCode:s.value.postalCode,timezone:s.value.timezone,isActive:s.value.isActive,isDefault:s.value.isDefault};await f("save",r)}finally{m.value=!1}};return(r,t)=>(i(),a("div",F,[e("div",K,[e("div",P,[e("h3",J,c(x.editMode?"Standort bearbeiten":"Neuen Standort erstellen"),1),e("button",{class:"text-gray-400 hover:text-gray-600",onClick:t[0]||(t[0]=l=>r.$emit("close"))},t[9]||(t[9]=[e("svg",{class:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("form",{onSubmit:O(d,["prevent"]),class:"px-6 py-4 overflow-y-auto flex-grow space-y-4"},[e("div",null,[t[10]||(t[10]=e("label",{class:"block text-sm font-medium text-gray-700"},"Name",-1)),p(e("input",{"onUpdate:modelValue":t[1]||(t[1]=l=>s.value.name=l),type:"text",required:"",class:"mt-1 block w-full rounded-lg border border-gray-300 px-3 py-2 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:"z.B. Hauptfiliale"},null,512),[[v,s.value.name]])]),e("div",null,[t[11]||(t[11]=e("label",{class:"block text-sm font-medium text-gray-700"},"Adresse",-1)),p(e("input",{"onUpdate:modelValue":t[2]||(t[2]=l=>s.value.address=l),type:"text",class:"mt-1 block w-full rounded-lg border border-gray-300 px-3 py-2 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:"Straße und Hausnummer"},null,512),[[v,s.value.address]])]),e("div",Y,[e("div",null,[t[12]||(t[12]=e("label",{class:"block text-sm font-medium text-gray-700"},"PLZ",-1)),p(e("input",{"onUpdate:modelValue":t[3]||(t[3]=l=>s.value.postalCode=l),type:"text",class:"mt-1 block w-full rounded-lg border border-gray-300 px-3 py-2 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:"10115"},null,512),[[v,s.value.postalCode]])]),e("div",null,[t[13]||(t[13]=e("label",{class:"block text-sm font-medium text-gray-700"},"Stadt",-1)),p(e("input",{"onUpdate:modelValue":t[4]||(t[4]=l=>s.value.city=l),type:"text",class:"mt-1 block w-full rounded-lg border border-gray-300 px-3 py-2 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:"Berlin"},null,512),[[v,s.value.city]])])]),e("div",null,[t[15]||(t[15]=e("label",{class:"block text-sm font-medium text-gray-700"},"Zeitzone",-1)),p(e("select",{"onUpdate:modelValue":t[5]||(t[5]=l=>s.value.timezone=l),class:"mt-1 block w-full rounded-lg border border-gray-300 px-3 py-2 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"},t[14]||(t[14]=[e("option",{value:"Europe/Berlin"},"Europe/Berlin",-1),e("option",{value:"UTC"},"UTC",-1)]),512),[[U,s.value.timezone]])]),e("div",Q,[e("div",W,[p(e("input",{id:"isActive","onUpdate:modelValue":t[6]||(t[6]=l=>
1s.value.isActive=l),type:"checkbox",class:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"},null,512),[[M,s.value.isActive]]),t[16]||(t[16]=e("label",{for:"isActive",class:"text-sm text-gray-700"}," Aktiv ",-1))]),e("div",X,[p(e("input",{id:"isDefault","onUpdate:modelValue":t[7]||(t[7]=l=>s.value.isDefault=l),type:"checkbox",class:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"},null,512),[[M,s.value.isDefault]]),t[17]||(t[17]=e("label",{for:"isDefault",class:"text-sm text-gray-700"}," Als Standard setzen ",-1))])])],32),e("div",ee,[e("button",{type:"button",class:"rounded-lg border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50",onClick:t[8]||(t[8]=l=>r.$emit("close"))}," Abbrechen "),e("button",{type:"button",class:"rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:opacity-50",onClick:d,disabled:m.value||!s.value.name},c(m.value?"Speichern...":"Speichern"),9,te)])])]))}},oe=[{popover:{title:"Standortverwaltung 📍",description:"Hier verwaltest du alle Geschäftsstandorte — erstellen, bearbeiten und Ressourcen zuweisen."}},{element:'[data-tour="locations-actions"]',popover:{title:"Standort hinzufügen",description:"Erstelle einen neuen Standort mit Adresse und Zeitzone.",side:"bottom",align:"end"}},{element:'[data-tour="locations-grid"]',popover:{title:"Deine Standorte",description:"Jede Karte zeigt Name, Adresse, Status (Standard/Aktiv/Inaktiv) und Zeitzone. Bearbeite oder lösche Standorte direkt über die Icons.",side:"top",align:"center"}}],le={class:"p-4 sm:p-6 overflow-x-hidden"},ne={class:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between mb-6"},re={"data-tour":"locations-actions",class:"flex flex-wrap items-center gap-2 sm:gap-3"},ie={key:0,class:"flex justify-center py-12"},ae={key:1,class:"text-center py-12 bg-white rounded-lg border border-gray-200"},de={key:2,"data-tour":"locations-grid",class:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3"},ue={class:"p-5 flex-1"},ce={class:"flex items-center justify-between mb-2"},me={class:"flex space-x-2"},pe=["onClick"],fe=["onClick"],ve={class:"text-lg font-medium text-gray-900 truncate"},ge={class:"mt-2 text-sm text-gray-500 space-y-1"},xe={key:0,class:"flex items-start"},be={key:1,class:"flex items-center"},Se={__name:"LocationList",setup(x){const{start:b,shouldAutoTrigger:y}=_(),f=()=>b(oe,C.LOCATIONS),s=T(),{goBack:m}=V("crm"),d=g(!1),r=g(null),t=B(()=>s.loading),l=B(()=>s.locations||[]);A(()=>{s.fetchLocations()}),A(()=>{setTimeout(()=>{y(C.LOCATIONS)&&f()},800)});const S=()=>{r.value=null,d.value=!0},L=u=>{r.value=u,d.value=!0},j=async u=>{confirm(`Bist du sicher, dass du "${u.name}" löschen möchtest?`)&&await s.deleteLocation(u.id)},z=()=>{d.value=!1,r.value=null},D=async u=>{r.value?await s.updateLocation(r.value.id,u):await s.createLocation(u),z()};return(u,o)=>(i(),a("section",le,[e("div",ne,[o[3]||(o[3]=e("div",null,[e("h1",{class:"text-xl sm:text-2xl font-semibold"},"Standorte"),e("p",{class:"mt-1 sm:mt-2 text-sm text-gray-600"}," Verwalte deine Geschäftsstandorte. ")],-1)),e("div",re,[e("button",{onClick:o[0]||(o[0]=(...n)=>k(m)&&k(m)(...n)),class:"inline-flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-700 transition-colors"},o[1]||(o[1]=[e("svg",{class:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1),e("span",{class:"hidden sm:inline"},"Zurück",-1),e("span",{class:"sm:hidden"},"Zurück",-1)])),e("button",{class:"inline-flex items-center justify-center rounded-lg bg-blue-600 px-3 py-2 sm:px-4 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",onClick:S},o[2]||(o[2]=[e("svg",{class:"h-5 w-5 sm:-ml-1 sm:mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),e("span",{class:"hidden sm:inline"},"Standort hinzufügen",-1)]))])]),t.value?(i(),a("div",ie,o[4]||(o[4]=[e("svg",{class:"animate-spin h-8 w-8 text-blue-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})],-1)]))):l.value.length===0?(i(),a("div",ae,[o[5]||(o[5]=H('<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path></svg><h3 class="mt-2 text-sm font-medium text-gray-900">Keine Standorte</h3><p class="mt-1 text-sm text-gray-500">
1 Lege Standorte an, um Ressourcen zuzuweisen. </p>',3)),e("div",{class:"mt-6"},[e("button",{type:"button",class:"inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",onClick:S}," Standort erstellen ")])])):(i(),a("div",de,[(i(!0),a(I,null,Z(l.value,n=>(i(),a("div",{key:n.id,class:"relative flex flex-col bg-white rounded-lg border border-gray-200 shadow-sm hover:shadow-md transition-shadow"},[e("div",ue,[e("div",ce,[e("span",{class:E(["inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",n.isDefault?"bg-blue-100 text-blue-800":n.isActive?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"])},c(n.isDefault?"Standard":n.isActive?"Aktiv":"Inaktiv"),3),e("div",me,[e("button",{onClick:$=>L(n),class:"text-gray-400 hover:text-blue-600"},o[6]||(o[6]=[e("svg",{class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})],-1)]),8,pe),e("button",{onClick:$=>j(n),class:"text-gray-400 hover:text-red-600"},o[7]||(o[7]=[e("svg",{class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)]),8,fe)])]),e("h3",ve,c(n.name),1),e("div",ge,[n.address?(i(),a("div",xe,[o[9]||(o[9]=e("svg",{class:"flex-shrink-0 mr-1.5 h-4 w-4 text-gray-400 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})],-1)),e("span",null,[w(c(n.address),1),o[8]||(o[8]=e("br",null,null,-1)),w(" "+c(n.postalCode)+" "+c(n.city),1)])])):h("",!0),n.timezone?(i(),a("div",be,[o[10]||(o[10]=e("svg",{class:"flex-shrink-0 mr-1.5 h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),w(" "+c(n.timezone),1)])):h("",!0)])])]))),128))])),d.value?(i(),R(se,{key:3,isOpen:d.value,editMode:!!r.value,initialData:r.value,onClose:z,onSave:D},null,8,["isOpen","editMode","initialData"])):h("",!0),G(q,{"tour-id":k(C).LOCATIONS,onStartTour:f},null,8,["tour-id"])]))}};export{Se 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.