forked from adempiere/adempiere-vue
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add zoom with button or record id.
- Loading branch information
1 parent
7fe59f0
commit e97bf21
Showing
4 changed files
with
236 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution | ||
* Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com | ||
* Contributor(s): Edwin Betancourt [email protected] 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' | ||
|
||
/** | ||
* Reference List from Window | ||
* @param {number} tableId | ||
* @param {string} tableName | ||
*/ | ||
export function listZoomWindowsRequest({ | ||
tableId, | ||
tableName | ||
}) { | ||
let url | ||
if (tableId > 0) { | ||
url = `record-management/zooms/id/${tableId}` | ||
} else { | ||
url = `record-management/zooms/${tableName}` | ||
} | ||
return request({ | ||
url: url, | ||
method: 'get' | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/** | ||
* ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution | ||
* Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com | ||
* Contributor(s): Edwin Betancourt [email protected] 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/>. | ||
*/ | ||
|
||
import Vue from 'vue' | ||
|
||
// API Request Methods | ||
import { listZoomWindowsRequest } from '@/api/ADempiere/recordManagement/zoomWindows.ts' | ||
import { isEmptyValue } from '@/utils/ADempiere' | ||
|
||
const initState = { | ||
tables: {}, | ||
zoomWindows: {} | ||
} | ||
|
||
const zoomManager = { | ||
state: initState, | ||
|
||
mutations: { | ||
setTableName(state, { | ||
tableId, | ||
tableName | ||
}) { | ||
Vue.set(state.tables, tableId, tableName) | ||
}, | ||
setZoomWindows(state, { | ||
tableId, | ||
tableName, | ||
zoomWindows = [] | ||
}) { | ||
Vue.set(state.zoomWindows, tableId, { | ||
tableId, | ||
tableName, | ||
zoomWindows | ||
}) | ||
} | ||
}, | ||
|
||
actions: { | ||
getZoomWindowsListFromServer({ commit, getters }, { | ||
tableId, | ||
tableName | ||
}) { | ||
return new Promise(resolve => { | ||
listZoomWindowsRequest({ | ||
tableId, | ||
tableName | ||
}).then(response => { | ||
const { table_id, table_name, zoom_windows } = response | ||
|
||
commit('setZoomWindows', { | ||
tableId: table_id, | ||
tableName: table_name, | ||
zoomWindows: zoom_windows | ||
}) | ||
commit('setTableName', { | ||
tableId: table_id, | ||
tableName: table_name | ||
}) | ||
|
||
resolve(zoom_windows) | ||
}) | ||
}) | ||
} | ||
}, | ||
|
||
getters: { | ||
getTableNameById: (state) => ({ | ||
tableId | ||
}) => { | ||
return state.tables[tableId] | ||
}, | ||
getZoomWindowsList: (state) => ({ | ||
tableId | ||
}) => { | ||
const storedWindows = state.zoomWindows[tableId] | ||
if (!isEmptyValue(storedWindows)) { | ||
return storedWindows.zoomWindows | ||
} | ||
return [] | ||
} | ||
} | ||
} | ||
|
||
export default zoomManager |