Skip to content

Commit

Permalink
Fix to preserve data for Transport Permit. Payload cleanup. (#1744)
Browse files Browse the repository at this point in the history
* Fix to preserve data for Transport Permit
* Cleanup payload for Transport Permit. Fix Pad preservation.
  • Loading branch information
dimak1 authored Feb 22, 2024
1 parent faea4db commit 9b3e9d5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ppr-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ppr-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ppr-ui",
"version": "3.0.46",
"version": "3.0.47",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ export default defineComponent({
const localState = reactive({
// transport permit
currentPadNumber: homeLocationInfo.pad,
newTransportPermitPadNumber: homeLocationInfo.pad,
newTransportPermitPadNumber: '',
showTaxCertificateExpiryDate: homeLocationInfo.taxCertificate
&& isNotManufacturersLot.value && !isMovingWithinSamePark.value,
Expand Down Expand Up @@ -583,6 +583,12 @@ export default defineComponent({
newPadNumberRef.value?.validate()
})
// is editing Pad number - get the value from either Permit or Registration
watch(() => props.isPadEditable, async () => {
localState.newTransportPermitPadNumber =
getMhrTransportPermit.value.newLocation.pad || structuredClone(homeLocationInfo.pad)
}, { immediate: true })
return {
homeLocationInfo,
newPadNumberRef,
Expand Down
2 changes: 0 additions & 2 deletions ppr-ui/src/composables/mhrInformation/useTransportPermits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ export const useTransportPermits = () => {
.toISOString()
.replace('.000Z', '+00:00')
}
// set empty postal code because it is not captured in the form
payloadData.newLocation.address.postalCode = ' '
}

// api does not support otherType, and it should be set to the locationType
Expand Down
3 changes: 2 additions & 1 deletion ppr-ui/src/utils/mhr-api-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { APIMhrTypes, ErrorCategories, ErrorCodes, ErrorRootCauses, StaffPayment
import { useSearch } from '@/composables/useSearch'
import { SessionStorageKeys } from 'sbc-common-components/src/util/constants'
import { addTimestampToDate } from '@/utils'
import { trim } from 'lodash'
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import type { AxiosError } from 'axios'

Expand Down Expand Up @@ -716,7 +717,7 @@ export function deleteEmptyProperties (obj) {
if (Object.keys(obj[key] || {}).length === 0) {
delete obj[key] // delete empty nested object
}
} else if (obj[key] === null || obj[key] === undefined || obj[key] === '') {
} else if (obj[key] === null || obj[key] === undefined || trim(obj[key]) === '') {
delete obj[key] // delete empty property value
}
}
Expand Down

0 comments on commit 9b3e9d5

Please sign in to comment.