Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates features #197

Merged
merged 24 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"cy:open": "CYPRESS_CACHE_FOLDER='node_modules/.cache/Cypress' yarn cypress open -C cypress/config/cypress.config.ts"
},
"dependencies": {
"@anzusystems/common-admin": "1.47.0-beta.102",
"@anzusystems/common-admin": "1.47.0-beta.103",
"@mdi/font": "7.4.47",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
Expand All @@ -30,10 +30,10 @@
"axios": "^1.7.8",
"cropperjs": "^1.6.2",
"jwt-decode": "^4.0.0",
"pinia": "^2.2.7",
"pinia": "^2.2.8",
"rusha": "^0.8.14",
"socket.io-client": "^4.8.1",
"sortablejs": "^1.15.5",
"sortablejs": "^1.15.6",
"universal-cookie": "^7.2.2",
"uuid": "^11.0.3",
"vue": "3.5.13",
Expand Down Expand Up @@ -65,7 +65,7 @@
"postcss-html": "^1.7.0",
"prettier": "^3.4.1",
"sass": "^1.81.0",
"stylelint": "^16.10.0",
"stylelint": "^16.11.0",
"stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard-scss": "^13.1.0",
"typescript": "5.5.4",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/sk/system.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"podcasts": "Podcasty",
"videoShows": "Video relácie",
"extSystemLicenceSwitch": {
"filters": "filtre",
"filters": "Filtre",
"filter": {
"extSystemName": "Meno externého systému",
"extSystemId": "ID externého systému",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
isUndefined,
useAlerts,
useDamConfigStore,
useValidate
useValidate,
} from '@anzusystems/common-admin'
import useVuelidate, { type ErrorObject } from '@vuelidate/core'
import { storeToRefs } from 'pinia'
Expand Down Expand Up @@ -65,6 +65,7 @@ const selectedLicence = ref<null | IntegerId>(null)

const selectedExtSystemSearch = ref<null | IntegerId>(null)
const selectedLicenceSearch = ref<null | IntegerId>(null)
const selectedLicenceSearchByExtId = ref<null | IntegerId>(null)

const extSystemsItems = computed(() => {
if (currentUser.value && currentUser.value.userToExtSystemsDto.length > 0) {
Expand Down Expand Up @@ -147,6 +148,7 @@ const onConfirm = async () => {
}

const onSelectedExtSystemSearchChange = (value: IntegerIdNullable | IntegerId[]) => {
selectedLicenceSearch.value = null
if (isArray<IntegerIdNullable>(value) && value[0]) {
selectedExtSystem.value = value[0]
selectedLicence.value = null
Expand All @@ -166,6 +168,18 @@ const onSelectedLicenceSearchChange = (value: IntegerIdNullable | IntegerId[]) =
if (isInt(value) || isNull(value)) selectedLicence.value = value
}

const onSelectedLicenceSearchByExtIdChange = (value: IntegerIdNullable | IntegerId[]) => {
if (isArray<IntegerIdNullable>(value) && value[0]) {
selectedLicence.value = value[0]
selectedLicenceSearch.value = value[0]
return
}
if (isInt(value) || isNull(value)) {
selectedLicence.value = value
selectedLicenceSearch.value = value
}
}

onMounted(async () => {
selectedExtSystem.value = currentExtSystemId.value
selectedLicence.value = currentAssetLicenceId.value
Expand All @@ -188,10 +202,10 @@ onMounted(async () => {
<div class="mb-4 text-caption">
{{ t('system.mainBar.extSystemLicenceSwitch.currentExtSystem') }}: {{ currentExtSystemId }} ({{
extSystemName
}})<br>
}})<br />
{{ t('system.mainBar.extSystemLicenceSwitch.currentLicence') }}: {{ currentAssetLicenceId }} ({{
licenceName
}})<br>
}})<br />
</div>
<ASystemEntityScope
:system="SYSTEM_CORE_DAM"
Expand Down Expand Up @@ -236,16 +250,16 @@ onMounted(async () => {
</VCol>
<VCol>
<AssetLicenceByExtIdRemoteAutocomplete
v-model="selectedLicenceSearch"
v-model="selectedLicenceSearchByExtId"
:label="t('system.mainBar.extSystemLicenceSwitch.filter.licenceExtId')"
:ext-system-id="selectedExtSystem"
hide-details
data-cy="field-id-licence"
@update:model-value="onSelectedLicenceSearchChange"
@update:model-value="onSelectedLicenceSearchByExtIdChange"
/>
</VCol>
</VRow>
<div class="d-flex align-center w-100">
<div class="d-flex align-center w-100 mt-8">
<div class="text-caption font-weight-bold">
{{ t('system.mainBar.extSystemLicenceSwitch.changeToLicenceId') }}: <span class="text-error">*</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<script lang="ts" setup>
import type { IntegerId, IntegerIdNullable } from '@anzusystems/common-admin'
import { AFormRemoteAutocomplete, cloneDeep, useDamAssetLicenceFilter } from '@anzusystems/common-admin'
import {
AFormRemoteAutocomplete,
cloneDeep,
type FilterBag,
type IntegerId,
type IntegerIdNullable,
isString,
type Pagination,
useDamAssetLicenceFilter,
} from '@anzusystems/common-admin'
import { useAssetLicenceByExtIdSelectActions } from '@/views/coreDam/assetLicence/composables/assetLicenceActions'
import { computed, watch } from 'vue'

Expand Down Expand Up @@ -42,6 +50,16 @@ const modelValueComputed = computed({

const { fetchItems, fetchItemsByIds } = useAssetLicenceByExtIdSelectActions()

/**
* Limit to fetch only when extId is set.
*/
const fetchItemsCustomized = async (pagination: Pagination, filterBag: FilterBag) => {
if (isString(filterBag.extId.model) && filterBag.extId.model.length > 0) {
return await fetchItems(pagination, filterBag)
}
return []
}

const innerFilter = useDamAssetLicenceFilter()

const selectedExtSystemId = computed(() => {
Expand Down Expand Up @@ -69,7 +87,7 @@ watch(
v-model="modelValueComputed"
:required="required"
:label="label"
:fetch-items="fetchItems"
:fetch-items="fetchItemsCustomized"
:fetch-items-by-ids="fetchItemsByIds"
:inner-filter="innerFilter"
:multiple="multiple"
Expand Down
Loading