From 571ba6917fce12322dd0f5a2ad005b9a6c2b6c5f Mon Sep 17 00:00:00 2001 From: Sergii Leonenko Date: Tue, 30 Mar 2021 22:33:22 +0300 Subject: [PATCH] TT#108160 Branding - As Customer, I want to see the custom primary color if it is available AC: Can see the custom primary and secondary color if it is set Can see the standard colours if not set Change-Id: Iac09886d1442c145d448e1d0431bf37f1b409f03 --- quasar.conf.js | 3 ++- src/api/user.js | 12 ++++++++++-- src/boot/branding.js | 8 ++++++++ src/layouts/CscLayoutMain.vue | 20 +++++++++++++++++++- src/store/user.js | 18 +++++++++++++++++- 5 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 src/boot/branding.js diff --git a/quasar.conf.js b/quasar.conf.js index b9aae7af..55237ee7 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -30,7 +30,8 @@ module.exports = function (/* ctx */) { 'vue-scrollto', 'constants', 'vue-wait', - 'e2e-testing' + 'e2e-testing', + 'branding' ], // https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css diff --git a/src/api/user.js b/src/api/user.js index d93b6544..3ad73f17 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -37,12 +37,14 @@ export function getUserData (id) { return Promise.all([ getSubscriberById(id), getCapabilities(id), - getFaxServerSettings(id) + getFaxServerSettings(id), + getResellerBranding() ]).then((results) => { results[1].faxactive = results[2].active resolve({ subscriber: results[0], - capabilities: results[1] + capabilities: results[1], + resellerBranding: results[3]?.items[0] || null }) }).catch((err) => { reject(err) @@ -127,3 +129,9 @@ export function getNumbers () { }) }) } + +export async function getResellerBranding () { + return getList({ + resource: 'resellerbrandings' + }) +} diff --git a/src/boot/branding.js b/src/boot/branding.js new file mode 100644 index 00000000..c2b112a6 --- /dev/null +++ b/src/boot/branding.js @@ -0,0 +1,8 @@ +import { colors } from 'quasar' + +export default async ({ Vue, store, app }) => { + await store.dispatch('user/setDefaultBranding', { + primaryColor: colors.getBrand('primary'), + secondaryColor: colors.getBrand('secondary') + }) +} diff --git a/src/layouts/CscLayoutMain.vue b/src/layouts/CscLayoutMain.vue index 650063a8..88183597 100644 --- a/src/layouts/CscLayoutMain.vue +++ b/src/layouts/CscLayoutMain.vue @@ -198,6 +198,7 @@