diff --git a/src/pages/Account/Role/Card/RoleBasicData.vue b/src/pages/Account/Role/Card/RoleBasicData.vue index 7a3548b8b..e3f03f653 100644 --- a/src/pages/Account/Role/Card/RoleBasicData.vue +++ b/src/pages/Account/Role/Card/RoleBasicData.vue @@ -1,181 +1,33 @@ - (workersOptions = data)" - auto-load - /> - - - + + + + - - - - - - - - - - - - filter(value, update, statesFilter)" - :rules="validate('account.accountStateFk')" - :input-debounce="0" - > - - - - - - - - - - - - diff --git a/src/pages/Account/Role/Card/RoleCard.vue b/src/pages/Account/Role/Card/RoleCard.vue index 7d9f97c22..7f5a45d8b 100644 --- a/src/pages/Account/Role/Card/RoleCard.vue +++ b/src/pages/Account/Role/Card/RoleCard.vue @@ -5,7 +5,7 @@ import RoleDescriptor from './RoleDescriptor.vue'; import { ref, computed, onMounted } from 'vue'; -import { useRoute } from 'vue-router'; +import { useRoute, useRouter } from 'vue-router'; import { useI18n } from 'vue-i18n'; import { toDate, toPercentage } from 'src/filters'; import { useState } from 'src/composables/useState'; @@ -9,7 +9,10 @@ import VnLv from 'src/components/ui/VnLv.vue'; import useCardDescription from 'src/composables/useCardDescription'; import VnUserLink from 'src/components/ui/VnUserLink.vue'; import { getUrl } from 'src/composables/getUrl'; +import { useQuasar } from 'quasar'; +import axios from 'axios'; +import useNotify from 'src/composables/useNotify.js'; const $props = defineProps({ id: { type: Number, @@ -19,122 +22,66 @@ const $props = defineProps({ }); const route = useRoute(); + +const quasar = useQuasar(); +const router = useRouter(); + +const { notify } = useNotify(); const state = useState(); const { t } = useI18n(); const salixUrl = ref(); const entityId = computed(() => { return $props.id || route.params.id; }); +const data = ref(useCardDescription()); +const setData = (entity) => (data.value = useCardDescription(entity.name, entity.id)); const filter = { where: { id: entityId }, - fields: ['id', 'nickname', 'name', 'role'], - include: { relation: 'role', scope: { fields: ['id', 'name'] } }, +}; +const removeRole = () => { + quasar + .dialog({ + title: 'Are you sure you want to delete it?', + message: 'Delete department', + ok: { + push: true, + color: 'primary', + }, + cancel: true, + }) + .onOk(async () => { + try { + await axios.post( + `/Departments/${entityId.value}/removeChild`, + entityId.value + ); + router.push({ name: 'WorkerDepartment' }); + notify('department.departmentRemoved', 'positive'); + } catch (err) { + console.error('Error removing department'); + } + }); }; - - {{ entity }} + + + {{ t('Delete') }} + - - - - {{ entity.accountState.description }} - - - - - - - - - - - - - - - - - - {{ entity.ticket?.zone?.name }} - - - - - - - - {{ entity.ticketFk }} - - - - - - - - - {{ t('account.card.customerSummary') }} - - - {{ t('account.card.accountedTicket') }} - - - {{ t('account.card.saleTracking') }} - - - {{ t('account.card.ticketTracking') }} - - + diff --git a/src/pages/Account/Role/Card/RoleSummary.vue b/src/pages/Account/Role/Card/RoleSummary.vue index 3f8ea701b..eca5f7085 100644 --- a/src/pages/Account/Role/Card/RoleSummary.vue +++ b/src/pages/Account/Role/Card/RoleSummary.vue @@ -12,6 +12,7 @@ import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnTitle from 'src/components/common/VnTitle.vue'; import axios from 'axios'; import dashIfEmpty from 'src/filters/dashIfEmpty'; +import { useArrayData } from 'src/composables/useArrayData'; const route = useRoute(); const router = useRouter(); @@ -26,76 +27,37 @@ const $props = defineProps({ }, }); +const { store } = useArrayData('Role'); +const role = ref(store.data); const entityId = computed(() => $props.id || route.params.id); - -onMounted(async () => {}); - -const detailsColumns = ref([ - { - name: 'item', - label: 'account.summary.item', - field: (row) => row.sale.itemFk, - sortable: true, - }, - { - name: 'landed', - label: 'account.summary.landed', - field: (row) => row.sale.ticket.landed, - format: (value) => toDate(value), - sortable: true, - }, - { - name: 'quantity', - label: 'account.summary.quantity', - field: (row) => row.sale.quantity, - sortable: true, - }, - { - name: 'accounted', - label: 'account.summary.accounted', - field: (row) => row.quantity, - sortable: true, - }, - { - name: 'description', - label: 'globals.description', - field: (row) => row.sale.concept, - }, - { - name: 'price', - label: 'account.summary.price', - field: (row) => row.sale.price, - sortable: true, - }, - { - name: 'discount', - label: 'account.summary.discount', - field: (row) => row.sale.discount, - format: (value) => `${value} %`, - sortable: true, - }, - { - name: 'total', - label: 'account.summary.total', - field: ({ sale }) => - toCurrency(sale.quantity * sale.price * ((100 - sale.discount) / 100)), - sortable: true, - }, -]); +const filter = { + where: { id: entityId }, +}; (role = data)" > - - - {{ entity }} + {{ role.id }} - {{ role.name }} + + + + + {{ t('globals.pageTitles.basicData') }} + + + + + + +