Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Invoice field changes. #2208

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>.
-->
<template>
<el-form-item :label="$t('field.invoice.saleOrder')">
<el-form-item :label="orderTitle">
<el-select
v-model="saleOrderField"
clearable
Expand All @@ -39,22 +39,48 @@

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

import lang from '@/lang'
import store from '@/store'

// Utils and Helper Methods
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import store from '@/store'

//
import { requestListOrders } from '@/api/ADempiere/field/search/invoice.ts'
import { convertStringToBoolean } from '@/utils/ADempiere/formatValue/booleanFormat'

export default defineComponent({
name: 'InvoiceField',
name: 'OrderField',

props: {
uuidForm: {
required: true,
type: String
}
},

setup() {
setup(props) {
const optionsListOrder = ref([])
const saleOrderField = ref('')

const isSalesTransaction = computed(() => {
const stringValue = store.getters.getInvoiceSearchQueryFilterByAttribute({
containerUuid: props.uuidForm,
attributeKey: 'is_sales_transaction'
})
return convertStringToBoolean(stringValue)
})

const orderTitle = computed(() => {
if (isSalesTransaction.value) {
return lang.t('field.invoice.salesOrder')
}
return lang.t('field.invoice.purchaseOrder')
})

function showList(isShow) {
if (isShow && isEmptyValue(optionsListOrder.value)) { filterSearchOrder({}) }
}
Expand Down Expand Up @@ -86,6 +112,8 @@ export default defineComponent({
optionsListOrder,
saleOrderField,
//
orderTitle,
//
filterSearchOrder,
showList,
currentValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
-->
<template>
<el-form-item
:label="$t('field.invoice.saleTransaction')"
:label="$t('field.invoice.salesTransaction')"
style="align-items: center;"
>
<el-select
v-model="saleTransactionField"
@change="currentValue()"
v-model="currentValue"
@change="changeValue()"
>
<el-option
v-for="(option, key) in YES_NO_OPTIONS_LIST"
Expand All @@ -35,17 +35,21 @@
</template>

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

import store from '@/store'

// Constants
import { YES_NO_OPTIONS_LIST } from '@/utils/ADempiere/dictionary/field/yesNo'

// Utils and Helper Methods
import { isSalesTransaction } from '@/utils/ADempiere/contextUtils'
import { convertBooleanToString } from '@/utils/ADempiere/formatValue/booleanFormat'
// import { isEmptyValue } from '@/utils/ADempiere'

export default defineComponent({
name: 'saleTransactionField',

props: {
uuidForm: {
required: true,
Expand All @@ -62,40 +66,61 @@ export default defineComponent({
},

setup(props) {
const saleTransactionField = ref('')

const currentValue = () => {
store.dispatch('searchInvociesInfos', {
is_sales_transaction: saleTransactionField.value
})
}
const ATTRIBUTE_KEY = 'is_sales_transaction'

const isSalesTransactionContext = computed(() => {
return isSalesTransaction({
const booleanValue = isSalesTransaction({
parentUuid: props.parentUuid,
containerUuid: props.containerUuid
})
return convertBooleanToString(booleanValue)
})
function changeValue() {
const response = isSalesTransactionContext.value
if (response === true) {
saleTransactionField.value = 'Y'
return
} else if (response === false) {
saleTransactionField.value = 'N'
return
} else {
saleTransactionField.value = ''

const currentValue = computed({
set(newValue) {
store.commit('setInvoiceSearchQueryFilterByAttribute', {
containerUuid: props.uuidForm,
attributeKey: ATTRIBUTE_KEY,
value: newValue
})
},
get() {
return store.getters.getInvoiceSearchQueryFilterByAttribute({
containerUuid: props.uuidForm,
attributeKey: ATTRIBUTE_KEY
})
}
currentValue()
return
})

// const currentValue = () => {
// store.dispatch('searchInvociesInfos', {
// is_sales_transaction: saleTransactionField.value
// })
// }

function changeValue() {
// const response = isSalesTransactionContext.value
// if (response === true) {
// saleTransactionField.value = 'Y'
// return
// } else if (response === false) {
// saleTransactionField.value = 'N'
// return
// } else {
// saleTransactionField.value = ''
// }
// currentValue()
// return
}

changeValue()
// changeValue()
currentValue.value = isSalesTransactionContext.value
console.log(currentValue.value)

return {
saleTransactionField,
// saleTransactionField,
YES_NO_OPTIONS_LIST,
//
isSalesTransactionContext,
//
currentValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
-->

<template>
<el-form-item
:label="$t('field.invoice.invoiceDate')"
Expand All @@ -23,16 +24,16 @@
<div class="date-picker-container">
<el-date-picker
v-model="billingDateFieldFrom"
type="datetime"
type="date"
placeholder="Select date and time"
@change="currentValue()"
/>
<b style="color: #c0c4cc;padding: 0px 5px;font-weight: bold;">
{{ '-' }}
</b>
<el-date-picker
v-model="billingDateFieldTo"
type="datetime"
type="date"
placeholder="Select date and time"
@change="currentValue"
/>
Expand All @@ -42,6 +43,7 @@

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

import store from '@/store'

export default defineComponent({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>.
-->
<template>
<el-form-item :label="$t('field.invoice.businessParnet')">
<el-form-item :label="$t('field.invoice.businessPartner')">
<el-select
v-model="businessPartnerField"
clearable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,26 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
-->

<template>
<el-form-item
:label="$t('field.invoice.grandTotal')"
style="align-items: center;"
>
<div style="display: flex;">
<el-input
<el-input-number
v-model="grandTotalFieldFrom"
clearable
controls-position="right"
@input="currentValue()"
/>
<b style="color: #c0c4cc;padding: 0px 5px;font-weight: bold;">
{{ '-' }}
</b>
<el-input
<el-input-number
v-model="grandTotalFieldTo"
clearable
controls-position="right"
@input="currentValue"
/>
</div>
Expand All @@ -40,6 +43,7 @@

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

import store from '@/store'

export default defineComponent({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
-->

<template>
<el-form label-position="top" size="mini" class="form-base">
<el-form label-position="top" size="mini" class="form-base invoice-search-query-criteria">
<el-row :gutter="10">
<el-col :span="8">
<document-field
Expand All @@ -30,7 +30,7 @@
/>
</el-col>
<el-col :span="8">
<sale-transaction-field
<sales-transaction-field
:uuid-form="uuidForm"
:parent-uuid="metadata.parentUuid"
:container-uuid="metadata.containerUuid"
Expand All @@ -49,7 +49,7 @@
/>
</el-col>
<el-col :span="8">
<invoice-field
<order-field
:uuid-form="uuidForm"
/>
</el-col>
Expand All @@ -68,36 +68,37 @@
</el-row>
</el-form>
</template>

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

// Components and Mixins
import DocumentField from './documentField.vue'
import BusinessPartnerField from './businessPartnerField.vue'
import SaleTransactionField from './SaleTransactionField.vue'
import SalesTransactionField from './SalesTransactionField.vue'
import PaidField from './PaidFieldInvoice.vue'
import BillingDateField from './billingDateField.vue'
import DescriptionField from './descriptionField.vue'
import InvoiceField from './InvoiceField.vue'
import OrderField from './OrderField.vue'
import GrandTotalField from './grandTotalField.vue'

// Constants
import {
INVOICE_LIST_FORM,
COLUMN_NAME
} from '@/utils/ADempiere/dictionary/field/search/invoice.ts'
} from '@/utils/ADempiere/dictionary/field/search/invoice'

export default defineComponent({
name: 'QueryCriteria',

components: {
DocumentField,
BusinessPartnerField,
SaleTransactionField,
SalesTransactionField,
PaidField,
BillingDateField,
DescriptionField,
InvoiceField,
OrderField,
GrandTotalField
},

Expand All @@ -118,3 +119,16 @@ export default defineComponent({
}
})
</script>

<style lang="scss">
.invoice-search-query-criteria {
.el-form-item--mini {
margin-bottom: 5px !important;

.el-form-item__label {
font-size: 12px !important;
line-height: 22px !important;
}
}
}
</style>
Loading
Loading