@ozdao/prometheus-framework 0.2.184 → 0.2.186

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/dist/pages.server.js +150 -0
  2. package/dist/pages.server.mjs +151 -0
  3. package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
  4. package/dist/prometheus-framework/src/components/Block/Block.vue.js +1 -1
  5. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  6. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +1 -1
  7. package/dist/prometheus-framework/src/modules/globals/mixins/mixins.cjs +1 -0
  8. package/dist/prometheus-framework/src/modules/globals/mixins/mixins.js +43 -0
  9. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  10. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +1 -1
  11. package/dist/prometheus-framework/src/modules/pages/pages.client.cjs +1 -0
  12. package/dist/prometheus-framework/src/modules/pages/pages.client.js +31 -0
  13. package/dist/prometheus-framework/src/modules/pages/views/components/blocks/CardPage.vue.cjs +1 -0
  14. package/dist/prometheus-framework/src/modules/pages/views/components/blocks/CardPage.vue.js +98 -0
  15. package/dist/prometheus-framework/src/modules/pages/views/components/pages/Page.vue.cjs +1 -0
  16. package/dist/prometheus-framework/src/modules/pages/views/components/pages/Page.vue.js +127 -0
  17. package/dist/prometheus-framework/src/modules/pages/views/components/pages/PageEdit.vue.cjs +1 -0
  18. package/dist/prometheus-framework/src/modules/pages/views/components/pages/PageEdit.vue.js +89 -0
  19. package/dist/prometheus-framework/src/modules/pages/views/components/pages/Pages.vue.cjs +1 -0
  20. package/dist/prometheus-framework/src/modules/pages/views/components/pages/Pages.vue.js +47 -0
  21. package/dist/prometheus-framework/src/modules/pages/views/components/partials/SidebarPages.vue.cjs +1 -0
  22. package/dist/prometheus-framework/src/modules/pages/views/components/partials/SidebarPages.vue.js +86 -0
  23. package/dist/prometheus-framework/src/modules/pages/views/router/pages.backoffice.router.cjs +1 -0
  24. package/dist/prometheus-framework/src/modules/pages/views/router/pages.backoffice.router.js +53 -0
  25. package/dist/prometheus-framework/src/modules/pages/views/router/pages.router.cjs +1 -0
  26. package/dist/prometheus-framework/src/modules/pages/views/router/pages.router.js +28 -0
  27. package/dist/prometheus-framework/src/modules/pages/views/store/pages.cjs +1 -0
  28. package/dist/prometheus-framework/src/modules/pages/views/store/pages.js +52 -0
  29. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
  30. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +1 -1
  31. package/dist/style.css +1 -1
  32. package/package.json +9 -1
  33. package/src/modules/globals/globals.client.js +2 -0
  34. package/src/modules/globals/mixins/mixins.js +0 -1
  35. package/src/modules/pages/views/components/pages/Page.vue +0 -2
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
3
+ require("./queryProcessor-iewDZq_f.js");
4
+ require("node-cache");
5
+ var page_model = (db) => {
6
+ const PageSchema = new db.mongoose.Schema({
7
+ name: { type: Object },
8
+ url: { type: String },
9
+ groups: { type: Array },
10
+ content: { type: [Object, Array] },
11
+ parent: {
12
+ type: db.mongoose.Schema.Types.ObjectId,
13
+ ref: "Page"
14
+ },
15
+ children: [{
16
+ type: db.mongoose.Schema.Types.ObjectId,
17
+ ref: "Page"
18
+ }]
19
+ }, {
20
+ timestamps: { currentTime: () => Date.now() }
21
+ });
22
+ const Page = db.mongoose.model("Page", PageSchema);
23
+ return Page;
24
+ };
25
+ const createPageController = (db) => {
26
+ const Page = db.page;
27
+ async function populateChildrenRecursively(page) {
28
+ await page.populate("children");
29
+ for (let child of page.children) {
30
+ await populateChildrenRecursively(child);
31
+ }
32
+ }
33
+ const create = async (req, res) => {
34
+ try {
35
+ const page = await Page.create(req.body);
36
+ if (!page) {
37
+ return res.status(404).send({ message: "Something wrong when creating page." });
38
+ }
39
+ if (req.body.parent) {
40
+ const parentPage = await Page.findById(req.body.parent);
41
+ if (parentPage) {
42
+ if (!parentPage.children) {
43
+ parentPage.children = [];
44
+ }
45
+ parentPage.children.push(page._id);
46
+ await parentPage.save();
47
+ } else {
48
+ console.warn(`Parent page with id ${req.body.parent} not found.`);
49
+ }
50
+ }
51
+ res.status(200).send(page);
52
+ } catch (err) {
53
+ res.status(500).send({ message: err.message });
54
+ }
55
+ };
56
+ const read = async (req, res) => {
57
+ try {
58
+ const { url } = req.query;
59
+ if (url) {
60
+ const page = await Page.findOne({ url }).populate("parent");
61
+ if (!page) {
62
+ return res.status(404).json({ message: "Page not found" });
63
+ }
64
+ await populateChildrenRecursively(page);
65
+ res.status(200).send(page);
66
+ } else {
67
+ const topLevelPages = await Page.find({ parent: null });
68
+ for (let page of topLevelPages) {
69
+ await populateChildrenRecursively(page);
70
+ }
71
+ res.json(topLevelPages);
72
+ }
73
+ } catch (error) {
74
+ console.error("Error:", error);
75
+ res.status(500).json({ message: "Server error" });
76
+ }
77
+ };
78
+ const update = async (req, res) => {
79
+ try {
80
+ const page = await Page.findOneAndUpdate({ _id: req.body._id }, req.body);
81
+ if (!page) {
82
+ return res.status(404).send({ message: "Page not found." });
83
+ }
84
+ res.status(200).send(page);
85
+ } catch (err) {
86
+ res.status(500).send({ message: err.message });
87
+ }
88
+ };
89
+ const deletePage = async (req, res) => {
90
+ try {
91
+ const page = await Page.findOneAndDelete({ _id: req.body._id });
92
+ if (!page) {
93
+ return res.status(404).send({ message: "Something wrong when deleting page." });
94
+ }
95
+ res.status(200).send(page);
96
+ } catch (err) {
97
+ res.status(500).send({ message: err.message });
98
+ }
99
+ };
100
+ return {
101
+ create,
102
+ read,
103
+ update,
104
+ delete: deletePage
105
+ };
106
+ };
107
+ var pages_factory = createPageController;
108
+ const controllerFactory = pages_factory;
109
+ var pages_routes = function(app, db, origins, publicPath) {
110
+ const controller = controllerFactory(db);
111
+ app.get(
112
+ "/api/pages/read",
113
+ controller.read
114
+ );
115
+ app.post(
116
+ "/api/pages/create",
117
+ controller.create
118
+ );
119
+ app.put(
120
+ "/api/pages/update",
121
+ controller.update
122
+ );
123
+ app.delete(
124
+ "/api/pages/delete",
125
+ controller.delete
126
+ );
127
+ };
128
+ const ModelPage = page_model;
129
+ const RoutesPage = pages_routes;
130
+ const FactoryPage = pages_factory;
131
+ function initializePages(app, db, origins, publicPath) {
132
+ db.page = ModelPage(db);
133
+ if (app) {
134
+ RoutesPage(app, db);
135
+ }
136
+ }
137
+ var pages_server = {
138
+ initialize: initializePages,
139
+ models: {
140
+ ModelPage
141
+ },
142
+ routes: {
143
+ RoutesPage
144
+ },
145
+ controllers: {
146
+ FactoryPage
147
+ }
148
+ };
149
+ const pages_server$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(pages_server);
150
+ module.exports = pages_server$1;
@@ -0,0 +1,151 @@
1
+ import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
2
+ import "./queryProcessor-DQSFR9YA.mjs";
3
+ import "node-cache";
4
+ var page_model = (db) => {
5
+ const PageSchema = new db.mongoose.Schema({
6
+ name: { type: Object },
7
+ url: { type: String },
8
+ groups: { type: Array },
9
+ content: { type: [Object, Array] },
10
+ parent: {
11
+ type: db.mongoose.Schema.Types.ObjectId,
12
+ ref: "Page"
13
+ },
14
+ children: [{
15
+ type: db.mongoose.Schema.Types.ObjectId,
16
+ ref: "Page"
17
+ }]
18
+ }, {
19
+ timestamps: { currentTime: () => Date.now() }
20
+ });
21
+ const Page = db.mongoose.model("Page", PageSchema);
22
+ return Page;
23
+ };
24
+ const createPageController = (db) => {
25
+ const Page = db.page;
26
+ async function populateChildrenRecursively(page) {
27
+ await page.populate("children");
28
+ for (let child of page.children) {
29
+ await populateChildrenRecursively(child);
30
+ }
31
+ }
32
+ const create = async (req, res) => {
33
+ try {
34
+ const page = await Page.create(req.body);
35
+ if (!page) {
36
+ return res.status(404).send({ message: "Something wrong when creating page." });
37
+ }
38
+ if (req.body.parent) {
39
+ const parentPage = await Page.findById(req.body.parent);
40
+ if (parentPage) {
41
+ if (!parentPage.children) {
42
+ parentPage.children = [];
43
+ }
44
+ parentPage.children.push(page._id);
45
+ await parentPage.save();
46
+ } else {
47
+ console.warn(`Parent page with id ${req.body.parent} not found.`);
48
+ }
49
+ }
50
+ res.status(200).send(page);
51
+ } catch (err) {
52
+ res.status(500).send({ message: err.message });
53
+ }
54
+ };
55
+ const read = async (req, res) => {
56
+ try {
57
+ const { url } = req.query;
58
+ if (url) {
59
+ const page = await Page.findOne({ url }).populate("parent");
60
+ if (!page) {
61
+ return res.status(404).json({ message: "Page not found" });
62
+ }
63
+ await populateChildrenRecursively(page);
64
+ res.status(200).send(page);
65
+ } else {
66
+ const topLevelPages = await Page.find({ parent: null });
67
+ for (let page of topLevelPages) {
68
+ await populateChildrenRecursively(page);
69
+ }
70
+ res.json(topLevelPages);
71
+ }
72
+ } catch (error) {
73
+ console.error("Error:", error);
74
+ res.status(500).json({ message: "Server error" });
75
+ }
76
+ };
77
+ const update = async (req, res) => {
78
+ try {
79
+ const page = await Page.findOneAndUpdate({ _id: req.body._id }, req.body);
80
+ if (!page) {
81
+ return res.status(404).send({ message: "Page not found." });
82
+ }
83
+ res.status(200).send(page);
84
+ } catch (err) {
85
+ res.status(500).send({ message: err.message });
86
+ }
87
+ };
88
+ const deletePage = async (req, res) => {
89
+ try {
90
+ const page = await Page.findOneAndDelete({ _id: req.body._id });
91
+ if (!page) {
92
+ return res.status(404).send({ message: "Something wrong when deleting page." });
93
+ }
94
+ res.status(200).send(page);
95
+ } catch (err) {
96
+ res.status(500).send({ message: err.message });
97
+ }
98
+ };
99
+ return {
100
+ create,
101
+ read,
102
+ update,
103
+ delete: deletePage
104
+ };
105
+ };
106
+ var pages_factory = createPageController;
107
+ const controllerFactory = pages_factory;
108
+ var pages_routes = function(app, db, origins, publicPath) {
109
+ const controller = controllerFactory(db);
110
+ app.get(
111
+ "/api/pages/read",
112
+ controller.read
113
+ );
114
+ app.post(
115
+ "/api/pages/create",
116
+ controller.create
117
+ );
118
+ app.put(
119
+ "/api/pages/update",
120
+ controller.update
121
+ );
122
+ app.delete(
123
+ "/api/pages/delete",
124
+ controller.delete
125
+ );
126
+ };
127
+ const ModelPage = page_model;
128
+ const RoutesPage = pages_routes;
129
+ const FactoryPage = pages_factory;
130
+ function initializePages(app, db, origins, publicPath) {
131
+ db.page = ModelPage(db);
132
+ if (app) {
133
+ RoutesPage(app, db);
134
+ }
135
+ }
136
+ var pages_server = {
137
+ initialize: initializePages,
138
+ models: {
139
+ ModelPage
140
+ },
141
+ routes: {
142
+ RoutesPage
143
+ },
144
+ controllers: {
145
+ FactoryPage
146
+ }
147
+ };
148
+ const pages_server$1 = /* @__PURE__ */ getDefaultExportFromCjs(pages_server);
149
+ export {
150
+ pages_server$1 as default
151
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("../Tooltip/Tooltip.vue.cjs"),a={class:"bg-light pd-medium radius-big"},c={key:0,class:"mn-b-small flex-v-center flex-nowrap flex"},s={key:0,class:"mn-r-thin t-medium p-big"},u=["onClick"],d=e.createElementVNode("p",{class:"bg-main radius-small t-center i-medium"},"i",-1),m={key:1,class:"w-100"},h={__name:"Block",props:{title:{type:String,default:null},tooltip:{type:String,default:null},actions:{type:Array,default:null},placeholder:{type:String,default:"Nothing here"},options:{type:Object,default:{theme:"white"}}},setup(t){e.useSlots();const r=(n,o={})=>n?n(o).some(l=>Array.isArray(l.children)?!!l.children.length:l.type!==e.Comment):!1;return(n,o)=>(e.openBlock(),e.createElementBlock("div",a,[t.title||t.actions?(e.openBlock(),e.createElementBlock("div",c,[t.title?(e.openBlock(),e.createElementBlock("p",s,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.actions,l=>(e.openBlock(),e.createElementBlock("button",{onClick:l.function,class:e.normalizeClass(["pd-thin button-delete button",l.class||"bg-main radius-small t-center i-medium"])},e.toDisplayString(l.label),11,u))),256)),t.tooltip?(e.openBlock(),e.createBlock(i.default,{key:1,text:t.tooltip},{default:e.withCtx(()=>[d]),_:1},8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),r(n.$slots.default)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",m,e.toDisplayString(t.placeholder),1)),e.renderSlot(n.$slots,"default")]))}};exports.default=h;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("../Tooltip/Tooltip.vue2.cjs"),a={class:"bg-light pd-medium radius-big"},c={key:0,class:"mn-b-small flex-v-center flex-nowrap flex"},s={key:0,class:"mn-r-thin t-medium p-big"},u=["onClick"],d=e.createElementVNode("p",{class:"bg-main radius-small t-center i-medium"},"i",-1),m={key:1,class:"w-100"},h={__name:"Block",props:{title:{type:String,default:null},tooltip:{type:String,default:null},actions:{type:Array,default:null},placeholder:{type:String,default:"Nothing here"},options:{type:Object,default:{theme:"white"}}},setup(t){e.useSlots();const r=(n,o={})=>n?n(o).some(l=>Array.isArray(l.children)?!!l.children.length:l.type!==e.Comment):!1;return(n,o)=>(e.openBlock(),e.createElementBlock("div",a,[t.title||t.actions?(e.openBlock(),e.createElementBlock("div",c,[t.title?(e.openBlock(),e.createElementBlock("p",s,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.actions,l=>(e.openBlock(),e.createElementBlock("button",{onClick:l.function,class:e.normalizeClass(["pd-thin button-delete button",l.class||"bg-main radius-small t-center i-medium"])},e.toDisplayString(l.label),11,u))),256)),t.tooltip?(e.openBlock(),e.createBlock(i.default,{key:1,text:t.tooltip},{default:e.withCtx(()=>[d]),_:1},8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),r(n.$slots.default)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",m,e.toDisplayString(t.placeholder),1)),e.renderSlot(n.$slots,"default")]))}};exports.default=h;
@@ -1,5 +1,5 @@
1
1
  import { useSlots as c, openBlock as l, createElementBlock as n, toDisplayString as s, createCommentVNode as r, Fragment as u, renderList as d, normalizeClass as m, createBlock as h, withCtx as f, renderSlot as y, createElementVNode as g, Comment as p } from "vue";
2
- import b from "../Tooltip/Tooltip.vue.js";
2
+ import b from "../Tooltip/Tooltip.vue2.js";
3
3
  const k = { class: "bg-light pd-medium radius-big" }, C = {
4
4
  key: 0,
5
5
  class: "mn-b-small flex-v-center flex-nowrap flex"
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),x=require("vue-router"),C=require("../../../icons/placeholders/PlaceholderUserpic.vue.cjs"),V=require("../../../reports/components/sections/FormReport.vue.cjs"),N=require("../../../../components/Tooltip/Tooltip.vue.cjs"),v=require("../../../../components/Dropdown/Dropdown.vue.cjs");;/* empty css */;/* empty css */require("../../../auth/store/auth.cjs");require("../../../organizations/store/memberships.cjs");const $=require("../../../icons/navigation/IconEllipsis.vue.cjs"),S={key:0,class:"pd-b-zero"},z={class:"w-100 flex-v-center flex-nojustify flex"},D={class:"w-100 flex-nowrap flex-v-center flex"},M=["src"],q={key:2,class:"t-semi"},R={key:1,class:"mn-l-micro mn-r-micro"},F={key:2,class:"pos-relative"},P={key:3},T={class:"d-block mn-l-auto flex-nowrap flex flex-v-center"},U={key:0,class:"w-4r pos-relative i-thin"},L={style:{position:"absolute",top:"0px",right:"0px"},class:"br-solid br-2px br-white z-index-1 radius-big i-thin bg-second flex flex-center t-white p-small t-semi"},I=["src"],O={class:"bg-black flex-column flex gap-thin pd-thin radius-small"},j=e.createElementVNode("button",{class:"w-100 bg-black br-solid br-1px br-white-transp-20 t-white button-small button"}," Report ",-1),A=["onClick"],H={__name:"CardHeader",props:["user","entity","entityType","date","dateFormatted","owner","creator","members","membersPhotos","type","actions"],setup(t){x.useRouter();function E(n){const r=new Date,d=new Date(n),m=Math.abs(r-d),u=Math.floor(m/1e3),a=Math.floor(u/60),s=Math.floor(a/60),i=Math.floor(s/24),c=Math.floor(i/7);return c>0?`${c} week${c>1?"s":""} ago`:i>0?`${i} day${i>1?"s":""} ago`:s>0?`${s} hour${s>1?"s":""} ago`:a>0?`${a} minute${a>1?"s":""} ago`:"Just now"}return(n,r)=>{var m,u,a,s,i,c,k,h,g,b,f,y,w,B,p;const d=e.resolveComponent("router-link");return t.owner?(e.openBlock(),e.createElementBlock("header",S,[e.createElementVNode("div",z,[e.createElementVNode("div",D,[((a=(u=(m=t.owner.target)==null?void 0:m.profile)==null?void 0:u.photo)==null?void 0:a.length)>0&&t.type!=="short"?(e.openBlock(),e.createElementBlock("img",{key:0,src:(n.FILE_SERVER_URL||"")+t.owner.target.profile.photo,class:"radius-medium object-fit-cover mn-r-thin i-thin",onClick:r[0]||(r[0]=e.withModifiers(o=>n.$router.push({name:t.owner.type==="user"?"User Profile":"Organization",params:{_id:t.owner.target._id}}),["stop"]))},null,8,M)):e.createCommentVNode("",!0),!((i=(s=t.owner.target)==null?void 0:s.profile)!=null&&i.photo)&&t.type!=="short"?(e.openBlock(),e.createBlock(C.default,{key:1,class:"radius-medium mn-r-thin i-thin",onClick:r[1]||(r[1]=e.withModifiers(o=>n.$router.push({name:t.owner.type==="user"?"User Profile":"Organization",params:{_id:t.owner.target._id}}),["stop"]))})):e.createCommentVNode("",!0),t.type!=="short"?(e.openBlock(),e.createElementBlock("span",q,[e.createElementVNode("span",{onClick:r[2]||(r[2]=e.withModifiers(o=>n.$router.push({name:t.owner.type==="user"?"User Profile":"Organization",params:{_id:t.owner.target._id}}),["stop"]))},e.toDisplayString(((k=(c=t.owner.target)==null?void 0:c.profile)==null?void 0:k.name)||((h=t.creator.target)==null?void 0:h.username)||"Anonymous"),1),!t.creator.hidden&&((b=(g=t.owner.target)==null?void 0:g.profile)==null?void 0:b.name)!==((y=(f=t.creator.target)==null?void 0:f.profile)==null?void 0:y.name)?(e.openBlock(),e.createElementBlock("span",{key:0,onClick:r[3]||(r[3]=e.withModifiers(o=>{var l;return n.$router.push({name:"User Profile",params:{_id:(l=t.creator.target)==null?void 0:l._id}})},["stop"]))}," · by "+e.toDisplayString(((B=(w=t.creator.target)==null?void 0:w.profile)==null?void 0:B.name)||((p=t.creator.target)==null?void 0:p.username)||"Anonymous"),1)):e.createCommentVNode("",!0),t.date?(e.openBlock(),e.createElementBlock("span",R,"·")):e.createCommentVNode("",!0),t.date?(e.openBlock(),e.createElementBlock("span",F,[t.date?(e.openBlock(),e.createBlock(N.default,{key:0,text:n.formatDate(t.date)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(E(t.date)),1)]),_:1},8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),t.dateFormatted?(e.openBlock(),e.createElementBlock("span",P," · "+e.toDisplayString(t.dateFormatted),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",T,[t.members?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("span",L,e.toDisplayString(t.members),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.membersPhotos.slice(0,2),(o,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o?(e.openBlock(),e.createElementBlock("img",{key:l,src:(n.FILE_SERVER_URL||"")+o,style:e.normalizeStyle({position:"absolute",top:"0px",right:l*20+20+"%",zIndex:1-l}),class:"br-solid br-2px br-white i-thin bg-light radius-big"},null,12,I)):(e.openBlock(),e.createBlock(C.default,{key:1,style:e.normalizeStyle({position:"absolute",top:"0px",right:l*20+20+"%",zIndex:1-l}),class:"br-solid br-2px br-white i-thin bg-light radius-big"},null,8,["style"]))],64))),256))])):e.createCommentVNode("",!0)]),t.type!=="short"&&t.user?(e.openBlock(),e.createBlock(v.default,{key:3,label:{component:$.default,class:"t-transp i-regular"},align:"right",class:"cursor-pointer z-index-2"},{default:e.withCtx(()=>[e.createElementVNode("section",O,[t.user!==t.creator.target._id?(e.openBlock(),e.createBlock(V.default,{key:0,user:t.user,type:t.entityType,target:t.entity._id,text:"Report",class:"w-100"},{default:e.withCtx(()=>[j]),_:1},8,["user","type","target"])):e.createCommentVNode("",!0),t.actions&&t.actions.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.actions,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o.to?(e.openBlock(),e.createBlock(d,{key:o.to,to:o.to,class:e.normalizeClass(o.class||"w-100 bg-black br-solid br-1px br-white-transp-20 t-white button-small button")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.label),1)]),_:2},1032,["to","class"])):e.createCommentVNode("",!0),o.method?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:o.method,class:e.normalizeClass(o.class||"w-100 bg-black br-solid br-1px br-white-transp-20 t-white button-small button")},e.toDisplayString(o.label),11,A)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)])]),_:1},8,["label"])):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0)}}};exports.default=H;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),x=require("vue-router"),C=require("../../../icons/placeholders/PlaceholderUserpic.vue.cjs"),V=require("../../../reports/components/sections/FormReport.vue.cjs"),N=require("../../../../components/Tooltip/Tooltip.vue2.cjs"),v=require("../../../../components/Dropdown/Dropdown.vue.cjs");;/* empty css */;/* empty css */require("../../../auth/store/auth.cjs");require("../../../organizations/store/memberships.cjs");const $=require("../../../icons/navigation/IconEllipsis.vue.cjs"),S={key:0,class:"pd-b-zero"},z={class:"w-100 flex-v-center flex-nojustify flex"},D={class:"w-100 flex-nowrap flex-v-center flex"},M=["src"],q={key:2,class:"t-semi"},R={key:1,class:"mn-l-micro mn-r-micro"},F={key:2,class:"pos-relative"},P={key:3},T={class:"d-block mn-l-auto flex-nowrap flex flex-v-center"},U={key:0,class:"w-4r pos-relative i-thin"},L={style:{position:"absolute",top:"0px",right:"0px"},class:"br-solid br-2px br-white z-index-1 radius-big i-thin bg-second flex flex-center t-white p-small t-semi"},I=["src"],O={class:"bg-black flex-column flex gap-thin pd-thin radius-small"},j=e.createElementVNode("button",{class:"w-100 bg-black br-solid br-1px br-white-transp-20 t-white button-small button"}," Report ",-1),A=["onClick"],H={__name:"CardHeader",props:["user","entity","entityType","date","dateFormatted","owner","creator","members","membersPhotos","type","actions"],setup(t){x.useRouter();function E(n){const r=new Date,d=new Date(n),m=Math.abs(r-d),u=Math.floor(m/1e3),a=Math.floor(u/60),s=Math.floor(a/60),i=Math.floor(s/24),c=Math.floor(i/7);return c>0?`${c} week${c>1?"s":""} ago`:i>0?`${i} day${i>1?"s":""} ago`:s>0?`${s} hour${s>1?"s":""} ago`:a>0?`${a} minute${a>1?"s":""} ago`:"Just now"}return(n,r)=>{var m,u,a,s,i,c,k,h,g,b,f,y,w,B,p;const d=e.resolveComponent("router-link");return t.owner?(e.openBlock(),e.createElementBlock("header",S,[e.createElementVNode("div",z,[e.createElementVNode("div",D,[((a=(u=(m=t.owner.target)==null?void 0:m.profile)==null?void 0:u.photo)==null?void 0:a.length)>0&&t.type!=="short"?(e.openBlock(),e.createElementBlock("img",{key:0,src:(n.FILE_SERVER_URL||"")+t.owner.target.profile.photo,class:"radius-medium object-fit-cover mn-r-thin i-thin",onClick:r[0]||(r[0]=e.withModifiers(o=>n.$router.push({name:t.owner.type==="user"?"User Profile":"Organization",params:{_id:t.owner.target._id}}),["stop"]))},null,8,M)):e.createCommentVNode("",!0),!((i=(s=t.owner.target)==null?void 0:s.profile)!=null&&i.photo)&&t.type!=="short"?(e.openBlock(),e.createBlock(C.default,{key:1,class:"radius-medium mn-r-thin i-thin",onClick:r[1]||(r[1]=e.withModifiers(o=>n.$router.push({name:t.owner.type==="user"?"User Profile":"Organization",params:{_id:t.owner.target._id}}),["stop"]))})):e.createCommentVNode("",!0),t.type!=="short"?(e.openBlock(),e.createElementBlock("span",q,[e.createElementVNode("span",{onClick:r[2]||(r[2]=e.withModifiers(o=>n.$router.push({name:t.owner.type==="user"?"User Profile":"Organization",params:{_id:t.owner.target._id}}),["stop"]))},e.toDisplayString(((k=(c=t.owner.target)==null?void 0:c.profile)==null?void 0:k.name)||((h=t.creator.target)==null?void 0:h.username)||"Anonymous"),1),!t.creator.hidden&&((b=(g=t.owner.target)==null?void 0:g.profile)==null?void 0:b.name)!==((y=(f=t.creator.target)==null?void 0:f.profile)==null?void 0:y.name)?(e.openBlock(),e.createElementBlock("span",{key:0,onClick:r[3]||(r[3]=e.withModifiers(o=>{var l;return n.$router.push({name:"User Profile",params:{_id:(l=t.creator.target)==null?void 0:l._id}})},["stop"]))}," · by "+e.toDisplayString(((B=(w=t.creator.target)==null?void 0:w.profile)==null?void 0:B.name)||((p=t.creator.target)==null?void 0:p.username)||"Anonymous"),1)):e.createCommentVNode("",!0),t.date?(e.openBlock(),e.createElementBlock("span",R,"·")):e.createCommentVNode("",!0),t.date?(e.openBlock(),e.createElementBlock("span",F,[t.date?(e.openBlock(),e.createBlock(N.default,{key:0,text:n.formatDate(t.date)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(E(t.date)),1)]),_:1},8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),t.dateFormatted?(e.openBlock(),e.createElementBlock("span",P," · "+e.toDisplayString(t.dateFormatted),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",T,[t.members?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("span",L,e.toDisplayString(t.members),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.membersPhotos.slice(0,2),(o,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o?(e.openBlock(),e.createElementBlock("img",{key:l,src:(n.FILE_SERVER_URL||"")+o,style:e.normalizeStyle({position:"absolute",top:"0px",right:l*20+20+"%",zIndex:1-l}),class:"br-solid br-2px br-white i-thin bg-light radius-big"},null,12,I)):(e.openBlock(),e.createBlock(C.default,{key:1,style:e.normalizeStyle({position:"absolute",top:"0px",right:l*20+20+"%",zIndex:1-l}),class:"br-solid br-2px br-white i-thin bg-light radius-big"},null,8,["style"]))],64))),256))])):e.createCommentVNode("",!0)]),t.type!=="short"&&t.user?(e.openBlock(),e.createBlock(v.default,{key:3,label:{component:$.default,class:"t-transp i-regular"},align:"right",class:"cursor-pointer z-index-2"},{default:e.withCtx(()=>[e.createElementVNode("section",O,[t.user!==t.creator.target._id?(e.openBlock(),e.createBlock(V.default,{key:0,user:t.user,type:t.entityType,target:t.entity._id,text:"Report",class:"w-100"},{default:e.withCtx(()=>[j]),_:1},8,["user","type","target"])):e.createCommentVNode("",!0),t.actions&&t.actions.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.actions,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o.to?(e.openBlock(),e.createBlock(d,{key:o.to,to:o.to,class:e.normalizeClass(o.class||"w-100 bg-black br-solid br-1px br-white-transp-20 t-white button-small button")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.label),1)]),_:2},1032,["to","class"])):e.createCommentVNode("",!0),o.method?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:o.method,class:e.normalizeClass(o.class||"w-100 bg-black br-solid br-1px br-white-transp-20 t-white button-small button")},e.toDisplayString(o.label),11,A)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)])]),_:1},8,["label"])):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0)}}};exports.default=H;
@@ -2,7 +2,7 @@ import { resolveComponent as S, openBlock as t, createElementBlock as s, createE
2
2
  import { useRouter as T } from "vue-router";
3
3
  import V from "../../../icons/placeholders/PlaceholderUserpic.vue.js";
4
4
  import A from "../../../reports/components/sections/FormReport.vue.js";
5
- import B from "../../../../components/Tooltip/Tooltip.vue.js";
5
+ import B from "../../../../components/Tooltip/Tooltip.vue2.js";
6
6
  import N from "../../../../components/Dropdown/Dropdown.vue.js";
7
7
  /* empty css */
8
8
  /* empty css */
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function g(){const m=t=>t?(t.includes("ROLE_ADMIN")?t.includes("ROLE_ADMIN"):!1)===!0:!1,y=(t,l,s,i)=>{const r=i.find(a=>a.organization===t);if(!r)return!1;const n=r.rights[l];return n?n[s]===!0:!1},u=()=>"฿",d=t=>{const l=u();return`${t.toFixed(2).replace(".",",").replace(/\B(?=(\d{3})+(?!\d))/g," ")} ${l}`},f=(t,l={})=>{var s=new Date(t),i=s.getFullYear().toString(),e=(s.getMonth()+1).toString(),r=s.getDate().toString(),n=s.getHours().toString(),a=s.getMinutes().toString(),c={dateOnly:l.dateOnly||!1,timeOnly:l.timeOnly||!1,dayMonth:l.dayMonth||!1,dayTime:l.dayTime||!1,monthYear:l.monthYear||!1,yearOnly:l.yearOnly||!1,custom:l.custom||""};return c.dateOnly?i+"."+(e[1]?e:"0"+e[0])+"."+(r[1]?r:"0"+r[0]):c.timeOnly?(n[1]?n:"0"+n[0])+":"+(a[1]?a:"0"+a[0]):c.dayMonth?(r[1]?r:"0"+r[0])+"."+(e[1]?e:"0"+e[0]):c.dayTime?(r[1]?r:"0"+r[0])+" в "+(n[1]?n:"0"+n[0])+":"+(a[1]?a:"0"+a[0]):c.monthYear?(e[1]?e:"0"+e[0])+"."+i:c.yearOnly?i:c.custom?c.custom.replace("yyyy",i).replace("mm",e[1]?e:"0"+e[0]).replace("dd",r[1]?r:"0"+r[0]).replace("hh",n[1]?n:"0"+n[0]).replace("min",a[1]?a:"0"+a[0]):(n[1]?n:"0"+n[0])+":"+(a[1]?a:"0"+a[0])+", "+i+"."+(e[1]?e:"0"+e[0])+"."+(r[1]?r:"0"+r[0])},o=t=>(t||(t=""),t.toLowerCase().replace(/ /g,"-").replace(/[^a-z0-9-]/g,""));return{isAdmin:m,hasAccess:y,returnCurrency:u,formatPrice:d,formatDate:f,normalizeUrlParam:o,joinArrayToUrl:t=>t.join("/"),getMarketplaceLink:(t,l,s,i)=>{let e=l?o(l):"",r=s?o(s):"",n=i?o(i):"",a="/marketplace";return a+=e?`/${e}`:"",a+=e&&r?`/${r}`:"",a+=e&&r&&n?`/${n}`:"",t&&t.length&&(a+=`?categories=${t.join(",")}`),a},getSpotsLink:(t,l,s)=>{let i=t?o(t):"",e=l?o(l):"",r=s?o(s):"",n="/spots";return n+=i?`/${i}`:"",n+=i&&e?`/${e}`:"",n+=i&&e&&r?`/${r}`:"",n}}}exports.useGlobalMixins=g;
@@ -0,0 +1,43 @@
1
+ function O() {
2
+ const m = (t) => t ? (t.includes("ROLE_ADMIN") ? t.includes("ROLE_ADMIN") : !1) === !0 : !1, y = (t, l, s, i) => {
3
+ const r = i.find((a) => a.organization === t);
4
+ if (!r)
5
+ return !1;
6
+ const n = r.rights[l];
7
+ return n ? n[s] === !0 : !1;
8
+ }, u = () => "฿", f = (t) => {
9
+ const l = u();
10
+ return `${t.toFixed(2).replace(".", ",").replace(/\B(?=(\d{3})+(?!\d))/g, " ")} ${l}`;
11
+ }, d = (t, l = {}) => {
12
+ var s = new Date(t), i = s.getFullYear().toString(), e = (s.getMonth() + 1).toString(), r = s.getDate().toString(), n = s.getHours().toString(), a = s.getMinutes().toString(), c = {
13
+ dateOnly: l.dateOnly || !1,
14
+ timeOnly: l.timeOnly || !1,
15
+ dayMonth: l.dayMonth || !1,
16
+ dayTime: l.dayTime || !1,
17
+ monthYear: l.monthYear || !1,
18
+ yearOnly: l.yearOnly || !1,
19
+ custom: l.custom || ""
20
+ };
21
+ return c.dateOnly ? i + "." + (e[1] ? e : "0" + e[0]) + "." + (r[1] ? r : "0" + r[0]) : c.timeOnly ? (n[1] ? n : "0" + n[0]) + ":" + (a[1] ? a : "0" + a[0]) : c.dayMonth ? (r[1] ? r : "0" + r[0]) + "." + (e[1] ? e : "0" + e[0]) : c.dayTime ? (r[1] ? r : "0" + r[0]) + " в " + (n[1] ? n : "0" + n[0]) + ":" + (a[1] ? a : "0" + a[0]) : c.monthYear ? (e[1] ? e : "0" + e[0]) + "." + i : c.yearOnly ? i : c.custom ? c.custom.replace("yyyy", i).replace("mm", e[1] ? e : "0" + e[0]).replace("dd", r[1] ? r : "0" + r[0]).replace("hh", n[1] ? n : "0" + n[0]).replace("min", a[1] ? a : "0" + a[0]) : (n[1] ? n : "0" + n[0]) + ":" + (a[1] ? a : "0" + a[0]) + ", " + i + "." + (e[1] ? e : "0" + e[0]) + "." + (r[1] ? r : "0" + r[0]);
22
+ }, o = (t) => (t || (t = ""), t.toLowerCase().replace(/ /g, "-").replace(/[^a-z0-9-]/g, ""));
23
+ return {
24
+ isAdmin: m,
25
+ hasAccess: y,
26
+ returnCurrency: u,
27
+ formatPrice: f,
28
+ formatDate: d,
29
+ normalizeUrlParam: o,
30
+ joinArrayToUrl: (t) => t.join("/"),
31
+ getMarketplaceLink: (t, l, s, i) => {
32
+ let e = l ? o(l) : "", r = s ? o(s) : "", n = i ? o(i) : "", a = "/marketplace";
33
+ return a += e ? `/${e}` : "", a += e && r ? `/${r}` : "", a += e && r && n ? `/${n}` : "", t && t.length && (a += `?categories=${t.join(",")}`), a;
34
+ },
35
+ getSpotsLink: (t, l, s) => {
36
+ let i = t ? o(t) : "", e = l ? o(l) : "", r = s ? o(s) : "", n = "/spots";
37
+ return n += i ? `/${i}` : "", n += i && e ? `/${e}` : "", n += i && e && r ? `/${r}` : "", n;
38
+ }
39
+ };
40
+ }
41
+ export {
42
+ O as useGlobalMixins
43
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),g=require("vue-router"),m=require("../../../../components/Feed/Feed.vue.cjs");;/* empty css */;/* empty css */const M=require("../../../../components/Popup/Popup.vue2.cjs"),N=require("../../../globals/components/sections/SectionPageTitle.vue.cjs"),z=require("../sections/MembersAdd.vue.cjs");;/* empty css */require("../../../../components/Menu/MenuItem.vue.cjs");const _=require("../../../users/components/blocks/CardUser.vue.cjs"),P=require("../blocks/CardDepartment.vue.cjs"),k=require("../../../icons/navigation/IconDelete.vue.cjs"),p=require("../../../auth/store/auth.cjs"),w=require("../../../globals/store/globals.cjs"),f=require("../../store/invites.cjs"),b=require("../../store/memberships.cjs"),y=require("../../store/organizations.cjs"),v=require("../../store/departments.cjs"),V={class:"pd-thin"},I={key:2,class:"cols-1 gap-thin"},A={key:3},F={__name:"Members",setup(S){const o=g.useRoute();g.useRouter();const d=e.ref(null),i=e.ref("members"),l=e.ref([]),c=e.ref(!1);function B(){c.value=!0}function h(){c.value=!1}e.onMounted(async()=>{d.value=(await y.actions.read({_id:o.params._id,user:p.state.user._id}))[0]}),e.computed(()=>{const n=v.state.departments,a=n.flatMap(s=>s.subdepartments.map(t=>t._id));return n.filter(s=>!a.includes(s._id))});async function C(n,a,s){try{const t=await f.actions.create({owner:{type:"Organization",target:d.value._id},creator:{type:"User",target:p.state.user._id},invites:n});for(let r of t.createdInvites)w.actions.add(l.value,r);h(),a()}catch(t){s(t)}}async function q(n,a){confirm("Confirm remove of member")==!0&&(b.state.memberships.splice(n,1),await b.actions.delete(a))}async function x(n,a){confirm("Confirm remove of member")==!0&&(w.actions.delete(l.value,a),await f.actions.delete(a._id))}return(n,a)=>{const s=e.resolveComponent("router-link");return e.openBlock(),e.createElementBlock("div",V,[e.createVNode(N.default,{title:"Members","onUpdate:tabs_current":a[0]||(a[0]=t=>i.value=t),tabs_current:i.value,tabs:[{name:`Members (${y.state.current.numberOfMembers||0})`,value:"members"},{name:"Departments",value:"departments"},{name:"Invites",value:"invites"}],actions:[{method:B,label:"Invite members"}],class:"mn-b-small bg-light bg-light radius-big"},null,8,["tabs_current","tabs","actions"]),e.createVNode(M.default,{title:"Add members",onClosePopup:h,isPopupOpen:c.value,class:"bg-white w-min-30r w-max-30r radius-big pd-medium"},{default:e.withCtx(()=>[e.createVNode(z.default,{text:"Please enter your email or phone number to send an invitation link:",organization:d.value,onSendInvite:C},null,8,["organization"])]),_:1},8,["isPopupOpen"]),i.value==="departments"?(e.openBlock(),e.createBlock(m.default,{key:0,states:{empty:{title:"No Departments Found",description:"Currently, there are no departments available.",action:"Add department",callback:()=>n.$router.push(`/organizations/${e.unref(o).params._id}/departments/create`)}},store:{read:t=>v.actions.read(t),state:null},options:{organization:e.unref(o).params._id,user:p.state.user._id}},{default:e.withCtx(({items:t})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t,(r,u)=>(e.openBlock(),e.createBlock(P.default,{key:u,department:r,organization:e.unref(o).params._id,class:"radius-semi bg-light pos-relative mn-b-thin"},null,8,["department","organization"]))),128))]),_:1},8,["states","store","options"])):e.createCommentVNode("",!0),i.value==="departments"&&v.state.departments.length>0?(e.openBlock(),e.createBlock(s,{key:1,to:{path:`/organizations/${e.unref(o).params._id}/departments/create`},class:"d-block flex-center flex uppercase t-semi bg-main w-100 pd-small radius-extra"},{default:e.withCtx(()=>[e.createTextVNode(" Add department ")]),_:1},8,["to"])):e.createCommentVNode("",!0),i.value==="members"?(e.openBlock(),e.createElementBlock("div",I,[e.createVNode(m.default,{search:!0,states:{empty:{title:"No Members Found",description:"Currently, there are no members."}},store:{read:t=>b.actions.read(t)},options:{target:e.unref(o).params._id,role:["member","owner"]},class:"gap-thin cols-1"},{default:e.withCtx(({items:t})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t,(r,u)=>(e.openBlock(),e.createBlock(_.default,{key:u,user:r,_id:r.user._id,photo:r.user.profile.photo,phone:r.user.phone,email:r.user.email,name:r.user.profile.name||"No name",role:r.label||r.role,onClick:$=>n.$router.push(`/profile/${r.user._id}`),action:r.role!=="owner"?{label:{is:k.default,props:{class:"i-medium",fill:"rgb(var(--white)"}},method:()=>q(u,r)}:null,class:"h-4r w-100 bg-light radius-big flex-nowrap flex pd-medium"},null,8,["user","_id","photo","phone","email","name","role","onClick","action"]))),128))]),_:1},8,["store","options"])])):e.createCommentVNode("",!0),i.value==="invites"?(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(m.default,{items:l.value,"onUpdate:items":a[1]||(a[1]=t=>l.value=t),states:{empty:{title:"No Invites Found",description:"Currently, there are no members."}},store:{read:t=>f.actions.read(t)},options:{owner:e.unref(o).params._id},class:"gap-thin cols-1"},{default:e.withCtx(({items:t})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t,r=>(e.openBlock(),e.createBlock(_.default,{key:n.index,user:{type:"invite"},name:r.email||r.phone,role:r.status,action:{label:{is:k.default,props:{class:"i-medium",fill:"rgb(var(--white)"}},method:()=>x(n.index,r)},class:"h-4r w-100 bg-light radius-big flex-nowrap flex pd-medium"},null,8,["name","role","action"]))),128))]),_:1},8,["items","store","options"])])):e.createCommentVNode("",!0)])}}};exports.default=F;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),g=require("vue-router"),m=require("../../../../components/Feed/Feed.vue.cjs");;/* empty css */;/* empty css */const M=require("../../../../components/Popup/Popup.vue2.cjs"),N=require("../../../globals/components/sections/SectionPageTitle.vue.cjs"),z=require("../sections/MembersAdd.vue.cjs");;/* empty css */require("../../../../components/Menu/MenuItem.vue.cjs");const _=require("../../../users/components/blocks/CardUser.vue.cjs"),P=require("../blocks/CardDepartment.vue.cjs"),k=require("../../../icons/navigation/IconDelete.vue.cjs"),p=require("../../../auth/store/auth.cjs"),w=require("../../../globals/store/globals.cjs"),f=require("../../store/invites.cjs"),b=require("../../store/memberships.cjs"),y=require("../../store/organizations.cjs"),v=require("../../store/departments.cjs"),V={class:"pd-thin"},I={key:2,class:"cols-1 gap-thin"},A={key:3},F={__name:"Members",setup(S){const o=g.useRoute();g.useRouter();const d=e.ref(null),i=e.ref("members"),l=e.ref([]),c=e.ref(!1);function B(){c.value=!0}function h(){c.value=!1}e.onMounted(async()=>{d.value=(await y.actions.read({_id:o.params._id,user:p.state.user._id}))[0]}),e.computed(()=>{const n=v.state.departments,a=n.flatMap(s=>s.subdepartments.map(t=>t._id));return n.filter(s=>!a.includes(s._id))});async function C(n,a,s){try{const t=await f.actions.create({owner:{type:"Organization",target:d.value._id},creator:{type:"User",target:p.state.user._id},invites:n});for(let r of t.createdInvites)w.actions.add(l.value,r);h(),a()}catch(t){s(t)}}async function q(n,a){confirm("Confirm remove of member")==!0&&(b.state.memberships.splice(n,1),await b.actions.delete(a))}async function x(n,a){confirm("Confirm remove of member")==!0&&(w.actions.delete(l.value,a),await f.actions.delete(a._id))}return(n,a)=>{const s=e.resolveComponent("router-link");return e.openBlock(),e.createElementBlock("div",V,[e.createVNode(N.default,{title:"Members","onUpdate:tabs_current":a[0]||(a[0]=t=>i.value=t),tabs_current:i.value,tabs:[{name:`Members (${y.state.current.numberOfMembers||0})`,value:"members"},{name:"Departments",value:"departments"},{name:"Invites",value:"invites"}],actions:[{method:B,label:"Invite members"}],class:"mn-b-small bg-light bg-light radius-big"},null,8,["tabs_current","tabs","actions"]),e.createVNode(M.default,{title:"Add members",onClosePopup:h,isPopupOpen:c.value,class:"bg-white w-min-30r w-max-30r radius-big pd-medium"},{default:e.withCtx(()=>[e.createVNode(z.default,{text:"Please enter your email or phone number to send an invitation link:",organization:d.value,onSendInvite:C},null,8,["organization"])]),_:1},8,["isPopupOpen"]),i.value==="departments"?(e.openBlock(),e.createBlock(m.default,{key:0,states:{empty:{title:"No Departments Found",description:"Currently, there are no departments available.",action:"Add department",callback:()=>n.$router.push(`/organizations/${e.unref(o).params._id}/departments/create`)}},store:{read:t=>v.actions.read(t),state:null},options:{organization:e.unref(o).params._id,user:p.state.user._id}},{default:e.withCtx(({items:t})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t,(r,u)=>(e.openBlock(),e.createBlock(P.default,{key:u,department:r,organization:e.unref(o).params._id,class:"radius-semi bg-light pos-relative mn-b-thin"},null,8,["department","organization"]))),128))]),_:1},8,["states","store","options"])):e.createCommentVNode("",!0),i.value==="departments"&&v.state.departments.length>0?(e.openBlock(),e.createBlock(s,{key:1,to:{path:`/organizations/${e.unref(o).params._id}/departments/create`},class:"d-block flex-center flex uppercase t-semi bg-main w-100 pd-small radius-extra"},{default:e.withCtx(()=>[e.createTextVNode(" Add department ")]),_:1},8,["to"])):e.createCommentVNode("",!0),i.value==="members"?(e.openBlock(),e.createElementBlock("div",I,[e.createVNode(m.default,{search:!0,states:{empty:{title:"No Members Found",description:"Currently, there are no members."}},store:{read:t=>b.actions.read(t)},options:{target:e.unref(o).params._id,role:["member","owner"]},class:"gap-thin cols-1"},{default:e.withCtx(({items:t})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t,(r,u)=>(e.openBlock(),e.createBlock(_.default,{key:u,user:r,_id:r.user._id,photo:r.user.profile.photo,phone:r.user.phone,email:r.user.email,name:r.user.profile.name||"No name",role:r.label||r.role,onClick:$=>n.$router.push(`/profile/${r.user._id}`),action:r.role!=="owner"?{label:{is:k.default,props:{class:"i-medium",fill:"rgb(var(--white)"}},method:()=>q(u,r)}:null,class:"h-4r w-100 bg-light radius-big flex-nowrap flex pd-medium"},null,8,["user","_id","photo","phone","email","name","role","onClick","action"]))),128))]),_:1},8,["store","options"])])):e.createCommentVNode("",!0),i.value==="invites"?(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(m.default,{items:l.value,"onUpdate:items":a[1]||(a[1]=t=>l.value=t),states:{empty:{title:"No Invites Found",description:"Currently, there are no members."}},store:{read:t=>f.actions.read(t)},options:{owner:e.unref(o).params._id},class:"gap-thin cols-1"},{default:e.withCtx(({items:t})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t,r=>(e.openBlock(),e.createBlock(_.default,{key:n.index,user:{type:"invite"},name:r.email||r.phone,role:r.status,action:{label:{is:k.default,props:{class:"i-medium",fill:"rgb(var(--white)"}},method:()=>x(n.index,r)},class:"h-4r w-100 bg-light radius-big flex-nowrap flex pd-medium"},null,8,["name","role","action"]))),128))]),_:1},8,["items","store","options"])])):e.createCommentVNode("",!0)])}}};exports.default=F;
@@ -2,7 +2,7 @@ import { ref as _, onMounted as F, computed as S, resolveComponent as B, openBlo
2
2
  import { useRoute as V, useRouter as R } from "vue-router";
3
3
  import $ from "../../../../components/Feed/Feed.vue.js";
4
4
  /* empty css */
5
- /* empty css */
5
+ /* empty css */
6
6
  import E from "../../../../components/Popup/Popup.vue2.js";
7
7
  import L from "../../../globals/components/sections/SectionPageTitle.vue.js";
8
8
  import T from "../sections/MembersAdd.vue.js";
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./views/store/pages.cjs"),u=require("./views/router/pages.router.cjs"),d=require("./views/router/pages.backoffice.router.cjs"),g=require("./views/components/pages/Pages.vue.cjs"),n=require("./views/components/pages/Page.vue.cjs"),f=require("./views/components/pages/PageEdit.vue.cjs");function l(p,s,e,t={}){var o,a;const i=((o=t.route)==null?void 0:o.home)||"Home",c=((a=t.route)==null?void 0:a.backoffice)||"Backoffice Root";e.addRoute(i,u.default),e.addRoute(c,d.default),s.addStore("pages",r)}const P={initialize:l,views:{store:{storePages:r},router:{routerPages:u.default},components:{Pages:g.default,Page:n.default,PageEdit:f.default}}};exports.default=P;
@@ -0,0 +1,31 @@
1
+ import * as r from "./views/store/pages.js";
2
+ import i from "./views/router/pages.router.js";
3
+ import p from "./views/router/pages.backoffice.router.js";
4
+ import c from "./views/components/pages/Pages.vue.js";
5
+ import g from "./views/components/pages/Page.vue.js";
6
+ import n from "./views/components/pages/PageEdit.vue.js";
7
+ function u(d, s, o, e = {}) {
8
+ var t, a;
9
+ const m = ((t = e.route) == null ? void 0 : t.home) || "Home", f = ((a = e.route) == null ? void 0 : a.backoffice) || "Backoffice Root";
10
+ o.addRoute(m, i), o.addRoute(f, p), s.addStore("pages", r);
11
+ }
12
+ const k = {
13
+ initialize: u,
14
+ views: {
15
+ store: {
16
+ storePages: r
17
+ },
18
+ router: {
19
+ routerPages: i
20
+ },
21
+ components: {
22
+ // Pages
23
+ Pages: c,
24
+ Page: g,
25
+ PageEdit: n
26
+ }
27
+ }
28
+ };
29
+ export {
30
+ k as default
31
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),d=require("../../../../icons/navigation/IconEdit.vue.cjs"),m=require("../../../../icons/navigation/IconAdd.vue.cjs");;/* empty css */;/* empty css */;/* empty css */const g=require("vue-router");;/* empty css */const h={class:"flex flex-nowrap gap-thin card-page-title"},f={key:0,class:"mn-l-small br-t br-solid br-black-transp-10"},p={__name:"CardPage",props:{page:{type:Object,required:!0},hasAdminRights:{type:Boolean,default:!1},showChildren:{type:Boolean,default:!0}},emits:["createPage"],setup(t,{emit:i}){const l=g.useRouter(),c=i;e.ref({show:!1,name:null});async function n(a){c("createPage",a)}return(a,o)=>{const s=e.resolveComponent("router-link"),u=e.resolveComponent("CardPage",!0);return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{class:e.normalizeClass(a.$attrs.class)},[e.createElementVNode("div",h,[e.createVNode(s,{to:e.unref(l).resolve({name:"Page",params:{url:t.page.url.split("/")}}).href,class:e.normalizeClass(["z-index-2 cursor-pointer mn-r-auto t-truncate",{"t-main":a.$route.params.url&&t.page.url===a.joinArrayToUrl(a.$route.params.url)}])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.page.name),1)]),_:1},8,["to","class"]),t.hasAdminRights?(e.openBlock(),e.createBlock(s,{key:0,to:e.unref(l).resolve({name:"Backoffice Pages Edit",params:{url:t.page.url.split("/")}}).href,class:"z-index-2 cursor-pointer card-page-actions radius-extra pd-micro bg-second"},{default:e.withCtx(()=>[e.createVNode(d.default,{class:"i-small",classes:"fill-white"})]),_:1},8,["to"])):e.createCommentVNode("",!0),t.hasAdminRights?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:o[0]||(o[0]=r=>n(t.page)),class:"z-index-2 cursor-pointer card-page-actions radius-extra pd-micro bg-second"},[e.createVNode(m.default,{class:"i-small",fill:"white"})])):e.createCommentVNode("",!0)])],2),t.page.children&&t.page.children.length>0&&t.page.children[0].url&&t.showChildren?(e.openBlock(),e.createElementBlock("div",f,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.page.children,r=>(e.openBlock(),e.createBlock(u,{onCreatePage:n,key:r.url,page:r,hasAdminRights:t.hasAdminRights,class:e.normalizeClass(a.$attrs.class)},null,8,["page","hasAdminRights","class"]))),128))])):e.createCommentVNode("",!0)])}}};exports.default=p;
@@ -0,0 +1,98 @@
1
+ import { ref as b, resolveComponent as d, openBlock as t, createElementBlock as r, createElementVNode as g, normalizeClass as l, createVNode as n, unref as h, withCtx as f, createTextVNode as v, toDisplayString as P, createBlock as p, createCommentVNode as i, Fragment as w, renderList as A } from "vue";
2
+ import R from "../../../../icons/navigation/IconEdit.vue.js";
3
+ import $ from "../../../../icons/navigation/IconAdd.vue.js";
4
+ /* empty css */
5
+ /* empty css */
6
+ /* empty css */
7
+ import { useRouter as x } from "vue-router";
8
+ /* empty css */
9
+ const B = { class: "flex flex-nowrap gap-thin card-page-title" }, z = {
10
+ key: 0,
11
+ class: "mn-l-small br-t br-solid br-black-transp-10"
12
+ }, L = {
13
+ __name: "CardPage",
14
+ props: {
15
+ page: {
16
+ type: Object,
17
+ required: !0
18
+ },
19
+ hasAdminRights: {
20
+ type: Boolean,
21
+ default: !1
22
+ },
23
+ showChildren: {
24
+ type: Boolean,
25
+ default: !0
26
+ }
27
+ },
28
+ emits: [
29
+ "createPage"
30
+ ],
31
+ setup(e, { emit: k }) {
32
+ const o = x(), C = k;
33
+ b({
34
+ show: !1,
35
+ name: null
36
+ });
37
+ async function c(a) {
38
+ C("createPage", a);
39
+ }
40
+ return (a, m) => {
41
+ const u = d("router-link"), y = d("CardPage", !0);
42
+ return t(), r("div", null, [
43
+ g("div", {
44
+ class: l(a.$attrs.class)
45
+ }, [
46
+ g("div", B, [
47
+ n(u, {
48
+ to: h(o).resolve({ name: "Page", params: { url: e.page.url.split("/") } }).href,
49
+ class: l(["z-index-2 cursor-pointer mn-r-auto t-truncate", {
50
+ "t-main": a.$route.params.url && e.page.url === a.joinArrayToUrl(a.$route.params.url)
51
+ }])
52
+ }, {
53
+ default: f(() => [
54
+ v(P(e.page.name), 1)
55
+ ]),
56
+ _: 1
57
+ }, 8, ["to", "class"]),
58
+ e.hasAdminRights ? (t(), p(u, {
59
+ key: 0,
60
+ to: h(o).resolve({ name: "Backoffice Pages Edit", params: { url: e.page.url.split("/") } }).href,
61
+ class: "z-index-2 cursor-pointer card-page-actions radius-extra pd-micro bg-second"
62
+ }, {
63
+ default: f(() => [
64
+ n(R, {
65
+ class: "i-small",
66
+ classes: "fill-white"
67
+ })
68
+ ]),
69
+ _: 1
70
+ }, 8, ["to"])) : i("", !0),
71
+ e.hasAdminRights ? (t(), r("button", {
72
+ key: 1,
73
+ onClick: m[0] || (m[0] = (s) => c(e.page)),
74
+ class: "z-index-2 cursor-pointer card-page-actions radius-extra pd-micro bg-second"
75
+ }, [
76
+ n($, {
77
+ class: "i-small",
78
+ fill: "white"
79
+ })
80
+ ])) : i("", !0)
81
+ ])
82
+ ], 2),
83
+ e.page.children && e.page.children.length > 0 && e.page.children[0].url && e.showChildren ? (t(), r("div", z, [
84
+ (t(!0), r(w, null, A(e.page.children, (s) => (t(), p(y, {
85
+ onCreatePage: c,
86
+ key: s.url,
87
+ page: s,
88
+ hasAdminRights: e.hasAdminRights,
89
+ class: l(a.$attrs.class)
90
+ }, null, 8, ["page", "hasAdminRights", "class"]))), 128))
91
+ ])) : i("", !0)
92
+ ]);
93
+ };
94
+ }
95
+ };
96
+ export {
97
+ L as default
98
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("vue-router"),N=require("vue-i18n"),V=require("../../../../constructor/components/sections/Viewer.vue.cjs"),r=require("../blocks/CardPage.vue.cjs"),g=require("../../store/pages.cjs"),w=require("../../../../auth/store/auth.cjs"),B=require("../../../../globals/mixins/mixins.cjs"),E={key:0,style:{overflow:"clip"},class:"bg-light pos-relative"},y={class:"pd-medium pos-sticky mobile-only z-index-1 pos-t-0 bg-light w-100 br-b br-solid br-black-transp-10"},P={key:0,class:"z-index-0 pos-relative"},x={class:"transition-ease-in-out w-100 bg-light"},C={key:1,class:"cols-2-1_3 h-100 bg-light z-index-0 pos-relative"},R={key:0,class:"desktop-only h-100 bg-white o-scroll z-index-0 pos-relative"},q={class:"transition-ease-in-out w-100 bg-light"},M={class:"o-scroll pd-medium"},A={class:"gap-thin cols-2"},z={key:0,class:"bg-white pd-medium mn-b-thin radius-semi"},I=e.createElementVNode("h4",{class:"mn-b-small"},"Read Previous",-1),S={key:1,class:"bg-white pd-medium mn-b-thin radius-semi"},T=e.createElementVNode("h4",{class:"mn-b-small pd-micro"},"Table of Contents",-1),j={key:2,class:"bg-white pd-medium mn-b-thin radius-semi"},F=e.createElementVNode("h4",{class:"mn-b-small"},"Read Next",-1),O={__name:"Page",setup(U){const i=e.ref(!1);function p(){i.value=!i.value}function v(t){const l=[];function s(d,k=null){for(const u of d)l.push({...u,parent:k}),u.children.length>0&&s(u.children,u)}return s(t.children),l}const c=e.computed(()=>v(a.value)),o=e.computed(()=>{if(n.value._id===a.value._id)return{children:n.value.children,previousPage:null,nextPage:null};const t=c.value.findIndex(d=>d._id===n.value._id),l=t>0?c.value[t-1]:a.value,s=t<c.value.length-1?c.value[t+1]:null;return{previousPage:l,nextPage:s,children:[]}}),{normalizeUrlParam:D,joinArrayToUrl:_,isAdmin:b}=B.useGlobalMixins(),m=e.computed(()=>b(w.state.access.roles));N.useI18n();const h=f.useRoute(),a=e.ref(null),n=e.ref(null);return e.onMounted(async()=>{let t=h.params.url;t.length>0&&(t=t[0]),a.value=await g.actions.read({url:t});let l=h.params.url;l.length>0&&(l=_(l)),n.value=await g.actions.read({url:l})}),(t,l)=>n.value&&n.value.content?(e.openBlock(),e.createElementBlock("div",E,[e.createElementVNode("div",y,[e.createElementVNode("button",{onClick:p,class:"cursor-pointer"},e.toDisplayString(i.value===!1?"Show Menu":"Hide Menu"),1)]),i.value?(e.openBlock(),e.createElementBlock("div",P,[e.createElementVNode("ul",x,[e.createVNode(r.default,{page:a.value,hasAdminRights:m.value,class:"pd-thin"},null,8,["page","hasAdminRights"])])])):e.createCommentVNode("",!0),i.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",C,[a.value.url!==n.value.url?(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("ul",q,[e.createVNode(r.default,{page:a.value,hasAdminRights:m.value,class:"bg-white pd-thin"},null,8,["page","hasAdminRights"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",M,[e.createVNode(V.default,{content:n.value.content,class:""},null,8,["content"]),e.createElementVNode("div",A,[o.value.previousPage?(e.openBlock(),e.createElementBlock("div",z,[I,e.createVNode(r.default,{page:o.value.previousPage,showChildren:!1,class:"h3 t-main bg-white mn-b-thin radius-semi"},null,8,["page"])])):e.createCommentVNode("",!0),o.value.children.length>0?(e.openBlock(),e.createElementBlock("div",S,[T,(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value.children,s=>(e.openBlock(),e.createBlock(r.default,{key:s.id,page:s,class:"bg-white pd-micro radius-semi"},null,8,["page"]))),128))])):e.createCommentVNode("",!0),o.value.nextPage?(e.openBlock(),e.createElementBlock("div",j,[F,e.createVNode(r.default,{page:o.value.nextPage,class:"h3 t-main bg-white mn-b-thin radius-semi",showChildren:!1},null,8,["page"])])):e.createCommentVNode("",!0)])])]))])):e.createCommentVNode("",!0)}};exports.default=O;