Unverified Commit d4a15d77 authored by Alberto Nale's avatar Alberto Nale Committed by GitHub
Browse files

[KNOWAGE-7035]

As discussed with Davide Z. in this change request we added the locale on decimal separators when user is editing the whatif table.
parents 86f2534a d95b89c9
......@@ -39,21 +39,29 @@ export default defineComponent({
url: '',
mode: '',
testIFrame: null as any,
name: '' as string
name: '' as string,
loadedItem: null as any
}
},
watch: {
id() {
this.name = this.id as string
this.loadItem()
this.setMode()
},
item() {
this.loadItem()
this.setMode()
}
},
created() {
this.name = this.id as string
this.createUrl()
this.loadItem()
this.setMode()
},
activated() {
this.loadItem()
this.setMode()
},
deactivated() {
......@@ -69,19 +77,22 @@ export default defineComponent({
this.url = process.env.VUE_APP_HOST_URL + `/knowagecockpitengine/api/1.0/pages/edit?NEW_SESSION=TRUE&SBI_LANGUAGE=${language}&user_id=${uniqueID}&SBI_COUNTRY=${country}&SBI_ENVIRONMENT=DOCBROWSER&IS_TECHNICAL_USER=true&documentMode=EDIT&FUNCTIONALITY_ID=${this.functionalityId}`
},
setMode() {
if (!this.item) return
if (!this.loadedItem) return
if (this.item.showMode === 'documentDetail') {
if (this.loadedItem.showMode === 'documentDetail') {
this.mode = 'document-detail'
} else if (this.item.showMode === 'execute') {
} else if (this.loadedItem.showMode === 'execute') {
this.mode = 'document-execution'
} else if (this.item.showMode === 'createCockpit') {
} else if (this.loadedItem.showMode === 'createCockpit') {
this.mode = 'cockpit'
this.$emit('iframeCreated', { iframe: this.url, item: this.item })
}
},
onDocumentsSaved(document: any) {
this.$emit('documentSaved', document)
},
loadItem() {
this.loadedItem = this.item
}
}
})
......
......@@ -3,7 +3,7 @@
v-show="item"
v-slot="{ Component }"
:functionalityId="functionalityId"
:item="item"
:item="loadedItem"
:parameterValuesMap="parameterValuesMap"
:tabKey="key"
@close="$emit('close', item)"
......@@ -29,7 +29,8 @@ export default defineComponent({
props: { item: { type: Object }, functionalityId: { type: String } },
data() {
return {
parameterValuesMap: {} as any
parameterValuesMap: {} as any,
loadedItem: null as any
}
},
computed: {
......@@ -37,14 +38,23 @@ export default defineComponent({
return this.item?.routerId
}
},
watch: {},
created() {},
watch: {
item() {
this.loadItem()
}
},
created() {
this.loadItem()
},
methods: {
onIframeCreated(payload: any) {
this.$emit('iframeCreated', payload)
},
onParametersChange(payload: any) {
this.parameterValuesMap[payload.document.label + '-' + this.key] = payload.parameters
},
loadItem() {
this.loadedItem = this.item
}
}
})
......
......@@ -956,11 +956,33 @@ export default defineComponent({
// @ts-ignore
this.$refs.whatifInput.style.display = 'flex'
this.whatifInputNewValue = event.target.attributes.value.value
let locale = localStorage.getItem('locale') as any
let cutLocalString = locale.split('_')
this.whatifInputNewValue = this.parseLocaleNumber(event.target.attributes.value.value, cutLocalString[0])
this.whatifInputOldValue = event.target.attributes.value.value
this.whatifInputOrdinal = event.target.attributes.ordinal.value
}
},
parseLocaleNumber(stringNumber, locale) {
let num = 123456.789,
fmt_local = new Intl.NumberFormat(locale),
parts_local = fmt_local.formatToParts(num),
group = ''
// separators
parts_local.forEach(function(i) {
switch (i.type) {
case 'group':
group = i.value
break
default:
break
}
})
return stringNumber.replace(new RegExp('\\' + group, 'g'), '')
},
checkIfVersionIsSet() {
let versionIsSet = false
for (let i = 0; i < this.olap.filters.length; i++) {
......@@ -1141,27 +1163,27 @@ export default defineComponent({
table {
border-collapse: collapse;
thead {
border-bottom: 1px solid #ccc;
overflow: auto;
th {
position: relative !important;
border-right: 1px solid #ccc;
border-left: 1px solid #ccc;
padding: 5px;
background: #f5f5f5;
white-space: nowrap;
text-align: left;
}
td {
border-top-width: 1px !important;
border-right-width: 1px !important;
text-align: right;
vertical-align: middle;
border-bottom: 1px solid #3b678c;
border-right: 1px solid #3b678c;
max-height: 43px !important;
}
border-bottom: 1px solid #ccc;
overflow: auto;
th {
position: relative !important;
border-right: 1px solid #ccc;
border-left: 1px solid #ccc;
padding: 5px;
background: #f5f5f5;
white-space: nowrap;
text-align: left;
}
td {
border-top-width: 1px !important;
border-right-width: 1px !important;
text-align: right;
vertical-align: middle;
border-bottom: 1px solid #3b678c;
border-right: 1px solid #3b678c;
max-height: 43px !important;
}
}
tbody {
th {
border-right: 1px solid #ccc;
......@@ -1180,7 +1202,6 @@ export default defineComponent({
}
}
}
}
#whatif-input {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment