From 0cc0b8053cddc585635351c32b440908c00ec5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Wed, 24 Jan 2024 13:28:32 +0100 Subject: [PATCH 1/6] update mdi version --- quasar.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quasar.conf.js b/quasar.conf.js index 7b475b3..a65befa 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -50,7 +50,7 @@ module.exports = configure(function(/* ctx */) { // 'ionicons-v5', // 'line-awesome', // 'material-icons', - 'mdi-v6', + 'mdi-v7', // 'themify', // 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both! -- 2.40.1 From 5bd837c11f2cf965034c02bb95b1271f7c61d883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Thu, 11 Apr 2024 09:57:43 +0200 Subject: [PATCH 2/6] sort users (by lastname) --- api/src/stores/user.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/api/src/stores/user.ts b/api/src/stores/user.ts index abe5283..c0e06c3 100644 --- a/api/src/stores/user.ts +++ b/api/src/stores/user.ts @@ -31,7 +31,18 @@ export const useUserStore = defineStore({ getters: { users(state) { - return state._users.filter((u) => !u.deleted); + const u = state._users.filter((u) => !u.deleted); + u.sort((a, b) => { + const a_lastname = a.lastname.toLowerCase(); + const b_lastname = b.lastname.toLowerCase(); + const a_firstname = a.firstname.toLowerCase(); + const b_firstname = b.firstname.toLowerCase(); + if (a_lastname === b_lastname) { + return a_firstname < b_firstname ? -1 : 1; + } + return a_lastname < b_lastname ? -1 : 1; + }); + return u; }, }, -- 2.40.1 From f777e36b7cb79d35b91db0e3e518904693882900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Fri, 12 Apr 2024 10:07:23 +0200 Subject: [PATCH 3/6] [feat] add settings --- src/boot/plugins.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/boot/plugins.ts b/src/boot/plugins.ts index b45bf7c..f9d4297 100644 --- a/src/boot/plugins.ts +++ b/src/boot/plugins.ts @@ -234,6 +234,12 @@ function loadPlugin( Array.prototype.push.apply(loadedPlugins.widgets, plugin.widgets); } + if (!plugin.settingWidgets) plugin.settingWidgets = []; + if (plugin.settingWidgets.length > 0) { + plugin.settingWidgets.forEach((widget) => (widget.name = plugin.id + '.' + widget.name)); + Array.prototype.push.apply(loadedPlugins.settingWidgets, plugin.settingWidgets); + } + loadedPlugins.plugins.push({ id: plugin.id, name: plugin.name, @@ -252,6 +258,7 @@ export async function loadPlugins(backend: FG.Backend, baseRoutes: RouteRecordRa shortcuts: [], outerShortcuts: [], widgets: [], + settingWidgets: [], }; // Wait for all plugins to be loaded -- 2.40.1 From 58544c7563f6cec916923d1e168c2ee334a42b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Tue, 8 Oct 2024 14:05:01 +0200 Subject: [PATCH 4/6] [feat] save display name mode --- api/src/stores/user.ts | 31 +++++++++++++++++++++++++++++++ plugin.config.js | 2 +- quasar.conf.js | 17 +++++++++++++---- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/api/src/stores/user.ts b/api/src/stores/user.ts index c0e06c3..2709950 100644 --- a/api/src/stores/user.ts +++ b/api/src/stores/user.ts @@ -22,6 +22,7 @@ export const useUserStore = defineStore({ state: () => ({ roles: [] as FG.Role[], permissions: [] as FG.Permission[], + userSettings: {} as FG.UserSettings, // list of all users, include deleted ones, use `users` getter for list of active ones _users: [] as FG.User[], // Internal flags for deciding if lists need to force-loaded @@ -218,5 +219,35 @@ export const useUserStore = defineStore({ await api.delete(`/roles/${role}`); this.roles = this.roles.filter((r) => r.id !== role); }, + + /** Get Settings for display name mode + * @param force If set to true a fresh list is loaded from backend even when a local copy is available + * @throws Probably an AxiosError if request failed + * @returns Settings for display name mode + */ + async getDisplayNameModeSetting(force = false): Promise { + const mainStore = useMainStore(); + if (force) { + const { data } = await api.get<{ data: string }>( + `users/${mainStore.currentUser.userid}/setting/display_name_mode` + ); + this.userSettings['display_name'] = data.data; + } + return this.userSettings['display_name']; + }, + + /** Set Settings for display name mode + * @param mode New display name mode + * @throws Probably an AxiosError if request failed + * @returns Settings for display name mode + */ + async setDisplayNameModeSetting(mode: string): Promise { + const mainStore = useMainStore(); + await api.put(`users/${mainStore.currentUser.userid}/setting/display_name_mode`, { + data: mode, + }); + this.userSettings['display_name'] = mode; + return mode; + }, }, }); diff --git a/plugin.config.js b/plugin.config.js index 91d11af..30437ac 100644 --- a/plugin.config.js +++ b/plugin.config.js @@ -3,4 +3,4 @@ module.exports = [ // '@flaschengeist/balance', // '@flaschengeist/schedule', // '@flaschengeist/pricelist', -] + '@flaschengeist/schedule', diff --git a/quasar.conf.js b/quasar.conf.js index a65befa..2cf98d6 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -15,12 +15,18 @@ const { configure } = require('quasar/wrappers'); const operation = () => { const custom_plgns = require('./plugin.config.js'); const required_plgns = require('./src/vendor-plugin.config.js'); - const plugins = [...custom_plgns, ...required_plgns].map((v) => `import("${v}").catch(() => "${v}")`); - const replace = new ReplaceOperation('all', `\\/\\* *INSERT_PLUGIN_LIST *\\*\\/`, `${plugins.join(', ')}`); + const plugins = [...custom_plgns, ...required_plgns].map( + (v) => `import("${v}").catch(() => "${v}")` + ); + const replace = new ReplaceOperation( + 'all', + `\\/\\* *INSERT_PLUGIN_LIST *\\*\\/`, + `${plugins.join(', ')}` + ); return replace; }; -module.exports = configure(function(/* ctx */) { +module.exports = configure(function (/* ctx */) { return { // https://quasar.dev/quasar-cli/supporting-ts supportTS: { @@ -60,7 +66,7 @@ module.exports = configure(function(/* ctx */) { // Full list of options: https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-build build: { vueRouterMode: 'history', // available values: 'hash', 'history' - + //publicPath: 'flaschengeist2', // transpile: false, // Add dependencies for transpiling with Babel (Array of string/regex) @@ -214,5 +220,8 @@ module.exports = configure(function(/* ctx */) { // chainWebpack also available besides this extendWebpack }, }, + bin: { + linuxAndroidStudio: '/home/crimsen/.local/share/JetBrains/Toolbox/scripts/studio', + }, }; }); -- 2.40.1 From a080a90f2cad800c870b10282a4929a0c63f5a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Tue, 8 Oct 2024 14:30:40 +0200 Subject: [PATCH 5/6] [feat] sort names by display name mode --- api/src/stores/user.ts | 45 ++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/api/src/stores/user.ts b/api/src/stores/user.ts index 2709950..04405a6 100644 --- a/api/src/stores/user.ts +++ b/api/src/stores/user.ts @@ -1,6 +1,7 @@ import { defineStore } from 'pinia'; import { api } from '../internal'; import { isAxiosError, useMainStore } from '.'; +import { DisplayNameMode } from '@flaschengeist/users'; export function fixUser(u?: FG.User) { return !u ? u : Object.assign(u, { birthday: u.birthday ? new Date(u.birthday) : undefined }); @@ -33,16 +34,40 @@ export const useUserStore = defineStore({ getters: { users(state) { const u = state._users.filter((u) => !u.deleted); - u.sort((a, b) => { - const a_lastname = a.lastname.toLowerCase(); - const b_lastname = b.lastname.toLowerCase(); - const a_firstname = a.firstname.toLowerCase(); - const b_firstname = b.firstname.toLowerCase(); - if (a_lastname === b_lastname) { - return a_firstname < b_firstname ? -1 : 1; - } - return a_lastname < b_lastname ? -1 : 1; - }); + + switch (this.userSettings['display_name']) { + case DisplayNameMode.FIRSTNAME_LASTNAME || DisplayNameMode.FIRSTNAME: + u.sort((a, b) => { + const a_lastname = a.lastname.toLowerCase(); + const b_lastname = b.lastname.toLowerCase(); + const a_firstname = a.firstname.toLowerCase(); + const b_firstname = b.firstname.toLowerCase(); + if (a_firstname === b_firstname) { + return a_lastname < b_lastname ? -1 : 1; + } + return a_firstname < b_firstname ? -1 : 1; + }); + break; + case DisplayNameMode.DISPLAYNAME: + u.sort((a, b) => { + const a_displayname = a.display_name.toLowerCase(); + const b_displayname = b.display_name.toLowerCase(); + return a_displayname < b_displayname ? -1 : 1; + }); + break; + default: + u.sort((a, b) => { + const a_lastname = a.lastname.toLowerCase(); + const b_lastname = b.lastname.toLowerCase(); + const a_firstname = a.firstname.toLowerCase(); + const b_firstname = b.firstname.toLowerCase(); + if (a_lastname === b_lastname) { + return a_firstname < b_firstname ? -1 : 1; + } + return a_lastname < b_lastname ? -1 : 1; + }); + } + return u; }, }, -- 2.40.1 From a807d9c809bdd81d1bd7a60dec20620e7f56d34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Tue, 8 Oct 2024 14:51:52 +0200 Subject: [PATCH 6/6] update to version 2.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 985604c..6a03d77 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "license": "MIT", - "version": "2.0.0", + "version": "2.1.0", "productName": "flaschengeist-frontend", "name": "flaschengeist", "author": "Tim Gröger ", -- 2.40.1