Skip to content

Commit

Permalink
18137 fix the bug: next nr number is not in url when clicking Get Nex…
Browse files Browse the repository at this point in the history
…t button (#1424)

* myKeycloak

* remove console.log

* fix errors

* update version

* correct format

* use absolut path for the buttons

* fix bugs and code refactor

* remove setNreExaminer which is useless
  • Loading branch information
eve-git authored Jan 26, 2024
1 parent 96e8f05 commit ffda5f0
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 57 deletions.
2 changes: 0 additions & 2 deletions client/src/components/application/Examine/ActionButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,7 @@ export default {
},
getNextCompany() {
this.$store.commit('toggleWordClassificationModal', false)
this.$store.dispatch('resetValues');
this.$store.dispatch('getpostgrescompNo');
this.$store.dispatch('resetConflictList')
},
holdRequest() {
this.is_making_decision = false
Expand Down
45 changes: 7 additions & 38 deletions client/src/components/application/Examine/RequestInfoHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,6 @@
mounted() {
this.$root.$on('saveEdits', this.save)
this.$root.$on('cancelSave', this.cancelSave)
console.log('***MOUNTED****')
this.setNewExaminer()
},
data() {
return {
Expand All @@ -360,7 +358,6 @@
'name_request_service_account'
],
corp_num_required: false,
examinerDisplay: null,
is_cp_nwpta_type: null,
is_lp_nwpta_type: null,
jurisdiction_required: false,
Expand Down Expand Up @@ -499,8 +496,7 @@
},
},
examiner() {
console.log('examiner computed - LAST CONSOLE LOG- this.examinerDisplay',this.examinerDisplay)
return this.examinerDisplay
return this.$store.getters.examiner
},
expiryDate: {
get() {
Expand Down Expand Up @@ -719,42 +715,19 @@
},
watch: {
nrNumber(val) {
this.$store.dispatch('getpostgrescompInfo', this.nrNumber)
console.log('WATCH nrNumber **** set new examiner')
this.setNewExaminer()
this.checkReqTypeRules(this.requestType)
const payload = {
search: val,
route: this.$router.currentRoute,
refresh: false
}
this.$store.dispatch('newNrNumber', payload)
},
requestType(val) {
/* Show/hide elements of NR Details based on request type (display and edit). */
this.checkReqTypeRules(val)
},
},
methods: {
async setNewExaminer() {
console.log('Calling the set new examiner function-->setNewExaminer')
this.examinerDisplay = this.$store.getters.examiner
if (this.examinerDisplay && this.examinerDisplay.includes('account')) {
// fetch transactions
this.$store.commit('setPendingTransactionsRequest', true)
await this.$store.dispatch('getTransactionsHistory', this.nrNumber)
this.$store.commit('setPendingTransactionsRequest', false)
console.log('REQUESTINFOHEADER-->this.transactionsData',this.transactionsData)
if ( this.transactionsData == null ) {
return
}
for (let i = 0; i < this.transactionsData.length; i++) {
const transactionList = this.transactionsData[i]
/* console.log('INSIDE LOOP -->i',i)
console.log('INSIDE LOOP -->user_name',transactionList.user_name)
console.log('INSIDE LOOP -->user_action',transactionList.user_action) */
if (transactionList.user_name.includes('idir') && transactionList.user_action.includes('Decision')) {
this.examinerDisplay = transactionList.user_name
return
}
}
}
},
buildAdditionalInfo() {
let newAddInfo = ""
// create new additional info from template if relevant; add to top of additional info
Expand Down Expand Up @@ -886,8 +859,6 @@
}, { headers: { Authorization: `Bearer ${ myToken }` } })
.then(response => {
this.$store.dispatch('getpostgrescompInfo', this.nrNumber)
console.log('revertToPreviousState nrNumber **** set new examiner')
this.setNewExaminer()
})
.catch(error => { console.log('ERROR: ' + error) })
},
Expand Down Expand Up @@ -960,8 +931,6 @@
}, { headers: { Authorization: `Bearer ${ myToken }` } })
.then(response => {
this.$store.dispatch('getpostgrescompInfo', this.nrNumber)
console.log('revertToPreviousState nrNumber **** set new examiner')
this.setNewExaminer()
})
.catch(error => {
console.log('ERROR: ' + error)
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/application/Find/findFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ export default {
if (nr != '') {
let payload = {
search: nr,
router: this.$router,
route: this.$router.currentRoute,
}
this.$store.dispatch('newNrNumber', payload)
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/application/sections/StdHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
if (search) {
let payload = {
search,
router: this.$router,
route: this.$router.currentRoute,
refresh: false
}
if (search === this.nrNumber) {
Expand Down
5 changes: 2 additions & 3 deletions client/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,12 @@ router.beforeResolve((to, from, next) => {
if (auth == 'true') {
if (to.name == 'nameexamination' && from.name == 'Signin' && to.params.param) {
const search = formatNrNum(to.params.param)
let payload = {
const payload = {
search,
router: to,
route: to,
refresh: false
}
store.commit('nrNumber', search)
store.dispatch('getpostgrescompInfo', search)
store.dispatch('newNrNumber', payload)
}
next()
Expand Down
26 changes: 14 additions & 12 deletions client/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Vue from 'vue'
import Vuex from 'vuex'
import axios from '../axios-auth'
import moment from 'moment'
import router from '../router/index.js'

Vue.use(Vuex)

Expand Down Expand Up @@ -117,9 +118,7 @@ export const actions = {
dispatch( 'checkToken' )
return axios.get( url, { headers: { Authorization: `Bearer ${ myToken }` } } )
.then( response => {
// response.data.nameRequest = 'NR 8270105';
//response.data.nameRequest = 'NR 0000021';
commit( 'loadpostgresNo', response.data )
commit( 'nrNumber', response.data.nameRequest )
} )
},
getpostgrescompInfo({ dispatch, commit }, nrNumber) {
Expand Down Expand Up @@ -328,7 +327,7 @@ export const actions = {
}
},
newNrNumber({ commit, dispatch }, payload) {
let { search, router, refresh } = payload
let { search, route, refresh } = payload
const myToken = sessionStorage.getItem( 'KEYCLOAK_TOKEN' )
const url = '/api/v1/requests/' + search
dispatch( 'checkToken' )
Expand All @@ -341,11 +340,6 @@ export const actions = {
if (refresh) {
commit( 'showExaminationArea', false )
}
if ( router && router.currentRoute.name !== 'nameexamination') {
router.push( {name: 'nameexamination',
params: {param: search.replace(/\s/g, "")}
} )
}
dispatch( 'resetValues' ).then( () => {
commit( 'nrNumber', search )
commit( 'loadCompanyInfo', response.data )
Expand All @@ -354,6 +348,14 @@ export const actions = {
commit( 'showExaminationArea', true )
}
} )

const url_param = search.replace(/\s/g, "")
const route_path = route?route.fullPath : null
if ( !route_path || route_path !== '/nameExamination/' + url_param) {
router.push( {name: 'nameexamination',
params: {param: url_param}
} )
}
} )
.catch( error => {
console.log( 'ERROR: ' + error )
Expand Down Expand Up @@ -1613,6 +1615,9 @@ export const mutations = {
corpNum(state, value) {
state.corpNum = value
},
setExaminer(state, examiner) {
state.examiner = examiner
},
searchQuery(state, value) {
state.searchQuery = value
},
Expand Down Expand Up @@ -1677,9 +1682,6 @@ export const mutations = {
state.userId = null
state.authorized = null
},
loadpostgresNo(state, postgresData) {
state.compInfo.nrNumber = postgresData.nameRequest
},
loadCompanyInfo(state, dbcompanyInfo) {
if (state.nrData && state.nrData.consent_dt) {
state.nrData.consent_dt = null
Expand Down

0 comments on commit ffda5f0

Please sign in to comment.