Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
elsiosanchez authored Feb 15, 2022
1 parent 459766c commit 56043dc
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 3 deletions.
16 changes: 16 additions & 0 deletions src/api/ADempiere/form/point-of-sales.js
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,22 @@ export function allocateSeller({
return response
})
}
export function deallocate({
posUuid,
salesRepresentativeUuid
}) {
return request({
url: `${config.pointOfSales.endpoint}/deallocate-seller`,
method: 'post',
data: {
pos_uuid: posUuid,
sales_representative_uuid: salesRepresentativeUuid
}
})
.then(response => {
return response
})
}
export function releaseOrder({
posUuid,
salesRepresentativeUuid,
Expand Down
40 changes: 38 additions & 2 deletions src/components/ADempiere/Form/VPOS/Options/AssignSeller/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@
<script>
import formMixin from '@/components/ADempiere/Form/formMixin'
import fieldsListAssignSeller from './fieldsList.js'
import { availableSellers } from '@/api/ADempiere/form/point-of-sales'
import {
allocateSeller
allocateSeller,
availableSellers,
deallocate
} from '@/api/ADempiere/form/point-of-sales.js'
import { getImagePath } from '@/utils/ADempiere/resource.js'

Expand Down Expand Up @@ -152,6 +153,9 @@ export default {
})
}
return []
},
showUnassignSeller() {
return this.$store.getters.getShowUnassignSeller
}
},
watch: {
Expand All @@ -178,12 +182,44 @@ export default {

return uri
},
selectSeller() {
if (this.showUnassignSeller) {
this.unassignSeller()
return
}
this.assignSeller()
},
unassignSeller() {
deallocate({
posUuid: this.$store.getters.posAttributes.currentPointOfSales.uuid,
salesRepresentativeUuid: this.salesRepresentative.uuid
})
.then(response => {
this.$message({
message: response,
isShowClose: true,
type: 'success'
})
})
.catch(error => {
this.$message({
message: error.message,
isShowClose: true,
type: 'error'
})
console.warn(`Error: ${error.message}. Code: ${error.code}.`)
})
.finally(() => {
this.close()
})
},
close() {
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
columnName: 'SalesRep_ID',
value: undefined
})
this.$store.commit('setShowUnassignSeller', false)
this.$store.commit('setShowAssignSeller', false)
this.salesRepresentative = ''
},
Expand Down
36 changes: 36 additions & 0 deletions src/components/ADempiere/Form/VPOS/Options/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,18 @@
</p>
</el-card>
</el-col>
<el-col v-if="isAllowsAllocateSeller" :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
<el-card shadow="hover" style="height: 100px">
<p
style="cursor: pointer; text-align: center !important; color: black;min-height: 50px;"
@click="adviserPin ? validateOption($t('form.pos.optionsPoinSales.cashManagement.unassignSeller')) : unassignSeller()"
>
<i class="el-icon-sold-out" />
<br>
{{ $t('form.pos.optionsPoinSales.cashManagement.unassignSeller') }}
</p>
</el-card>
</el-col>
</el-row>
</el-collapse-item>

Expand Down Expand Up @@ -412,6 +424,16 @@
>
<assign-seller />
</el-dialog>
<el-dialog
:title="$t('form.pos.optionsPoinSales.cashManagement.unassignSeller')"
:visible.sync="showUnassignSeller"
:is-loaded-panel="showUnassignSeller"
width="60%"
center
class="dialogo-seller"
>
<assign-seller />
</el-dialog>
</div>
</template>

Expand Down Expand Up @@ -556,6 +578,14 @@ export default {
this.$store.commit('setShowAssignSeller', value)
}
},
showUnassignSeller: {
get() {
return this.$store.getters.getShowUnassignSeller
},
set(value) {
this.$store.commit('setShowUnassignSeller', value)
}
},
adviserPin() {
return this.$store.getters.posAttributes.currentPointOfSales.isPosRequiredPin
},
Expand Down Expand Up @@ -691,6 +721,9 @@ export default {
assignSeller() {
this.$store.commit('setShowAssignSeller', true)
},
unassignSeller() {
this.$store.commit('setShowUnassignSeller', true)
},
openListOrdes() {
this.showFieldListOrder = true
},
Expand Down Expand Up @@ -784,6 +817,9 @@ export default {
case this.$t('form.pos.optionsPoinSales.cashManagement.assignSeller'):
this.assignSeller()
break
case this.$t('form.pos.optionsPoinSales.cashManagement.unassignSeller'):
this.unassignSeller()
break
}
},
printTicket() {
Expand Down
3 changes: 3 additions & 0 deletions src/lang/ADempiere/en/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ export default {
cashOpening: 'Cash Opening',
closeBox: 'Close the box',
assignSeller: 'Assign seller',
unassignSeller: 'Unassign Seller',
transfer: 'Transfer',
moneyIncome: 'Money Income',
cashOpenBox: 'Cashbox Opened',
cashwithdrawal: 'Cash Withdrawal',
successfulCashWithdrawal: 'Cash withdrawal successful',
Expand Down
5 changes: 4 additions & 1 deletion src/lang/ADempiere/es/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,13 @@ export default {
cashOpening: 'Apertura de Caja',
cashOpenBox: 'Caja Aperturada',
cashwithdrawal: 'Retiro de Efectivo',
transfer: 'Transferencia',
moneyIncome: 'Ingreso de Dinero',
successfulCashWithdrawal: 'Retiro de caja exitoso',
cashCloseBox: 'Caja Cerrada',
closeBox: 'Cierre de Caja',
assignSeller: 'Asignar vendedor'
assignSeller: 'Asignar vendedor',
unassignSeller: 'Desasignar vendedor'
},
generalOptions: {
title: 'Opciones Generales',
Expand Down
7 changes: 7 additions & 0 deletions src/store/modules/ADempiere/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const initStateUtils = {
showCashWithdrawl: false,
showCashSummaryMovements: false,
showAssignSeller: false,
showUnassignSeller: false,
showPanelAddress: false,
quickSearchOrder: {}
}
Expand Down Expand Up @@ -154,6 +155,9 @@ export default {
setShowAssignSeller(state, payload) {
state.showAssignSeller = payload
},
setShowUnassignSeller(state, payload) {
state.showUnassignSeller = payload
},
setQuickSearchOrder(state, order) {
state.quickSearchOrder = order
},
Expand Down Expand Up @@ -357,6 +361,9 @@ export default {
getShowAssignSeller: (state) => {
return state.showAssignSeller
},
getShowUnassignSeller: (state) => {
return state.showUnassignSeller
},
getQuickSearchOrder: (state) => {
return state.quickSearchOrder
}
Expand Down

0 comments on commit 56043dc

Please sign in to comment.