utopia-ui 3.0.0-alpha.191 → 3.0.0-alpha.193

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { AssetsApi } from '../../types';
3
- export declare function AppShell({ appName, children, assetsApi }: {
3
+ export declare function AppShell({ appName, children, assetsApi, userType }: {
4
4
  appName: string;
5
5
  children: React.ReactNode;
6
6
  assetsApi: AssetsApi;
7
+ userType: string;
7
8
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,4 @@
1
- export default function NavBar({ appName }: {
1
+ export default function NavBar({ appName, userType }: {
2
2
  appName: string;
3
+ userType: string;
3
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1,3 @@
1
- export declare function OverlayItemProfile(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function OverlayItemProfile({ userType }: {
2
+ userType: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1,3 @@
1
- export declare function OverlayItemProfileSettings(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function OverlayItemProfileSettings({ userType }: {
2
+ userType: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
package/dist/index.js CHANGED
@@ -3994,12 +3994,12 @@ var PopupButton = function (_a) {
3994
3994
  };
3995
3995
 
3996
3996
  function NavBar(_a) {
3997
- var appName = _a.appName;
3997
+ var appName = _a.appName, userType = _a.userType;
3998
3998
  var _b = useAuth(), isAuthenticated = _b.isAuthenticated, user = _b.user, logout = _b.logout;
3999
3999
  var _c = useState({}), userProfile = _c[0], setUserProfile = _c[1];
4000
4000
  var items = useItems();
4001
4001
  useEffect(function () {
4002
- var profile = user && items.find(function (i) { var _a, _b; return (((_a = i.user_created) === null || _a === void 0 ? void 0 : _a.id) === user.id) && ((_b = i.layer) === null || _b === void 0 ? void 0 : _b.itemType.name) === "user"; });
4002
+ var profile = user && items.find(function (i) { var _a, _b; return (((_a = i.user_created) === null || _a === void 0 ? void 0 : _a.id) === user.id) && ((_b = i.layer) === null || _b === void 0 ? void 0 : _b.itemType.name) === userType; });
4003
4003
  profile ? setUserProfile(profile) : setUserProfile({ id: crypto.randomUUID(), name: user === null || user === void 0 ? void 0 : user.first_name, text: "" });
4004
4004
  }, [user, items]);
4005
4005
  useEffect(function () {
@@ -4077,10 +4077,10 @@ var SetAssetsApi = function (_a) {
4077
4077
  };
4078
4078
 
4079
4079
  function AppShell(_a) {
4080
- var appName = _a.appName, children = _a.children, assetsApi = _a.assetsApi;
4080
+ var appName = _a.appName, children = _a.children, assetsApi = _a.assetsApi, userType = _a.userType;
4081
4081
  // Create a client
4082
4082
  var queryClient = new QueryClient();
4083
- return (jsx(BrowserRouter, { children: jsx(PermissionsProvider, __assign({ initialPermissions: [] }, { children: jsx(TagsProvider, __assign({ initialTags: [] }, { children: jsx(LayersProvider, __assign({ initialLayers: [] }, { children: jsx(FilterProvider, __assign({ initialTags: [] }, { children: jsx(ItemsProvider, __assign({ initialItems: [] }, { children: jsx(SelectPositionProvider, { children: jsx(LeafletRefsProvider, __assign({ initialLeafletRefs: {} }, { children: jsx(QueryClientProvider, __assign({ client: queryClient }, { children: jsx(AssetsProvider, { children: jsxs(ClusterRefProvider, { children: [jsx(SetAssetsApi, { assetsApi: assetsApi }), jsxs(QuestsProvider, __assign({ initialOpen: true }, { children: [jsx(ToastContainer, { position: "top-right", autoClose: 2000, hideProgressBar: true, newestOnTop: false, closeOnClick: true, rtl: false, pauseOnFocusLoss: true, draggable: true, pauseOnHover: true, theme: "light" }), jsxs("div", __assign({ className: 'tw-flex tw-flex-col tw-h-full' }, { children: [jsx(NavBar, { appName: appName }), jsx("div", __assign({ id: "app-content", className: "tw-flex-grow" }, { children: children }))] }))] }))] }) }) })) })) }) })) })) })) })) })) }));
4083
+ return (jsx(BrowserRouter, { children: jsx(PermissionsProvider, __assign({ initialPermissions: [] }, { children: jsx(TagsProvider, __assign({ initialTags: [] }, { children: jsx(LayersProvider, __assign({ initialLayers: [] }, { children: jsx(FilterProvider, __assign({ initialTags: [] }, { children: jsx(ItemsProvider, __assign({ initialItems: [] }, { children: jsx(SelectPositionProvider, { children: jsx(LeafletRefsProvider, __assign({ initialLeafletRefs: {} }, { children: jsx(QueryClientProvider, __assign({ client: queryClient }, { children: jsx(AssetsProvider, { children: jsxs(ClusterRefProvider, { children: [jsx(SetAssetsApi, { assetsApi: assetsApi }), jsxs(QuestsProvider, __assign({ initialOpen: true }, { children: [jsx(ToastContainer, { position: "top-right", autoClose: 2000, hideProgressBar: true, newestOnTop: false, closeOnClick: true, rtl: false, pauseOnFocusLoss: true, draggable: true, pauseOnHover: true, theme: "light" }), jsxs("div", __assign({ className: 'tw-flex tw-flex-col tw-h-full' }, { children: [jsx(NavBar, { userType: userType, appName: appName }), jsx("div", __assign({ id: "app-content", className: "tw-flex-grow" }, { children: children }))] }))] }))] }) }) })) })) }) })) })) })) })) })) }));
4084
4084
  }
4085
4085
 
4086
4086
  function SidebarSubmenu(_a) {
@@ -4867,20 +4867,21 @@ var SubHeader = function (_a) {
4867
4867
  return (jsxs("div", { children: [jsx("div", __assign({ className: "tw-flex tw-items-center tw-mt-6" }, { children: jsxs("span", __assign({ className: "tw-text-sm tw-text-gray-600" }, { children: [type, (status && status !== 'active') ? " (".concat(statusMapping[status], ")") : ''] })) })), jsx("div", __assign({ className: "tw-mt-4" }, { children: jsx(SocialShareBar, { url: url, title: title }) }))] }));
4868
4868
  };
4869
4869
 
4870
- function OverlayItemProfile() {
4870
+ function OverlayItemProfile(_a) {
4871
4871
  var _this = this;
4872
- var _a, _b, _c, _d, _e, _f, _g;
4873
- var _h = useState(false), updatePermission = _h[0], setUpdatePermission = _h[1];
4874
- var _j = useState([]), relations = _j[0], setRelations = _j[1];
4875
- var _k = useState(1), activeTab = _k[0], setActiveTab = _k[1];
4876
- var _l = useState(""), addItemPopupType = _l[0]; _l[1];
4877
- var _m = useState(false), loading = _m[0], setLoading = _m[1];
4878
- var _o = useState([]), offers = _o[0], setOffers = _o[1];
4879
- var _p = useState([]), needs = _p[0], setNeeds = _p[1];
4872
+ var _b, _c, _d, _e;
4873
+ var userType = _a.userType;
4874
+ var _f = useState(false), updatePermission = _f[0], setUpdatePermission = _f[1];
4875
+ var _g = useState([]), relations = _g[0], setRelations = _g[1];
4876
+ var _h = useState(1), activeTab = _h[0], setActiveTab = _h[1];
4877
+ var _j = useState(""), addItemPopupType = _j[0]; _j[1];
4878
+ var _k = useState(false), loading = _k[0], setLoading = _k[1];
4879
+ var _l = useState([]), offers = _l[0], setOffers = _l[1];
4880
+ var _m = useState([]), needs = _m[0], setNeeds = _m[1];
4880
4881
  var location = useLocation();
4881
4882
  var items = useItems();
4882
4883
  var updateItem = useUpdateItem();
4883
- var _q = useState({}), item = _q[0], setItem = _q[1];
4884
+ var _o = useState({}), item = _o[0], setItem = _o[1];
4884
4885
  var map = useMap();
4885
4886
  useLayers();
4886
4887
  var selectPosition = useSelectPosition();
@@ -4904,10 +4905,14 @@ function OverlayItemProfile() {
4904
4905
  useEffect(function () {
4905
4906
  scroll();
4906
4907
  }, [addItemPopupType]);
4907
- var _r = useState(), profile = _r[0], setProfile = _r[1];
4908
+ var _p = useState(), profile = _p[0], setProfile = _p[1];
4908
4909
  useEffect(function () {
4909
- setProfile(items.find(function (i) { var _a, _b, _c; return (((_a = i.user_created) === null || _a === void 0 ? void 0 : _a.id) === ((_b = item.user_created) === null || _b === void 0 ? void 0 : _b.id)) && ((_c = i.layer) === null || _c === void 0 ? void 0 : _c.itemType.name) === "user"; }));
4910
+ console.log(userType);
4911
+ setProfile(items.find(function (i) { var _a, _b, _c; return (((_a = i.user_created) === null || _a === void 0 ? void 0 : _a.id) === ((_b = item.user_created) === null || _b === void 0 ? void 0 : _b.id)) && ((_c = i.layer) === null || _c === void 0 ? void 0 : _c.itemType.name) === userType; }));
4910
4912
  }, [item, items]);
4913
+ useEffect(function () {
4914
+ console.log(profile);
4915
+ }, [profile]);
4911
4916
  var updateActiveTab = function (id) {
4912
4917
  setActiveTab(id);
4913
4918
  var params = new URLSearchParams(window.location.search);
@@ -5101,17 +5106,23 @@ function OverlayItemProfile() {
5101
5106
  };
5102
5107
  var groupType = item.group_type ? item.group_type : 'default';
5103
5108
  var groupTypeText = typeMapping[groupType];
5109
+ var _q = useState(""), template = _q[0], setTemplate = _q[1];
5110
+ useEffect(function () {
5111
+ var _a;
5112
+ setTemplate(((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemType.template) || userType);
5113
+ }, [userType, item]);
5104
5114
  return (jsx(Fragment, { children: item &&
5105
- jsx(MapOverlayPage, __assign({ className: "".concat(((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemType.onepager) && '!tw-p-0', " tw-mx-4 tw-mt-4 tw-max-h-[calc(100dvh-96px)] tw-h-[calc(100dvh-96px)] md:tw-w-[calc(50%-32px)] tw-w-[calc(100%-32px)] tw-min-w-80 tw-max-w-3xl !tw-left-0 sm:!tw-left-auto tw-top-0 tw-bottom-0 tw-transition-opacity tw-duration-500 ").concat(!selectPosition ? 'tw-opacity-100 tw-pointer-events-auto' : 'tw-opacity-0 tw-pointer-events-none') }, { children: jsxs(Fragment, { children: [jsxs("div", __assign({ className: "tw-px-6 tw-pt-6" }, { children: [jsx(HeaderView, { api: (_b = item.layer) === null || _b === void 0 ? void 0 : _b.api, item: item, deleteCallback: handleDelete, editCallback: function () { return navigate("/edit-item/" + item.id); }, setPositionCallback: function () { map.closePopup(); setSelectPosition(item); navigate("/"); }, big: true, truncateSubname: false }), jsx(SubHeader, { type: groupTypeText, status: item.status, url: window.location.href, title: item.name })] })), jsxs("div", __assign({ className: 'tw-h-full tw-overflow-y-auto fade' }, { children: [((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.onepager) &&
5106
- jsxs(Fragment, { children: [item.user_created.first_name && (jsx(ContactInfo, { name: (profile === null || profile === void 0 ? void 0 : profile.name) ? profile.name : item.user_created.first_name, avatar: (profile === null || profile === void 0 ? void 0 : profile.image) ? profile.image : item.user_created.avatar, email: item.contact, telephone: item.telephone })), jsx("div", __assign({ className: "tw-my-10 tw-mt-2 tw-px-6 tw-text-sm tw-text-gray-600" }, { children: jsx(TextView, { rawText: item.text || 'Keine Beschreibung vorhanden' }) })), item.next_appointment && (jsxs("div", __assign({ className: "tw-my-10 tw-px-6" }, { children: [jsx("h2", __assign({ className: "tw-text-lg tw-font-semibold" }, { children: "N\u00E4chste Termine" })), jsx("div", __assign({ className: "tw-mt-2 tw-text-sm tw-text-gray-600" }, { children: jsx(TextView, { rawText: item.next_appointment }) }))] }))), ";"] }), !((_d = item.layer) === null || _d === void 0 ? void 0 : _d.itemType.onepager) &&
5107
- jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsxs("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto fade tw-pt-2 tw-pb-4 tw-mb-4 tw-overflow-x-hidden" }, { children: [((_e = item.layer) === null || _e === void 0 ? void 0 : _e.itemType.show_start_end) &&
5108
- jsx("div", __assign({ className: 'tw-max-w-xs' }, { children: jsx(StartEndView, { item: item }) })), jsx(TextView, { item: item })] })), ((_f = item.layer) === null || _f === void 0 ? void 0 : _f.itemType.offers_and_needs) &&
5115
+ jsx(MapOverlayPage, __assign({ className: "".concat(template == "onepager" && '!tw-p-0', " tw-mx-4 tw-mt-4 tw-max-h-[calc(100dvh-96px)] tw-h-[calc(100dvh-96px)] md:tw-w-[calc(50%-32px)] tw-w-[calc(100%-32px)] tw-min-w-80 tw-max-w-3xl !tw-left-0 sm:!tw-left-auto tw-top-0 tw-bottom-0 tw-transition-opacity tw-duration-500 ").concat(!selectPosition ? 'tw-opacity-100 tw-pointer-events-auto' : 'tw-opacity-0 tw-pointer-events-none') }, { children: jsxs(Fragment, { children: [jsxs("div", __assign({ className: "".concat(template == "onepager" && "tw-px-6 tw-pt-6") }, { children: [jsx(HeaderView, { api: (_b = item.layer) === null || _b === void 0 ? void 0 : _b.api, item: item, deleteCallback: handleDelete, editCallback: function () { return navigate("/edit-item/" + item.id); }, setPositionCallback: function () { map.closePopup(); setSelectPosition(item); navigate("/"); }, big: true, truncateSubname: false }), template == "onepager" && jsx(SubHeader, { type: groupTypeText, status: item.status, url: window.location.href, title: item.name })] })), jsxs("div", __assign({ className: 'tw-h-full tw-overflow-y-auto fade' }, { children: [template == "onepager" &&
5116
+ jsxs(Fragment, { children: [item.user_created.first_name && (jsx(ContactInfo, { name: (profile === null || profile === void 0 ? void 0 : profile.name) ? profile.name : item.user_created.first_name, avatar: (profile === null || profile === void 0 ? void 0 : profile.image) ? profile.image : item.user_created.avatar, email: item.contact, telephone: item.telephone })), jsx("div", __assign({ className: "tw-my-10 tw-mt-2 tw-px-6 tw-text-sm tw-text-gray-600" }, { children: jsx(TextView, { rawText: item.text || 'Keine Beschreibung vorhanden' }) })), item.next_appointment && (jsxs("div", __assign({ className: "tw-my-10 tw-px-6" }, { children: [jsx("h2", __assign({ className: "tw-text-lg tw-font-semibold" }, { children: "N\u00E4chste Termine" })), jsx("div", __assign({ className: "tw-mt-2 tw-text-sm tw-text-gray-600" }, { children: jsx(TextView, { rawText: item.next_appointment }) }))] }))), ";"] }), template == "simple" &&
5117
+ jsx("div", __assign({ className: 'tw-mt-8' }, { children: jsx(TextView, { item: item }) })), template == "tabs" &&
5118
+ jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsxs("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto fade tw-pt-2 tw-pb-4 tw-mb-4 tw-overflow-x-hidden" }, { children: [((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.show_start_end) &&
5119
+ jsx("div", __assign({ className: 'tw-max-w-xs' }, { children: jsx(StartEndView, { item: item }) })), jsx(TextView, { item: item })] })), ((_d = item.layer) === null || _d === void 0 ? void 0 : _d.itemType.offers_and_needs) &&
5109
5120
  jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab tw-min-w-[10em] [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Offers & Needs", checked: activeTab == 3 && true, onChange: function () { return updateActiveTab(3); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-268px)] tw-overflow-y-auto fade tw-pt-4 tw-pb-1" }, { children: jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1' }, { children: [offers.length > 0 ?
5110
5121
  jsxs("div", __assign({ className: 'tw-col-span-1' }, { children: [jsx("h3", __assign({ className: '-tw-mb-2' }, { children: "Offers" })), jsx("div", __assign({ className: 'tw-flex tw-flex-wrap tw-mb-4' }, { children: offers.map(function (o) { return jsx(TagView, { tag: o, onClick: function () {
5111
5122
  console.log(o);
5112
5123
  addFilterTag(o);
5113
5124
  } }, o === null || o === void 0 ? void 0 : o.id); }) }))] })) : "", needs.length > 0 ?
5114
- jsxs("div", __assign({ className: 'tw-col-span-1' }, { children: [jsx("h3", __assign({ className: '-tw-mb-2 tw-col-span-1' }, { children: "Needs" })), jsx("div", __assign({ className: 'tw-flex tw-flex-wrap tw-mb-4' }, { children: needs.map(function (n) { return jsx(TagView, { tag: n, onClick: function () { return addFilterTag(n); } }, n === null || n === void 0 ? void 0 : n.id); }) }))] })) : ""] })) })) }))] }), ((_g = item.layer) === null || _g === void 0 ? void 0 : _g.itemType.relations) &&
5125
+ jsxs("div", __assign({ className: 'tw-col-span-1' }, { children: [jsx("h3", __assign({ className: '-tw-mb-2 tw-col-span-1' }, { children: "Needs" })), jsx("div", __assign({ className: 'tw-flex tw-flex-wrap tw-mb-4' }, { children: needs.map(function (n) { return jsx(TagView, { tag: n, onClick: function () { return addFilterTag(n); } }, n === null || n === void 0 ? void 0 : n.id); }) }))] })) : ""] })) })) }))] }), ((_e = item.layer) === null || _e === void 0 ? void 0 : _e.itemType.relations) &&
5115
5126
  jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Relations", checked: activeTab == 7 && true, onChange: function () { return updateActiveTab(7); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto tw-pt-4 tw-pb-1 -tw-mx-4 tw-overflow-x-hidden" }, { children: jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-1 lg:tw-grid-cols-1 xl:tw-grid-cols-1 2xl:tw-grid-cols-2' }, { children: [relations && relations.map(function (i) {
5116
5127
  return jsxs("div", __assign({ className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-mx-4 tw-p-6 tw-mb-4', onClick: function () { return navigate('/item/' + i.id); } }, { children: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: unlinkItem, loading: loading }), jsx("div", __assign({ className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade' }, { children: jsx(TextView, { truncate: true, item: i }) }))] }), i.id);
5117
5128
  }), updatePermission && jsx(ActionButton, { collection: "items", item: item, existingRelations: relations, triggerItemSelected: linkItem, colorField: item.layer.itemColorField })] })) })) }))] })] }))] }))] }) }), item.id) }));
@@ -5130,9 +5141,10 @@ var ComboBoxInput = function (_a) {
5130
5141
  }) })));
5131
5142
  };
5132
5143
 
5133
- function OverlayItemProfileSettings() {
5144
+ function OverlayItemProfileSettings(_a) {
5134
5145
  var _this = this;
5135
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5146
+ var _b, _c, _d, _e, _f, _g, _h;
5147
+ var userType = _a.userType;
5136
5148
  var typeMapping = [
5137
5149
  { value: 'wuerdekompass', label: 'Regional-Gruppe' },
5138
5150
  { value: 'themenkompass', label: 'Themen-Gruppe' },
@@ -5143,24 +5155,24 @@ function OverlayItemProfileSettings() {
5143
5155
  { value: 'in_planning', label: 'in Planung' },
5144
5156
  { value: 'paused', label: 'pausiert' }
5145
5157
  ];
5146
- var _k = useState(""), id = _k[0], setId = _k[1];
5147
- var _l = useState(""), groupType = _l[0], setGroupType = _l[1];
5148
- var _m = useState(""), status = _m[0], setStatus = _m[1];
5149
- var _o = useState(""), name = _o[0], setName = _o[1];
5150
- var _p = useState(""), subname = _p[0], setSubname = _p[1];
5151
- var _q = useState(""), text = _q[0], setText = _q[1];
5152
- var _r = useState(""), contact = _r[0], setContact = _r[1];
5153
- var _s = useState(""), telephone = _s[0], setTelephone = _s[1];
5154
- var _t = useState(""), nextAppointment = _t[0], setNextAppointment = _t[1];
5155
- var _u = useState(""), markerIcon = _u[0], setMarkerIcon = _u[1];
5156
- var _v = useState(""), image = _v[0], setImage = _v[1];
5157
- var _w = useState(""), color = _w[0], setColor = _w[1];
5158
- var _x = useState([]), offers = _x[0], setOffers = _x[1];
5159
- var _y = useState([]), needs = _y[0], setNeeds = _y[1];
5160
- var _z = useState([]), relations = _z[0], setRelations = _z[1];
5161
- var _0 = useState(false), updatePermission = _0[0], setUpdatePermission = _0[1];
5162
- var _1 = useState(1), activeTab = _1[0], setActiveTab = _1[1];
5163
- var _2 = useState(false), loading = _2[0], setLoading = _2[1];
5158
+ var _j = useState(""), id = _j[0], setId = _j[1];
5159
+ var _k = useState(""), groupType = _k[0], setGroupType = _k[1];
5160
+ var _l = useState(""), status = _l[0], setStatus = _l[1];
5161
+ var _m = useState(""), name = _m[0], setName = _m[1];
5162
+ var _o = useState(""), subname = _o[0], setSubname = _o[1];
5163
+ var _p = useState(""), text = _p[0], setText = _p[1];
5164
+ var _q = useState(""), contact = _q[0], setContact = _q[1];
5165
+ var _r = useState(""), telephone = _r[0], setTelephone = _r[1];
5166
+ var _s = useState(""), nextAppointment = _s[0], setNextAppointment = _s[1];
5167
+ var _t = useState(""), markerIcon = _t[0], setMarkerIcon = _t[1];
5168
+ var _u = useState(""), image = _u[0], setImage = _u[1];
5169
+ var _v = useState(""), color = _v[0], setColor = _v[1];
5170
+ var _w = useState([]), offers = _w[0], setOffers = _w[1];
5171
+ var _x = useState([]), needs = _x[0], setNeeds = _x[1];
5172
+ var _y = useState([]), relations = _y[0], setRelations = _y[1];
5173
+ var _z = useState(false), updatePermission = _z[0], setUpdatePermission = _z[1];
5174
+ var _0 = useState(1), activeTab = _0[0], setActiveTab = _0[1];
5175
+ var _1 = useState(false), loading = _1[0], setLoading = _1[1];
5164
5176
  var user = useAuth().user;
5165
5177
  var updateItem = useUpdateItem();
5166
5178
  var addItem = useAddItem();
@@ -5192,7 +5204,7 @@ function OverlayItemProfileSettings() {
5192
5204
  }
5193
5205
  }, [groupType]);
5194
5206
  var items = useItems();
5195
- var _3 = useState({}), item = _3[0], setItem = _3[1];
5207
+ var _2 = useState({}), item = _2[0], setItem = _2[1];
5196
5208
  useEffect(function () {
5197
5209
  item && hasUserPermission("items", "update", item) && setUpdatePermission(true);
5198
5210
  }, [item]);
@@ -5200,7 +5212,7 @@ function OverlayItemProfileSettings() {
5200
5212
  var itemId = location.pathname.split("/")[2];
5201
5213
  var item = items.find(function (i) { return i.id === itemId; });
5202
5214
  item && setItem(item);
5203
- var layer = layers.find(function (l) { return l.itemType.name == "user"; });
5215
+ var layer = layers.find(function (l) { return l.itemType.name == userType; });
5204
5216
  !item && setItem({ id: crypto.randomUUID(), name: user ? user.first_name : "", text: "", layer: layer, new: true });
5205
5217
  }, [items]);
5206
5218
  var updateActiveTab = function (id) {
@@ -5394,15 +5406,18 @@ function OverlayItemProfileSettings() {
5394
5406
  }
5395
5407
  });
5396
5408
  }); };
5409
+ var _3 = useState(""), template = _3[0], setTemplate = _3[1];
5397
5410
  useEffect(function () {
5398
- console.log(item);
5399
- }, [item]);
5400
- return (jsx(Fragment, { children: jsx(MapOverlayPage, __assign({ backdrop: true, className: 'tw-mx-4 tw-mt-4 tw-mb-12 tw-overflow-x-hidden tw-max-h-[calc(100dvh-96px)] !tw-h-[calc(100dvh-96px)] tw-w-[calc(100%-32px)] md:tw-w-[calc(50%-32px)] tw-max-w-3xl !tw-left-auto tw-top-0 tw-bottom-0' }, { children: jsxs("div", __assign({ className: 'tw-flex tw-flex-col tw-h-full' }, { children: [jsxs("div", __assign({ className: "tw-flex" }, { children: [jsx(AvatarWidget, { avatar: image, setAvatar: setImage }), jsx(ColorPicker, { color: color, onChange: setColor, className: "-tw-left-6 tw-top-14 -tw-mr-6" }), jsxs("div", __assign({ className: 'tw-grow tw-mr-4' }, { children: [jsx(TextInput, { placeholder: "Name", defaultValue: (item === null || item === void 0 ? void 0 : item.name) ? item.name : "", updateFormValue: function (v) { return setName(v); }, containerStyle: 'tw-grow tw-input-md' }), jsx(TextInput, { placeholder: "Subtitle", defaultValue: (item === null || item === void 0 ? void 0 : item.subname) ? item.subname : "", updateFormValue: function (v) { return setSubname(v); }, containerStyle: 'tw-grow tw-input-sm tw-px-4 tw-mt-1' })] }))] })), ((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemType.onepager) && (jsxs("div", __assign({ className: "tw-space-y-6 tw-mt-6" }, { children: [jsxs("div", __assign({ className: "tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-6" }, { children: [jsxs("div", { children: [jsx("label", __assign({ htmlFor: "groupType", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "Gruppenart:" })), jsx(ComboBoxInput, { id: "groupType", options: typeMapping, value: groupType, onValueChange: function (v) { return setGroupType(v); } })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "status", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "Gruppenstatus:" })), jsx(ComboBoxInput, { id: "status", options: statusMapping, value: status, onValueChange: function (v) { return setStatus(v); } })] })] })), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "email", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "Email-Adresse (Kontakt):" })), jsx(TextInput, { placeholder: "Email", defaultValue: contact, updateFormValue: function (v) { return setContact(v); } })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "telephone", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "Telefonnummer (Kontakt):" })), jsx(TextInput, { placeholder: "Telefonnummer", defaultValue: telephone, updateFormValue: function (v) { return setTelephone(v); } })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "nextAppointment", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "N\u00E4chste Termine:" })), jsx(TextAreaInput, { placeholder: "N\u00E4chste Termine", defaultValue: nextAppointment, updateFormValue: function (v) { return setNextAppointment(v); }, inputStyle: "tw-h-24" })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "description", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "Gruppenbeschreibung:" })), jsx(TextAreaInput, { placeholder: "Beschreibung", defaultValue: (_b = item === null || item === void 0 ? void 0 : item.text) !== null && _b !== void 0 ? _b : "", updateFormValue: function (v) { return setText(v); }, inputStyle: "tw-h-48" })] })] }))), !((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.onepager) &&
5401
- jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-4" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none" }, { children: jsx(TextAreaInput, { placeholder: "My Visino...", defaultValue: (item === null || item === void 0 ? void 0 : item.text) ? item.text : "", updateFormValue: function (v) { console.log(v); setText(v); }, containerStyle: 'tw-h-full', inputStyle: 'tw-h-full tw-border-t-0 tw-rounded-tl-none' }) })), ((_d = item.layer) === null || _d === void 0 ? void 0 : _d.itemType.offers_and_needs) &&
5402
- jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab tw-min-w-[10em] [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Offers & Needs", checked: activeTab == 3 && true, onChange: function () { return updateActiveTab(3); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none" }, { children: jsxs("div", __assign({ className: 'tw-h-full' }, { children: [jsx("div", __assign({ className: 'tw-w-full tw-h-[calc(50%-0.75em)] tw-mb-4' }, { children: jsx(TagsWidget, { defaultTags: offers, onUpdate: function (v) { return setOffers(v); }, placeholder: "enter your offers", containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) })), jsx("div", __assign({ className: 'tw-w-full tw-h-[calc(50%-0.75em)] ' }, { children: jsx(TagsWidget, { defaultTags: needs, onUpdate: function (v) { return setNeeds(v); }, placeholder: "enter your needs", containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) }))] })) }))] }), ((_e = item.layer) === null || _e === void 0 ? void 0 : _e.itemType.relations) &&
5411
+ var _a;
5412
+ setTemplate(((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemType.template) || userType);
5413
+ }, [userType, item]);
5414
+ return (jsx(Fragment, { children: jsx(MapOverlayPage, __assign({ backdrop: true, className: 'tw-mx-4 tw-mt-4 tw-mb-12 tw-overflow-x-hidden tw-max-h-[calc(100dvh-96px)] !tw-h-[calc(100dvh-96px)] tw-w-[calc(100%-32px)] md:tw-w-[calc(50%-32px)] tw-max-w-3xl !tw-left-auto tw-top-0 tw-bottom-0' }, { children: jsxs("div", __assign({ className: 'tw-flex tw-flex-col tw-h-full' }, { children: [jsxs("div", __assign({ className: "tw-flex" }, { children: [jsx(AvatarWidget, { avatar: image, setAvatar: setImage }), jsx(ColorPicker, { color: color, onChange: setColor, className: "-tw-left-6 tw-top-14 -tw-mr-6" }), jsxs("div", __assign({ className: 'tw-grow tw-mr-4' }, { children: [jsx(TextInput, { placeholder: "Name", defaultValue: (item === null || item === void 0 ? void 0 : item.name) ? item.name : "", updateFormValue: function (v) { return setName(v); }, containerStyle: 'tw-grow tw-input-md' }), jsx(TextInput, { placeholder: "Subtitle", defaultValue: (item === null || item === void 0 ? void 0 : item.subname) ? item.subname : "", updateFormValue: function (v) { return setSubname(v); }, containerStyle: 'tw-grow tw-input-sm tw-px-4 tw-mt-1' })] }))] })), template == "onepager" && (jsxs("div", __assign({ className: "tw-space-y-6 tw-mt-6" }, { children: [jsxs("div", __assign({ className: "tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-6" }, { children: [jsxs("div", { children: [jsx("label", __assign({ htmlFor: "groupType", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "Gruppenart:" })), jsx(ComboBoxInput, { id: "groupType", options: typeMapping, value: groupType, onValueChange: function (v) { return setGroupType(v); } })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "status", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "Gruppenstatus:" })), jsx(ComboBoxInput, { id: "status", options: statusMapping, value: status, onValueChange: function (v) { return setStatus(v); } })] })] })), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "email", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "Email-Adresse (Kontakt):" })), jsx(TextInput, { placeholder: "Email", defaultValue: contact, updateFormValue: function (v) { return setContact(v); } })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "telephone", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "Telefonnummer (Kontakt):" })), jsx(TextInput, { placeholder: "Telefonnummer", defaultValue: telephone, updateFormValue: function (v) { return setTelephone(v); } })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "nextAppointment", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "N\u00E4chste Termine:" })), jsx(TextAreaInput, { placeholder: "N\u00E4chste Termine", defaultValue: nextAppointment, updateFormValue: function (v) { return setNextAppointment(v); }, inputStyle: "tw-h-24" })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "description", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-1" }, { children: "Gruppenbeschreibung:" })), jsx(TextAreaInput, { placeholder: "Beschreibung", defaultValue: (_b = item === null || item === void 0 ? void 0 : item.text) !== null && _b !== void 0 ? _b : "", updateFormValue: function (v) { return setText(v); }, inputStyle: "tw-h-48" })] })] }))), template == "simple" &&
5415
+ jsx(TextAreaInput, { placeholder: "About me ...", defaultValue: (item === null || item === void 0 ? void 0 : item.text) ? item.text : "", updateFormValue: function (v) { console.log(v); setText(v); }, containerStyle: 'tw-mt-8 tw-h-full', inputStyle: 'tw-h-full' }), template == "tabs" &&
5416
+ jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-4" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none" }, { children: jsx(TextAreaInput, { placeholder: "About me ...", defaultValue: (item === null || item === void 0 ? void 0 : item.text) ? item.text : "", updateFormValue: function (v) { console.log(v); setText(v); }, containerStyle: 'tw-h-full', inputStyle: 'tw-h-full tw-border-t-0 tw-rounded-tl-none' }) })), ((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.offers_and_needs) &&
5417
+ jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab tw-min-w-[10em] [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Offers & Needs", checked: activeTab == 3 && true, onChange: function () { return updateActiveTab(3); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none" }, { children: jsxs("div", __assign({ className: 'tw-h-full' }, { children: [jsx("div", __assign({ className: 'tw-w-full tw-h-[calc(50%-0.75em)] tw-mb-4' }, { children: jsx(TagsWidget, { defaultTags: offers, onUpdate: function (v) { return setOffers(v); }, placeholder: "enter your offers", containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) })), jsx("div", __assign({ className: 'tw-w-full tw-h-[calc(50%-0.75em)] ' }, { children: jsx(TagsWidget, { defaultTags: needs, onUpdate: function (v) { return setNeeds(v); }, placeholder: "enter your needs", containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) }))] })) }))] }), ((_d = item.layer) === null || _d === void 0 ? void 0 : _d.itemType.relations) &&
5403
5418
  jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Relations", checked: activeTab == 7 && true, onChange: function () { return updateActiveTab(7); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-332px)] tw-overflow-y-auto tw-pt-4 tw-pb-1 -tw-mx-4 tw-overflow-x-hidden" }, { children: jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-1 lg:tw-grid-cols-1 xl:tw-grid-cols-1 2xl:tw-grid-cols-2' }, { children: [relations && relations.map(function (i) {
5404
5419
  return jsxs("div", __assign({ className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-mx-4 tw-p-6 tw-mb-4', onClick: function () { return navigate('/item/' + i.id); } }, { children: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: unlinkItem, loading: loading }), jsx("div", __assign({ className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade' }, { children: jsx(TextView, { truncate: true, item: i }) }))] }), i.id);
5405
- }), updatePermission && jsx(ActionButton, { customStyle: "!tw-bottom-20", collection: "items", item: item, existingRelations: relations, triggerItemSelected: linkItem, colorField: item.layer.itemColorField })] })) })) }))] })] })), jsx("div", __assign({ className: "tw-mt-4 tw-mb-4" }, { children: jsx("button", __assign({ className: loading ? " tw-loading tw-btn tw-float-right" : "tw-btn tw-float-right", onClick: function () { return onUpdateItem(); }, style: { backgroundColor: "".concat(((_f = item.layer) === null || _f === void 0 ? void 0 : _f.itemColorField) && getValue(item, (_g = item.layer) === null || _g === void 0 ? void 0 : _g.itemColorField) ? getValue(item, (_h = item.layer) === null || _h === void 0 ? void 0 : _h.itemColorField) : (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (_j = item === null || item === void 0 ? void 0 : item.layer) === null || _j === void 0 ? void 0 : _j.markerDefaultColor)), color: "#fff" } }, { children: "Update" })) }))] })) })) }));
5420
+ }), updatePermission && jsx(ActionButton, { customStyle: "!tw-bottom-20", collection: "items", item: item, existingRelations: relations, triggerItemSelected: linkItem, colorField: item.layer.itemColorField })] })) })) }))] })] })), jsx("div", __assign({ className: "tw-mt-4 tw-mb-4" }, { children: jsx("button", __assign({ className: loading ? " tw-loading tw-btn tw-float-right" : "tw-btn tw-float-right", onClick: function () { return onUpdateItem(); }, style: { backgroundColor: "".concat(((_e = item.layer) === null || _e === void 0 ? void 0 : _e.itemColorField) && getValue(item, (_f = item.layer) === null || _f === void 0 ? void 0 : _f.itemColorField) ? getValue(item, (_g = item.layer) === null || _g === void 0 ? void 0 : _g.itemColorField) : (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (_h = item === null || item === void 0 ? void 0 : item.layer) === null || _h === void 0 ? void 0 : _h.markerDefaultColor)), color: "#fff" } }, { children: "Update" })) }))] })) })) }));
5406
5421
  }
5407
5422
 
5408
5423
  function Modal(_a) {