@ozdao/prometheus-framework 0.2.50 → 0.2.51

Sign up to get free protection for your applications and to get access to all the features.
@@ -429,23 +429,29 @@ const ObjectId$1 = require$$0.Types.ObjectId;
429
429
  const controllerFactory$3 = (db) => {
430
430
  const Membership = db.membership;
431
431
  const read = async (req, res) => {
432
- let query = {};
433
- let options = {};
434
- if (req.query.user) {
435
- query.user = req.query.user;
436
- }
437
- if (req.query.type) {
438
- query.type = req.query.type;
439
- }
440
- if (req.query.target) {
441
- query.target = req.query.target;
442
- }
443
- if (req.query.role) {
444
- query.role = req.query.role;
445
- }
446
432
  try {
447
- const memberships = await Membership.find(query, null, options).populate("user");
448
- if (!memberships) {
433
+ const memberships = await Membership.aggregate([
434
+ {
435
+ $match: {
436
+ ...req.query.user && { user: req.query.user },
437
+ ...req.query.type && { type: req.query.type },
438
+ ...req.query.target && { target: req.query.target },
439
+ ...req.query.role && { role: req.query.role }
440
+ }
441
+ },
442
+ {
443
+ $lookup: {
444
+ from: "users",
445
+ localField: "user",
446
+ foreignField: "_id",
447
+ as: "user"
448
+ }
449
+ },
450
+ {
451
+ $unwind: "$user"
452
+ }
453
+ ]);
454
+ if (!memberships || memberships.length === 0) {
449
455
  return res.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
450
456
  }
451
457
  res.send(memberships);
@@ -428,23 +428,29 @@ const ObjectId$1 = require$$0.Types.ObjectId;
428
428
  const controllerFactory$3 = (db) => {
429
429
  const Membership = db.membership;
430
430
  const read = async (req, res) => {
431
- let query = {};
432
- let options = {};
433
- if (req.query.user) {
434
- query.user = req.query.user;
435
- }
436
- if (req.query.type) {
437
- query.type = req.query.type;
438
- }
439
- if (req.query.target) {
440
- query.target = req.query.target;
441
- }
442
- if (req.query.role) {
443
- query.role = req.query.role;
444
- }
445
431
  try {
446
- const memberships = await Membership.find(query, null, options).populate("user");
447
- if (!memberships) {
432
+ const memberships = await Membership.aggregate([
433
+ {
434
+ $match: {
435
+ ...req.query.user && { user: req.query.user },
436
+ ...req.query.type && { type: req.query.type },
437
+ ...req.query.target && { target: req.query.target },
438
+ ...req.query.role && { role: req.query.role }
439
+ }
440
+ },
441
+ {
442
+ $lookup: {
443
+ from: "users",
444
+ localField: "user",
445
+ foreignField: "_id",
446
+ as: "user"
447
+ }
448
+ },
449
+ {
450
+ $unwind: "$user"
451
+ }
452
+ ]);
453
+ if (!memberships || memberships.length === 0) {
448
454
  return res.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
449
455
  }
450
456
  res.send(memberships);
@@ -227,7 +227,10 @@ var leftover_model = (mongoose) => {
227
227
  const leftover_model$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(leftover_model);
228
228
  const ObjectId$1 = require$$0.Types.ObjectId;
229
229
  const OpenAI = require$$3;
230
- const openai = new OpenAI();
230
+ console.log(process.env.OPENAI_API_KEY);
231
+ const openai = new OpenAI({
232
+ apiKey: process.env.OPENAI_API_KEY
233
+ });
231
234
  const controllerFactory$5 = (db) => {
232
235
  const Product = db.product;
233
236
  db.modification;
@@ -465,13 +468,13 @@ const controllerFactory$5 = (db) => {
465
468
  console.log("no products");
466
469
  return res.status(404).send({ message: "Products not found." });
467
470
  }
468
- const productsList = products.map((p) => `
469
- ${p._id}:
470
- ${p.name}
471
- (${p.information[0].value})
472
- (${p.information[1].value}%)
473
- (${p.information[2].value})
474
- `).join(", ");
471
+ const productsList = products.map((p) => {
472
+ const info = p.information || [];
473
+ const value0 = info[0] ? info[0].value : "";
474
+ const value1 = info[1] ? `(${info[1].value}%)` : "";
475
+ const value2 = info[2] ? `(${info[2].value})` : "";
476
+ return `${p._id}: ${p.name} (${value0}) ${value1} ${value2}`;
477
+ }).join(", ");
475
478
  const prompt = `
476
479
  1. When asked how the client wants to feel, they responded "${mood}".
477
480
  2. Here is a list of products in our store: ${productsList}.
@@ -485,7 +488,7 @@ const controllerFactory$5 = (db) => {
485
488
  while (true) {
486
489
  try {
487
490
  response = await openai.chat.completions.create({
488
- model: "gpt-4",
491
+ model: "gpt-3.5-turbo",
489
492
  messages: [{ role: "user", content: prompt }]
490
493
  });
491
494
  console.log(response);
@@ -225,7 +225,10 @@ var leftover_model = (mongoose) => {
225
225
  const leftover_model$1 = /* @__PURE__ */ getDefaultExportFromCjs(leftover_model);
226
226
  const ObjectId$1 = require$$0.Types.ObjectId;
227
227
  const OpenAI = require$$3;
228
- const openai = new OpenAI();
228
+ console.log(process.env.OPENAI_API_KEY);
229
+ const openai = new OpenAI({
230
+ apiKey: process.env.OPENAI_API_KEY
231
+ });
229
232
  const controllerFactory$5 = (db) => {
230
233
  const Product = db.product;
231
234
  db.modification;
@@ -463,13 +466,13 @@ const controllerFactory$5 = (db) => {
463
466
  console.log("no products");
464
467
  return res.status(404).send({ message: "Products not found." });
465
468
  }
466
- const productsList = products.map((p) => `
467
- ${p._id}:
468
- ${p.name}
469
- (${p.information[0].value})
470
- (${p.information[1].value}%)
471
- (${p.information[2].value})
472
- `).join(", ");
469
+ const productsList = products.map((p) => {
470
+ const info = p.information || [];
471
+ const value0 = info[0] ? info[0].value : "";
472
+ const value1 = info[1] ? `(${info[1].value}%)` : "";
473
+ const value2 = info[2] ? `(${info[2].value})` : "";
474
+ return `${p._id}: ${p.name} (${value0}) ${value1} ${value2}`;
475
+ }).join(", ");
473
476
  const prompt = `
474
477
  1. When asked how the client wants to feel, they responded "${mood}".
475
478
  2. Here is a list of products in our store: ${productsList}.
@@ -483,7 +486,7 @@ const controllerFactory$5 = (db) => {
483
486
  while (true) {
484
487
  try {
485
488
  response = await openai.chat.completions.create({
486
- model: "gpt-4",
489
+ model: "gpt-3.5-turbo",
487
490
  messages: [{ role: "user", content: prompt }]
488
491
  });
489
492
  console.log(response);
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("../../../icons/placeholders/PlaceholderUserpic.vue.cjs");require("./User.vue2.cjs");const c=require("../../../../../../_virtual/_plugin-vue_export-helper.cjs"),d=t=>(e.pushScopeId("data-v-94253368"),t=t(),e.popScopeId(),t),m={class:""},p=["src"],h={class:"mn-r-auto"},f={class:"mn-r-small"},k={class:"t-transp"},v=d(()=>e.createElementVNode("br",null,null,-1)),y={class:"mn-r-auto t-transp"},E={key:2,class:"mn-l-medium flex-v-center flex"},b={__name:"User",props:{user:{type:Object,required:!0}},setup(t){return(r,o)=>{var s,n,i,l;return e.openBlock(),e.createElementBlock("div",m,[((s=t.user.profile)==null?void 0:s.photo.length)>0&&r.type!=="short"?(e.openBlock(),e.createElementBlock("img",{key:0,src:(r.FILE_SERVER_URL||"")+r.member.profile.photo,class:"radius-medium object-fit-cover mn-r-thin i-thin",onClick:o[0]||(o[0]=e.withModifiers(a=>r.$router.push({name:t.user.type==="user"?"User Profile":"Organization",params:{_id:t.user._id}}),["stop"]))},null,8,p)):e.createCommentVNode("",!0),!((n=t.user.profile)!=null&&n.photo)&&r.type!=="short"?(e.openBlock(),e.createBlock(u.default,{key:1,class:"radius-medium mn-r-thin i-thin",onClick:o[1]||(o[1]=e.withModifiers(a=>r.$router.push({name:t.user.type==="user"?"User Profile":"Organization",params:{_id:t.user._id}}),["stop"]))})):e.createCommentVNode("",!0),e.createElementVNode("div",h,[e.createElementVNode("span",f,e.toDisplayString((i=t.user.profile)==null?void 0:i.email)+" "+e.toDisplayString((l=t.user.profile)==null?void 0:l.phone),1),e.createElementVNode("span",k,e.toDisplayString(t.user.role),1),v,e.createElementVNode("span",y,"Member since (date) "+e.toDisplayString(t.user.createdAt),1)]),t.user.position!=="Основатель"?(e.openBlock(),e.createElementBlock("div",E,[e.createElementVNode("button",{onClick:o[2]||(o[2]=a=>r.removeMember(t.user)),class:"button-small button"},"×")])):e.createCommentVNode("",!0)])}}},g=c.default(b,[["__scopeId","data-v-94253368"]]);exports.default=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("../../../icons/placeholders/PlaceholderUserpic.vue.cjs");require("./User.vue2.cjs");const c=require("../../../../../../_virtual/_plugin-vue_export-helper.cjs"),d=t=>(e.pushScopeId("data-v-58f07aab"),t=t(),e.popScopeId(),t),m={class:""},p=["src"],h={class:"mn-r-auto"},f={class:"mn-r-small"},k={class:"t-transp"},v=d(()=>e.createElementVNode("br",null,null,-1)),b={class:"mn-r-auto t-transp"},y={key:2,class:"mn-l-medium flex-v-center flex"},E={__name:"User",props:{user:{type:Object,required:!0}},setup(t){return(r,o)=>{var s,n,i,l;return e.openBlock(),e.createElementBlock("div",m,[((s=t.user.profile)==null?void 0:s.photo.length)>0&&r.type!=="short"?(e.openBlock(),e.createElementBlock("img",{key:0,src:(r.FILE_SERVER_URL||"")+r.member.profile.photo,class:"radius-medium object-fit-cover mn-r-thin i-thin",onClick:o[0]||(o[0]=e.withModifiers(a=>r.$router.push({name:t.user.type==="user"?"User Profile":"Organization",params:{_id:t.user._id}}),["stop"]))},null,8,p)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.user)+"123 ",1),!((n=t.user.profile)!=null&&n.photo)&&r.type!=="short"?(e.openBlock(),e.createBlock(u.default,{key:1,class:"radius-medium mn-r-thin i-thin",onClick:o[1]||(o[1]=e.withModifiers(a=>r.$router.push({name:"User Profile",params:{_id:t.user._id}}),["stop"]))})):e.createCommentVNode("",!0),e.createElementVNode("div",h,[e.createElementVNode("span",f,e.toDisplayString((i=t.user.profile)==null?void 0:i.email)+" "+e.toDisplayString((l=t.user.profile)==null?void 0:l.phone),1),e.createElementVNode("span",k,e.toDisplayString(t.user.role),1),v,e.createElementVNode("span",b,"Member since (date) "+e.toDisplayString(t.user.createdAt),1)]),t.user.position!=="Основатель"?(e.openBlock(),e.createElementBlock("div",y,[e.createElementVNode("button",{onClick:o[2]||(o[2]=a=>r.removeMember(t.user)),class:"button-small button"},"×")])):e.createCommentVNode("",!0)])}}},V=c.default(E,[["__scopeId","data-v-58f07aab"]]);exports.default=V;
@@ -1,8 +1,8 @@
1
- import { openBlock as o, createElementBlock as n, withModifiers as p, createCommentVNode as l, createBlock as h, createElementVNode as r, toDisplayString as i, pushScopeId as f, popScopeId as v } from "vue";
2
- import b from "../../../icons/placeholders/PlaceholderUserpic.vue.js";
1
+ import { openBlock as i, createElementBlock as n, withModifiers as p, createCommentVNode as a, createTextVNode as h, toDisplayString as o, createBlock as f, createElementVNode as r, pushScopeId as b, popScopeId as v } from "vue";
2
+ import k from "../../../icons/placeholders/PlaceholderUserpic.vue.js";
3
3
  import "./User.vue2.js";
4
- import k from "../../../../../../_virtual/_plugin-vue_export-helper.js";
5
- const y = (e) => (f("data-v-94253368"), e = e(), v(), e), U = { class: "" }, g = ["src"], E = { class: "mn-r-auto" }, I = { class: "mn-r-small" }, S = { class: "t-transp" }, $ = /* @__PURE__ */ y(() => /* @__PURE__ */ r("br", null, null, -1)), C = { class: "mn-r-auto t-transp" }, B = {
4
+ import y from "../../../../../../_virtual/_plugin-vue_export-helper.js";
5
+ const U = (e) => (b("data-v-58f07aab"), e = e(), v(), e), E = { class: "" }, I = ["src"], S = { class: "mn-r-auto" }, $ = { class: "mn-r-small" }, g = { class: "t-transp" }, C = /* @__PURE__ */ U(() => /* @__PURE__ */ r("br", null, null, -1)), V = { class: "mn-r-auto t-transp" }, B = {
6
6
  key: 2,
7
7
  class: "mn-l-medium flex-v-center flex"
8
8
  }, M = {
@@ -16,9 +16,9 @@ const y = (e) => (f("data-v-94253368"), e = e(), v(), e), U = { class: "" }, g =
16
16
  },
17
17
  setup(e) {
18
18
  return (t, s) => {
19
- var a, u, m, d;
20
- return o(), n("div", U, [
21
- ((a = e.user.profile) == null ? void 0 : a.photo.length) > 0 && t.type !== "short" ? (o(), n("img", {
19
+ var l, u, m, d;
20
+ return i(), n("div", E, [
21
+ ((l = e.user.profile) == null ? void 0 : l.photo.length) > 0 && t.type !== "short" ? (i(), n("img", {
22
22
  key: 0,
23
23
  src: (t.FILE_SERVER_URL || "") + t.member.profile.photo,
24
24
  class: "radius-medium object-fit-cover mn-r-thin i-thin",
@@ -28,33 +28,34 @@ const y = (e) => (f("data-v-94253368"), e = e(), v(), e), U = { class: "" }, g =
28
28
  _id: e.user._id
29
29
  }
30
30
  }), ["stop"]))
31
- }, null, 8, g)) : l("", !0),
32
- !((u = e.user.profile) != null && u.photo) && t.type !== "short" ? (o(), h(b, {
31
+ }, null, 8, I)) : a("", !0),
32
+ h(" " + o(e.user) + "123 ", 1),
33
+ !((u = e.user.profile) != null && u.photo) && t.type !== "short" ? (i(), f(k, {
33
34
  key: 1,
34
35
  class: "radius-medium mn-r-thin i-thin",
35
36
  onClick: s[1] || (s[1] = p((c) => t.$router.push({
36
- name: e.user.type === "user" ? "User Profile" : "Organization",
37
+ name: "User Profile",
37
38
  params: {
38
39
  _id: e.user._id
39
40
  }
40
41
  }), ["stop"]))
41
- })) : l("", !0),
42
- r("div", E, [
43
- r("span", I, i((m = e.user.profile) == null ? void 0 : m.email) + " " + i((d = e.user.profile) == null ? void 0 : d.phone), 1),
44
- r("span", S, i(e.user.role), 1),
45
- $,
46
- r("span", C, "Member since (date) " + i(e.user.createdAt), 1)
42
+ })) : a("", !0),
43
+ r("div", S, [
44
+ r("span", $, o((m = e.user.profile) == null ? void 0 : m.email) + " " + o((d = e.user.profile) == null ? void 0 : d.phone), 1),
45
+ r("span", g, o(e.user.role), 1),
46
+ C,
47
+ r("span", V, "Member since (date) " + o(e.user.createdAt), 1)
47
48
  ]),
48
- e.user.position !== "Основатель" ? (o(), n("div", B, [
49
+ e.user.position !== "Основатель" ? (i(), n("div", B, [
49
50
  r("button", {
50
51
  onClick: s[2] || (s[2] = (c) => t.removeMember(e.user)),
51
52
  class: "button-small button"
52
53
  }, "×")
53
- ])) : l("", !0)
54
+ ])) : a("", !0)
54
55
  ]);
55
56
  };
56
57
  }
57
- }, j = /* @__PURE__ */ k(M, [["__scopeId", "data-v-94253368"]]);
58
+ }, w = /* @__PURE__ */ y(M, [["__scopeId", "data-v-58f07aab"]]);
58
59
  export {
59
- j as default
60
+ w as default
60
61
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("vue-router");require("vue-i18n");require("../../../globals/localization/vue-i18n.cjs");require("../../../../components/Breadcrumbs/Breadcrumbs.vue.cjs");const b=require("../../../../components/Tab/Tab.vue2.cjs"),f=require("../../../../components/Block/Block.vue.cjs"),_=require("../../../../components/Feed/Feed.vue.cjs"),g=require("../../../mobile/components/Menu/Menu.vue.cjs"),h=require("../../../mobile/components/Menu/MenuItem.vue.cjs");require("../blocks/DepartmentSub.vue2.cjs");const v=require("../blocks/User.vue.cjs"),y=require("../blocks/CardDepartment.vue.cjs"),C=require("../../../events/components/sections/Feed.vue.cjs"),N=require("../../../community/components/sections/Feed.vue.cjs"),q=require("../../../spots/components/blocks/CardSpot.vue.cjs"),w=require("../sections/DetailsTab.vue.cjs"),B=require("../../../products/components/pages/Products.vue.cjs"),s=require("../../../auth/store/auth.cjs"),a=require("../../store/organizations.cjs"),V=require("../../store/memberships.cjs"),x=require("../../store/departments.cjs"),z=require("../../../spots/store/spots.cjs");require("./Organization.vue2.cjs");const E={key:0,class:"pd-thin for-transition w-100"},$={class:"cols-2 pd-medium bg-grey radius-bg"},M={class:"pos-relative"},T={key:0},F={__name:"Organization",setup(O){const c=p.useRouter(),t=p.useRoute();let k=t.query.tab?t.query.tab:"products";const m=e.ref(null);e.onMounted(async()=>{m.value=await a.actions.read({_id:t.params._id,user:s.state.user._id}),await V.actions.read(t.params._id)});const o=e.ref(k);return t.query.tab=o.value,e.watch(o,i=>{c.replace({query:{...t.query,tab:i}})}),(i,n)=>{const d=e.resolveComponent("router-link");return m.value?(e.openBlock(),e.createElementBlock("div",E,[e.createVNode(w.default,{organization:a.state.current,user:s.state.user,class:"mn-b-semi"},null,8,["organization","user"]),e.createVNode(g.default,{class:"mn-b-regular bg-grey"},{default:e.withCtx(()=>[e.createVNode(h.default,{onClick:n[0]||(n[0]=r=>e.unref(c).push({name:"Organization Members",params:{_id:e.unref(t).params._id}})),class:"cursor-pointer",theme:"black"},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(a.state.current.numberOfMembers)+" members ",1)]),_:1})]),_:1}),e.createElementVNode("div",$,[e.createVNode(f.default,{title:"Departments",actions:[{label:"+",function:()=>i.$router.push(`/organizations/${e.unref(t).params._id}/departments/create`)}]},{default:e.withCtx(()=>[e.createVNode(_.default,{states:{empty:{title:"No Departments Found",description:"Currently, there are no departments available."}},store:{read:r=>x.actions.read(e.unref(t).params._id),state:null},options:{user:s.state.user._id,sort:"numberOfMemberships",limit:10}},{default:e.withCtx(({items:r})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,(u,l)=>(e.openBlock(),e.createBlock(y.default,{key:l,department:u,organization:e.unref(t).params._id,class:"radius-big bg-white pos-relative mn-b-thin"},null,8,["department","organization"]))),128))]),_:1},8,["states","store","options"])]),_:1},8,["actions"]),e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.state.current.memberships,(r,u)=>(e.openBlock(),e.createBlock(v.default,{key:u,user:r,position:r.position,onClick:l=>i.$router.push(`/app/profile/${r.user._id}`),class:"bg-grey radius-small flex-nowrap flex pd-medium"},null,8,["user","position","onClick"]))),128))])]),e.createVNode(b.default,{selected:o.value,"onUpdate:selected":n[1]||(n[1]=r=>o.value=r),tabs:[{name:"Community",value:"community"},{name:"Menu",value:"products"},{name:"Events",value:"events"},{name:"Spots",value:"spots"}],class:"mn-b-small o-hidden h5 radius-big bg-grey"},null,8,["selected"]),e.createElementVNode("div",M,[e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[o.value==="community"?(e.openBlock(),e.createBlock(N.default,{key:0,user:s.state.user._id,owner:e.unref(t).params._id},null,8,["user","owner"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[o.value==="events"?(e.openBlock(),e.createBlock(C.default,{key:0,user:s.state.user._id,owner:e.unref(t).params._id,sortOrder:"desc",sortParam:"date.start"},null,8,["user","owner","sortParam"])):e.createCommentVNode("",!0)]),_:1}),o.value==="products"&&s.state.user._id===a.state.current.owner?(e.openBlock(),e.createBlock(f.default,{key:0,class:"flex-nowrap gap-thin mn-b-small flex"},{default:e.withCtx(()=>[e.createVNode(d,{class:"bg-black t-white uppercase t-semi pd-thin radius-extra",to:{name:"ProductAdd",params:{_id:e.unref(t).params._id}}},{default:e.withCtx(()=>[e.createTextVNode(" Add Product ")]),_:1},8,["to"]),e.createVNode(d,{class:"uppercase t-semi pd-thin radius-extra",to:{name:"Leftovers",params:{_id:e.unref(t).params._id}}},{default:e.withCtx(()=>[e.createTextVNode(" Change Invetory ")]),_:1},8,["to"]),e.createVNode(d,{class:"d-block mn-l-auto uppercase t-semi bg-white pd-thin radius-extra",to:{name:"Backoffice",params:{_id:e.unref(t).params._id}}},{default:e.withCtx(()=>[e.createTextVNode(" Go to Backoffice ")]),_:1},8,["to"])]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[o.value==="products"?(e.openBlock(),e.createBlock(B.default,{key:0,organization:a.state.current},null,8,["organization"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[o.value==="spots"?(e.openBlock(),e.createElementBlock("div",T,[e.createVNode(_.default,{states:{empty:{title:"No Spots Found",description:"Currently, there are no spots available."}},store:{read:r=>z.actions.read(e.unref(t).params._id),state:a.state},options:{user:s.state.user._id,sort:"numberOfMemberships",contain:["blogposts"],limit:10}},{default:e.withCtx(({items:r})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,(u,l)=>(e.openBlock(),e.createBlock(q.default,{key:l,spot:u,organization:a.state.current,class:"radius-big bg-grey mn-b-thin"},null,8,["spot","organization"]))),128))]),_:1},8,["states","store","options"]),s.state.user._id===a.state.current.owner?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:n[2]||(n[2]=r=>i.$router.push(`/spots/${a.state.current._id}/spots/create`)),class:"mn-b-thin button w-100"}," Add spot ")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),_:1})])])):e.createCommentVNode("",!0)}}};exports.default=F;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("vue-router");require("vue-i18n");require("../../../globals/localization/vue-i18n.cjs");require("../../../../components/Breadcrumbs/Breadcrumbs.vue.cjs");const k=require("../../../../components/Tab/Tab.vue2.cjs"),f=require("../../../../components/Block/Block.vue.cjs"),_=require("../../../../components/Feed/Feed.vue.cjs"),g=require("../../../mobile/components/Menu/Menu.vue.cjs"),h=require("../../../mobile/components/Menu/MenuItem.vue.cjs");require("../blocks/DepartmentSub.vue2.cjs");const v=require("../blocks/User.vue.cjs"),y=require("../blocks/CardDepartment.vue.cjs"),N=require("../../../events/components/sections/Feed.vue.cjs"),q=require("../../../community/components/sections/Feed.vue.cjs"),w=require("../../../spots/components/blocks/CardSpot.vue.cjs"),B=require("../sections/DetailsTab.vue.cjs"),C=require("../../../products/components/pages/Products.vue.cjs"),s=require("../../../auth/store/auth.cjs"),a=require("../../store/organizations.cjs"),V=require("../../store/memberships.cjs"),x=require("../../store/departments.cjs"),z=require("../../../spots/store/spots.cjs");require("./Organization.vue2.cjs");const E={key:0,class:"pd-thin for-transition w-100"},M={class:"cols-2 pd-medium bg-grey radius-bg"},T={class:"pos-relative"},F={key:0},O={__name:"Organization",setup($){const c=p.useRouter(),t=p.useRoute();let b=t.query.tab?t.query.tab:"products";const m=e.ref(null);e.onMounted(async()=>{m.value=await a.actions.read({_id:t.params._id,user:s.state.user._id}),await V.actions.read(t.params._id)});const o=e.ref(b);return t.query.tab=o.value,e.watch(o,u=>{c.replace({query:{...t.query,tab:u}})}),(u,n)=>{const l=e.resolveComponent("router-link");return m.value?(e.openBlock(),e.createElementBlock("div",E,[e.createVNode(B.default,{organization:a.state.current,user:s.state.user,class:"mn-b-semi"},null,8,["organization","user"]),e.createVNode(g.default,{class:"mn-b-regular bg-grey"},{default:e.withCtx(()=>[e.createVNode(h.default,{onClick:n[0]||(n[0]=r=>e.unref(c).push({name:"Organization Members",params:{_id:e.unref(t).params._id}})),class:"cursor-pointer",theme:"black"},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(a.state.current.numberOfMembers)+" members ",1)]),_:1})]),_:1}),e.createElementVNode("div",M,[e.createVNode(f.default,{title:"Departments",actions:[{label:"+",function:()=>u.$router.push(`/organizations/${e.unref(t).params._id}/departments/create`)}]},{default:e.withCtx(()=>[e.createVNode(_.default,{states:{empty:{title:"No Departments Found",description:"Currently, there are no departments available."}},store:{read:r=>x.actions.read(e.unref(t).params._id),state:null},options:{user:s.state.user._id,sort:"numberOfMemberships",limit:10}},{default:e.withCtx(({items:r})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,(i,d)=>(e.openBlock(),e.createBlock(y.default,{key:d,department:i,organization:e.unref(t).params._id,class:"radius-big bg-white pos-relative mn-b-thin"},null,8,["department","organization"]))),128))]),_:1},8,["states","store","options"])]),_:1},8,["actions"]),e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.state.current.memberships,(r,i)=>(e.openBlock(),e.createBlock(v.default,{key:i,user:r,position:r.position,class:"bg-grey radius-small flex-nowrap flex pd-medium"},null,8,["user","position"]))),128))])]),e.createVNode(k.default,{selected:o.value,"onUpdate:selected":n[1]||(n[1]=r=>o.value=r),tabs:[{name:"Community",value:"community"},{name:"Menu",value:"products"},{name:"Events",value:"events"},{name:"Spots",value:"spots"}],class:"mn-b-small o-hidden h5 radius-big bg-grey"},null,8,["selected"]),e.createElementVNode("div",T,[e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[o.value==="community"?(e.openBlock(),e.createBlock(q.default,{key:0,user:s.state.user._id,owner:e.unref(t).params._id},null,8,["user","owner"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[o.value==="events"?(e.openBlock(),e.createBlock(N.default,{key:0,user:s.state.user._id,owner:e.unref(t).params._id,sortOrder:"desc",sortParam:"date.start"},null,8,["user","owner","sortParam"])):e.createCommentVNode("",!0)]),_:1}),o.value==="products"&&s.state.user._id===a.state.current.owner?(e.openBlock(),e.createBlock(f.default,{key:0,class:"flex-nowrap gap-thin mn-b-small flex"},{default:e.withCtx(()=>[e.createVNode(l,{class:"bg-black t-white uppercase t-semi pd-thin radius-extra",to:{name:"ProductAdd",params:{_id:e.unref(t).params._id}}},{default:e.withCtx(()=>[e.createTextVNode(" Add Product ")]),_:1},8,["to"]),e.createVNode(l,{class:"uppercase t-semi pd-thin radius-extra",to:{name:"Leftovers",params:{_id:e.unref(t).params._id}}},{default:e.withCtx(()=>[e.createTextVNode(" Change Invetory ")]),_:1},8,["to"]),e.createVNode(l,{class:"d-block mn-l-auto uppercase t-semi bg-white pd-thin radius-extra",to:{name:"Backoffice",params:{_id:e.unref(t).params._id}}},{default:e.withCtx(()=>[e.createTextVNode(" Go to Backoffice ")]),_:1},8,["to"])]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[o.value==="products"?(e.openBlock(),e.createBlock(C.default,{key:0,organization:a.state.current},null,8,["organization"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[o.value==="spots"?(e.openBlock(),e.createElementBlock("div",F,[e.createVNode(_.default,{states:{empty:{title:"No Spots Found",description:"Currently, there are no spots available."}},store:{read:r=>z.actions.read(e.unref(t).params._id),state:a.state},options:{user:s.state.user._id,sort:"numberOfMemberships",contain:["blogposts"],limit:10}},{default:e.withCtx(({items:r})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,(i,d)=>(e.openBlock(),e.createBlock(w.default,{key:d,spot:i,organization:a.state.current,class:"radius-big bg-grey mn-b-thin"},null,8,["spot","organization"]))),128))]),_:1},8,["states","store","options"]),s.state.user._id===a.state.current.owner?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:n[2]||(n[2]=r=>u.$router.push(`/spots/${a.state.current._id}/spots/create`)),class:"mn-b-thin button w-100"}," Add spot ")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),_:1})])])):e.createCommentVNode("",!0)}}};exports.default=O;
@@ -1,4 +1,4 @@
1
- import { ref as z, onMounted as M, watch as N, resolveComponent as q, openBlock as a, createElementBlock as p, createVNode as t, withCtx as s, unref as o, createElementVNode as b, toDisplayString as B, Fragment as y, renderList as h, createBlock as m, Transition as g, createCommentVNode as l, createTextVNode as k } from "vue";
1
+ import { ref as z, onMounted as M, watch as N, resolveComponent as q, openBlock as r, createElementBlock as p, createVNode as t, withCtx as a, unref as o, createElementVNode as f, toDisplayString as B, Fragment as y, renderList as h, createBlock as m, Transition as b, createCommentVNode as l, createTextVNode as k } from "vue";
2
2
  import { useRouter as D, useRoute as P } from "vue-router";
3
3
  import "vue-i18n";
4
4
  import "../../../globals/localization/vue-i18n.js";
@@ -38,20 +38,20 @@ const K = {
38
38
  }), await j.read(e.params._id);
39
39
  });
40
40
  const n = z(O);
41
- return e.query.tab = n.value, N(n, (c) => {
42
- $.replace({ query: { ...e.query, tab: c } });
43
- }), (c, d) => {
44
- const v = q("router-link");
45
- return w.value ? (a(), p("div", K, [
41
+ return e.query.tab = n.value, N(n, (_) => {
42
+ $.replace({ query: { ...e.query, tab: _ } });
43
+ }), (_, d) => {
44
+ const g = q("router-link");
45
+ return w.value ? (r(), p("div", K, [
46
46
  t(U, {
47
47
  organization: i.current,
48
48
  user: u.user,
49
49
  class: "mn-b-semi"
50
50
  }, null, 8, ["organization", "user"]),
51
51
  t(V, { class: "mn-b-regular bg-grey" }, {
52
- default: s(() => [
52
+ default: a(() => [
53
53
  t(A, {
54
- onClick: d[0] || (d[0] = (r) => o($).push({
54
+ onClick: d[0] || (d[0] = (s) => o($).push({
55
55
  name: "Organization Members",
56
56
  params: {
57
57
  _id: o(e).params._id
@@ -60,23 +60,23 @@ const K = {
60
60
  class: "cursor-pointer",
61
61
  theme: "black"
62
62
  }, {
63
- default: s(() => [
64
- b("span", null, B(i.current.numberOfMembers) + " members ", 1)
63
+ default: a(() => [
64
+ f("span", null, B(i.current.numberOfMembers) + " members ", 1)
65
65
  ]),
66
66
  _: 1
67
67
  })
68
68
  ]),
69
69
  _: 1
70
70
  }),
71
- b("div", Q, [
71
+ f("div", Q, [
72
72
  t(C, {
73
73
  title: "Departments",
74
74
  actions: [{
75
75
  label: "+",
76
- function: () => c.$router.push(`/organizations/${o(e).params._id}/departments/create`)
76
+ function: () => _.$router.push(`/organizations/${o(e).params._id}/departments/create`)
77
77
  }]
78
78
  }, {
79
- default: s(() => [
79
+ default: a(() => [
80
80
  t(x, {
81
81
  states: {
82
82
  empty: {
@@ -85,7 +85,7 @@ const K = {
85
85
  }
86
86
  },
87
87
  store: {
88
- read: (r) => H.read(o(e).params._id),
88
+ read: (s) => H.read(o(e).params._id),
89
89
  state: null
90
90
  },
91
91
  options: {
@@ -94,12 +94,12 @@ const K = {
94
94
  limit: 10
95
95
  }
96
96
  }, {
97
- default: s(({
98
- items: r
97
+ default: a(({
98
+ items: s
99
99
  }) => [
100
- (a(!0), p(y, null, h(r, (_, f) => (a(), m(F, {
101
- key: f,
102
- department: _,
100
+ (r(!0), p(y, null, h(s, (c, v) => (r(), m(F, {
101
+ key: v,
102
+ department: c,
103
103
  organization: o(e).params._id,
104
104
  class: "radius-big bg-white pos-relative mn-b-thin"
105
105
  }, null, 8, ["department", "organization"]))), 128))
@@ -109,19 +109,18 @@ const K = {
109
109
  ]),
110
110
  _: 1
111
111
  }, 8, ["actions"]),
112
- b("div", null, [
113
- (a(!0), p(y, null, h(i.current.memberships, (r, _) => (a(), m(E, {
114
- key: _,
115
- user: r,
116
- position: r.position,
117
- onClick: (f) => c.$router.push(`/app/profile/${r.user._id}`),
112
+ f("div", null, [
113
+ (r(!0), p(y, null, h(i.current.memberships, (s, c) => (r(), m(E, {
114
+ key: c,
115
+ user: s,
116
+ position: s.position,
118
117
  class: "bg-grey radius-small flex-nowrap flex pd-medium"
119
- }, null, 8, ["user", "position", "onClick"]))), 128))
118
+ }, null, 8, ["user", "position"]))), 128))
120
119
  ])
121
120
  ]),
122
121
  t(S, {
123
122
  selected: n.value,
124
- "onUpdate:selected": d[1] || (d[1] = (r) => n.value = r),
123
+ "onUpdate:selected": d[1] || (d[1] = (s) => n.value = s),
125
124
  tabs: [
126
125
  { name: "Community", value: "community" },
127
126
  { name: "Menu", value: "products" },
@@ -130,10 +129,10 @@ const K = {
130
129
  ],
131
130
  class: "mn-b-small o-hidden h5 radius-big bg-grey"
132
131
  }, null, 8, ["selected"]),
133
- b("div", W, [
134
- t(g, { name: "slide-fade" }, {
135
- default: s(() => [
136
- n.value === "community" ? (a(), m(R, {
132
+ f("div", W, [
133
+ t(b, { name: "slide-fade" }, {
134
+ default: a(() => [
135
+ n.value === "community" ? (r(), m(R, {
137
136
  key: 0,
138
137
  user: u.user._id,
139
138
  owner: o(e).params._id
@@ -141,9 +140,9 @@ const K = {
141
140
  ]),
142
141
  _: 1
143
142
  }),
144
- t(g, { name: "slide-fade" }, {
145
- default: s(() => [
146
- n.value === "events" ? (a(), m(L, {
143
+ t(b, { name: "slide-fade" }, {
144
+ default: a(() => [
145
+ n.value === "events" ? (r(), m(L, {
147
146
  key: 0,
148
147
  user: u.user._id,
149
148
  owner: o(e).params._id,
@@ -153,12 +152,12 @@ const K = {
153
152
  ]),
154
153
  _: 1
155
154
  }),
156
- n.value === "products" && u.user._id === i.current.owner ? (a(), m(C, {
155
+ n.value === "products" && u.user._id === i.current.owner ? (r(), m(C, {
157
156
  key: 0,
158
157
  class: "flex-nowrap gap-thin mn-b-small flex"
159
158
  }, {
160
- default: s(() => [
161
- t(v, {
159
+ default: a(() => [
160
+ t(g, {
162
161
  class: "bg-black t-white uppercase t-semi pd-thin radius-extra",
163
162
  to: {
164
163
  name: "ProductAdd",
@@ -167,12 +166,12 @@ const K = {
167
166
  }
168
167
  }
169
168
  }, {
170
- default: s(() => [
169
+ default: a(() => [
171
170
  k(" Add Product ")
172
171
  ]),
173
172
  _: 1
174
173
  }, 8, ["to"]),
175
- t(v, {
174
+ t(g, {
176
175
  class: "uppercase t-semi pd-thin radius-extra",
177
176
  to: {
178
177
  name: "Leftovers",
@@ -181,12 +180,12 @@ const K = {
181
180
  }
182
181
  }
183
182
  }, {
184
- default: s(() => [
183
+ default: a(() => [
185
184
  k(" Change Invetory ")
186
185
  ]),
187
186
  _: 1
188
187
  }, 8, ["to"]),
189
- t(v, {
188
+ t(g, {
190
189
  class: "d-block mn-l-auto uppercase t-semi bg-white pd-thin radius-extra",
191
190
  to: {
192
191
  name: "Backoffice",
@@ -195,7 +194,7 @@ const K = {
195
194
  }
196
195
  }
197
196
  }, {
198
- default: s(() => [
197
+ default: a(() => [
199
198
  k(" Go to Backoffice ")
200
199
  ]),
201
200
  _: 1
@@ -203,18 +202,18 @@ const K = {
203
202
  ]),
204
203
  _: 1
205
204
  })) : l("", !0),
206
- t(g, { name: "slide-fade" }, {
207
- default: s(() => [
208
- n.value === "products" ? (a(), m(G, {
205
+ t(b, { name: "slide-fade" }, {
206
+ default: a(() => [
207
+ n.value === "products" ? (r(), m(G, {
209
208
  key: 0,
210
209
  organization: i.current
211
210
  }, null, 8, ["organization"])) : l("", !0)
212
211
  ]),
213
212
  _: 1
214
213
  }),
215
- t(g, { name: "slide-fade" }, {
216
- default: s(() => [
217
- n.value === "spots" ? (a(), p("div", X, [
214
+ t(b, { name: "slide-fade" }, {
215
+ default: a(() => [
216
+ n.value === "spots" ? (r(), p("div", X, [
218
217
  t(x, {
219
218
  states: {
220
219
  empty: {
@@ -223,7 +222,7 @@ const K = {
223
222
  }
224
223
  },
225
224
  store: {
226
- read: (r) => J.read(o(e).params._id),
225
+ read: (s) => J.read(o(e).params._id),
227
226
  state: i
228
227
  },
229
228
  options: {
@@ -233,21 +232,21 @@ const K = {
233
232
  limit: 10
234
233
  }
235
234
  }, {
236
- default: s(({
237
- items: r
235
+ default: a(({
236
+ items: s
238
237
  }) => [
239
- (a(!0), p(y, null, h(r, (_, f) => (a(), m(T, {
240
- key: f,
241
- spot: _,
238
+ (r(!0), p(y, null, h(s, (c, v) => (r(), m(T, {
239
+ key: v,
240
+ spot: c,
242
241
  organization: i.current,
243
242
  class: "radius-big bg-grey mn-b-thin"
244
243
  }, null, 8, ["spot", "organization"]))), 128))
245
244
  ]),
246
245
  _: 1
247
246
  }, 8, ["states", "store", "options"]),
248
- u.user._id === i.current.owner ? (a(), p("button", {
247
+ u.user._id === i.current.owner ? (r(), p("button", {
249
248
  key: 0,
250
- onClick: d[2] || (d[2] = (r) => c.$router.push(`/spots/${i.current._id}/spots/create`)),
249
+ onClick: d[2] || (d[2] = (s) => _.$router.push(`/spots/${i.current._id}/spots/create`)),
251
250
  class: "mn-b-thin button w-100"
252
251
  }, " Add spot ")) : l("", !0)
253
252
  ])) : l("", !0)