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

Commit

Permalink
Fix Api (#2566)
Browse files Browse the repository at this point in the history
* Fix Api

* WIP on feature/combination-report-engine Report Manager stash

* Support to Report Engine and Report Run
  • Loading branch information
elsiosanchez authored Aug 12, 2024
1 parent 5d82263 commit 822700f
Show file tree
Hide file tree
Showing 14 changed files with 459 additions and 496 deletions.
23 changes: 14 additions & 9 deletions src/api/ADempiere/reportManagement/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { request } from '@/utils/ADempiere/request'
export function generateReportRequest({
id,
reportType,
reportFormat,
parameters,
printFormatId,
reportViewId,
Expand All @@ -45,7 +46,7 @@ export function generateReportRequest({
url: `/report-management/report/${id}`,
method: 'post',
data: {
report_type: reportType,
report_type: reportFormat,
parameters,
print_format_id: printFormatId,
report_view_id: reportViewId,
Expand All @@ -58,14 +59,16 @@ export function generateReportRequest({

// Get report output from parameters
export function getReportOutputRequest({
processId,
reportId,
recordId,
processUuid,
tableName,
printFormatUuid,
printFormatId,
reportViewUuid,
isSummary,
reportName,
reportType,
reportFormat,
parametersList = [],
// query criteria
query,
Expand All @@ -80,18 +83,20 @@ export function getReportOutputRequest({
})

return request({
url: '/user-interface/process/report-output',
url: `/report-management/report-output/${reportId}/${tableName}`,
method: 'get',
params: {
process_id: processId,
report_id: reportId,
process_uuid: processUuid,
table_name: tableName,
// reference
print_format_uuid: printFormatUuid,
print_format_id: printFormatId,
report_view_uuid: reportViewUuid,
record_id: recordId,
is_summary: isSummary,
report_name: reportName,
report_type: reportType,
report_type: reportFormat,
// DSL Query
filters,
criteria: filters,
Expand Down Expand Up @@ -193,21 +198,21 @@ export function runExport({
})
}

export function ListNotificationsTypes() {
export function listNotificationsTypes() {
return request({
url: '/send_notifications/notifications_types',
method: 'get'
})
}

export function ListUsers() {
export function listUsers() {
return request({
url: '/send_notifications/user',
method: 'get'
})
}

export function SendNotification({
export function sendNotification({
user_id,
title,
recipients,
Expand Down
19 changes: 19 additions & 0 deletions src/api/ADempiere/reportManagement/printFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,22 @@ export function listPrintFormatsRequest({
}
})
}

/**
* Get default value for a field, parameter or query criteria
* @param {Number} reportId, identifier of report
*/
export function listPrintFormatsTableRequest({
tableName,
pageToken,
pageSize = ROWS_OF_RECORDS_BY_PAGE
}) {
return request({
url: `/report-management/print-formats/table/${tableName}`,
method: 'get',
params: {
page_size: pageSize,
page_token: pageToken
}
})
}
159 changes: 136 additions & 23 deletions src/components/ADempiere/TabManager/convenienceButtons/PrintProcess.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!--
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
Contributor(s): Elsio Sanchez elsiosanches@gmail.com https://github.com/elsiosanchez
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
Expand All @@ -17,25 +18,55 @@
-->

<template>
<el-button
v-if="!isEmptyValue(process) && is_document"
plain
type="info"
size="small"
style="margin-left: 5px;padding-top: 1px;padding-right: 5px;padding-bottom: 8px;padding-left: 5px;"
@click="printProcess()"
>
<svg-icon
style="font-size: 21px;"
icon-class="print"
/>
</el-button>
<span>
<el-dropdown
v-if="!isEmptyValue(process) && is_document && !isEmptyValue(printFormats)"
split-button
size="small"
trigger="click"
class="print-button"
style="margin-left: 8px; padding-right: 9px;"
@click="printProcess"
@command="handleCommandActions"
>
<svg-icon
style="font-size: 23px;"
icon-class="print"
/>

<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-for="(process, index) in printFormats"
:key="index"
:command="process"
>
{{ $t(process.name) }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button
v-if="!isEmptyValue(process) && is_document && isEmptyValue(printFormats)"
plain
type="info"
size="small"
style="margin-left: 5px;padding-top: 1px;padding-right: 5px;padding-bottom: 8px;padding-left: 5px;"
@click="printProcess()"
>
<svg-icon
style="font-size: 21px;"
icon-class="print"
/>
</el-button>
</span>
</template>

<script>
import { defineComponent } from '@vue/composition-api'

import { defineComponent, computed } from '@vue/composition-api'
import language from '@/lang'
import store from '@/store'
// Utils
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import { showNotification } from '@/utils/ADempiere/notification.js'

export default defineComponent({
name: 'PrintProcess',
Expand All @@ -61,29 +92,111 @@ export default defineComponent({
*/
const containerUuid = props.tabAttributes.uuid
const { process } = props.tabAttributes
const { is_document } = props.tabAttributes.table
const { is_document, table_name } = props.tabAttributes.table

/**
* Computed
*/

const recordId = computed(() => {
return store.getters.getIdOfContainer({
containerUuid,
tableName: table_name
})
})

const getReportDefinition = computed(() => {
if (
isEmptyValue(process) ||
isEmptyValue(process.uuid)
) return []
return store.getters.getStoredReport(process.uuid)
})

const printFormats = computed(() => {
if (
isEmptyValue(process)
) return []
return store.getters.getPrintFormatList(process.id)
})

/**
* Methods
*/
function printProcess() {
const { uuid } = process
store.commit('setSelectProcessWindows', uuid)
if (isEmptyValue(process)) return
store.dispatch('runReport', {
containerUuid: process.uuid,
recordId: recordId.value,
reportId: process.id,
tableName: table_name
})
}

function handleCommandActions(command) {
showNotification({
title: language.t('notifications.processing'),
message: process.name,
summary: process.description,
type: 'info'
})
store.dispatch('generateReportViwer', {
containerUuid: process.uuid,
reportUuid: process.uuid,
printFormatId: command.id,
reportId: process.id,
tableName: command.table_name,
filters: `[{\"name\":\"${command.table_name}_ID\",\"operator\":\"equal\",\"values\":${recordId.value}}]`,
isView: false
})
}

store.commit('setShowedModalDialog', {
parentUuid: containerUuid,
containerUuid: uuid,
isShowed: true
function loadProcessData() {
if (isEmptyValue(process) || isEmptyValue(is_document)) return
if (!isEmptyValue(getReportDefinition.value)) return
const { id } = process
store.dispatch('getReportDefinitionFromServer', {
id,
tableName: table_name
})
}

loadProcessData()

return {
// Const
process,
is_document,
// Computed
recordId,
printFormats,
getReportDefinition,
// Methods
printProcess
printProcess,
loadProcessData,
handleCommandActions
}
}
})
</script>

<style lang="scss">
.print-button {
&.el-dropdown {
.el-button {
padding-top: 3px;
color: #909399;
padding-bottom: 3px;
background: #f4f4f5;
border-color: #d3d4d6;

&:hover {
// as button success without plain
background: #909399;
border-color: #909399;
color: #fff;
}
}
}
}
</style>
20 changes: 15 additions & 5 deletions src/store/modules/ADempiere/dictionary/report/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export default {
* @param {string} uuid of dictionary
*/
getReportDefinitionFromServer({ dispatch, getters, rootGetters }, {
id
id,
tableName
}) {
return new Promise((resolve, reject) => {
const language = rootGetters['getCurrentLanguage']
Expand All @@ -89,10 +90,19 @@ export default {
const { processDefinition: reportDefinition } = generateReport({
processToGenerate: reportResponse
})

await dispatch('getListPrintFormatsFromServer', {
reportId: reportDefinition.id
})
const {
type
} = router.app._route.meta
if (type === 'window') {
await dispatch('listPrintFormatWindow', {
tableName,
reportId: reportDefinition.id
})
} else {
await dispatch('listPrintFormatsFromServer', {
reportId: reportDefinition.id
})
}

dispatch('addReportToList', reportDefinition)

Expand Down
19 changes: 19 additions & 0 deletions src/store/modules/ADempiere/dictionary/window/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import store from '@/store'

// API Request Methods
import { requestWindowMetadata } from '@/api/ADempiere/dictionary/window.ts'
import { listPrintFormatsTableRequest } from '@/api/ADempiere/reportManagement/printFormat.ts'

// Constants
import { CLIENT, DOCUMENT_ACTION, DOCUMENT_STATUS } from '@/utils/ADempiere/constants/systemColumns'
Expand Down Expand Up @@ -964,5 +965,23 @@ export default {
parentUuid: parentUuid + IS_ADVANCED_QUERY,
tabAdvanceQuery
})
},
setPrintFormatWindow({ commit }, {
tableName,
reportId
}) {
return new Promise(resolve => {
listPrintFormatsTableRequest({
tableName
})
.then(response => {
const { print_formats } = response
commit('setPrintFormatsList', {
reportId,
printFormatList: print_formats
})
resolve(print_formats)
})
})
}
}
17 changes: 0 additions & 17 deletions src/store/modules/ADempiere/report/Report.ts

This file was deleted.

Loading

0 comments on commit 822700f

Please sign in to comment.