corrections of errors in post services (#859)
Co-authored-by: elsiosanchez <elsiossanches@gmail.com>pull/3759/head
							parent
							
								
									97287f160c
								
							
						
					
					
						commit
						09c9bea77d
					
				|  | @ -171,8 +171,8 @@ export function requestListOrders({ | |||
|   isProcessed, | ||||
|   isAisleSeller, | ||||
|   isInvoiced, | ||||
|   // dateOrderedFrom,
 | ||||
|   // dateOrderedTo,
 | ||||
|   dateOrderedFrom, | ||||
|   dateOrderedTo, | ||||
|   salesRepresentativeUuid, | ||||
|   pageSize, | ||||
|   pageToken | ||||
|  | @ -233,6 +233,8 @@ export function requestListOrders({ | |||
|       is_processed: isProcessed, | ||||
|       is_aisle_seller: isAisleSeller, | ||||
|       is_invoiced: isInvoiced, | ||||
|       date_ordered_from: dateOrderedFrom, | ||||
|       date_ordered_to: dateOrderedTo, | ||||
|       page_size: pageSize, | ||||
|       page_token: pageToken | ||||
|     } | ||||
|  |  | |||
|  | @ -109,7 +109,7 @@ | |||
|               </template> | ||||
|             </el-dropdown-menu> | ||||
|           </el-dropdown> | ||||
|           <el-menu v-else class="el-menu-demo" mode="horizontal" :unique-opened="true" style="z-index: 0" :menu-trigger="triggerMenu" @open="handleOpen" @close="handleClose" @select="handleSelect"> | ||||
|           <el-menu v-else-if="field.panelType !== 'form' && !isMobile" class="el-menu-demo" mode="horizontal" :unique-opened="true" style="z-index: 0" :menu-trigger="triggerMenu" @open="handleOpen" @close="handleClose" @select="handleSelect"> | ||||
|             <el-submenu index="menu"> | ||||
|               <template slot="title"> | ||||
|                 <div :style="isMobile ? 'display: flex;width: auto;' : 'display: block;'"> | ||||
|  | @ -179,6 +179,9 @@ | |||
|               </el-menu-item> | ||||
|             </el-submenu> | ||||
|           </el-menu> | ||||
|           <span v-else> | ||||
|             {{ field.name }} | ||||
|           </span> | ||||
|         </template> | ||||
|         <el-popover | ||||
|           v-if="openOptionField && !isEmptyValue(optionColumnName) && (optionColumnName === field.columnName) && showPopoverPath" | ||||
|  | @ -737,7 +740,6 @@ export default { | |||
|       } | ||||
|     }, | ||||
|     handleCommand(command) { | ||||
|       console.log({ command }) | ||||
|       this.$store.commit('setRecordAccess', false) | ||||
|       if (command.name === this.$t('table.ProcessActivity.zoomIn')) { | ||||
|         this.redirect({ window: command.fieldAttributes.reference.zoomWindows[0] }) | ||||
|  |  | |||
|  | @ -107,8 +107,14 @@ | |||
|                       <i class="el-icon-arrow-down el-icon--right" /> | ||||
|                     </span> | ||||
|                     <el-dropdown-menu slot="dropdown" style="padding-bottom: 0px;"> | ||||
|                       <el-dropdown-item :command="scope.row"> | ||||
|                       <el-dropdown-item | ||||
|                         :command="{ | ||||
|                           ...scope.row, | ||||
|                           option: $t('form.productInfo.productInformation') | ||||
|                         }" | ||||
|                       > | ||||
|                         <el-popover | ||||
|                           v-if="!isEmptyValue(currentLineOrder)" | ||||
|                           placement="right" | ||||
|                           trigger="click" | ||||
|                           :title="$t('form.productInfo.productInformation')" | ||||
|  | @ -131,20 +137,20 @@ | |||
|                                 </div> | ||||
|                               </el-col> | ||||
|                               <el-col :span="10"> | ||||
|                                 {{ $t('form.productInfo.code') }}: <b>{{ currentOrderLine.product.value }}</b><br> | ||||
|                                 {{ $t('form.productInfo.name') }}: <b>{{ currentOrderLine.product.name }}</b><br> | ||||
|                                 {{ $t('form.productInfo.description') }}: <b>{{ currentOrderLine.product.description }}</b><br> | ||||
|                                 {{ $t('form.productInfo.code') }}: <b>{{ currentLineOrder.product.value }}</b><br> | ||||
|                                 {{ $t('form.productInfo.name') }}: <b>{{ currentLineOrder.product.name }}</b><br> | ||||
|                                 {{ $t('form.productInfo.description') }}: <b>{{ currentLineOrder.product.description }}</b><br> | ||||
|                               </el-col> | ||||
|                               <el-col :span="10"> | ||||
|                                 <div style="float: right"> | ||||
|                                   {{ $t('form.productInfo.price') }}: | ||||
|                                   <b>{{ formatPrice(currentOrderLine.product.priceStandard, pointOfSalesCurrency.iSOCode) }}</b> | ||||
|                                   <b>{{ formatPrice(currentLineOrder.product.priceStandard, pointOfSalesCurrency.iSOCode) }}</b> | ||||
|                                   <br> | ||||
|                                   {{ $t('form.productInfo.taxAmount') }}: | ||||
|                                   <b>{{ currentOrderLine.taxIndicator }}</b> | ||||
|                                   <b>{{ currentLineOrder.taxIndicator }}</b> | ||||
|                                   <br> | ||||
|                                   {{ $t('form.productInfo.quantityAvailable') }}: | ||||
|                                   <b>{{ formatQuantity(currentOrderLine.quantityOrdered) }}</b> | ||||
|                                   <b>{{ formatQuantity(currentLineOrder.quantityOrdered) }}</b> | ||||
|                                 </div> | ||||
|                               </el-col> | ||||
|                             </el-row> | ||||
|  | @ -154,7 +160,12 @@ | |||
|                           </el-button> | ||||
|                         </el-popover> | ||||
|                       </el-dropdown-item> | ||||
|                       <el-dropdown-item :command="$t('form.pos.tableProduct.editQuantities')"> | ||||
|                       <el-dropdown-item | ||||
|                         :command="{ | ||||
|                           ...scope.row, | ||||
|                           option: $t('form.pos.tableProduct.editQuantities') | ||||
|                         }" | ||||
|                       > | ||||
|                         <el-popover | ||||
|                           placement="right" | ||||
|                           trigger="click" | ||||
|  | @ -452,6 +463,10 @@ export default { | |||
|         return [] | ||||
|       } | ||||
|       return this.currentOrder.lineOrder | ||||
|     }, | ||||
|     currentLineOrder() { | ||||
|       console.log(this.$store.state['pointOfSales/orderLine/index'].line) | ||||
|       return this.$store.state['pointOfSales/orderLine/index'].line | ||||
|     } | ||||
|   }, | ||||
|   mounted() { | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ export default [ | |||
|       isReadOnly: true, | ||||
|       handleActionPerformed: true, | ||||
|       handleContentSelection: true, | ||||
|       handleFocusGained: true, | ||||
|       handleActionKeyPerformed: true | ||||
|     } | ||||
|   }, | ||||
|  | @ -49,6 +50,7 @@ export default [ | |||
|       sequence: 10, | ||||
|       handleActionPerformed: true, | ||||
|       handleContentSelection: true, | ||||
|       handleFocusGained: true, | ||||
|       handleActionKeyPerformed: true | ||||
|     } | ||||
|   } | ||||
|  |  | |||
|  | @ -28,7 +28,10 @@ | |||
|             <field | ||||
|               v-if="field.columnName === 'PriceEntered'" | ||||
|               :key="field.columnName" | ||||
|               :metadata-field="field" | ||||
|               :metadata-field="{ | ||||
|                 ...field, | ||||
|                 isReadOnly: !isModifyPrice | ||||
|               }" | ||||
|             /> | ||||
|             <field | ||||
|               v-if="field.columnName === 'QtyEntered'" | ||||
|  | @ -36,7 +39,9 @@ | |||
|               :metadata-field="field" | ||||
|             /> | ||||
|             <el-popover | ||||
|               v-if="columnNameVisible === field.columnName" | ||||
|               ref="ping" | ||||
|               v-model="visible" | ||||
|               placement="right" | ||||
|               trigger="click" | ||||
|             > | ||||
|  | @ -58,21 +63,19 @@ | |||
|                 <el-button | ||||
|                   type="primary" | ||||
|                   icon="el-icon-check" | ||||
|                   @click="checkclosePing" | ||||
|                 /> | ||||
|                 {{ | ||||
|                   isPosRequiredPin | ||||
|                 }} | ||||
|               </span> | ||||
|               <field | ||||
|                 v-if="field.columnName === 'Discount'" | ||||
|                 slot="reference" | ||||
|                 :key="field.columnName" | ||||
|                 :metadata-field="{ | ||||
|                   ...field, | ||||
|                   isReadOnly: !isModifyPrice || isPosRequiredPin | ||||
|                 }" | ||||
|               /> | ||||
|               <el-button slot="reference" type="text" disabled @click="visible = !visible" /> | ||||
|             </el-popover> | ||||
|             <field | ||||
|               v-if="field.columnName === 'Discount'" | ||||
|               :key="field.columnName" | ||||
|               :metadata-field="{ | ||||
|                 ...field, | ||||
|                 isReadOnly: !isModifyPrice | ||||
|               }" | ||||
|             /> | ||||
|           </el-form> | ||||
|         </el-col> | ||||
|       </template> | ||||
|  | @ -127,21 +130,23 @@ export default { | |||
|       fieldsListLine, | ||||
|       fieldsList: [], | ||||
|       input: '', | ||||
|       visible: false | ||||
|       visible: false, | ||||
|       columnNameVisible: '', | ||||
|       validatePing: false | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
|     isModifyPrice() { | ||||
|       const pos = this.$store.getters.getCurrentPOS | ||||
|       const pos = this.$store.getters.posAttributes.currentPointOfSales | ||||
|       if (!this.isEmptyValue(pos.isModifyPrice)) { | ||||
|         return this.$store.getters.getCurrentPOS.isModifyPrice | ||||
|         return pos.isModifyPrice | ||||
|       } | ||||
|       return false | ||||
|     }, | ||||
|     isPosRequiredPin() { | ||||
|       const pos = this.$store.getters.getCurrentPOS | ||||
|       if (!this.isEmptyValue(pos.isPosRequiredPin)) { | ||||
|         return this.$store.getters.getCurrentPOS.isPosRequiredPin | ||||
|       const pos = this.$store.getters.posAttributes.currentPointOfSales | ||||
|       if (!this.isEmptyValue(pos.isPosRequiredPin) && !this.validatePing) { | ||||
|         return pos.isPosRequiredPin | ||||
|       } | ||||
|       return false | ||||
|     } | ||||
|  | @ -163,6 +168,12 @@ export default { | |||
|       } | ||||
|     } | ||||
|   }, | ||||
|   beforeMount() { | ||||
|     this.unsubscribe = this.subscribeChanges() | ||||
|   }, | ||||
|   beforeDestroy() { | ||||
|     this.unsubscribe() | ||||
|   }, | ||||
|   methods: { | ||||
|     createFieldFromDictionary, | ||||
|     notSubmitForm(event) { | ||||
|  | @ -217,6 +228,18 @@ export default { | |||
|     }, | ||||
|     closePing() { | ||||
|       this.$refs.ping[this.$refs.ping.length - 1].showPopper = false | ||||
|     }, | ||||
|     checkclosePing() { | ||||
|       this.validatePing = true | ||||
|       this.closePing() | ||||
|     }, | ||||
|     subscribeChanges() { | ||||
|       return this.$store.subscribe((mutation, state) => { | ||||
|         if (mutation.type === 'addFocusGained' && this.isPosRequiredPin) { | ||||
|           this.columnNameVisible = mutation.payload.columnName | ||||
|           this.visible = true | ||||
|         } | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -51,13 +51,27 @@ export default { | |||
|           label: 'Total', | ||||
|           isNumeric: true | ||||
|         } | ||||
|       }, | ||||
|       currentOrderLine: { | ||||
|         product: { | ||||
|           value: 0, | ||||
|           name: '', | ||||
|           description: '', | ||||
|           priceStandard: 0 | ||||
|         }, | ||||
|         taxIndicator: 0, | ||||
|         quantityOrdered: 0, | ||||
|         uuid: '' | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
| 
 | ||||
|   }, | ||||
|   methods: { | ||||
|     formatPercent, | ||||
|     changeLine(command) { | ||||
|       switch (command) { | ||||
|       switch (command.option) { | ||||
|         case 'Eliminar': | ||||
|           // this.deleteOrderLine()
 | ||||
|           break | ||||
|  | @ -68,6 +82,7 @@ export default { | |||
|             quantityOrdered: this.currentOrderLine.quantityOrdered, | ||||
|             discount: this.currentOrderLine.discount | ||||
|           }) | ||||
|           this.currentOrderLine.uuid = command.uuid | ||||
|           this.edit = true | ||||
|           break | ||||
|         //
 | ||||
|  | @ -113,22 +128,32 @@ export default { | |||
|       switch (line.columnName) { | ||||
|         case 'QtyEntered': | ||||
|           quantity = line.value | ||||
|           price = line.line.price | ||||
|           discountRate = line.line.discountRate | ||||
|           break | ||||
|         case 'PriceEntered': | ||||
|           price = line.value | ||||
|           quantity = line.line.quantity | ||||
|           discountRate = line.line.discountRate | ||||
|           break | ||||
|         case 'Discount': | ||||
|           discountRate = line.value | ||||
|           price = line.line.price | ||||
|           quantity = line.line.quantity | ||||
|           break | ||||
|       } | ||||
| 
 | ||||
|       requestUpdateOrderLine({ | ||||
|         orderLineUuid: this.currentOrderLine.uuid, | ||||
|         orderLineUuid: line.line.uuid, | ||||
|         quantity, | ||||
|         price, | ||||
|         discountRate | ||||
|       }) | ||||
|         .then(response => { | ||||
|           this.fillOrderLineQuantities({ | ||||
|             currentPrice: response.price, | ||||
|             quantityOrdered: response.quantity, | ||||
|             discount: response.discountRate | ||||
|           }) | ||||
|           this.fillOrderLine(response) | ||||
|           this.reloadOrder(true) | ||||
|         }) | ||||
|  | @ -173,12 +198,13 @@ export default { | |||
|       } else if (columnName === 'QtyOrdered') { | ||||
|         return this.formatQuantity(row.quantityOrdered) | ||||
|       } else if (columnName === 'Discount') { | ||||
|         return this.formatPercent(row.discount) | ||||
|         return this.formatPercent(row.discount / 100) | ||||
|       } else if (columnName === 'GrandTotal') { | ||||
|         return this.formatPrice(row.grandTotal, currency) | ||||
|       } | ||||
|     }, | ||||
|     handleCurrentLineChange(rowLine) { | ||||
|       this.$store.dispatch('currentLine', rowLine) | ||||
|       if (!this.isEmptyValue(rowLine)) { | ||||
|         this.currentOrderLine = rowLine | ||||
|         this.currentTable = this.listOrderLine.findIndex(item => item.uuid === rowLine.uuid) | ||||
|  | @ -192,25 +218,25 @@ export default { | |||
|       quantityOrdered, | ||||
|       discount | ||||
|     }) { | ||||
|       const containerUuid = this.formUuid | ||||
|       // const containerUuid = this.formUuid
 | ||||
|       //  Editable fields
 | ||||
|       if (!this.isEmptyValue(quantityOrdered)) { | ||||
|         this.$store.commit('updateValueOfField', { | ||||
|           containerUuid, | ||||
|           containerUuid: 'line', | ||||
|           columnName: 'QtyEntered', | ||||
|           value: quantityOrdered | ||||
|         }) | ||||
|       } | ||||
|       if (!this.isEmptyValue(currentPrice)) { | ||||
|         this.$store.commit('updateValueOfField', { | ||||
|           containerUuid, | ||||
|           containerUuid: 'line', | ||||
|           columnName: 'PriceEntered', | ||||
|           value: currentPrice | ||||
|         }) | ||||
|       } | ||||
|       if (!this.isEmptyValue(discount)) { | ||||
|         this.$store.commit('updateValueOfField', { | ||||
|           containerUuid, | ||||
|           containerUuid: 'line', | ||||
|           columnName: 'Discount', | ||||
|           value: discount | ||||
|         }) | ||||
|  |  | |||
|  | @ -40,16 +40,6 @@ export default { | |||
|     return { | ||||
|       product: {}, | ||||
|       currentTable: 0, | ||||
|       currentOrderLine: { | ||||
|         product: { | ||||
|           value: 0, | ||||
|           name: '', | ||||
|           description: '', | ||||
|           priceStandard: 0 | ||||
|         }, | ||||
|         taxIndicator: 0, | ||||
|         quantityOrdered: 0 | ||||
|       }, | ||||
|       orderLines: [], | ||||
|       products: { | ||||
|         uuid: '', | ||||
|  | @ -64,7 +54,7 @@ export default { | |||
|       return this.$store.getters['user/getWarehouse'] | ||||
|     }, | ||||
|     isSetTemplateBP() { | ||||
|       const currentPOS = this.currentPoint | ||||
|       const currentPOS = this.currentPointOfSales | ||||
|       if (!this.isEmptyValue(currentPOS) && | ||||
|         !this.isEmptyValue(currentPOS.templateBusinessPartner) && | ||||
|         this.isEmptyValue(this.$route.query.action)) { | ||||
|  | @ -200,10 +190,10 @@ export default { | |||
|     }, | ||||
|     updateOrder(update) { | ||||
|       // user session
 | ||||
|       if (update.value !== this.currentOrder.businessPartner.uuid && !this.isEmptyValue(this.currentPoint)) { | ||||
|       if (!this.isEmptyValue(update.value) && update.value !== this.currentOrder.businessPartner.uuid && !this.isEmptyValue(this.currentPointOfSales)) { | ||||
|         this.$store.dispatch('updateOrder', { | ||||
|           orderUuid: this.$route.query.action, | ||||
|           posUuid: this.currentPoint.uuid, | ||||
|           posUuid: this.currentPointOfSales.uuid, | ||||
|           customerUuid: update.value | ||||
|         }) | ||||
|       } | ||||
|  | @ -312,7 +302,7 @@ export default { | |||
|                 this.createOrderLine(response.uuid) | ||||
|               } | ||||
|               this.$store.dispatch('listOrdersFromServer', { | ||||
|                 posUuid: this.currentPoint.uuid | ||||
|                 posUuid: this.currentPointOfSales.uuid | ||||
|               }) | ||||
|             }).catch(() => {}) | ||||
|           }) | ||||
|  | @ -375,7 +365,10 @@ export default { | |||
|             case 'PriceEntered': | ||||
|             case 'Discount': | ||||
|               if (!this.isEmptyValue(this.currentOrderLine)) { | ||||
|                 this.updateOrderLine(mutation.payload) | ||||
|                 this.updateOrderLine({ | ||||
|                   ...mutation.payload, | ||||
|                   line: this.$store.state['pointOfSales/orderLine/index'].line | ||||
|                 }) | ||||
|               } | ||||
|               break | ||||
|           } | ||||
|  | @ -387,8 +380,8 @@ export default { | |||
| 
 | ||||
|             case 'C_BPartner_ID_UUID': { | ||||
|               const bPartnerValue = mutation.payload.value | ||||
|               if (!this.isEmptyValue(this.currentPoint)) { | ||||
|                 const bPartnerPOS = this.currentPoint.templateBusinessPartner.uuid | ||||
|               if (!this.isEmptyValue(this.currentPointOfSales)) { | ||||
|                 const bPartnerPOS = this.currentPointOfSales.templateBusinessPartner.uuid | ||||
|                 // Does not send values to server, when empty values are set or
 | ||||
|                 // if BPartner set equal to BPartner POS template
 | ||||
|                 if (this.isEmptyValue(bPartnerValue) || bPartnerValue === bPartnerPOS) { | ||||
|  |  | |||
|  | @ -84,5 +84,8 @@ export default { | |||
|       } | ||||
|     }) | ||||
|     commit('setListOrderLine', found) | ||||
|   }, | ||||
|   currentLine({ commit }, currentLine) { | ||||
|     commit('setLine', currentLine) | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -21,5 +21,8 @@ | |||
| export default { | ||||
|   setListOrderLine(state, listOrderLine) { | ||||
|     state.listOrderLine = listOrderLine | ||||
|   }, | ||||
|   setLine(state, line) { | ||||
|     state.line = line | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -19,5 +19,6 @@ | |||
|  */ | ||||
| 
 | ||||
| export default { | ||||
|   listOrderLine: [] | ||||
|   listOrderLine: [], | ||||
|   line: {} | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Elsio Sanchez
						Elsio Sanchez