Skip to content

Commit

Permalink
Error List Order (#779)
Browse files Browse the repository at this point in the history
* Fixes: #736

* minimal changes

* minimal changes

Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>
  • Loading branch information
elsiosanchez and Elsio Sanchez committed Apr 23, 2021
1 parent ec95ba8 commit 11cd2cb
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/components/ADempiere/Form/VPOS/OrderList/fieldsListOrders.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default [
isFromDictionary: true,
overwriteDefinition: {
size: 8,
sequence: 0,
isMandatory: false
}
},
Expand All @@ -34,6 +35,7 @@ export default [
isFromDictionary: true,
overwriteDefinition: {
size: 8,
sequence: 1,
isMandatory: false
}
},
Expand All @@ -44,6 +46,7 @@ export default [
isFromDictionary: true,
overwriteDefinition: {
size: 8,
sequence: 2,
isMandatory: false
}
},
Expand All @@ -53,6 +56,7 @@ export default [
isFromDictionary: true,
overwriteDefinition: {
size: 8,
sequence: 3,
isMandatory: false
}
},
Expand All @@ -62,6 +66,7 @@ export default [
isFromDictionary: true,
overwriteDefinition: {
size: 8,
sequence: 4,
isMandatory: false
}
},
Expand All @@ -71,6 +76,7 @@ export default [
isFromDictionary: true,
overwriteDefinition: {
size: 8,
sequence: 5,
isMandatory: false
}
},
Expand All @@ -80,6 +86,7 @@ export default [
isFromDictionary: true,
overwriteDefinition: {
size: 8,
sequence: 6,
isMandatory: false
}
},
Expand All @@ -90,6 +97,7 @@ export default [
isFromDictionary: true,
overwriteDefinition: {
size: 8,
sequence: 7,
isMandatory: false
}
},
Expand All @@ -101,6 +109,7 @@ export default [
overwriteDefinition: {
columnName: 'DateOrderedFrom',
size: 8,
sequence: 8,
isMandatory: false
}
},
Expand All @@ -112,6 +121,7 @@ export default [
overwriteDefinition: {
columnName: 'DateOrderedTo',
size: 8,
sequence: 9,
isMandatory: false
}
},
Expand All @@ -122,6 +132,7 @@ export default [
isFromDictionary: true,
overwriteDefinition: {
size: 8,
sequence: 10,
isMandatory: false
}
}
Expand Down
37 changes: 33 additions & 4 deletions src/components/ADempiere/Form/VPOS/OrderList/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
Ver Histórico de Órdenes
</template>
<el-form
v-if="!isEmptyValue(metadataList)"
v-if="!isEmptyValue(sortFieldsListOrder)"
label-position="top"
label-width="10px"
@submit.native.prevent="notSubmitForm"
>
<template
v-for="(field) in metadataList"
v-for="(field) in sortFieldsListOrder"
>
<field
:key="field.columnName"
Expand All @@ -43,7 +43,7 @@
<div
v-else
key="form-loading"
v-loading="isEmptyValue(metadataList)"
v-loading="isEmptyValue(sortFieldsListOrder)"
:element-loading-text="$t('notifications.loading')"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(255, 255, 255, 0.8)"
Expand All @@ -56,7 +56,7 @@
ref="orderTable"
v-shortkey="shortsKey"
v-loading="!ordersList.isLoaded"
:data="ordersList.ordersList"
:data="sortTableOrderList"
border
fit
:highlight-current-row="highlightRow"
Expand Down Expand Up @@ -152,6 +152,7 @@ export default {
type: Object,
default: () => {
return {
panelType: 'from',
uuid: 'Orders-List',
containerUuid: 'Orders-List'
}
Expand Down Expand Up @@ -204,6 +205,15 @@ export default {
closeOrdersList: ['esc'],
refreshList: ['f5']
}
},
sortFieldsListOrder() {
return this.sortfield(this.metadataList)
},
sortTableOrderList() {
if (this.isEmptyValue(this.ordersList.ordersList)) {
return []
}
return this.sortDate(this.ordersList.ordersList)
}
},
watch: {
Expand Down Expand Up @@ -342,6 +352,14 @@ export default {
},
setFieldsList() {
const list = []
// Create Panel
this.$store.dispatch('addPanel', {
containerUuid: this.metadata.containerUuid,
isCustomForm: false,
uuid: this.metadata.uuid,
panelType: this.metadata.panelType,
fieldsList: this.fieldsList
})
// Product Code
this.fieldsList.forEach(element => {
this.createFieldFromDictionary(element)
Expand All @@ -356,7 +374,18 @@ export default {
})
})
this.metadataList = list
},
sortDate(listDate) {
return listDate.sort((elementA, elementB) => {
return new Date().setTime(new Date(elementB.dateOrdered).getTime()) - new Date().setTime(new Date(elementA.dateOrdered).getTime())
})
},
sortfield(field) {
return field.sort((elementA, elementB) => {
return elementA.sequence - elementB.sequence
})
}
}
}
</script>

0 comments on commit 11cd2cb

Please sign in to comment.