From 9783e4087c17a12c6d545c1fada12fbda9ac698f Mon Sep 17 00:00:00 2001 From: amir baharlou Date: Tue, 5 Dec 2023 15:54:23 +0330 Subject: [PATCH 1/3] fix social layout bug --- src/boot/language.js | 11 ++++++----- src/layouts/SocialLayout.vue | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/boot/language.js b/src/boot/language.js index 453c7d8..9c0e73c 100644 --- a/src/boot/language.js +++ b/src/boot/language.js @@ -1,19 +1,20 @@ import { boot } from 'quasar/wrappers' // import { dayjs } from 'boot/dayjs' -// import { LocalStorage } from 'quasar' +import { LocalStorage } from 'quasar' // import { jalali } from 'dayjs-jalali' export default boot(({ app }) => { - // const lang = LocalStorage.getItem('lang') - + const lang = LocalStorage.getItem('lang') + if (!lang) { + LocalStorage.set('lang', 'en-US') + LocalStorage.set('ltrDir', true) + } // if (lang === 'fa-IR' || !lang) { // import('quasar/lang/fa-IR').then((lang) => { // lang.default.rtl = false // app.config.globalProperties.$q.lang.set(lang.default) // import('dayjs/locale/fa').then(ln => { - // LocalStorage.set('lang', 'fa-IR') - // LocalStorage.set('ltrDir', false) // dayjs.locale(ln.name) // // dayjs.calendar('jalali') diff --git a/src/layouts/SocialLayout.vue b/src/layouts/SocialLayout.vue index bdb5b02..3a4d235 100644 --- a/src/layouts/SocialLayout.vue +++ b/src/layouts/SocialLayout.vue @@ -102,6 +102,7 @@ const profileData = ref({}) // const userType = computed(() => userStore.user.user_type) const checkLogin = computed(() => !!userStore.token) const ltrDir = computed(() => LocalStorage.getItem('ltrDir')) +const owner = computed(() => userStore.user.id === stageStore.event.user_info.id) useI18n().locale.value = LocalStorage.getItem('lang') const { t } = useI18n() @@ -156,7 +157,7 @@ const menus = computed(() => [ label: 'Feed', icon: roundRssFeed, badge: false, - show: true, + show: false, route: { name: 'SocialFeed' } }, { @@ -177,7 +178,7 @@ const menus = computed(() => [ label: t('social.companies'), icon: roundBusiness, badge: false, - show: userStore.user.id === stageStore.event.user_info.id, + show: owner.value, route: { name: 'AddCompanies' } }, { -- GitLab From ec104e05fbb529eb21ab68032b124061c3a61884 Mon Sep 17 00:00:00 2001 From: amir baharlou Date: Tue, 5 Dec 2023 15:55:51 +0330 Subject: [PATCH 2/3] fix --- src/layouts/SocialLayout.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/SocialLayout.vue b/src/layouts/SocialLayout.vue index 3a4d235..5342e4a 100644 --- a/src/layouts/SocialLayout.vue +++ b/src/layouts/SocialLayout.vue @@ -102,7 +102,7 @@ const profileData = ref({}) // const userType = computed(() => userStore.user.user_type) const checkLogin = computed(() => !!userStore.token) const ltrDir = computed(() => LocalStorage.getItem('ltrDir')) -const owner = computed(() => userStore.user.id === stageStore.event.user_info.id) +const owner = computed(() => userStore.user.id === stageStore.event?.user_info?.id) useI18n().locale.value = LocalStorage.getItem('lang') const { t } = useI18n() -- GitLab From 4dd68b95e9e490b45a9bdd4b6cc814d7a373ccd0 Mon Sep 17 00:00:00 2001 From: picasso Date: Wed, 6 Dec 2023 14:26:28 +0330 Subject: [PATCH 3/3] adding companies api --- quasar.config.js | 4 +- src/base-url/index.js | 6 ++ src/boot/notify-default.js | 117 ++++++++++++++++-------------- src/composable/index.js | 1 + src/composable/useTableHandler.js | 61 ++++++++++++++++ src/pages/social/AddCompanies.vue | 82 ++++++++++++++++++--- 6 files changed, 204 insertions(+), 67 deletions(-) create mode 100644 src/composable/useTableHandler.js diff --git a/quasar.config.js b/quasar.config.js index bbbe43c..fdf6256 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -102,13 +102,13 @@ module.exports = configure(function (ctx) { open: true, // opens browser window automatically proxy: { '/api': { - target: 'https://social.netall.live', + target: 'http://172.16.86.239:8000/', secure: false, changeOrigin: true // rewrite: (path) => path.replace(/^\/api/, '') }, '/media': { - target: 'https://social.netall.live', + target: 'http://172.16.86.239:8000/', secure: false, changeOrigin: true }, diff --git a/src/base-url/index.js b/src/base-url/index.js index 5b48e6b..7fe6bf1 100644 --- a/src/base-url/index.js +++ b/src/base-url/index.js @@ -178,3 +178,9 @@ export const API_URL_CHAT = { newMsg: id => `/chat/msg/${id}`, seenMsg: id => `/chat/seen_chat/${id}` } + +export const API_URL_TELECOM = { + participantList: '/meeting-table/companies/available', + addCompanies: '/meeting-table/companies/add', + companiesList: '/meeting-table/companies' +} diff --git a/src/boot/notify-default.js b/src/boot/notify-default.js index 3a657a7..776f984 100644 --- a/src/boot/notify-default.js +++ b/src/boot/notify-default.js @@ -2,63 +2,68 @@ import { Notify } from 'quasar' import { roundCheckCircle, roundCancel, roundInfo, roundError } from '@quasar/extras/material-icons-round' -const success = { - type: 'success', - icon: roundCheckCircle, - timeout: 3000, - classes: 'custom-notify-success no-shadow text-body1 border-radius-8', - message: 'Success', - iconSize: '48px', - progress: true, - textColor: 'neutral-1', - iconColor: 'success', - badgeColor: 'success', - progressClass: 'bg-success' - -} -const error = { - type: 'error', - icon: roundCancel, - timeout: 3000, - classes: 'custom-notify-error no-shadow text-body1 border-radius-8', - message: 'Error', - iconSize: '48px', - progress: true, - textColor: 'neutral-1', - iconColor: 'error', - badgeColor: 'error', - progressClass: 'bg-error' +const notificationTypes = { + success: { + icon: roundCheckCircle, + classes: 'custom-notify-success no-shadow text-body2 border-radius-8', + message: 'Success', + iconSize: '40px', + progress: true, + textColor: 'dark', + iconColor: 'success', + badgeColor: 'success' + }, + error: { + icon: roundCancel, + classes: 'custom-notify-error no-shadow text-body2 border-radius-8', + message: 'Error', + iconSize: '40px', + progress: true, + textColor: 'error', + iconColor: 'error', + badgeColor: 'error' + }, + alert: { + icon: roundInfo, + classes: 'custom-notify-alert no-shadow text-body2 border-radius-8', + message: 'Info', + iconSize: '40px', + progress: true, + textColor: 'neutral-1', + iconColor: 'primary', + badgeColor: 'primary' + }, + notic: { + icon: roundError, + classes: 'custom-notify-warning no-shadow text-body2 border-radius-8', + message: 'Warning', + iconSize: '40px', + progress: true, + textColor: 'neutral-1', + iconColor: 'warning', + badgeColor: 'warning' + } } +Notify.registerType('success', notificationTypes.success) +Notify.registerType('error', notificationTypes.error) +Notify.registerType('alert', notificationTypes.alert) +Notify.registerType('notic', notificationTypes.notic) -const alert = { - type: 'alert', - icon: roundInfo, - timeout: 3000, - classes: 'custom-notify-alert no-shadow text-body1 border-radius-8', - message: 'Info', - iconSize: '48px', - progress: true, - textColor: 'neutral-1', - iconColor: 'primary', - badgeColor: 'primary', - progressClass: 'bg-primary' -} +export default function useNotif () { + const $notify = (type, message, position = 'top', options) => { + const notificationOptions = notificationTypes[type] -const notic = { - type: 'notic', - icon: roundError, - timeout: 3000, - classes: 'custom-notify-warning no-shadow text-body1 border-radius-8', - message: 'Warning', - iconSize: '48px', - progress: true, - textColor: 'neutral-1', - iconColor: 'warning', - badgeColor: 'warning', - progressClass: 'bg-warning' -} + Notify.create({ + ...notificationOptions, + ...options, + progress: false, + multiLine: true, + position, + message + }) + } -Notify.registerType('success', success) -Notify.registerType('error', error) -Notify.registerType('alert', alert) -Notify.registerType('notic', notic) + return { + $notify + } +} diff --git a/src/composable/index.js b/src/composable/index.js index 735f423..285cd1d 100644 --- a/src/composable/index.js +++ b/src/composable/index.js @@ -1 +1,2 @@ export * from './useScreenHandler' +export * from './useTableHandler' diff --git a/src/composable/useTableHandler.js b/src/composable/useTableHandler.js new file mode 100644 index 0000000..91a49de --- /dev/null +++ b/src/composable/useTableHandler.js @@ -0,0 +1,61 @@ +import { ref } from 'vue' +import { api } from 'src/boot/axios' + +export function useTableHandler ({ url, params = {} }) { + const rows = ref([]) + const filter = ref(null) + const tableRef = ref(null) + const loading = ref(false) + const pagination = ref({ + page: 1, + sortBy: 'desc', + descending: false, + rowsNumber: 15, + rowsPerPage: 15 + }) + + const onRequest = async (props) => { + loading.value = true + const { page, rowsPerPage, sortBy, descending } = props.pagination + + const requestData = { + offset: page - 1, + limit: rowsPerPage, + ...params, + ...(typeof filter.value === 'object' ? filter.value : { q: filter.value }), + ...(typeof props.filter !== 'undefined' ? props.filter : {}) + } + + try { + const { data } = await api.get(url, { params: requestData }) + rows.value = data.data + loading.value = false + pagination.value.rowsNumber = data.count + } + catch (err) { + console.log('err', err) + } + finally { + loading.value = false + } + + pagination.value.page = page + pagination.value.rowsPerPage = rowsPerPage + pagination.value.sortBy = sortBy + pagination.value.descending = descending + } + + function request () { + tableRef.value.requestServerInteraction() + } + + return { + rows, + filter, + request, + loading, + tableRef, + onRequest, + pagination + } +} diff --git a/src/pages/social/AddCompanies.vue b/src/pages/social/AddCompanies.vue index 869632d..d7b47e3 100644 --- a/src/pages/social/AddCompanies.vue +++ b/src/pages/social/AddCompanies.vue @@ -24,10 +24,13 @@ import { LocalStorage } from 'quasar'; dense :options="companyOptions" use-input + option-label="name" + option-value="user_id" multiple emit-value map-options :label="$t('social.addCompany')" + @filter="filterFn" >