diff --git a/config/default.json b/config/default.json index d22e21f5..9a8bbb99 100644 --- a/config/default.json +++ b/config/default.json @@ -5,11 +5,11 @@ }, "adempiere": { "api": { - "url": "https://api.erpya.com/adempiere-api", + "url": "https://api.erpya.com/api", "timeout": 10000 }, "images": { - "url": "https://api.erpya.com/adempiere-api/img" + "url": "https://api.erpya.com/adempiere-api" } }, "repository": { diff --git a/src/api/ADempiere/actions/private-access.js b/src/api/ADempiere/actions/private-access.js index ea518e17..a69ec29a 100644 --- a/src/api/ADempiere/actions/private-access.js +++ b/src/api/ADempiere/actions/private-access.js @@ -24,9 +24,9 @@ export function getPrivateAccess({ recordUuid }) { return request({ - url: '/ui/get-private-access', - method: 'post', - data: { + url: '/user-interface/component/private-access/private-access', + method: 'get', + params: { table_name: tableName, id: recordId, uuid: recordUuid @@ -48,7 +48,7 @@ export function lockPrivateAccess({ recordUuid }) { return request({ - url: '/ui/lock-private-access', + url: '/user-interface/component/private-access/lock-private-access', method: 'post', data: { table_name: tableName, @@ -72,7 +72,7 @@ export function unlockPrivateAccess({ recordUuid }) { return request({ - url: '/ui/unlock-private-access', + url: '/user-interface/component/private-access/unlock-private-access', method: 'post', data: { table_name: tableName, diff --git a/src/api/ADempiere/actions/record-access.js b/src/api/ADempiere/actions/record-access.js index 409d7ca2..bfcfe716 100644 --- a/src/api/ADempiere/actions/record-access.js +++ b/src/api/ADempiere/actions/record-access.js @@ -31,7 +31,7 @@ export function getRecordAccess({ }) { return new Promise(resolve => { request({ - url: '/ui/record-access', + url: '/user-interface/component/record-access/record-access', method: 'get', params: { table_name: tableName, @@ -59,7 +59,7 @@ export function setRecordAccess({ recordAccesses }) { return request({ - url: '/ui/set-record-access', + url: '/user-interface/component/record-access/set-record-access', method: 'post', data: { table_name: tableName, diff --git a/src/api/ADempiere/actions/translation.js b/src/api/ADempiere/actions/translation.js new file mode 100644 index 00000000..2c277b72 --- /dev/null +++ b/src/api/ADempiere/actions/translation.js @@ -0,0 +1,59 @@ +// 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 . + +// Get Instance for connection +import { request } from '@/utils/ADempiere/request' + +/** + * Request translations + * @param {string} tableName + * @param {string} language + * @param {string} recordUuid + * @param {number} recordId + */ +export function requestTranslations({ + tableName, + language, + recordUuid, + recordId, + pageToken, + pageSize +}) { + return request({ + url: '/user-interface/component/translation/translations', + method: 'get', + params: { + table_name: tableName, + id: recordId, + uuid: recordUuid, + language, + // Page Data + pageToken, + pageSize + } + }) + .then(languageListResponse => { + const { convertTranslation } = require('@/utils/ADempiere/apiConverts/persistence.js') + + return { + nextPageToken: languageListResponse.next_page_token, + recordCount: languageListResponse.record_count, + translationsList: languageListResponse.records.map(record => { + return convertTranslation(record) + }) + } + }) +} diff --git a/src/api/ADempiere/browser.js b/src/api/ADempiere/browser.js index 8f7768f7..b4b525a7 100644 --- a/src/api/ADempiere/browser.js +++ b/src/api/ADempiere/browser.js @@ -54,7 +54,7 @@ export function requestBrowserSearch({ }) return request({ - url: '/ui/list-browser-items', + url: '/user-interface/smart-browser/browser-items', data: { // Running Parameters uuid, diff --git a/src/api/ADempiere/persistence.js b/src/api/ADempiere/common/persistence.js similarity index 68% rename from src/api/ADempiere/persistence.js rename to src/api/ADempiere/common/persistence.js index 810b97ca..07bb079b 100644 --- a/src/api/ADempiere/persistence.js +++ b/src/api/ADempiere/common/persistence.js @@ -34,7 +34,7 @@ export function requestCreateEntity({ }) return request({ - url: '/data/create', + url: '/common/api/create', method: 'post', data: { table_name: tableName, @@ -69,7 +69,7 @@ export function requestUpdateEntity({ }) return request({ - url: '/data/update', + url: '/common/api/update', method: 'post', data: { table_name: tableName, @@ -97,7 +97,7 @@ export function requestDeleteEntity({ recordUuid }) { return request({ - url: '/data/delete', + url: '/common/api/delete', method: 'post', data: { table_name: tableName, @@ -122,7 +122,7 @@ export function rollbackEntity({ eventType }) { return request({ - url: '/data/rollback-entity', + url: '/common/api/rollback-entity', method: 'post', data: { table_name: tableName, @@ -145,7 +145,7 @@ export function requestGetEntity({ recordUuid }) { return request({ - url: '/data/entity', + url: '/common/api/entity', method: 'get', params: { table_name: tableName, @@ -193,9 +193,9 @@ export function requestListEntities({ }) return request({ - url: '/data/list', - method: 'post', - data: { + url: '/common/api/entites', + method: 'get', + params: { table_name: tableName, // DSL Query filters, @@ -204,9 +204,7 @@ export function requestListEntities({ query, where_clause: whereClause, order_by_clause: orderByClause, - limit - }, - params: { + limit, // Page Data pageToken, pageSize @@ -218,99 +216,3 @@ export function requestListEntities({ return convertEntityList(entitiesListResponse) }) } - -/** - * Request translations - * @param {string} tableName - * @param {string} language - * @param {string} recordUuid - * @param {number} recordId - */ -export function getTranslations({ - tableName, - language, - recordUuid, - recordId, - pageToken, - pageSize -}) { - return request({ - url: '/ui/list-translations', - method: 'post', - data: { - table_name: tableName, - id: recordId, - uuid: recordUuid - }, - params: { - language, - // Page Data - pageToken, - pageSize - } - }) - .then(languageListResponse => { - const { convertTranslation } = require('@/utils/ADempiere/apiConverts/persistence.js') - - return { - nextPageToken: languageListResponse.next_page_token, - recordCount: languageListResponse.record_count, - translationsList: languageListResponse.records.map(record => { - return convertTranslation(record) - }) - } - }) -} - -// Download a resource from file name -export function requestResource({ resourceUuid }, callBack = { - onData: () => {}, - onStatus: () => {}, - onEnd: () => {} -}) { - const stream = request({ - url: '/resource', - method: 'get', - params: { - resource_uuid: resourceUuid - } - }) - - stream.on('data', (response) => callBack.onData(response)) - stream.on('status', (status) => callBack.onStatus(status)) - stream.on('end', (end) => callBack.onEnd(end)) - - return stream -} - -/** - * Get image with uri request - * @author EdwinBetanc0urt - * @author Elsio15 - * @param {string} file - * @param {number} width - * @param {number} height - * @param {string} operation fit, resize - * @returns {promise} with array buffer in response - */ -export function requestImage({ - file, - width, - height, - operation = 'fit' -}) { - const { getImagePath } = require('@/utils/ADempiere/resource.js') - - const { urn } = getImagePath({ - file, - width, - height, - operation - }) - - return request({ - url: urn, - method: 'get', - responseType: 'arraybuffer' - }) -} diff --git a/src/api/ADempiere/common/resource.js b/src/api/ADempiere/common/resource.js new file mode 100644 index 00000000..d34daf72 --- /dev/null +++ b/src/api/ADempiere/common/resource.js @@ -0,0 +1,70 @@ +// 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 . + +// Get Instance for connection +import { request } from '@/utils/ADempiere/request' +import { config } from '@/utils/ADempiere/config' + +// Download a resource from file name +export function requestResource({ resourceUuid }, callBack = { + onData: () => {}, + onStatus: () => {}, + onEnd: () => {} +}) { + const stream = request({ + url: '/resource', + method: 'get', + params: { + resource_uuid: resourceUuid + } + }) + + stream.on('data', (response) => callBack.onData(response)) + stream.on('status', (status) => callBack.onStatus(status)) + stream.on('end', (end) => callBack.onEnd(end)) + + return stream +} + +/** + * Get image with uri request + * @param {string} file + * @param {number} width + * @param {number} height + * @param {string} operation fit, resize + * @returns {promise} with array buffer in response + */ +export function requestImage({ + file, + width, + height, + operation = 'fit' +}) { + const { getImagePath } = require('@/utils/ADempiere/resource.js') + + const { urn } = getImagePath({ + file, + width, + height, + operation + }) + return request({ + url: urn, + method: 'get', + responseType: 'arraybuffer', + baseURL: config.adempiere.images.url + }) +} diff --git a/src/api/ADempiere/dashboard/dashboard.js b/src/api/ADempiere/dashboard/dashboard.js index 31e2ad6f..ddb1c473 100644 --- a/src/api/ADempiere/dashboard/dashboard.js +++ b/src/api/ADempiere/dashboard/dashboard.js @@ -18,107 +18,6 @@ // Get Instance for connection import { request } from '@/utils/ADempiere/request' -// Get Recent Items based on selection option -export function requestListRecentItems({ - userUuid, - roleUuid, - pageToken, - pageSize -}) { - return request({ - url: '/logs/list-recent-items', - method: 'post', - data: { - user_uuid: userUuid, - role_uuid: roleUuid, - current_session: true - }, - params: { - // Page Data - pageToken, - pageSize - } - }) - .then(recentItmesReponse => { - const { convertRecentItemsList } = require('@/utils/ADempiere/apiConverts/dashboard.js') - - return convertRecentItemsList(recentItmesReponse) - }) -} - -/** - * Request Favorites List - * @param {string} userUuid - */ -export function getFavoritesFromServer({ - userId, - userUuid, - pageToken, - pageSize -}) { - return request({ - url: '/dashboard/list-favorites', - method: 'post', - data: { - user_id: userId, - user_uuid: userUuid - }, - params: { - // Page Data - pageToken, - pageSize - } - }) - .then(favoritesListReponse => { - const { convertFavorite } = require('@/utils/ADempiere/apiConverts/dashboard.js') - - return { - recordCount: favoritesListReponse.record_count, - favoritesList: favoritesListReponse.records.map(favorite => { - return convertFavorite(favorite) - }), - nextPageToken: favoritesListReponse.next_page_token - } - }) -} - -// Get pending documents -export function getPendingDocumentsFromServer({ - userId, - userUuid, - roleId, - roleUuid, - pageToken, - pageSize -}) { - return request({ - url: '/dashboard/list-pending-documents', - method: 'post', - data: { - user_id: userId, - user_uuid: userUuid, - role_id: roleId, - role_uuid: roleUuid - }, - params: { - // Page Data - pageToken, - pageSize - } - }) - .then(pendingDocumentsListResponse => { - const { convertPendingDocument } = require('@/utils/ADempiere/apiConverts/dashboard.js') - - return { - recordCount: pendingDocumentsListResponse.record_count, - pendingDocumentsList: pendingDocumentsListResponse.records.map(pendingDocument => { - return convertPendingDocument(pendingDocument) - }), - nextPageToken: pendingDocumentsListResponse.next_page_token - } - }) -} - // List all dashboard for role export function requestLisDashboards({ roleId, @@ -127,13 +26,11 @@ export function requestLisDashboards({ pageSize }) { return request({ - url: '/dashboard/list-dashboards', - method: 'post', - data: { - role_id: roleId, - role_uuid: roleUuid - }, + url: '/dashboard/dashboards', + method: 'get', params: { + role_id: roleId, + role_uuid: roleUuid, // Page Data pageToken, pageSize diff --git a/src/api/ADempiere/dashboard/tasks.js b/src/api/ADempiere/dashboard/tasks.js new file mode 100644 index 00000000..92464d55 --- /dev/null +++ b/src/api/ADempiere/dashboard/tasks.js @@ -0,0 +1,54 @@ +// 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 . +// This file is for get all information for dashboard of ADempiere client, +// please if you want to implement a custom dashboard create a new fielwith api definition +// Get Instance for connection +import { request } from '@/utils/ADempiere/request' + +// Get pending documents +export function getPendingDocumentsFromServer({ + userId, + userUuid, + roleId, + roleUuid, + pageToken, + pageSize +}) { + return request({ + url: '/dashboard/addons/tasks/pending-documents', + method: 'get', + params: { + user_id: userId, + user_uuid: userUuid, + role_id: roleId, + role_uuid: roleUuid, + // Page Data + pageToken, + pageSize + } + }) + .then(pendingDocumentsListResponse => { + const { convertPendingDocument } = require('@/utils/ADempiere/apiConverts/dashboard.js') + + return { + recordCount: pendingDocumentsListResponse.record_count, + pendingDocumentsList: pendingDocumentsListResponse.records.map(pendingDocument => { + return convertPendingDocument(pendingDocument) + }), + nextPageToken: pendingDocumentsListResponse.next_page_token + } + }) +} diff --git a/src/api/ADempiere/dashboard/user.js b/src/api/ADempiere/dashboard/user.js new file mode 100644 index 00000000..6cf23aff --- /dev/null +++ b/src/api/ADempiere/dashboard/user.js @@ -0,0 +1,79 @@ +// 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 . +// This file is for get all information for dashboard of ADempiere client, +// please if you want to implement a custom dashboard create a new fielwith api definition +// Get Instance for connection +import { request } from '@/utils/ADempiere/request' + +// Get Recent Items based on selection option +export function requestListRecentItems({ + userUuid, + roleUuid, + pageToken, + pageSize +}) { + return request({ + url: '/dashboard/addons/user/recent-items', + method: 'get', + params: { + user_uuid: userUuid, + role_uuid: roleUuid, + current_session: true, + // Page Data + pageToken, + pageSize + } + }) + .then(recentItmesReponse => { + const { convertRecentItemsList } = require('@/utils/ADempiere/apiConverts/dashboard.js') + + return convertRecentItemsList(recentItmesReponse) + }) +} + +/** + * Request Favorites List + * @param {string} userUuid + */ +export function getFavoritesFromServer({ + userId, + userUuid, + pageToken, + pageSize +}) { + return request({ + url: '/dashboard/addons/user/favorites', + method: 'get', + params: { + user_id: userId, + user_uuid: userUuid, + // Page Data + pageToken, + pageSize + } + }) + .then(favoritesListReponse => { + const { convertFavorite } = require('@/utils/ADempiere/apiConverts/dashboard.js') + + return { + recordCount: favoritesListReponse.record_count, + favoritesList: favoritesListReponse.records.map(favorite => { + return convertFavorite(favorite) + }), + nextPageToken: favoritesListReponse.next_page_token + } + }) +} diff --git a/src/api/ADempiere/rule.js b/src/api/ADempiere/dictionary/form.js similarity index 54% rename from src/api/ADempiere/rule.js rename to src/api/ADempiere/dictionary/form.js index a4cda9e8..1a950f98 100644 --- a/src/api/ADempiere/rule.js +++ b/src/api/ADempiere/dictionary/form.js @@ -18,45 +18,25 @@ import { request } from '@/utils/ADempiere/request' /** - * Run callout request - * @param {string} windowUuid - * @param {number} windowNo - * @param {string} tabUuid - * @param {string} tableName - * @param {string} columnName - * @param {mixed} value - * @param {mixed} oldValue - * @param {string} callout - * @param {array} attributesList - * @returns {Map} Entity + * Request dictionary Form metadata + * @param {string} uuid universally unique identifier + * @param {number} id, integer identifier */ -export function runCallOutRequest({ - windowUuid, - windowNo, - tabUuid, - tableName, - columnName, - value, - oldValue, - callout, - attributesList = [] +export function requestForm({ + uuid, + id }) { return request({ - url: '/ui/run-callout', - method: 'post', - data: { - table_name: tableName, - window_uuid: windowUuid, - tab_uuid: tabUuid, - callout, - column_name: columnName, - old_value: oldValue, - value, - window_no: windowNo, - attributes: attributesList + url: '/dictionary/form', + method: 'get', + params: { + uuid, + id } }) - .then(response => { - return response + .then(formResponse => { + const { convertForm } = require('@/utils/ADempiere/apiConverts/dictionary.js') + + return convertForm(formResponse) }) } diff --git a/src/api/ADempiere/dictionary/process.js b/src/api/ADempiere/dictionary/process.js new file mode 100644 index 00000000..d3f44024 --- /dev/null +++ b/src/api/ADempiere/dictionary/process.js @@ -0,0 +1,42 @@ +// 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 . + +// Get Instance for connection +import { request } from '@/utils/ADempiere/request' + +/** + * Request dictionary Process/Report metadata + * @param {string} uuid universally unique identifier + * @param {number} id, identifier + */ +export function requestProcessMetadata({ + uuid, + id +}) { + return request({ + url: '/dictionary/process', + method: 'get', + params: { + uuid, + id + } + }) + .then(processResponse => { + const { convertProcess } = require('@/utils/ADempiere/apiConverts/dictionary.js') + + return convertProcess(processResponse) + }) +} diff --git a/src/api/ADempiere/dictionary/smart-browser.js b/src/api/ADempiere/dictionary/smart-browser.js new file mode 100644 index 00000000..d0ab361d --- /dev/null +++ b/src/api/ADempiere/dictionary/smart-browser.js @@ -0,0 +1,42 @@ +// 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 . + +// Get Instance for connection +import { request } from '@/utils/ADempiere/request' + +/** + * Request dictionary Smart Browser metadata + * @param {string} uuid universally unique identifier + * @param {number} id, identifier + */ +export function requestBrowserMetadata({ + uuid, + id +}) { + return request({ + url: '/dictionary/browser', + method: 'get', + params: { + uuid, + id + } + }) + .then(browserResponse => { + const { convertBrowser } = require('@/utils/ADempiere/apiConverts/dictionary.js') + + return convertBrowser(browserResponse) + }) +} diff --git a/src/api/ADempiere/dictionary.js b/src/api/ADempiere/dictionary/window.js similarity index 66% rename from src/api/ADempiere/dictionary.js rename to src/api/ADempiere/dictionary/window.js index 3896200a..d8cac60c 100644 --- a/src/api/ADempiere/dictionary.js +++ b/src/api/ADempiere/dictionary/window.js @@ -41,78 +41,6 @@ export function requestWindowMetadata({ }) } -/** - * Request dictionary Process/Report metadata - * @param {string} uuid universally unique identifier - * @param {number} id, identifier - */ -export function requestProcessMetadata({ - uuid, - id -}) { - return request({ - url: '/dictionary/process', - method: 'get', - params: { - uuid, - id - } - }) - .then(processResponse => { - const { convertProcess } = require('@/utils/ADempiere/apiConverts/dictionary.js') - - return convertProcess(processResponse) - }) -} - -/** - * Request dictionary Smart Browser metadata - * @param {string} uuid universally unique identifier - * @param {number} id, identifier - */ -export function requestBrowserMetadata({ - uuid, - id -}) { - return request({ - url: '/dictionary/browser', - method: 'get', - params: { - uuid, - id - } - }) - .then(browserResponse => { - const { convertBrowser } = require('@/utils/ADempiere/apiConverts/dictionary.js') - - return convertBrowser(browserResponse) - }) -} - -/** - * Request dictionary Form metadata - * @param {string} uuid universally unique identifier - * @param {number} id, integer identifier - */ -export function requestForm({ - uuid, - id -}) { - return request({ - url: '/dictionary/form', - method: 'get', - params: { - uuid, - id - } - }) - .then(formResponse => { - const { convertForm } = require('@/utils/ADempiere/apiConverts/dictionary.js') - - return convertForm(formResponse) - }) -} - export function requestFieldMetadata({ uuid, columnUuid, diff --git a/src/api/ADempiere/enrollment.js b/src/api/ADempiere/enrollment.js index 83c4b0f6..8d5cf20c 100644 --- a/src/api/ADempiere/enrollment.js +++ b/src/api/ADempiere/enrollment.js @@ -33,7 +33,7 @@ export function requestEnrollUser({ eMail }) { return request({ - url: '/enrollment/enroll', + url: '/user/enrollment/enroll', data: { user_name: userName, name, @@ -65,7 +65,7 @@ export function requestForgotPassword(eMailOrUserName) { } return request({ - url: '/enrollment/reset-password', + url: '/user/enrollment/reset-password', data: { user_name: userName, email: eMail, @@ -91,7 +91,7 @@ export function requestChangePassword({ password }) { return request({ - url: '/enrollment/change-password', + url: '/user/enrollment/change-password', data: { token, password, @@ -116,7 +116,7 @@ export function requestActivateUser({ token }) { return request({ - url: '/enrollment/activate-user', + url: '/user/enrollment/activate-user', data: { token, client_version: clientVersion, diff --git a/src/api/ADempiere/field/binary.js b/src/api/ADempiere/field/binary.js index 35195385..c5a2027a 100644 --- a/src/api/ADempiere/field/binary.js +++ b/src/api/ADempiere/field/binary.js @@ -23,7 +23,7 @@ export function getResource({ uuid, tableName }) { - const { requestGetEntity } = require('@/api/ADempiere/persistence.js') + const { requestGetEntity } = require('@/api/ADempiere/common/persistence.js') return requestGetEntity({ recordUuid: uuid, @@ -42,7 +42,7 @@ export function updateResource({ tableName, binaryFile }) { - const { requestUpdateEntity } = require('@/api/ADempiere/persistence.js') + const { requestUpdateEntity } = require('@/api/ADempiere/common/persistence.js') return requestUpdateEntity({ recordUuid: uuid, diff --git a/src/api/ADempiere/field/location.js b/src/api/ADempiere/field/location.js index 3cb818c0..400ccf12 100644 --- a/src/api/ADempiere/field/location.js +++ b/src/api/ADempiere/field/location.js @@ -23,7 +23,7 @@ const tableName = 'C_Location' export function createLocationAddress({ attributesList }) { - const { requestCreateEntity } = require('@/api/ADempiere/persistence.js') + const { requestCreateEntity } = require('@/api/ADempiere/common/persistence.js') return requestCreateEntity({ tableName, @@ -40,7 +40,7 @@ export function getLocationAddress({ id, uuid }) { - const { requestGetEntity } = require('@/api/ADempiere/persistence.js') + const { requestGetEntity } = require('@/api/ADempiere/common/persistence.js') return requestGetEntity({ tableName, @@ -60,7 +60,7 @@ export function updateLocationAddress({ uuid, attributesList }) { - const { requestUpdateEntity } = require('@/api/ADempiere/persistence.js') + const { requestUpdateEntity } = require('@/api/ADempiere/common/persistence.js') return requestUpdateEntity({ tableName, diff --git a/src/api/ADempiere/field/locator.js b/src/api/ADempiere/field/locator.js index 1dff39fc..0757b157 100644 --- a/src/api/ADempiere/field/locator.js +++ b/src/api/ADempiere/field/locator.js @@ -22,7 +22,7 @@ const tableName = 'M_Locator' export function getLocatorList({ warehouseId }) { - const { requestListEntities } = require('@/api/ADempiere/persistence.js') + const { requestListEntities } = require('@/api/ADempiere/common/persistence.js') return new Promise(resolve => { requestListEntities({ tableName, diff --git a/src/api/ADempiere/field/preference.js b/src/api/ADempiere/field/preference.js index f8487c04..d1336063 100644 --- a/src/api/ADempiere/field/preference.js +++ b/src/api/ADempiere/field/preference.js @@ -30,7 +30,7 @@ export function setPreference({ isForCurrentContainer }) { return request({ - url: '/ui/set-preference', + url: '/user-interface/component/preference/set-preference', method: 'post', data: { container_uuid: parentUuid, @@ -55,7 +55,7 @@ export function deletePreference({ isForCurrentContainer }) { return request({ - url: '/ui/delete-preference', + url: '/user-interface/component/preference/delete-preference', method: 'post', data: { container_uuid: parentUuid, diff --git a/src/api/ADempiere/form/point-of-sales.js b/src/api/ADempiere/form/point-of-sales.js index 6ec5819b..02faa45c 100644 --- a/src/api/ADempiere/form/point-of-sales.js +++ b/src/api/ADempiere/form/point-of-sales.js @@ -31,9 +31,9 @@ export function requestGetPointOfSales({ posUuid }) { return request({ - url: '/pos/get-point-of-sales', - method: 'post', - data: { + url: '/form/addons/point-of-sales/point-of-sales', + method: 'get', + params: { point_of_sales_uuid: posUuid } }) @@ -51,12 +51,10 @@ export function requestListPointOfSales({ pageToken }) { return request({ - url: '/pos/list-point-of-sales', - method: 'post', - data: { - user_uuid: userUuid - }, + url: '/form/addons/point-of-sales/selling-points', + method: 'get', params: { + user_uuid: userUuid, page_size: pageSize, page_token: pageToken } @@ -82,7 +80,7 @@ export function requestCreateOrder({ salesRepresentativeUuid }) { return request({ - url: '/pos/create-order', + url: '/form/addons/point-of-sales/create-order', method: 'post', data: { pos_uuid: posUuid, @@ -106,7 +104,7 @@ export function requestUpdateOrder({ description }) { return request({ - url: '/pos/update-order', + url: '/form/addons/point-of-sales/update-order', method: 'post', data: { order_uuid: orderUuid, @@ -125,9 +123,9 @@ export function requestUpdateOrder({ // Get order from uuid export function requestGetOrder(orderUuid) { return request({ - url: '/pos/get-order', - method: 'post', - data: { + url: '/form/addons/point-of-sales/order', + method: 'get', + params: { order_uuid: orderUuid } }) @@ -147,7 +145,7 @@ export function requestDeleteOrder({ // salesRepresentativeUuid }) { return request({ - url: '/pos/delete-order', + url: '/form/addons/point-of-sales/delete-order', method: 'post', data: { order_uuid: orderUuid @@ -222,9 +220,9 @@ export function requestListOrders({ */ return request({ - url: '/pos/list-orders', - method: 'post', - data: { + url: '/form/addons/point-of-sales/orders', + method: 'get', + params: { pos_uuid: posUuid, document_no: documentNo, business_partner_uuid: businessPartnerUuid, @@ -234,11 +232,7 @@ export function requestListOrders({ is_paid: isPaid, is_processed: isProcessed, is_aisle_seller: isAisleSeller, - is_invoiced: isInvoiced - // date_ordered_from: dateOrderedFrom, - // date_ordered_to: dateOrderedTo - }, - params: { + is_invoiced: isInvoiced, page_size: pageSize, page_token: pageToken } @@ -268,9 +262,9 @@ export function requestCreateOrderLine({ discountRate }) { return request({ - url: '/pos/create-order-line', + url: '/form/addons/point-of-sales/create-order-line', method: 'post', - data: { + params: { order_uuid: orderUuid, product_uuid: productUuid, description, @@ -297,7 +291,7 @@ export function requestUpdateOrderLine({ discountRate }) { return request({ - url: '/pos/update-order-line', + url: '/form/addons/point-of-sales/update-order-line', method: 'post', data: { // is_add_quantity: true, @@ -320,7 +314,7 @@ export function requestDeleteOrderLine({ orderLineUuid }) { return request({ - url: '/pos/delete-order-line', + url: '/form/addons/point-of-sales/delete-order-line', method: 'post', data: { order_line_uuid: orderLineUuid @@ -337,12 +331,10 @@ export function requestListOrderLines({ pageToken }) { return request({ - url: '/pos/list-order-lines', - method: 'post', - data: { - order_uuid: orderUuid - }, + url: '/form/addons/point-of-sales/order-lines', + method: 'get', params: { + order_uuid: orderUuid, page_size: pageSize, page_token: pageToken } @@ -362,9 +354,9 @@ export function requestListOrderLines({ export function getKeyLayout({ keyLayoutUuid }) { return request({ - url: '/pos/get-key-layout', - method: 'post', - data: { + url: '/form/addons/point-of-sales/key-layout', + method: 'get', + params: { key_layout_uuid: keyLayoutUuid } }) @@ -388,16 +380,14 @@ export function getProductPriceList({ pageToken }) { return request({ - url: '/pos/list-product-prices', - method: 'post', - data: { + url: '/form/addons/point-of-sales/product-prices', + method: 'get', + params: { price_list_uuid: priceListUuid, search_value: searchValue, valid_from: validFrom, business_partner_uuid: businessPartnerUuid, - warehouse_uuid: warehouseUuid - }, - params: { + warehouse_uuid: warehouseUuid, page_size: pageSize, page_token: pageToken } @@ -475,7 +465,7 @@ export function createPayment({ currencyUuid }) { return request({ - url: '/pos/create-payment', + url: '/form/addons/point-of-sales/create-payment', method: 'post', data: { pos_uuid: posUuid, @@ -507,7 +497,7 @@ export function updatePayment({ tenderTypeCode }) { return request({ - url: '/pos/update-payment', + url: '/form/addons/point-of-sales/update-payment', method: 'post', data: { payment_uuid: paymentUuid, @@ -530,7 +520,7 @@ export function deletePayment({ paymentUuid }) { return request({ - url: '/pos/delete-payment', + url: '/form/addons/point-of-sales/delete-payment', method: 'post', data: { payment_uuid: paymentUuid @@ -548,9 +538,9 @@ export function getPaymentsList({ orderUuid }) { return request({ - url: '/pos/list-payments', - method: 'post', - data: { + url: '/form/addons/point-of-sales/payments', + method: 'get', + params: { pos_uuid: posUuid, order_uuid: orderUuid } @@ -609,7 +599,7 @@ export function processOrder({ }) } return request({ - url: '/pos/process-order', + url: '/form/addons/point-of-sales/process-order', method: 'post', data: { pos_uuid: posUuid, diff --git a/src/api/ADempiere/form/price-checking.js b/src/api/ADempiere/form/price-checking.js index 7d8b9291..e2983ec8 100644 --- a/src/api/ADempiere/form/price-checking.js +++ b/src/api/ADempiere/form/price-checking.js @@ -29,9 +29,9 @@ export function requestGetProductPrice({ validFrom }) { return request({ - url: '/pos/get-product-price', - method: 'post', - data: { + url: '/form/addons/point-of-sales/get-product-price', + method: 'get', + params: { search_value: searchValue, upc, value, diff --git a/src/api/ADempiere/process.js b/src/api/ADempiere/process.js index 06a4dad2..b1b78e88 100644 --- a/src/api/ADempiere/process.js +++ b/src/api/ADempiere/process.js @@ -57,7 +57,7 @@ export function requestRunProcess({ }) return request({ - url: '/data/process', + url: '/common/api/process', method: 'post', data: { process_uuid: uuid, @@ -92,16 +92,14 @@ export function requestListProcessesLogs({ }) { // Get Process Activity return request({ - url: '/logs/list-process-logs', - method: 'post', - data: { + url: '/user/log/process-logs', + method: 'get', + params: { instance_uuid: instanceUuid, user_uuid: userUuid, table_name: tableName, id: recordId, - uuid: recordUuid - }, - params: { + uuid: recordUuid, page_size: pageSize, page_token: pageToken } diff --git a/src/api/ADempiere/report.js b/src/api/ADempiere/report.js index 949988a5..bc4ab9a3 100644 --- a/src/api/ADempiere/report.js +++ b/src/api/ADempiere/report.js @@ -29,13 +29,11 @@ export function requestListReportsViews({ pageSize }) { return request({ - url: '/ui/list-report-views', - method: 'post', - data: { - table_name: tableName, - process_uuid: processUuid - }, + url: '/user-interface/process/report-views', + method: 'get', params: { + table_name: tableName, + process_uuid: processUuid, page_token: pageToken, page_size: pageSize } @@ -62,14 +60,12 @@ export function requestListPrintFormats({ pageSize }) { return request({ - url: '/ui/list-print-formats', - method: 'post', - data: { + url: '/user-interface/process/print-formats', + method: 'get', + params: { table_name: tableName, report_view_uuid: reportViewUuid, - process_uuid: processUuid - }, - params: { + process_uuid: processUuid, page_token: pageToken, page_size: pageSize } @@ -88,12 +84,10 @@ export function requestListDrillTables({ pageSize }) { return request({ - url: '/ui/list-drill-tables', - method: 'post', - data: { - table_name: tableName - }, + url: '/user-interface/process/drill-tables', + method: 'get', params: { + table_name: tableName, page_token: pageToken, page_size: pageSize } @@ -126,9 +120,9 @@ export function requestGetReportOutput({ orderByClause }) { return request({ - url: '/ui/get-report-output', - method: 'post', - data: { + url: '/user-interface/process/report-output', + method: 'get', + params: { table_name: tableName, // reference print_format_uuid: printFormatUuid, diff --git a/src/api/ADempiere/system-core.js b/src/api/ADempiere/system-core.js index 2340e398..f6e2fb5b 100644 --- a/src/api/ADempiere/system-core.js +++ b/src/api/ADempiere/system-core.js @@ -25,13 +25,11 @@ export function requestOrganizationsList({ pageSize }) { return request({ - url: '/core/list-organizations', - method: 'post', - data: { - role_id: roleId, - role_uuid: roleUuid - }, + url: '/common/organizations', + method: 'get', params: { + role_id: roleId, + role_uuid: roleUuid, // Page Data pageToken, pageSize @@ -58,13 +56,11 @@ export function requestWarehousesList({ pageSize }) { return request({ - url: '/core/list-warehouses', - method: 'post', - data: { - organization_id: organizationId, - organization_uuid: organizationUuid - }, + url: '/common/warehouses', + method: 'get', params: { + organization_id: organizationId, + organization_uuid: organizationUuid, // Page Data pageToken, pageSize @@ -89,7 +85,7 @@ export function requestGetCountryDefinition({ uuid }) { return request({ - url: '/core/country', + url: '/common/country', method: 'get', params: { id, @@ -109,8 +105,8 @@ export function requestLanguagesList({ pageSize }) { return request({ - url: '/core/list-languages', - method: 'post', + url: '/common/languages', + method: 'get', params: { // Page Data pageToken, @@ -156,7 +152,7 @@ export function requestCreateBusinessPartner({ posUuid }) { return request({ - url: '/core/create-business-partner', + url: '/common/create-business-partner', method: 'post', data: { value, @@ -195,7 +191,7 @@ export function requestGetBusinessPartner({ searchValue }) { return request({ - url: '/core/get-business-partner', + url: '/common/business-partner', method: 'get', params: { search_value: searchValue @@ -222,9 +218,9 @@ export function requestListBusinessPartner({ pageToken }) { return request({ - url: '/core/list-business-partner', - method: 'post', - data: { + url: '/common/business-partners', + method: 'get', + params: { search_value: searchValue, value, name, @@ -232,9 +228,7 @@ export function requestListBusinessPartner({ e_mail: eMail, phone, // Location - postal_code: postalCode - }, - params: { + postal_code: postalCode, page_size: pageSize, page_token: pageToken } @@ -267,9 +261,9 @@ export function requestGetConversionRate({ conversionDate }) { return request({ - url: '/core/get-conversion-rate', - method: 'post', - data: { + url: '/common/conversion-rate', + method: 'get', + params: { conversion_type_uuid: conversionTypeUuid, currency_from_uuid: currencyFromUuid, currency_to_uuid: currencyToUuid, diff --git a/src/api/ADempiere/values.js b/src/api/ADempiere/values.js deleted file mode 100644 index 8c3c85bc..00000000 --- a/src/api/ADempiere/values.js +++ /dev/null @@ -1,182 +0,0 @@ -// 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 . - -// Get Instance for connection -import { request } from '@/utils/ADempiere/request' - -import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js' - -/** - * Request a Lookup data from Reference - * The main attributes that function hope are: - * @param {string} tableName - * @param {string} directQuery - * @param {string|number} value - */ -export function requestLookup({ - tableName, - directQuery, - value -}) { - let filters = [] - if (!isEmptyValue(value)) { - filters = [{ - value - }] - } - return request({ - url: '/ui/get-lookup-item', - method: 'post', - data: { - table_name: tableName, - query: directQuery, - filters - } - }) - .then(respose => { - return respose - }) -} - -/** - * Request a Lookup list data from Reference - * The main attributes that function hope are: - * @param {string} tableName - * @param {string} query - * @param {string} whereClause - * @param {array} valuesList // TODO: Add support - * @param {string} pageToken - * @param {number} pageSize - */ -export function requestLookupList({ - tableName, - query, - whereClause, - columnName, - valuesList = [], - pageToken, - pageSize -}) { - let filters = [] - if (!isEmptyValue(valuesList)) { - filters = [{ - column_name: columnName, - values: valuesList - }] - } - - return request({ - url: '/ui/list-lookup-items', - method: 'post', - data: { - table_name: tableName, - query, - where_clause: whereClause, - filters - }, - params: { - // Page Data - pageToken, - pageSize - } - }) - .then(lookupListResponse => { - return { - nextPageToken: lookupListResponse.next_page_token, - recordCount: lookupListResponse.record_count, - recordsList: lookupListResponse.records - } - }) -} - -/** - * Reference List from Window - * @param {string} tableName - * @param {string} windowUuid - * @param {string} recordUuid - * @param {number} recordId - */ -export function requestReferencesList({ - windowUuid, - tableName, - recordId, - recordUuid, - pageToken, - pageSize -}) { - return request({ - url: '/ui/list-references', - method: 'post', - data: { - id: recordId, - uuid: recordUuid, - window_uuid: windowUuid, - table_name: tableName - }, - params: { - // Page Data - pageToken, - pageSize - } - }) - .then(referencesListResposnse => { - const { convertReferencesList } = require('@/utils/ADempiere/apiConverts/values.js') - - return convertReferencesList(referencesListResposnse) - }) -} - -// Get default value for a field -export function requestDefaultValue(query) { - return request({ - url: '/ui/get-default-value', - method: 'post', - data: { - query - } - }) - .then(respose => { - return respose - }) -} - -/** - * Get context information for a window, tab or field - * @param {string} query - * @param {string} uuid - * @param {number} id - */ -export function requestGetContextInfoValue({ - uuid, - id, - query -}) { - return request({ - url: '/ui/get-context-info-value', - method: 'post', - data: { - query, - uuid, - id - } - }) - .then(contextInfoValueResponse => { - return { - messageText: contextInfoValueResponse.message_text, - messageTip: contextInfoValueResponse.message_tip - } - }) -} diff --git a/src/api/ADempiere/window.js b/src/api/ADempiere/window.js index 41a32958..86e87ec4 100644 --- a/src/api/ADempiere/window.js +++ b/src/api/ADempiere/window.js @@ -17,6 +17,210 @@ // Get Instance for connection import { request } from '@/utils/ADempiere/request' +import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js' + +/** + * Request a Lookup data from Reference + * The main attributes that function hope are: + * @param {string} tableName + * @param {string} directQuery + * @param {string|number} value + */ +export function requestLookup({ + tableName, + directQuery, + value +}) { + let filters = [] + if (!isEmptyValue(value)) { + filters = [{ + value + }] + } + return request({ + url: '/user-interface/window/lookup-item', + method: 'get', + params: { + table_name: tableName, + query: directQuery, + filters + } + }) + .then(respose => { + return respose + }) +} + +/** + * Request a Lookup list data from Reference + * The main attributes that function hope are: + * @param {string} tableName + * @param {string} query + * @param {string} whereClause + * @param {array} valuesList // TODO: Add support + * @param {string} pageToken + * @param {number} pageSize + */ +export function requestLookupList({ + tableName, + query, + whereClause, + columnName, + valuesList = [], + pageToken, + pageSize +}) { + let filters = [] + if (!isEmptyValue(valuesList)) { + filters = [{ + column_name: columnName, + values: valuesList + }] + } + + return request({ + url: '/user-interface/window/lookup-items', + method: 'get', + params: { + table_name: tableName, + query, + where_clause: whereClause, + filters, + // Page Data + pageToken, + pageSize + } + }) + .then(lookupListResponse => { + return { + nextPageToken: lookupListResponse.next_page_token, + recordCount: lookupListResponse.record_count, + recordsList: lookupListResponse.records + } + }) +} + +/** + * Reference List from Window + * @param {string} tableName + * @param {string} windowUuid + * @param {string} recordUuid + * @param {number} recordId + */ +export function requestReferencesList({ + windowUuid, + tableName, + recordId, + recordUuid, + pageToken, + pageSize +}) { + return request({ + url: '/user-interface/window/references', + method: 'get', + params: { + id: recordId, + uuid: recordUuid, + window_uuid: windowUuid, + table_name: tableName, + // Page Data + pageToken, + pageSize + } + }) + .then(referencesListResposnse => { + const { convertReferencesList } = require('@/utils/ADempiere/apiConverts/values.js') + + return convertReferencesList(referencesListResposnse) + }) +} + +// Get default value for a field +export function requestDefaultValue(query) { + return request({ + url: '/user-interface/window/default-value', + method: 'get', + params: { + query + } + }) + .then(respose => { + return respose + }) +} + +/** + * Get context information for a window, tab or field + * @param {string} query + * @param {string} uuid + * @param {number} id + */ +export function requestGetContextInfoValue({ + uuid, + id, + query +}) { + return request({ + url: '/user-interface/window/context-info-value', + method: 'get', + params: { + query, + uuid, + id + } + }) + .then(contextInfoValueResponse => { + return { + messageText: contextInfoValueResponse.message_text, + messageTip: contextInfoValueResponse.message_tip + } + }) +} + +/** + * Run callout request + * @param {string} windowUuid + * @param {number} windowNo + * @param {string} tabUuid + * @param {string} tableName + * @param {string} columnName + * @param {mixed} value + * @param {mixed} oldValue + * @param {string} callout + * @param {array} attributesList + * @returns {Map} Entity + */ +export function runCallOutRequest({ + windowUuid, + windowNo, + tabUuid, + tableName, + columnName, + value, + oldValue, + callout, + attributesList = [] +}) { + return request({ + url: '/user-interface/window/run-callout', + method: 'post', + data: { + table_name: tableName, + window_uuid: windowUuid, + tab_uuid: tabUuid, + callout, + column_name: columnName, + old_value: oldValue, + value, + window_no: windowNo, + attributes: attributesList + } + }) + .then(response => { + return response + }) +} + // Get list of log for a records export function requestListEntityLogs({ tableName, @@ -26,14 +230,12 @@ export function requestListEntityLogs({ pageSize }) { return request({ - url: '/logs/list-entity-logs', - method: 'post', - data: { + url: '/user/log/entity-logs', + method: 'get', + params: { table_name: tableName, id: recordId, - uuid: recordUuid - }, - params: { + uuid: recordUuid, // Page Data pageToken, pageSize @@ -61,14 +263,12 @@ export function requestListWorkflowsLogs({ pageSize }) { return request({ - url: '/logs/list-workflow-logs', - method: 'post', - data: { + url: '/user/log/workflow-logs', + method: 'get', + params: { table_name: tableName, id: recordId, - uuid: recordUuid - }, - params: { + uuid: recordUuid, // Page Data pageToken, pageSize @@ -94,12 +294,10 @@ export function requestListWorkflows({ pageSize }) { return request({ - url: '/workflow/list-workflow', - method: 'post', - data: { - table_name: tableName - }, + url: '/user/log/workflow-logs', + method: 'get', params: { + table_name: tableName, // Page Data pageToken, pageSize @@ -132,14 +330,12 @@ export function requestListEntityChats({ pageSize }) { return request({ - url: '/logs/list-entity-chats', - method: 'post', - data: { + url: '/user/log/entity-chats', + method: 'get', + params: { table_name: tableName, id: recordId, - uuid: recordUuid - }, - params: { + uuid: recordUuid, // Page Data pageToken, pageSize @@ -170,13 +366,11 @@ export function requestListChatsEntries({ pageSize }) { return request({ - url: '/logs/list-chat-entries', - method: 'post', - data: { - id, - uuid - }, + url: '/user/log/chat-entries', + method: 'get', params: { + id, + uuid, // Page Data pageToken, pageSize @@ -208,7 +402,7 @@ export function requestCreateChatEntry({ comment }) { return request({ - url: '/ui/create-chat-entry', + url: '/user-interface/component/notes/create-chat-entry', method: 'post', data: { table_name: tableName, @@ -223,83 +417,3 @@ export function requestCreateChatEntry({ return convertChatEntry(chatEntryResponse) }) } - -/** - * Request Document Status List - * @param {string} tableName - * @param {number} recordId - * @param {string} recordUuid - * @param {string} documentStatus - * @param {string} documentAction - * @param {number} pageSize - * @param {string} pageToken - */ -export function requestListDocumentStatuses({ - tableName, - recordId, - recordUuid, - documentStatus, - pageSize, - pageToken -}) { - return request({ - url: '/workflow/list-document-statuses', - method: 'post', - data: { - id: recordId, - uuid: recordUuid, - table_name: tableName, - document_status: documentStatus - }, - params: { - // Page Data - pageToken, - pageSize - } - }) - .then(listDocumentsActionsResponse => { - return { - nextPageToken: listDocumentsActionsResponse.next_page_token, - recordCount: listDocumentsActionsResponse.record_count, - documentStatusesList: listDocumentsActionsResponse.records - } - }) -} - -// Request a document action list from current status of document -export function requestListDocumentActions({ - tableName, - recordId, - recordUuid, - documentStatus, - documentAction, - pageSize, - pageToken -}) { - return request({ - url: '/workflow/list-document-actions', - method: 'post', - data: { - id: recordId, - uuid: recordUuid, - table_name: tableName, - document_action: documentAction, - document_status: documentStatus - }, - params: { - // Page Data - pageToken, - pageSize - } - }) - .then(listDocumentsActionsResponse => { - return { - nextPageToken: listDocumentsActionsResponse.next_page_token, - recordCount: listDocumentsActionsResponse.record_count, - defaultDocumentAction: { - ...listDocumentsActionsResponse.default_document_action - }, - documentActionsList: listDocumentsActionsResponse.records - } - }) -} diff --git a/src/api/ADempiere/workflow.js b/src/api/ADempiere/workflow.js new file mode 100644 index 00000000..96b12549 --- /dev/null +++ b/src/api/ADempiere/workflow.js @@ -0,0 +1,94 @@ +// 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 . + +// Get Instance for connection +import { request } from '@/utils/ADempiere/request' + +/** + * Request Document Status List + * @param {string} tableName + * @param {number} recordId + * @param {string} recordUuid + * @param {string} documentStatus + * @param {string} documentAction + * @param {number} pageSize + * @param {string} pageToken + */ +export function requestListDocumentStatuses({ + tableName, + recordId, + recordUuid, + documentStatus, + pageSize, + pageToken +}) { + return request({ + url: '/workflow/document-statuses', + method: 'get', + params: { + id: recordId, + uuid: recordUuid, + table_name: tableName, + document_status: documentStatus, + // Page Data + pageToken, + pageSize + } + }) + .then(listDocumentsActionsResponse => { + return { + nextPageToken: listDocumentsActionsResponse.next_page_token, + recordCount: listDocumentsActionsResponse.record_count, + documentStatusesList: listDocumentsActionsResponse.records + } + }) +} + +// Request a document action list from current status of document +export function requestListDocumentActions({ + tableName, + recordId, + recordUuid, + documentStatus, + documentAction, + pageSize, + pageToken +}) { + return request({ + url: '/workflow/document-actions', + method: 'get', + params: { + id: recordId, + uuid: recordUuid, + table_name: tableName, + document_action: documentAction, + document_status: documentStatus, + // Page Data + pageToken, + pageSize + } + }) + .then(listDocumentsActionsResponse => { + return { + nextPageToken: listDocumentsActionsResponse.next_page_token, + recordCount: listDocumentsActionsResponse.record_count, + defaultDocumentAction: { + ...listDocumentsActionsResponse.default_document_action + }, + documentActionsList: listDocumentsActionsResponse.records + } + }) +} diff --git a/src/components/ADempiere/Dashboard/docstatus/index.vue b/src/components/ADempiere/Dashboard/docstatus/index.vue index 3a2443ca..557c88c4 100644 --- a/src/components/ADempiere/Dashboard/docstatus/index.vue +++ b/src/components/ADempiere/Dashboard/docstatus/index.vue @@ -44,7 +44,7 @@