Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
fix: Smart Browse zoom window from query criteria field. (#1913)
Browse files Browse the repository at this point in the history
* fix: SB Zoom window from field.

* use same icon.
  • Loading branch information
EdwinBetanc0urt authored Feb 14, 2024
1 parent a7c2335 commit c8cd67e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<!--
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
Contributor(s): Elsio Sanchez esanchez@erpya.com https://github.com/elsiosanchez
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
Contributor(s): Elsio Sanchez esanchez@erpya.com https://github.com/elsiosanchez
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
-->

<template>
Expand All @@ -22,7 +22,7 @@
<span style="word-break: break-word;">
{{ $t('field.field') }}
<b>{{ fieldAttributes.name }}</b>
({{ fieldAttributes.id }}, {{ fieldAttributes.columnName }})
({{ fieldAttributes.id }}, {{ fieldAttributes.columnName }}{{ !fieldAttributes.isSameColumnElement ? ', ' + fieldAttributes.elementName : '' }})
</span>
</div>

Expand Down Expand Up @@ -98,6 +98,7 @@
type="text"
@click="redirect({ window: zoomItem })"
>
<i class="el-icon-zoom-in" />
{{ $t('page.processActivity.zoomIn') }}
{{ zoomItem.name }}
</el-button>
Expand All @@ -112,8 +113,8 @@ import store from '@/store'

// Utils and Helper Methods
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import { zoomIn } from '@/utils/ADempiere/coreUtils.js'
import { parseContext } from '@/utils/ADempiere/contextUtils'
import { zoomInOptionItem } from '@/components/ADempiere/FieldDefinition/FieldOptions/fieldOptionsList'

export default defineComponent({
name: 'ContextInfo',
Expand Down Expand Up @@ -153,21 +154,10 @@ export default defineComponent({
// panel in mobile mode
store.commit('changeShowRigthPanel', false)

const { columnName } = props.fieldAttributes

const filters = [{
columnName,
zoomInOptionItem.executeMethod({
window,
fieldAttributes: props.fieldAttributes,
value: fieldValue.value
}]

zoomIn({
uuid: window.uuid,
query: {
filters
},
params: {
filters
}
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,28 @@ export const zoomInOptionItem = {
name: language.t('page.processActivity.zoomIn'),
enabled: true,
svg: false,
icon: 'el-icon-files',
// icon: 'el-icon-files',
icon: 'el-icon-zoom-in',
index: 0,
isRender: false,
componentRender: () => import('@/components/ADempiere/FieldDefinition/FieldOptions/EmptyOption'),
executeMethod: ({ containerManager, fieldAttributes, value }) => {
executeMethod: ({ containerManager, window, fieldAttributes, value }) => {
const { parentUuid, containerUuid, reference } = fieldAttributes
const { zoomWindows } = reference

const isSOTrx = isSalesTransaction({
parentUuid,
containerUuid
})
let window = zoomWindows.find(zoomWindow => {
// Is Sales Transaction Window or Is Purchase Transaction Window
return zoomWindow.isSalesTransaction === isSOTrx
})
if (isEmptyValue(window)) {
window = zoomWindows.at(0)
let windowToZoom = window
if (isEmptyValue(windowToZoom)) {
const isSOTrx = isSalesTransaction({
parentUuid,
containerUuid
})
windowToZoom = zoomWindows.find(zoomWindow => {
// Is Sales Transaction Window or Is Purchase Transaction Window
return zoomWindow.isSalesTransaction === isSOTrx
})
if (isEmptyValue(windowToZoom)) {
windowToZoom = zoomWindows.at(0)
}
}

let currentValue = value
Expand Down Expand Up @@ -95,7 +99,7 @@ export const zoomInOptionItem = {
}

zoomIn({
attributeValue: `window_${window.id}`,
attributeValue: `window_${windowToZoom.id}`,
attributeName: 'containerKey',
query: {
[columnName]: currentValue
Expand Down

0 comments on commit c8cd67e

Please sign in to comment.