fix: Send context to process associated. (#263)
* fix: Send context values from parent view to process associated. * change parseContext. * fix get preference.pull/3759/head
							parent
							
								
									997b7fcfe3
								
							
						
					
					
						commit
						fb08cf3c0a
					
				| 
						 | 
				
			
			@ -357,28 +357,22 @@ export const contextMixin = {
 | 
			
		|||
 | 
			
		||||
      if (this.actions && this.actions.length) {
 | 
			
		||||
        this.actions.forEach(itemAction => {
 | 
			
		||||
          // if no exists set prop with value
 | 
			
		||||
          itemAction.disabled = false
 | 
			
		||||
          if (this.$route.name !== 'Report Viewer' && itemAction.action === 'changeParameters') {
 | 
			
		||||
            itemAction.disabled = true
 | 
			
		||||
          }
 | 
			
		||||
          if (this.$route.meta.type === 'report' && itemAction.action === 'startProcess') {
 | 
			
		||||
            itemAction.reportExportType = 'html'
 | 
			
		||||
          }
 | 
			
		||||
          if (this.$route.meta.type === 'process' && itemAction.type === 'summary') {
 | 
			
		||||
 | 
			
		||||
          // if no exists set prop with value
 | 
			
		||||
          itemAction.disabled = false
 | 
			
		||||
          if ((this.$route.name !== 'Report Viewer' && itemAction.action === 'changeParameters') ||
 | 
			
		||||
             (this.$route.meta.type === 'process' && itemAction.type === 'summary')) {
 | 
			
		||||
            itemAction.disabled = true
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          if (this.$route.meta.type === 'window') {
 | 
			
		||||
            if (this.recordUuid === 'create-new') {
 | 
			
		||||
            if (this.recordUuid === 'create-new' || !this.isInsertRecord) {
 | 
			
		||||
              itemAction.disabled = true
 | 
			
		||||
            } else {
 | 
			
		||||
              if (this.isInsertRecord) {
 | 
			
		||||
                itemAction.disabled = false
 | 
			
		||||
              } else {
 | 
			
		||||
                itemAction.disabled = true
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
            // rollback
 | 
			
		||||
            if (itemAction.action === 'undoModifyData') {
 | 
			
		||||
              itemAction.disabled = Boolean(!this.getterDataLog && !this.getterWindowOldRoute)
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -389,6 +383,21 @@ export const contextMixin = {
 | 
			
		|||
    showModal(action) {
 | 
			
		||||
      // TODO: Refactor and remove redundant dispatchs
 | 
			
		||||
      if (action.type === 'process') {
 | 
			
		||||
        // Add context from view open in process to opening
 | 
			
		||||
        if (action.parentUuidAssociated || action.containerUuidAssociated) {
 | 
			
		||||
          const contextValues = this.$store.getters.getContextView({
 | 
			
		||||
            parentUuid: action.parentUuidAssociated,
 | 
			
		||||
            containerUuid: action.containerUuidAssociated
 | 
			
		||||
          })
 | 
			
		||||
          if (!this.isEmptyValue(contextValues)) {
 | 
			
		||||
            this.$store.dispatch('setMultipleContextView', {
 | 
			
		||||
              containerUuid: action.uuid,
 | 
			
		||||
              values: contextValues
 | 
			
		||||
            })
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // open modal dialog with metadata
 | 
			
		||||
        this.$store.dispatch('setShowDialog', {
 | 
			
		||||
          type: action.type,
 | 
			
		||||
          action: {
 | 
			
		||||
| 
						 | 
				
			
			@ -459,13 +468,6 @@ export const contextMixin = {
 | 
			
		|||
      } else if (action.type === 'process') {
 | 
			
		||||
        // run process associate with view (window or browser)
 | 
			
		||||
        this.showModal(action)
 | 
			
		||||
        if (this.panelType === 'process' || this.panelType === 'browser' || this.panelType === 'report') {
 | 
			
		||||
          this.$store.dispatch('resetPanelToNew', {
 | 
			
		||||
            parentUuid: this.parentUuid,
 | 
			
		||||
            containerUuid: this.containerUuid,
 | 
			
		||||
            panelType: this.panelType
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
      } else if (action.type === 'dataAction') {
 | 
			
		||||
        if (action.action === 'undoModifyData' && Boolean(!this.getterDataLog) && this.getterWindowOldRoute) {
 | 
			
		||||
          this.$router.push({
 | 
			
		||||
| 
						 | 
				
			
			@ -491,7 +493,10 @@ export const contextMixin = {
 | 
			
		|||
            })
 | 
			
		||||
        }
 | 
			
		||||
      } else if (action.type === 'reference') {
 | 
			
		||||
        this.$store.dispatch('getWindowByUuid', { routes: this.permissionRoutes, windowUuid: action.windowUuid })
 | 
			
		||||
        this.$store.dispatch('getWindowByUuid', {
 | 
			
		||||
          routes: this.permissionRoutes,
 | 
			
		||||
          windowUuid: action.windowUuid
 | 
			
		||||
        })
 | 
			
		||||
        if (action.windowUuid && action.recordUuid) {
 | 
			
		||||
          var windowRoute = this.$store.getters.getWindowRoute(action.windowUuid)
 | 
			
		||||
          this.$router.push({
 | 
			
		||||
| 
						 | 
				
			
			@ -541,7 +546,10 @@ export const contextMixin = {
 | 
			
		|||
              }
 | 
			
		||||
              response.url = link.href
 | 
			
		||||
            }
 | 
			
		||||
            this.$store.dispatch('finishProcess', { processOutput: response, routeToDelete: this.$route })
 | 
			
		||||
            this.$store.dispatch('finishProcess', {
 | 
			
		||||
              processOutput: response,
 | 
			
		||||
              routeToDelete: this.$route
 | 
			
		||||
            })
 | 
			
		||||
          })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -340,8 +340,11 @@ export default {
 | 
			
		|||
      }
 | 
			
		||||
    },
 | 
			
		||||
    redirect({ window, columnName, value }) {
 | 
			
		||||
      this.$store.dispatch('getWindowByUuid', { routes: this.permissionRoutes, windowUuid: window.uuid })
 | 
			
		||||
      var windowRoute = this.$store.getters.getWindowRoute(window.uuid)
 | 
			
		||||
      this.$store.dispatch('getWindowByUuid', {
 | 
			
		||||
        routes: this.permissionRoutes,
 | 
			
		||||
        windowUuid: window.uuid
 | 
			
		||||
      })
 | 
			
		||||
      const windowRoute = this.$store.getters.getWindowRoute(window.uuid)
 | 
			
		||||
      if (windowRoute) {
 | 
			
		||||
        this.$router.push({
 | 
			
		||||
          name: windowRoute.name,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,8 +81,9 @@ export const tabMixin = {
 | 
			
		|||
        metadataTab.whereClause = parseContext({
 | 
			
		||||
          parentUuid: metadataTab.parentUuid,
 | 
			
		||||
          containerUuid: metadataTab.uuid,
 | 
			
		||||
          value: metadataTab.whereClause
 | 
			
		||||
        }, true)
 | 
			
		||||
          value: metadataTab.whereClause,
 | 
			
		||||
          isBoolToString: true
 | 
			
		||||
        }).value
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -111,7 +111,9 @@ const browser = {
 | 
			
		|||
                name: process.name,
 | 
			
		||||
                description: process.description,
 | 
			
		||||
                isReport: process.isReport,
 | 
			
		||||
                isDirectPrint: process.isDirectPrint
 | 
			
		||||
                isDirectPrint: process.isDirectPrint,
 | 
			
		||||
                containerUuidAssociated: newBrowser.uuid,
 | 
			
		||||
                panelTypeAssociated: panelType
 | 
			
		||||
              })
 | 
			
		||||
              // TODO: No list of parameters
 | 
			
		||||
              // // add process associated in vuex store
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ const browserControl = {
 | 
			
		|||
        parsedQuery = parseContext({
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          value: parsedQuery
 | 
			
		||||
        }, true)
 | 
			
		||||
        }).value
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      let parsedWhereClause = browser.whereClause
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ const browserControl = {
 | 
			
		|||
        parsedWhereClause = parseContext({
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          value: parsedWhereClause
 | 
			
		||||
        }, true)
 | 
			
		||||
        }).value
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      let nextPageToken
 | 
			
		||||
| 
						 | 
				
			
			@ -114,7 +114,7 @@ const browserControl = {
 | 
			
		|||
            summary: error.message,
 | 
			
		||||
            type: 'error'
 | 
			
		||||
          })
 | 
			
		||||
          console.warn(`Error getting browser search: ${error.message}. Code: ${error.code}`)
 | 
			
		||||
          console.warn(`Error getting browser search: ${error.message}. Code: ${error.code}.`)
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,7 @@ const context = {
 | 
			
		|||
     * @param {mixed} payload.value
 | 
			
		||||
     */
 | 
			
		||||
    setContext(state, payload) {
 | 
			
		||||
      var key = ''
 | 
			
		||||
      let key = ''
 | 
			
		||||
      if (payload.parentUuid && !isEmptyValue(payload.value)) {
 | 
			
		||||
        key += payload.parentUuid + '|'
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -40,15 +40,29 @@ const context = {
 | 
			
		|||
    }
 | 
			
		||||
  },
 | 
			
		||||
  actions: {
 | 
			
		||||
    setContext: ({ commit }, objectValue) => {
 | 
			
		||||
    setContext({ commit }, objectValue) {
 | 
			
		||||
      commit('setContext', objectValue)
 | 
			
		||||
    },
 | 
			
		||||
    setMultipleContext: ({ commit }, valuesToSetter) => {
 | 
			
		||||
    setMultipleContext({ commit }, valuesToSetter) {
 | 
			
		||||
      valuesToSetter.forEach(itemToSetter => {
 | 
			
		||||
        commit('setContext', itemToSetter)
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    setMultipleContextObject: ({ commit }, valuesToSetter) => {
 | 
			
		||||
    setMultipleContextView({ commit }, {
 | 
			
		||||
      parentUuid,
 | 
			
		||||
      containerUuid,
 | 
			
		||||
      values
 | 
			
		||||
    }) {
 | 
			
		||||
      Object.keys(values).forEach(key => {
 | 
			
		||||
        commit('setContext', {
 | 
			
		||||
          parentUuid,
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          columnName: key,
 | 
			
		||||
          value: values[key]
 | 
			
		||||
        })
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    setMultipleContextObject({ commit }, valuesToSetter) {
 | 
			
		||||
      Object.keys(valuesToSetter).forEach(key => {
 | 
			
		||||
        commit('setContext', {
 | 
			
		||||
          columnName: key,
 | 
			
		||||
| 
						 | 
				
			
			@ -56,7 +70,7 @@ const context = {
 | 
			
		|||
        })
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    setMultipleContextMap: ({ commit }, valuesToSetter) => {
 | 
			
		||||
    setMultipleContextMap({ commit }, valuesToSetter) {
 | 
			
		||||
      return new Promise(resolve => {
 | 
			
		||||
        valuesToSetter.forEach((value, key) => {
 | 
			
		||||
          commit('setContext', {
 | 
			
		||||
| 
						 | 
				
			
			@ -67,19 +81,18 @@ const context = {
 | 
			
		|||
        resolve()
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    setInitialContext: ({ commit }, otherContext = {}) => {
 | 
			
		||||
    setInitialContext({ commit }, otherContext = {}) {
 | 
			
		||||
      commit('setInitialContext', otherContext)
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  getters: {
 | 
			
		||||
    /**
 | 
			
		||||
     * @param  {object} findedContext
 | 
			
		||||
     *  - parentUuid
 | 
			
		||||
     *  - containerUuid
 | 
			
		||||
     *  - columnName
 | 
			
		||||
     * @param  {string} parentUuid
 | 
			
		||||
     * @param  {string} containerUuid
 | 
			
		||||
     * @param  {string} columnName
 | 
			
		||||
     */
 | 
			
		||||
    getContext: (state) => ({ parentUuid, containerUuid, columnName }) => {
 | 
			
		||||
      var key = ''
 | 
			
		||||
      let key = ''
 | 
			
		||||
 | 
			
		||||
      if (parentUuid) {
 | 
			
		||||
        key += parentUuid + '|'
 | 
			
		||||
| 
						 | 
				
			
			@ -98,8 +111,50 @@ const context = {
 | 
			
		|||
 | 
			
		||||
      return state.context[key]
 | 
			
		||||
    },
 | 
			
		||||
    /**
 | 
			
		||||
     * @param {string} parentUuid
 | 
			
		||||
     * @param {string} containerUuid
 | 
			
		||||
     * @returns {object}
 | 
			
		||||
     */
 | 
			
		||||
    getContextView: (state) => ({
 | 
			
		||||
      parentUuid,
 | 
			
		||||
      containerUuid
 | 
			
		||||
    }) => {
 | 
			
		||||
      // generate context with parent uuid or container uuid associated
 | 
			
		||||
      const contextAllContainers = {}
 | 
			
		||||
      Object.keys(state.context).forEach(key => {
 | 
			
		||||
        if (key.includes(parentUuid) || key.includes(containerUuid)) {
 | 
			
		||||
          contextAllContainers[key] = state.context[key]
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      // generate context only columnName
 | 
			
		||||
      const contextContainer = {}
 | 
			
		||||
      Object.keys(contextAllContainers).forEach(key => {
 | 
			
		||||
        if (isEmptyValue(contextAllContainers[key])) {
 | 
			
		||||
          return
 | 
			
		||||
        }
 | 
			
		||||
        let newKey
 | 
			
		||||
        if (parentUuid) {
 | 
			
		||||
          if (!key.includes(containerUuid)) {
 | 
			
		||||
            newKey = key
 | 
			
		||||
              .replace(`${parentUuid}|`, '')
 | 
			
		||||
              .replace(`${containerUuid}|`, '')
 | 
			
		||||
            // set window parent context
 | 
			
		||||
            contextContainer[newKey] = contextAllContainers[key]
 | 
			
		||||
          }
 | 
			
		||||
          // next if is tab context
 | 
			
		||||
          return
 | 
			
		||||
        }
 | 
			
		||||
        // set container context (smart browser, process/report)
 | 
			
		||||
        newKey = key.replace(`${containerUuid}|`, '')
 | 
			
		||||
        contextContainer[newKey] = contextAllContainers[key]
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      return contextContainer
 | 
			
		||||
    },
 | 
			
		||||
    getContextAll: (state) => {
 | 
			
		||||
      state.context
 | 
			
		||||
      return state.context
 | 
			
		||||
    },
 | 
			
		||||
    getContextClientId: (state) => {
 | 
			
		||||
      return parseInt(state.context['#AD_Client_ID'], 10)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ const data = {
 | 
			
		|||
    notifyCellTableChange: (state, payload) => {
 | 
			
		||||
      payload.row[payload.columnName] = payload.value
 | 
			
		||||
      if (payload.displayColumn !== undefined) {
 | 
			
		||||
        const key = 'DisplayColumn_' + payload.columnName
 | 
			
		||||
        const key = `DisplayColumn_${payload.columnName}`
 | 
			
		||||
        payload.row[key] = payload.displayColumn
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ const data = {
 | 
			
		|||
      if (payload.row !== undefined) {
 | 
			
		||||
        payload.row[payload.columnName] = payload.value
 | 
			
		||||
        if (payload.displayColumn !== undefined) {
 | 
			
		||||
          const key = 'DisplayColumn_' + payload.columnName
 | 
			
		||||
          const key = `DisplayColumn_${payload.columnName}`
 | 
			
		||||
          payload.row[key] = payload.displayColumn
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			@ -106,15 +106,15 @@ const data = {
 | 
			
		|||
      // refresh list table with data from server
 | 
			
		||||
      if (panelType === 'window') {
 | 
			
		||||
        dispatch('getDataListTab', {
 | 
			
		||||
          parentUuid: parentUuid,
 | 
			
		||||
          containerUuid: containerUuid,
 | 
			
		||||
          isAddRecord: isAddRecord,
 | 
			
		||||
          isShowNotification: isShowNotification
 | 
			
		||||
          parentUuid,
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          isAddRecord,
 | 
			
		||||
          isShowNotification
 | 
			
		||||
        })
 | 
			
		||||
      } else if (panelType === 'browser') {
 | 
			
		||||
        if (!rootGetters.isNotReadyForSubmit(containerUuid)) {
 | 
			
		||||
          dispatch('getBrowserSearch', {
 | 
			
		||||
            containerUuid: containerUuid,
 | 
			
		||||
            containerUuid,
 | 
			
		||||
            isClearSelection: true
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -142,17 +142,17 @@ const data = {
 | 
			
		|||
      if (isPanelValues) {
 | 
			
		||||
        // add row with values used from record in panel
 | 
			
		||||
        values = rootGetters.getColumnNamesAndValues({
 | 
			
		||||
          containerUuid: containerUuid,
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          propertyName: 'value',
 | 
			
		||||
          isObjectReturn: true,
 | 
			
		||||
          isAddDisplayColumn: true,
 | 
			
		||||
          fieldList: fieldList
 | 
			
		||||
          fieldList
 | 
			
		||||
        })
 | 
			
		||||
      } else {
 | 
			
		||||
        values = rootGetters.getParsedDefaultValues({
 | 
			
		||||
          parentUuid: parentUuid,
 | 
			
		||||
          containerUuid: containerUuid,
 | 
			
		||||
          fieldList: fieldList
 | 
			
		||||
          parentUuid,
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          fieldList
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
      values.isNew = isNew
 | 
			
		||||
| 
						 | 
				
			
			@ -170,8 +170,8 @@ const data = {
 | 
			
		|||
      // get context value if link column exists and does not exist in row
 | 
			
		||||
      if (!isEmptyValue(linkColumnName)) {
 | 
			
		||||
        valueLink = rootGetters.getContext({
 | 
			
		||||
          parentUuid: parentUuid,
 | 
			
		||||
          containerUuid: containerUuid,
 | 
			
		||||
          parentUuid,
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          columnName: linkColumnName
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			@ -188,7 +188,7 @@ const data = {
 | 
			
		|||
            var valueGetDisplayColumn = values[itemField.columnName]
 | 
			
		||||
            if (String(values[itemField.columnName]) === '[object Object]' && itemField.componentPath === 'FieldSelect') {
 | 
			
		||||
              values[itemField.columnName] = ' '
 | 
			
		||||
              values['DisplayColumn_' + itemField.columnName] = ' '
 | 
			
		||||
              values[`DisplayColumn_${itemField.columnName}`] = ' '
 | 
			
		||||
            } else if (String(values[itemField.columnName]) === '[object Object]' && itemField.componentPath === 'FieldNumber') {
 | 
			
		||||
              values[itemField.columnName] = 0
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -211,19 +211,22 @@ const data = {
 | 
			
		|||
            }
 | 
			
		||||
            if (!isEmptyValue(valueGetDisplayColumn) && String(valueGetDisplayColumn) === '[object Object]') {
 | 
			
		||||
              // get value from direct Query
 | 
			
		||||
              dispatch('getRecordBySQL', { query: valueGetDisplayColumn.query, field: itemField })
 | 
			
		||||
              dispatch('getRecordBySQL', {
 | 
			
		||||
                query: valueGetDisplayColumn.query,
 | 
			
		||||
                field: itemField
 | 
			
		||||
              })
 | 
			
		||||
                .then(defaultValue => {
 | 
			
		||||
                  if (itemField.componentPath === 'FieldSelect') {
 | 
			
		||||
                    values[itemField.columnName] = defaultValue.key
 | 
			
		||||
                    values['DisplayColumn_' + itemField.columnName] = defaultValue.label
 | 
			
		||||
                    values[`DisplayColumn_${itemField.columnName}`] = defaultValue.label
 | 
			
		||||
                  } else {
 | 
			
		||||
                    values[itemField.columnName] = defaultValue.key
 | 
			
		||||
                    dispatch('notifyRowTableChange', {
 | 
			
		||||
                      parentUuid: parentUuid,
 | 
			
		||||
                      containerUuid: containerUuid,
 | 
			
		||||
                      isNew: isNew,
 | 
			
		||||
                      isEdit: isEdit,
 | 
			
		||||
                      values: values
 | 
			
		||||
                      parentUuid,
 | 
			
		||||
                      containerUuid,
 | 
			
		||||
                      isNew,
 | 
			
		||||
                      isEdit,
 | 
			
		||||
                      values
 | 
			
		||||
                    })
 | 
			
		||||
                  }
 | 
			
		||||
                })
 | 
			
		||||
| 
						 | 
				
			
			@ -231,8 +234,8 @@ const data = {
 | 
			
		|||
            }
 | 
			
		||||
            // get label (DisplayColumn) from vuex store
 | 
			
		||||
            const options = rootGetters.getLookupAll({
 | 
			
		||||
              parentUuid: parentUuid,
 | 
			
		||||
              containerUuid: containerUuid,
 | 
			
		||||
              parentUuid,
 | 
			
		||||
              containerUuid,
 | 
			
		||||
              tableName: itemField.reference.tableName,
 | 
			
		||||
              query: itemField.reference.query,
 | 
			
		||||
              directQuery: itemField.reference.directQuery,
 | 
			
		||||
| 
						 | 
				
			
			@ -242,32 +245,32 @@ const data = {
 | 
			
		|||
            const option = options.find(itemOption => itemOption.key === valueGetDisplayColumn)
 | 
			
		||||
            // if there is a lookup option, assign the display column with the label
 | 
			
		||||
            if (option) {
 | 
			
		||||
              values['DisplayColumn_' + itemField.columnName] = option.label
 | 
			
		||||
              values[`DisplayColumn_${itemField.columnName}`] = option.label
 | 
			
		||||
              return
 | 
			
		||||
            }
 | 
			
		||||
            if (linkColumnName === itemField.columnName) {
 | 
			
		||||
              // get context value if link column exists and does not exist in row
 | 
			
		||||
              const nameParent = rootGetters.getContext({
 | 
			
		||||
                parentUuid: parentUuid,
 | 
			
		||||
                containerUuid: containerUuid,
 | 
			
		||||
                parentUuid,
 | 
			
		||||
                containerUuid,
 | 
			
		||||
                columnName: 'Name'
 | 
			
		||||
              })
 | 
			
		||||
              if (nameParent) {
 | 
			
		||||
                values['DisplayColumn_' + itemField.columnName] = nameParent
 | 
			
		||||
                values[`DisplayColumn_${itemField.columnName}`] = nameParent
 | 
			
		||||
                return
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
            // get from server
 | 
			
		||||
            dispatch('getLookupItemFromServer', {
 | 
			
		||||
              parentUuid: parentUuid,
 | 
			
		||||
              containerUuid: containerUuid,
 | 
			
		||||
              parentUuid,
 | 
			
		||||
              containerUuid,
 | 
			
		||||
              tableName: itemField.reference.tableName,
 | 
			
		||||
              directQuery: itemField.reference.directQuery,
 | 
			
		||||
              value: valueGetDisplayColumn
 | 
			
		||||
            })
 | 
			
		||||
              .then(responseLookup => {
 | 
			
		||||
                dispatch('addDisplayColumn', {
 | 
			
		||||
                  containerUuid: containerUuid,
 | 
			
		||||
                  containerUuid,
 | 
			
		||||
                  columnName: itemField.columnName,
 | 
			
		||||
                  displayColumn: responseLookup.label
 | 
			
		||||
                })
 | 
			
		||||
| 
						 | 
				
			
			@ -293,8 +296,8 @@ const data = {
 | 
			
		|||
 | 
			
		||||
      commit('addDisplayColumn', {
 | 
			
		||||
        row: rowRecord,
 | 
			
		||||
        displayColumn: displayColumn,
 | 
			
		||||
        columnName: 'DisplayColumn_' + columnName
 | 
			
		||||
        displayColumn,
 | 
			
		||||
        columnName: `DisplayColumn_${columnName}`
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -335,20 +338,20 @@ const data = {
 | 
			
		|||
      })
 | 
			
		||||
 | 
			
		||||
      const newDataStore = {
 | 
			
		||||
        parentUuid: parentUuid,
 | 
			
		||||
        containerUuid: containerUuid,
 | 
			
		||||
        record: record,
 | 
			
		||||
        selection: selection,
 | 
			
		||||
        pageNumber: pageNumber,
 | 
			
		||||
        recordCount: recordCount,
 | 
			
		||||
        nextPageToken: nextPageToken,
 | 
			
		||||
        originalNextPageToken: originalNextPageToken,
 | 
			
		||||
        panelType: panelType,
 | 
			
		||||
        isLoaded: isLoaded,
 | 
			
		||||
        parentUuid,
 | 
			
		||||
        containerUuid,
 | 
			
		||||
        record,
 | 
			
		||||
        selection,
 | 
			
		||||
        pageNumber,
 | 
			
		||||
        recordCount,
 | 
			
		||||
        nextPageToken,
 | 
			
		||||
        originalNextPageToken,
 | 
			
		||||
        panelType,
 | 
			
		||||
        isLoaded,
 | 
			
		||||
        isLoadedContext: false,
 | 
			
		||||
        query: query,
 | 
			
		||||
        whereClause: whereClause,
 | 
			
		||||
        orderByClause: orderByClause
 | 
			
		||||
        query,
 | 
			
		||||
        whereClause,
 | 
			
		||||
        orderByClause
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (dataStore) {
 | 
			
		||||
| 
						 | 
				
			
			@ -478,9 +481,9 @@ const data = {
 | 
			
		|||
      }
 | 
			
		||||
 | 
			
		||||
      commit('addInGetting', {
 | 
			
		||||
        containerUuid: containerUuid,
 | 
			
		||||
        tableName: tableName,
 | 
			
		||||
        conditions: conditions
 | 
			
		||||
        containerUuid,
 | 
			
		||||
        tableName,
 | 
			
		||||
        conditions
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      // gets the default value of the fields (including whether it is empty or undefined)
 | 
			
		||||
| 
						 | 
				
			
			@ -560,8 +563,8 @@ const data = {
 | 
			
		|||
          // Set default registry values so that the table does not say loading,
 | 
			
		||||
          // there was already a response from the server
 | 
			
		||||
          dispatch('setRecordSelection', {
 | 
			
		||||
            parentUuid: parentUuid,
 | 
			
		||||
            containerUuid: containerUuid
 | 
			
		||||
            parentUuid,
 | 
			
		||||
            containerUuid
 | 
			
		||||
          })
 | 
			
		||||
 | 
			
		||||
          if (isShowNotification) {
 | 
			
		||||
| 
						 | 
				
			
			@ -571,7 +574,7 @@ const data = {
 | 
			
		|||
              type: 'error'
 | 
			
		||||
            })
 | 
			
		||||
          }
 | 
			
		||||
          console.warn(`Error Get Object List ${error.message}. Code: ${error.code}`)
 | 
			
		||||
          console.warn(`Error Get Object List ${error.message}. Code: ${error.code}.`)
 | 
			
		||||
        })
 | 
			
		||||
        .finally(() => {
 | 
			
		||||
          commit('deleteInGetting', {
 | 
			
		||||
| 
						 | 
				
			
			@ -580,8 +583,10 @@ const data = {
 | 
			
		|||
          })
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
    getRecordBySQL({ dispatch }, parameters) {
 | 
			
		||||
      const { query, field } = parameters
 | 
			
		||||
    getRecordBySQL({ dispatch }, {
 | 
			
		||||
      query,
 | 
			
		||||
      field
 | 
			
		||||
    }) {
 | 
			
		||||
      // TODO: Change to promise all
 | 
			
		||||
      return new Promise((resolve, reject) => {
 | 
			
		||||
        getDefaultValueFromServer(query)
 | 
			
		||||
| 
						 | 
				
			
			@ -628,8 +633,8 @@ const data = {
 | 
			
		|||
        currentValues = objectParams.values
 | 
			
		||||
      } else {
 | 
			
		||||
        currentValues = rootGetters.getColumnNamesAndValues({
 | 
			
		||||
          parentUuid: parentUuid,
 | 
			
		||||
          containerUuid: containerUuid,
 | 
			
		||||
          parentUuid,
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          propertyName: 'value',
 | 
			
		||||
          isObjectReturn: true,
 | 
			
		||||
          isAddDisplayColumn: true
 | 
			
		||||
| 
						 | 
				
			
			@ -641,13 +646,13 @@ const data = {
 | 
			
		|||
      var newRow = {
 | 
			
		||||
        ...currentValues,
 | 
			
		||||
        // ...objectParams.row,
 | 
			
		||||
        isEdit: isEdit
 | 
			
		||||
        isEdit
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      commit('notifyRowTableChange', {
 | 
			
		||||
        isNew: objectParams.isNew,
 | 
			
		||||
        newRow: newRow,
 | 
			
		||||
        row: row
 | 
			
		||||
        newRow,
 | 
			
		||||
        row
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    notifyCellTableChange({ commit, state, dispatch, rootGetters }, parameters) {
 | 
			
		||||
| 
						 | 
				
			
			@ -761,7 +766,7 @@ const data = {
 | 
			
		|||
          return contextInfoResponse
 | 
			
		||||
        })
 | 
			
		||||
        .catch(error => {
 | 
			
		||||
          console.warn(`Error ${error.code} getting context info value for field ${error.message}`)
 | 
			
		||||
          console.warn(`Error ${error.code} getting context info value for field ${error.message}.`)
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
    getPrivateAccessFromServer({ rootGetters }, {
 | 
			
		||||
| 
						 | 
				
			
			@ -792,7 +797,7 @@ const data = {
 | 
			
		|||
          }
 | 
			
		||||
        })
 | 
			
		||||
        .catch(error => {
 | 
			
		||||
          console.warn(`Error get private access: ${error.message}. Code: ${error.code}:`)
 | 
			
		||||
          console.warn(`Error get private access: ${error.message}. Code: ${error.code}.`)
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
    lockRecord({ rootGetters }, {
 | 
			
		||||
| 
						 | 
				
			
			@ -829,7 +834,7 @@ const data = {
 | 
			
		|||
            message: language.t('login.unexpectedError'),
 | 
			
		||||
            type: 'error'
 | 
			
		||||
          })
 | 
			
		||||
          console.warn(`Error lock private access: ${error.message}. Code: ${error.code}:`)
 | 
			
		||||
          console.warn(`Error lock private access: ${error.message}. Code: ${error.code}.`)
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
    unlockRecord({ rootGetters }, {
 | 
			
		||||
| 
						 | 
				
			
			@ -866,7 +871,7 @@ const data = {
 | 
			
		|||
            message: language.t('login.unexpectedError'),
 | 
			
		||||
            type: 'error'
 | 
			
		||||
          })
 | 
			
		||||
          console.warn(`Error unlock private access: ${error.message}. Code: ${error.code}:`)
 | 
			
		||||
          console.warn(`Error unlock private access: ${error.message}. Code: ${error.code}.`)
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			@ -882,7 +887,7 @@ const data = {
 | 
			
		|||
      return state.recordSelection.find(itemRecord => {
 | 
			
		||||
        return itemRecord.containerUuid === containerUuid
 | 
			
		||||
      }) || {
 | 
			
		||||
        containerUuid: containerUuid,
 | 
			
		||||
        containerUuid,
 | 
			
		||||
        record: [],
 | 
			
		||||
        recordCount: 0,
 | 
			
		||||
        selection: [],
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ const lookup = {
 | 
			
		|||
          parentUuid,
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          value: directQuery
 | 
			
		||||
        }, true)
 | 
			
		||||
        }).value
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      return getLookup({
 | 
			
		||||
| 
						 | 
				
			
			@ -86,7 +86,7 @@ const lookup = {
 | 
			
		|||
          parentUuid,
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          value: query
 | 
			
		||||
        }, true)
 | 
			
		||||
        }).value
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      return getLookupList({
 | 
			
		||||
| 
						 | 
				
			
			@ -128,7 +128,7 @@ const lookup = {
 | 
			
		|||
          parentUuid,
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          value: parsedDirectQuery
 | 
			
		||||
        }, true)
 | 
			
		||||
        }).value
 | 
			
		||||
      }
 | 
			
		||||
      const lookupItem = state.lookupItem.filter(itemLookup => {
 | 
			
		||||
        return itemLookup.parsedDirectQuery !== parsedDirectQuery &&
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +143,7 @@ const lookup = {
 | 
			
		|||
          parentUuid: parentUuid,
 | 
			
		||||
          containerUuid: containerUuid,
 | 
			
		||||
          value: parsedQuery
 | 
			
		||||
        }, true)
 | 
			
		||||
        }).value
 | 
			
		||||
      }
 | 
			
		||||
      const lookupList = state.lookupList.filter(itemLookup => {
 | 
			
		||||
        return itemLookup.parsedQuery !== parsedQuery &&
 | 
			
		||||
| 
						 | 
				
			
			@ -170,7 +170,7 @@ const lookup = {
 | 
			
		|||
          parentUuid,
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          value: parsedDirectQuery
 | 
			
		||||
        }, true)
 | 
			
		||||
        }).value
 | 
			
		||||
      }
 | 
			
		||||
      const lookupItem = state.lookupItem.find(itemLookup => {
 | 
			
		||||
        return itemLookup.parsedDirectQuery === parsedDirectQuery &&
 | 
			
		||||
| 
						 | 
				
			
			@ -196,7 +196,7 @@ const lookup = {
 | 
			
		|||
          parentUuid,
 | 
			
		||||
          containerUuid,
 | 
			
		||||
          value: parsedQuery
 | 
			
		||||
        }, true)
 | 
			
		||||
        }).value
 | 
			
		||||
      }
 | 
			
		||||
      const lookupList = state.lookupList.find(itemLookup => {
 | 
			
		||||
        return itemLookup.parsedQuery === parsedQuery &&
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,6 +33,9 @@ const panel = {
 | 
			
		|||
      if (payload.isReportFromLogic !== undefined) {
 | 
			
		||||
        payload.field.isReportFromLogic = payload.isReportFromLogic
 | 
			
		||||
      }
 | 
			
		||||
      if (payload.parsedDefaultValue !== undefined) {
 | 
			
		||||
        payload.field.parsedDefaultValue = payload.parsedDefaultValue
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    dictionaryResetCache(state) {
 | 
			
		||||
      state.panel = []
 | 
			
		||||
| 
						 | 
				
			
			@ -87,7 +90,8 @@ const panel = {
 | 
			
		|||
              count++
 | 
			
		||||
            }
 | 
			
		||||
          } else {
 | 
			
		||||
            if (params.isParentTab) {
 | 
			
		||||
            if (['browser', 'process', 'report'].includes(params.panelType) ||
 | 
			
		||||
              params.panelType === 'window' && params.isParentTab) {
 | 
			
		||||
              dispatch('setContext', {
 | 
			
		||||
                parentUuid: params.parentUuid,
 | 
			
		||||
                containerUuid: params.uuid,
 | 
			
		||||
| 
						 | 
				
			
			@ -509,7 +513,7 @@ const panel = {
 | 
			
		|||
              columnName,
 | 
			
		||||
              value: sqlStatement,
 | 
			
		||||
              isSQL: isSQL
 | 
			
		||||
            })
 | 
			
		||||
            }).value
 | 
			
		||||
            if (isSQL && String(sqlStatement) === '[object Object]') {
 | 
			
		||||
              sqlStatement = sqlStatement.query
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -532,49 +536,12 @@ const panel = {
 | 
			
		|||
      }
 | 
			
		||||
 | 
			
		||||
      //  Change Dependents
 | 
			
		||||
      let dependentsList = []
 | 
			
		||||
      if (field.dependentFieldsList.length) {
 | 
			
		||||
        dependentsList = fieldList.filter(fieldItem => {
 | 
			
		||||
          return field.dependentFieldsList.includes(fieldItem.columnName)
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
      //  Iterate for change logic
 | 
			
		||||
      dependentsList.forEach(dependent => {
 | 
			
		||||
        //  isDisplayed Logic
 | 
			
		||||
        let isDisplayedFromLogic, isMandatoryFromLogic, isReadOnlyFromLogic
 | 
			
		||||
        if (dependent.displayLogic.trim() !== '') {
 | 
			
		||||
          isDisplayedFromLogic = evaluator.evaluateLogic({
 | 
			
		||||
            context: getters,
 | 
			
		||||
            parentUuid,
 | 
			
		||||
            containerUuid,
 | 
			
		||||
            logic: dependent.displayLogic,
 | 
			
		||||
            type: 'displayed'
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
        //  Mandatory Logic
 | 
			
		||||
        if (dependent.mandatoryLogic.trim() !== '') {
 | 
			
		||||
          isMandatoryFromLogic = evaluator.evaluateLogic({
 | 
			
		||||
            context: getters,
 | 
			
		||||
            parentUuid,
 | 
			
		||||
            containerUuid,
 | 
			
		||||
            logic: dependent.mandatoryLogic
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
        //  Read Only Logic
 | 
			
		||||
        if (dependent.readOnlyLogic.trim() !== '') {
 | 
			
		||||
          isReadOnlyFromLogic = evaluator.evaluateLogic({
 | 
			
		||||
            context: getters,
 | 
			
		||||
            parentUuid,
 | 
			
		||||
            containerUuid,
 | 
			
		||||
            logic: dependent.readOnlyLogic
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
        commit('changeFieldLogic', {
 | 
			
		||||
          field: dependent,
 | 
			
		||||
          isDisplayedFromLogic,
 | 
			
		||||
          isMandatoryFromLogic,
 | 
			
		||||
          isReadOnlyFromLogic
 | 
			
		||||
        })
 | 
			
		||||
      dispatch('changeDependentFieldsList', {
 | 
			
		||||
        parentUuid,
 | 
			
		||||
        containerUuid,
 | 
			
		||||
        dependentFieldsList: field.dependentFieldsList,
 | 
			
		||||
        fieldsList: fieldList,
 | 
			
		||||
        isSendToServer
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      // the field has not changed, then the action is broken
 | 
			
		||||
| 
						 | 
				
			
			@ -722,6 +689,90 @@ const panel = {
 | 
			
		|||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    changeDependentFieldsList({ commit, dispatch, getters }, {
 | 
			
		||||
      parentUuid,
 | 
			
		||||
      containerUuid,
 | 
			
		||||
      dependentFieldsList = [],
 | 
			
		||||
      fieldsList = [],
 | 
			
		||||
      isSendToServer
 | 
			
		||||
    }) {
 | 
			
		||||
      if (isEmptyValue(dependentFieldsList)) {
 | 
			
		||||
        // breaks if there are no field dependencies
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (!fieldsList.length) {
 | 
			
		||||
        fieldsList = getters.getFieldsListFromPanel(containerUuid)
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      const dependentsList = fieldsList.filter(fieldItem => {
 | 
			
		||||
        return dependentFieldsList.includes(fieldItem.columnName)
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      //  Iterate for change logic
 | 
			
		||||
      dependentsList.forEach(fieldDependent => {
 | 
			
		||||
        //  isDisplayed Logic
 | 
			
		||||
        let isDisplayedFromLogic, isMandatoryFromLogic, isReadOnlyFromLogic, defaultValue
 | 
			
		||||
        if (fieldDependent.displayLogic.trim() !== '') {
 | 
			
		||||
          isDisplayedFromLogic = evaluator.evaluateLogic({
 | 
			
		||||
            context: getters,
 | 
			
		||||
            parentUuid,
 | 
			
		||||
            containerUuid,
 | 
			
		||||
            logic: fieldDependent.displayLogic,
 | 
			
		||||
            type: 'displayed'
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
        //  Mandatory Logic
 | 
			
		||||
        if (fieldDependent.mandatoryLogic.trim() !== '') {
 | 
			
		||||
          isMandatoryFromLogic = evaluator.evaluateLogic({
 | 
			
		||||
            context: getters,
 | 
			
		||||
            parentUuid,
 | 
			
		||||
            containerUuid,
 | 
			
		||||
            logic: fieldDependent.mandatoryLogic
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
        //  Read Only Logic
 | 
			
		||||
        if (fieldDependent.readOnlyLogic.trim() !== '') {
 | 
			
		||||
          isReadOnlyFromLogic = evaluator.evaluateLogic({
 | 
			
		||||
            context: getters,
 | 
			
		||||
            parentUuid,
 | 
			
		||||
            containerUuid,
 | 
			
		||||
            logic: fieldDependent.readOnlyLogic
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
        //  Default Value
 | 
			
		||||
        if (fieldDependent.defaultValue.trim() !== '' &&
 | 
			
		||||
          fieldDependent.defaultValue.includes('@')) {
 | 
			
		||||
          defaultValue = parseContext({
 | 
			
		||||
            parentUuid,
 | 
			
		||||
            containerUuid,
 | 
			
		||||
            value: fieldDependent.defaultValue
 | 
			
		||||
          }).value
 | 
			
		||||
          if (isSendToServer && defaultValue !== fieldDependent.defaultValue) {
 | 
			
		||||
            dispatch('getRecordBySQL', {
 | 
			
		||||
              field: fieldDependent,
 | 
			
		||||
              query: defaultValue
 | 
			
		||||
            })
 | 
			
		||||
              .then(response => {
 | 
			
		||||
                dispatch('notifyFieldChange', {
 | 
			
		||||
                  parentUuid,
 | 
			
		||||
                  containerUuid,
 | 
			
		||||
                  panelType: fieldDependent.panelType,
 | 
			
		||||
                  columnName: fieldDependent.columnName,
 | 
			
		||||
                  newValue: response.key
 | 
			
		||||
                })
 | 
			
		||||
              })
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        commit('changeFieldLogic', {
 | 
			
		||||
          field: fieldDependent,
 | 
			
		||||
          isDisplayedFromLogic,
 | 
			
		||||
          isMandatoryFromLogic,
 | 
			
		||||
          isReadOnlyFromLogic,
 | 
			
		||||
          parsedDefaultValue: defaultValue
 | 
			
		||||
        })
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    notifyFieldChangeDisplayColumn({ commit, getters }, {
 | 
			
		||||
      containerUuid,
 | 
			
		||||
      columnName,
 | 
			
		||||
| 
						 | 
				
			
			@ -770,7 +821,7 @@ const panel = {
 | 
			
		|||
        .catch(error => {
 | 
			
		||||
          return {
 | 
			
		||||
            ...error,
 | 
			
		||||
            moreInfo: `Dictionary getPanelAndFields ${panelType} (State Panel)`
 | 
			
		||||
            moreInfo: `Dictionary getPanelAndFields ${panelType} (State Panel).`
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
| 
						 | 
				
			
			@ -1010,8 +1061,8 @@ const panel = {
 | 
			
		|||
              containerUuid: containerUuid,
 | 
			
		||||
              columnName: fieldItem.columnName,
 | 
			
		||||
              value: fieldItem.defaultValue,
 | 
			
		||||
              isSQL: isSQL
 | 
			
		||||
            })
 | 
			
		||||
              isSQL
 | 
			
		||||
            }).value
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          valueToReturn = parsedValueComponent({
 | 
			
		||||
| 
						 | 
				
			
			@ -1024,7 +1075,7 @@ const panel = {
 | 
			
		|||
 | 
			
		||||
          // add display column to default
 | 
			
		||||
          if (fieldItem.componentPath === 'FieldSelect' && fieldItem.value === valueToReturn) {
 | 
			
		||||
            attributesObject['DisplayColumn_' + fieldItem.columnName] = fieldItem.displayColumn
 | 
			
		||||
            attributesObject[`DisplayColumn_${fieldItem.columnName}`] = fieldItem.displayColumn
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          return {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,8 +26,10 @@ const process = {
 | 
			
		|||
      containerUuid,
 | 
			
		||||
      routeToDelete
 | 
			
		||||
    }) {
 | 
			
		||||
      var printFormatsAvailable
 | 
			
		||||
      dispatch('requestPrintFormats', { processUuid: containerUuid })
 | 
			
		||||
      let printFormatsAvailable
 | 
			
		||||
      dispatch('requestPrintFormats', {
 | 
			
		||||
        processUuid: containerUuid
 | 
			
		||||
      })
 | 
			
		||||
        .then(response => {
 | 
			
		||||
          printFormatsAvailable = response
 | 
			
		||||
        })
 | 
			
		||||
| 
						 | 
				
			
			@ -51,13 +53,15 @@ const process = {
 | 
			
		|||
            resolve(processDefinition)
 | 
			
		||||
          })
 | 
			
		||||
          .catch(error => {
 | 
			
		||||
            router.push({ path: '/dashboard' })
 | 
			
		||||
            router.push({
 | 
			
		||||
              path: '/dashboard'
 | 
			
		||||
            })
 | 
			
		||||
            dispatch('tagsView/delView', routeToDelete)
 | 
			
		||||
            showMessage({
 | 
			
		||||
              message: language.t('login.unexpectedError'),
 | 
			
		||||
              type: 'error'
 | 
			
		||||
            })
 | 
			
		||||
            console.warn(`Dictionary Process (State) - Error ${error.message}`)
 | 
			
		||||
            console.warn(`Dictionary Process (State) - Error ${error.message}.`)
 | 
			
		||||
            reject(error)
 | 
			
		||||
          })
 | 
			
		||||
      })
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -179,7 +179,10 @@ const window = {
 | 
			
		|||
                  description: processItem.description,
 | 
			
		||||
                  help: processItem.help,
 | 
			
		||||
                  isReport: processItem.isReport,
 | 
			
		||||
                  isDirectPrint: processItem.isDirectPrint
 | 
			
		||||
                  isDirectPrint: processItem.isDirectPrint,
 | 
			
		||||
                  containerUuidAssociated: tabItem.uuid,
 | 
			
		||||
                  parentUuidAssociated: windowUuid,
 | 
			
		||||
                  panelTypeAssociated: 'window'
 | 
			
		||||
                }
 | 
			
		||||
              })
 | 
			
		||||
              actions = actions.concat(processList)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -574,7 +574,7 @@ const windowControl = {
 | 
			
		|||
          parentUuid: parentUuid,
 | 
			
		||||
          containerUuid: containerUuid,
 | 
			
		||||
          value: tab.query
 | 
			
		||||
        }, true)
 | 
			
		||||
        }).value
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      let parsedWhereClause = tab.whereClause
 | 
			
		||||
| 
						 | 
				
			
			@ -583,7 +583,7 @@ const windowControl = {
 | 
			
		|||
          parentUuid: parentUuid,
 | 
			
		||||
          containerUuid: containerUuid,
 | 
			
		||||
          value: tab.whereClause
 | 
			
		||||
        }, true)
 | 
			
		||||
        }).value
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (isReference) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,22 @@
 | 
			
		|||
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
 | 
			
		||||
import evaluator from '@/utils/ADempiere/evaluator'
 | 
			
		||||
import store from '@/store'
 | 
			
		||||
 | 
			
		||||
export default evaluator
 | 
			
		||||
 | 
			
		||||
// get context state from vuex store
 | 
			
		||||
export const getContext = ({
 | 
			
		||||
  parentUuid,
 | 
			
		||||
  containerUuid,
 | 
			
		||||
  columnName
 | 
			
		||||
}) => {
 | 
			
		||||
  return store.getters.getContext({
 | 
			
		||||
    parentUuid,
 | 
			
		||||
    containerUuid,
 | 
			
		||||
    columnName
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Extracts the associated fields from the logics or default values
 | 
			
		||||
 * @param {string} displayLogic
 | 
			
		||||
| 
						 | 
				
			
			@ -45,19 +59,30 @@ export function getParentFields({ displayLogic, mandatoryLogic, readOnlyLogic, d
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * Parse Context String
 | 
			
		||||
 * @param {object} context
 | 
			
		||||
 *  - value: (REQUIRED) String to parsing
 | 
			
		||||
 *  - parentUuid: (REQUIRED from Window) UUID Window
 | 
			
		||||
 *  - containerUuid: (REQUIRED) UUID Tab, Process, SmartBrowser, Report and Form
 | 
			
		||||
 *  - columnName: (Optional if exists in value) Column name to search in context
 | 
			
		||||
 * @param {string} value: (REQUIRED) String to parsing
 | 
			
		||||
 * @param {string} parentUuid: (REQUIRED from Window) UUID Window
 | 
			
		||||
 * @param {string} containerUuid: (REQUIRED) UUID Tab, Process, SmartBrowser, Report and Form
 | 
			
		||||
 * @param {string} columnName: (Optional if exists in value) Column name to search in context
 | 
			
		||||
 * @param {boolean} isBoolToString, convert boolean values to string
 | 
			
		||||
 */
 | 
			
		||||
export function parseContext(context, isBoolToString = false) {
 | 
			
		||||
  const store = require('@/store')
 | 
			
		||||
  var value = String(context.value)
 | 
			
		||||
  var valueSQL = {}
 | 
			
		||||
export function parseContext({
 | 
			
		||||
  parentUuid,
 | 
			
		||||
  containerUuid,
 | 
			
		||||
  columnName,
 | 
			
		||||
  value,
 | 
			
		||||
  isSQL = false
 | 
			
		||||
}) {
 | 
			
		||||
  const isBooleanToString = value.includes('@SQL=')
 | 
			
		||||
  let isError = false
 | 
			
		||||
  const errorsList = []
 | 
			
		||||
  value = String(value)
 | 
			
		||||
 | 
			
		||||
  if (isEmptyValue(value)) {
 | 
			
		||||
    return ''
 | 
			
		||||
    return {
 | 
			
		||||
      value: undefined,
 | 
			
		||||
      isError: true,
 | 
			
		||||
      errorsList: []
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  if (value.includes('@SQL=')) {
 | 
			
		||||
    value = value.replace('@SQL=', '')
 | 
			
		||||
| 
						 | 
				
			
			@ -71,36 +96,47 @@ export function parseContext(context, isBoolToString = false) {
 | 
			
		|||
  var inStr = value
 | 
			
		||||
  var outStr = ''
 | 
			
		||||
 | 
			
		||||
  var i = inStr.indexOf('@')
 | 
			
		||||
  let firstIndexTag = inStr.indexOf('@')
 | 
			
		||||
 | 
			
		||||
  while (i !== -1) {
 | 
			
		||||
    outStr = outStr + inStr.substring(0, i) // up to @
 | 
			
		||||
    inStr = inStr.substring(i + 1, inStr.length)	// from first @
 | 
			
		||||
    var j = inStr.indexOf('@') // next @
 | 
			
		||||
    if (j < 0) {
 | 
			
		||||
      console.log('No second tag: ' + inStr)
 | 
			
		||||
      return ''	//	no second tag
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    token = inStr.substring(0, j)
 | 
			
		||||
    context.columnName = token
 | 
			
		||||
 | 
			
		||||
    var ctxInfo = store.default.getters.getContext(context)	// get context
 | 
			
		||||
    if (isBoolToString && typeof ctxInfo === 'boolean') {
 | 
			
		||||
      if (ctxInfo) {
 | 
			
		||||
        ctxInfo = 'Y'
 | 
			
		||||
      } else {
 | 
			
		||||
        ctxInfo = 'N'
 | 
			
		||||
  while (firstIndexTag !== -1) {
 | 
			
		||||
    outStr = outStr + inStr.substring(0, firstIndexTag) // up to @
 | 
			
		||||
    inStr = inStr.substring(firstIndexTag + 1, inStr.length) // from first @
 | 
			
		||||
    const secondIndexTag = inStr.indexOf('@') // next @
 | 
			
		||||
    // no exists second tag
 | 
			
		||||
    if (secondIndexTag < 0) {
 | 
			
		||||
      console.log(`No second tag: ${inStr}`)
 | 
			
		||||
      return {
 | 
			
		||||
        value: undefined,
 | 
			
		||||
        isError: true,
 | 
			
		||||
        errorsList
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((ctxInfo === undefined || ctxInfo.length === 0) && (token.startsWith('#') || token.startsWith('$'))) {
 | 
			
		||||
      context.parentUuid = undefined
 | 
			
		||||
      context.containerUuid = undefined
 | 
			
		||||
      ctxInfo = store.default.getters.getContext(context)	// get global context
 | 
			
		||||
    token = inStr.substring(0, secondIndexTag)
 | 
			
		||||
    columnName = token
 | 
			
		||||
 | 
			
		||||
    var ctxInfo = getContext({
 | 
			
		||||
      parentUuid,
 | 
			
		||||
      containerUuid,
 | 
			
		||||
      columnName
 | 
			
		||||
    }) // get context
 | 
			
		||||
    if (isBooleanToString && typeof ctxInfo === 'boolean') {
 | 
			
		||||
      ctxInfo = 'N'
 | 
			
		||||
      if (ctxInfo) {
 | 
			
		||||
        ctxInfo = 'Y'
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((ctxInfo === undefined || ctxInfo.length === 0) &&
 | 
			
		||||
      (token.startsWith('#') || token.startsWith('$'))) {
 | 
			
		||||
      ctxInfo = getContext({
 | 
			
		||||
        columnName
 | 
			
		||||
      }) // get global context
 | 
			
		||||
    }
 | 
			
		||||
    if (ctxInfo === undefined || ctxInfo.length === 0) {
 | 
			
		||||
      console.info('No Context for: ' + token)
 | 
			
		||||
      console.info(`No Context for: ${token}`)
 | 
			
		||||
      isError = true
 | 
			
		||||
      errorsList.push(token)
 | 
			
		||||
    } else {
 | 
			
		||||
      if (typeof ctxInfo === 'object') {
 | 
			
		||||
        outStr = ctxInfo
 | 
			
		||||
| 
						 | 
				
			
			@ -109,16 +145,85 @@ export function parseContext(context, isBoolToString = false) {
 | 
			
		|||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    inStr = inStr.substring(j + 1, inStr.length)	// from second @
 | 
			
		||||
    i = inStr.indexOf('@')
 | 
			
		||||
    inStr = inStr.substring(secondIndexTag + 1, inStr.length) // from second @
 | 
			
		||||
    firstIndexTag = inStr.indexOf('@')
 | 
			
		||||
  }
 | 
			
		||||
  if (typeof ctxInfo !== 'object') {
 | 
			
		||||
    outStr = outStr + inStr	// add the rest of the string
 | 
			
		||||
    outStr = outStr + inStr // add the rest of the string
 | 
			
		||||
  }
 | 
			
		||||
  if (context.isSQL) {
 | 
			
		||||
    valueSQL['query'] = outStr
 | 
			
		||||
    valueSQL['value'] = ctxInfo
 | 
			
		||||
    return valueSQL
 | 
			
		||||
  if (isSQL) {
 | 
			
		||||
    return {
 | 
			
		||||
      query: outStr,
 | 
			
		||||
      value: ctxInfo
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return outStr
 | 
			
		||||
}	//	parseContext
 | 
			
		||||
  return {
 | 
			
		||||
    value: outStr,
 | 
			
		||||
    isError,
 | 
			
		||||
    errorsList
 | 
			
		||||
  }
 | 
			
		||||
} // parseContext
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *  Get Preference.
 | 
			
		||||
 *  <pre>
 | 
			
		||||
 *      0)  Current Setting
 | 
			
		||||
 *      1)  Window Preference
 | 
			
		||||
 *      2)  Global Preference
 | 
			
		||||
 *      3)  Login settings
 | 
			
		||||
 *      4)  Accounting settings
 | 
			
		||||
 *  </pre>
 | 
			
		||||
 *  @param  {string} parentUuid UUID Window
 | 
			
		||||
 *  @param  {string} containerUuid  UUID Tab, Process, SmartBrowser, Report and Form
 | 
			
		||||
 *  @param  {string}  columnName (context)  Entity to search
 | 
			
		||||
 *  @return preference value
 | 
			
		||||
 */
 | 
			
		||||
export function getPreference({
 | 
			
		||||
  parentUuid,
 | 
			
		||||
  containerUuid,
 | 
			
		||||
  columnName
 | 
			
		||||
}) {
 | 
			
		||||
  let retValue
 | 
			
		||||
  if (isEmptyValue(columnName)) {
 | 
			
		||||
    console.warn('Require Context ColumnName')
 | 
			
		||||
    return retValue
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //        USER PREFERENCES
 | 
			
		||||
  // View Preferences
 | 
			
		||||
  retValue = getContext({
 | 
			
		||||
    parentUuid: 'P' + parentUuid,
 | 
			
		||||
    containerUuid,
 | 
			
		||||
    columnName: columnName
 | 
			
		||||
  })
 | 
			
		||||
  if (!isEmptyValue(retValue)) {
 | 
			
		||||
    return retValue
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //  Global Preferences
 | 
			
		||||
  retValue = getContext({
 | 
			
		||||
    columnName: 'P|' + columnName
 | 
			
		||||
  })
 | 
			
		||||
  if (!isEmptyValue(retValue)) {
 | 
			
		||||
    return retValue
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //        SYSTEM PREFERENCES
 | 
			
		||||
  // Login setting
 | 
			
		||||
  if (!isEmptyValue(parentUuid)) {
 | 
			
		||||
    // get # globals context only window
 | 
			
		||||
    retValue = getContext({
 | 
			
		||||
      columnName: '#' + columnName
 | 
			
		||||
    })
 | 
			
		||||
    if (!isEmptyValue(retValue)) {
 | 
			
		||||
      return retValue
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //  Accounting setting
 | 
			
		||||
  retValue = getContext({
 | 
			
		||||
    columnName: '$' + columnName
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  return retValue
 | 
			
		||||
} //  getPreference
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
import evaluator from '@/utils/ADempiere/evaluator'
 | 
			
		||||
import { isEmptyValue, parsedValueComponent } from '@/utils/ADempiere/valueUtils'
 | 
			
		||||
import { getParentFields, parseContext } from '@/utils/ADempiere/contextUtils'
 | 
			
		||||
import { getParentFields, getPreference, parseContext } from '@/utils/ADempiere/contextUtils'
 | 
			
		||||
import REFERENCES, { FIELD_NOT_SHOWED } from '@/components/ADempiere/Field/references'
 | 
			
		||||
import { FIELD_DISPLAY_SIZES, DEFAULT_SIZE } from '@/components/ADempiere/Field/fieldSize'
 | 
			
		||||
import language from '@/lang'
 | 
			
		||||
| 
						 | 
				
			
			@ -22,15 +22,28 @@ export function generateField(fieldToGenerate, moreAttributes, typeRange = false
 | 
			
		|||
  const referenceType = componentReference.alias[0]
 | 
			
		||||
 | 
			
		||||
  let parsedDefaultValue = fieldToGenerate.defaultValue
 | 
			
		||||
  if (String(parsedDefaultValue).includes('@')) {
 | 
			
		||||
    if (String(parsedDefaultValue).includes('@SQL=')) {
 | 
			
		||||
      parsedDefaultValue.replace('@SQL=', '')
 | 
			
		||||
  if (isEmptyValue(parsedDefaultValue)) {
 | 
			
		||||
    parsedDefaultValue = getPreference({
 | 
			
		||||
      parentUuid: fieldToGenerate.parentUuid,
 | 
			
		||||
      containerUuid: fieldToGenerate.containerUuid,
 | 
			
		||||
      columnName: fieldToGenerate.columnName
 | 
			
		||||
    })
 | 
			
		||||
    if (isEmptyValue(parsedDefaultValue)) {
 | 
			
		||||
      parsedDefaultValue = getPreference({
 | 
			
		||||
        parentUuid: fieldToGenerate.parentUuid,
 | 
			
		||||
        containerUuid: fieldToGenerate.containerUuid,
 | 
			
		||||
        columnName: fieldToGenerate.elementName
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  } else if (String(parsedDefaultValue).includes('@')) {
 | 
			
		||||
    // if (String(parsedDefaultValue).includes('@SQL=')) {
 | 
			
		||||
    //   parsedDefaultValue.replace('@SQL=', '')
 | 
			
		||||
    // }
 | 
			
		||||
    parsedDefaultValue = parseContext({
 | 
			
		||||
      ...moreAttributes,
 | 
			
		||||
      columnName: fieldToGenerate.columnName,
 | 
			
		||||
      value: parsedDefaultValue
 | 
			
		||||
    })
 | 
			
		||||
    }).value
 | 
			
		||||
  }
 | 
			
		||||
  parsedDefaultValue = parsedValueComponent({
 | 
			
		||||
    fieldType: componentReference.type,
 | 
			
		||||
| 
						 | 
				
			
			@ -40,12 +53,28 @@ export function generateField(fieldToGenerate, moreAttributes, typeRange = false
 | 
			
		|||
  })
 | 
			
		||||
 | 
			
		||||
  let parsedDefaultValueTo = fieldToGenerate.defaultValueTo
 | 
			
		||||
  if (String(parsedDefaultValueTo).includes('@')) {
 | 
			
		||||
  if (isEmptyValue(parsedDefaultValueTo)) {
 | 
			
		||||
    parsedDefaultValueTo = getPreference({
 | 
			
		||||
      parentUuid: fieldToGenerate.parentUuid,
 | 
			
		||||
      containerUuid: fieldToGenerate.containerUuid,
 | 
			
		||||
      columnName: `${fieldToGenerate.columnName}_To`
 | 
			
		||||
    })
 | 
			
		||||
    if (isEmptyValue()) {
 | 
			
		||||
      parsedDefaultValueTo = getPreference({
 | 
			
		||||
        parentUuid: fieldToGenerate.parentUuid,
 | 
			
		||||
        containerUuid: fieldToGenerate.containerUuid,
 | 
			
		||||
        columnName: `${fieldToGenerate.elementName}_To`
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  } else if (String(parsedDefaultValueTo).includes('@')) {
 | 
			
		||||
    // if (String(parsedDefaultValueTo).includes('@SQL=')) {
 | 
			
		||||
    //   parsedDefaultValueTo.replace('@SQL=', '')
 | 
			
		||||
    // }
 | 
			
		||||
    parsedDefaultValueTo = parseContext({
 | 
			
		||||
      ...moreAttributes,
 | 
			
		||||
      columnName: fieldToGenerate.columnName,
 | 
			
		||||
      value: fieldToGenerate.defaultValueTo
 | 
			
		||||
    })
 | 
			
		||||
    }).value
 | 
			
		||||
  }
 | 
			
		||||
  parsedDefaultValueTo = parsedValueComponent({
 | 
			
		||||
    fieldType: componentReference.type,
 | 
			
		||||
| 
						 | 
				
			
			@ -53,6 +82,7 @@ export function generateField(fieldToGenerate, moreAttributes, typeRange = false
 | 
			
		|||
    referenceType,
 | 
			
		||||
    isMandatory: fieldToGenerate.isMandatory
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  fieldToGenerate.reference.zoomWindowList = fieldToGenerate.reference.windowsList
 | 
			
		||||
  const field = {
 | 
			
		||||
    ...fieldToGenerate,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue