Skip to content

Commit

Permalink
feat: Create/Update Entity with display columns. (adempiere#745)
Browse files Browse the repository at this point in the history
* fix: Create/Update tab entity with display columns.

* fix comments.

* update sub modules.
  • Loading branch information
EdwinBetanc0urt authored Jan 17, 2023
1 parent 3b32233 commit 0f12844
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 32 deletions.
102 changes: 86 additions & 16 deletions src/api/ADempiere/user-interface/persistence.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Yamel Senih ysenih@erpya.com www.erpya.com
// 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) 2017-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
* Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt
* 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/>.
*/

// Get Instance for connection
import { request } from '@/utils/ADempiere/request'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'

// constants
// Constants
import { ROWS_OF_RECORDS_BY_PAGE } from '@/utils/ADempiere/tableUtils'

/**
Expand Down Expand Up @@ -118,6 +120,74 @@ export function getEntities({
})
}

/**
* Create entity
* @param {string} tabUuid
* @param {array} attributesList
*/
export function createEntity({
tabUuid,
attributesList
}) {
attributesList = attributesList.map(parameter => {
return {
key: parameter.columnName,
value: parameter.value
}
})

return request({
url: '/user-interface/window/create-entity',
method: 'post',
data: {
tab_uuid: tabUuid,
attributes: attributesList
}
})
.then(entityCreateResponse => {
const { convertEntity } = require('@/utils/ADempiere/apiConverts/persistence.js')

return convertEntity(entityCreateResponse)
})
}

/**
* Update entity
* @param {string} tabUuid
* @param {number} recordId
* @param {string} recordUuid
* @param {array} attributesList
*/
export function updateEntity({
tabUuid,
recordId,
recordUuid,
attributesList
}) {
attributesList = attributesList.map(parameter => {
return {
key: parameter.columnName,
value: parameter.value
}
})

return request({
url: '/user-interface/window/update-entity',
method: 'post',
data: {
tab_uuid: tabUuid,
id: recordId,
uuid: recordUuid,
attributes: attributesList
}
})
.then(entityUpdateResponse => {
const { convertEntity } = require('@/utils/ADempiere/apiConverts/persistence.js')

return convertEntity(entityUpdateResponse)
})
}

/**
* Get default value for a field, parameter or query criteria
* @param {array} contextAttributesList, key value
Expand Down
14 changes: 7 additions & 7 deletions src/store/modules/ADempiere/persistence.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* 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
* 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
Expand All @@ -20,18 +20,18 @@ import Vue from 'vue'

import language from '@/lang'

// constants
// Constants
import { LOG_COLUMNS_NAME_LIST, UUID } from '@/utils/ADempiere/constants/systemColumns'
import { ROW_ATTRIBUTES } from '@/utils/ADempiere/tableUtils'
import { DISPLAY_COLUMN_PREFIX, IDENTIFIER_COLUMN_SUFFIX } from '@/utils/ADempiere/dictionaryUtils'

// api request methods
// API Request Methods
import {
createEntity,
updateEntity
} from '@/api/ADempiere/common/persistence.js'
} from '@/api/ADempiere/user-interface/persistence'

// utils and helper methods
// Utils and Helper Methods
import { isEmptyValue, isSameValues } from '@/utils/ADempiere/valueUtils.js'
import { showMessage } from '@/utils/ADempiere/notification.js'
import { getContextDefaultValue } from '@/utils/ADempiere/dictionaryUtils.js'
Expand Down Expand Up @@ -245,7 +245,7 @@ const persistence = {
if (!isEmptyValue(recordUuid)) {
// Update existing entity
return updateEntity({
tableName,
tabUuid: containerUuid,
recordUuid,
attributesList
})
Expand Down Expand Up @@ -289,7 +289,7 @@ const persistence = {

// Create new entity
return createEntity({
tableName,
tabUuid: containerUuid,
attributesList
})
.then(response => {
Expand Down
16 changes: 8 additions & 8 deletions src/store/modules/ADempiere/windowManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* 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
* 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
Expand All @@ -20,19 +20,20 @@ import Vue from 'vue'
import language from '@/lang'
import router from '@/router'

// api request methods
// API Request Methods
import {
getEntities
getEntities,
updateEntity
} from '@/api/ADempiere/user-interface/persistence.js'
import {
updateEntity,
deleteEntity
} from '@/api/ADempiere/common/persistence.js'
// constants

// Constants
import { UUID } from '@/utils/ADempiere/constants/systemColumns'
import { ROW_ATTRIBUTES } from '@/utils/ADempiere/tableUtils'

// utils and helper methods
// Utils and Helper Methods
import { containerManager } from '@/utils/ADempiere/dictionary/window'
import { getContextAttributes, generateContextKey } from '@/utils/ADempiere/contextUtils.js'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
Expand Down Expand Up @@ -561,7 +562,6 @@ const windowManager = {
updateRowTableWindows({ commit, dispatch, getters }, {
parentUuid,
containerUuid,
tableName,
recordUuid,
attributesList
}) {
Expand All @@ -581,7 +581,7 @@ const windowManager = {
})
return new Promise((resolve, reject) => {
updateEntity({
tableName,
tabUuid: containerUuid,
recordUuid,
attributesList
})
Expand Down
2 changes: 1 addition & 1 deletion src/themes/default
Submodule default updated 54 files
+8 −7 components/ADempiere/CollapseCriteria/index.vue
+1 −1 components/ADempiere/ContainerInfo/workflowLogs.vue
+10 −57 components/ADempiere/ContainerOptions/DocumentStatusTag/index.vue
+1 −1 components/ADempiere/DataTable/Browser/index.vue
+71 −4 components/ADempiere/DataTable/Components/CellEditInfo.vue
+70 −24 components/ADempiere/DataTable/Windows/index.vue
+1 −0 components/ADempiere/DataTable/index.vue
+42 −20 components/ADempiere/FieldDefinition/FieldButton.vue
+38 −25 components/ADempiere/FieldDefinition/FieldDate.vue
+3 −3 components/ADempiere/FieldDefinition/FieldOptions/ChangeLogs/index.vue
+31 −25 components/ADempiere/FieldDefinition/FieldOptions/ContextInfo/index.vue
+1 −1 components/ADempiere/FieldDefinition/FieldOptions/fieldOptionsList.js
+5 −5 components/ADempiere/FieldDefinition/FieldOptions/index.vue
+1 −0 components/ADempiere/FieldDefinition/FieldSearch/BusinessPartnerInfo/index.vue
+1 −0 components/ADempiere/FieldDefinition/FieldSearch/mixinFieldSearch.js
+1 −1 components/ADempiere/FieldDefinition/FieldSelect.vue
+1 −1 components/ADempiere/FieldDefinition/FieldYesNo/DefaultTemplate.vue
+55 −39 components/ADempiere/FieldDefinition/index.vue
+7 −1 components/ADempiere/FieldDefinition/mixin/mixinField.js
+18 −16 components/ADempiere/FieldDefinition/mixin/mixinFieldRange.js
+3 −1 components/ADempiere/FieldDefinition/mixin/mixinFieldSelect.js
+78 −0 components/ADempiere/FilterFields/fieldsDisplayOptions.vue
+49 −16 components/ADempiere/FilterFields/index.vue
+24 −10 components/ADempiere/Form/VPOS/BusinessPartner/businessPartnerUpdate.vue
+8 −8 components/ADempiere/Form/VPOS/OrderList/FindOrders/index.vue
+9 −9 components/ADempiere/Form/VPOS/OrderList/index.vue
+0 −6 components/ADempiere/Form/VPOS/ProductInfo/index.vue
+785 −115 components/ADempiere/Form/VPayPrint/index.vue
+14 −28 components/ADempiere/Form/WFPanel/index.vue
+25 −6 components/ADempiere/Form/WorkflowActivity/Guide/steps.js
+20 −18 components/ADempiere/Form/WorkflowActivity/fieldsList.js
+16 −10 components/ADempiere/Form/WorkflowActivity/index.vue
+370 −0 components/ADempiere/PanelDefinition/DraggablePanel.vue
+3 −3 components/ADempiere/PanelDefinition/SortPanel.vue
+217 −0 components/ADempiere/PanelDefinition/TreePanel.vue
+13 −3 components/ADempiere/PanelDefinition/index.vue
+3 −3 components/ADempiere/PanelInfo/Component/ReferenceRecords/index.vue
+24 −96 components/ADempiere/PanelInfo/Component/workflowLogs/index.vue
+66 −11 components/ADempiere/PanelInfo/index.vue
+30 −7 components/ADempiere/ReportManager/Setup/optionsReport.vue
+92 −15 components/ADempiere/ReportManager/Setup/optionsReportViewer.vue
+144 −45 components/ADempiere/TabManager/AdvancedTabQuery.vue
+14 −11 components/ADempiere/TabManager/TabLabel.vue
+1 −1 components/ADempiere/TabManager/TabOptions.vue
+12 −8 components/ADempiere/TabManager/TabPanel.vue
+365 −0 components/ADempiere/TabManager/convenienceButtons/documentAction.vue
+160 −0 components/ADempiere/TabManager/convenienceButtons/documentStatus.vue
+12 −320 components/ADempiere/TabManager/convenienceButtons/index.vue
+8 −2 components/ADempiere/TabManager/index.vue
+57 −32 components/ADempiere/TabManager/tabChild.vue
+13 −7 components/ADempiere/WorkflowManager/WorkflowDiagram.vue
+84 −0 components/ADempiere/WorkflowManager/WorkflowStatusBar.vue
+0 −322 components/ADempiere/WorkflowStatusBar/index.vue
+0 −188 components/ADempiere/searchRecordField/panelSearchCriteria.vue

0 comments on commit 0f12844

Please sign in to comment.