Skip to content

Commit

Permalink
Merge branch 'main' into 15773-error-msg-on-joint-tenancy
Browse files Browse the repository at this point in the history
  • Loading branch information
flutistar authored Aug 23, 2024
2 parents c1ca697 + b71479b commit 3347153
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 46 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.2.46",
"version": "3.2.48",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
28 changes: 13 additions & 15 deletions ppr-ui/src/components/common/RegistrationsWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
:setNewRegItem="getRegTableNewItem"
:setRegistrationHistory="myRegistrations"
:setSearch="myRegFilter"
:setSort="getRegTableSortOptions"
:setSort="isPpr ? getRegTableSortOptions : getRegTableMhSortOptions"
@action="myRegActionHandler($event)"
@error="emitError($event)"
@sort="myRegSort($event)"
Expand Down Expand Up @@ -357,19 +357,16 @@ export default defineComponent({
getRegTableBaseRegs, getRegTableDraftsBaseReg, isMhrRegistration, isMhrManufacturerRegistration,
getRegTableTotalRowCount, getStateModel, getRegTableDraftsChildReg, hasMorePages, getRegTableNewItem,
getRegTableSortOptions, getRegTableSortPage, getUserSettings, getMhRegTableBaseRegs, isRoleStaffReg,
isRoleQualifiedSupplier
isRoleQualifiedSupplier, getRegTableMhSortOptions
} = storeToRefs(useStore())
const {
initNewMhr,
initNewManufacturerMhr,
fetchMhRegistrations
} = useNewMhrRegistration(true)
const { initDraftMhrCorrection } = useMhrCorrections()
const { goToExemptions } = useExemptions()
const { initMhrReRegistration, initDraftMhrReRegistration } = useMhrReRegistration()
const localState = reactive({
Expand Down Expand Up @@ -447,8 +444,8 @@ export default defineComponent({
} else if (props.isPpr) {
// load in registrations from scratch
resetRegTableData(null)
const myRegDrafts = await draftHistory(cloneDeep(getRegTableSortOptions.value))
const myRegHistory = await registrationHistory()
const myRegDrafts = await draftHistory(getRegTableSortOptions.value)
const myRegHistory = await registrationHistory(getRegTableSortOptions.value)
if (myRegDrafts?.error || myRegHistory?.error) {
// prioritize reg error
Expand All @@ -469,7 +466,7 @@ export default defineComponent({
setRegTableTotalRowCount(getRegTableTotalRowCount.value + historyDraftsCollapsed.drafts.length)
}
} else if (props.isMhr && !props.isTabView) { // If Tab view, Mhr Data will be loaded in dashboardTabs component
await fetchMhRegistrations()
await fetchMhRegistrations(getRegTableMhSortOptions.value)
}
Expand Down Expand Up @@ -703,7 +700,7 @@ export default defineComponent({
prevDraft: ''
}
setRegTableNewItem(newRegItem)
await fetchMhRegistrations()
await fetchMhRegistrations(getRegTableMhSortOptions.value)
}
localState.loading = false
}
Expand Down Expand Up @@ -869,7 +866,7 @@ export default defineComponent({
const removeMhrDraft = async (mhrNumber: string): Promise<void> => {
localState.myRegDataLoading = true
await deleteMhrDraft(mhrNumber)
await fetchMhRegistrations() // Refresh the table with update Registration History
await fetchMhRegistrations(getRegTableMhSortOptions.value)
localState.myRegDataLoading = false
}
Expand Down Expand Up @@ -916,7 +913,7 @@ export default defineComponent({
localState.myRegDataLoading = true
const page = getRegTableSortPage.value + 1
setRegTableSortPage(page)
const nextRegs = await registrationHistory(cloneDeep(getRegTableSortOptions.value), page)
const nextRegs = await registrationHistory(getRegTableSortOptions.value, page)
if (nextRegs.error) {
emitError(nextRegs.error)
} else {
Expand Down Expand Up @@ -1029,7 +1026,7 @@ export default defineComponent({
const myRegSort = async (args: { sortOptions: RegistrationSortIF, sorting: boolean }): Promise<void> => {
localState.myRegDataLoading = true
setRegTableSortOptions(args.sortOptions)
setRegTableSortOptions(args.sortOptions, props.isMhr)
const sorting = args.sorting
let sortedDrafts = { drafts: [] as DraftResultIF[], error: null }
Expand Down Expand Up @@ -1062,7 +1059,7 @@ export default defineComponent({
setRegTableBaseRegs(updatedRegs.registrations)
}
} else if (props.isMhr) {
await fetchMhRegistrations(cloneDeep(args.sortOptions))
await fetchMhRegistrations(getRegTableMhSortOptions.value)
}
localState.myRegDataLoading = false
}
Expand All @@ -1086,7 +1083,7 @@ export default defineComponent({
val.addedRegSummary = regSummary
} else {
// its a draft - get draft summary
const drafts = await draftHistory(null)
const drafts = await draftHistory(getRegTableSortOptions.value)
if (drafts.error) {
emitError(drafts.error) // dialog and will reload the dash after
localState.myRegDataAdding = false
Expand Down Expand Up @@ -1177,7 +1174,7 @@ export default defineComponent({
}
}
} else {
await fetchMhRegistrations()
await fetchMhRegistrations(getRegTableMhSortOptions.value)
}
localState.myRegDataAdding = false
Expand Down Expand Up @@ -1282,6 +1279,7 @@ export default defineComponent({
getRegTableNewItem,
getRegTableTotalRowCount,
getRegTableSortOptions,
getRegTableMhSortOptions,
getMhRegTableBaseRegs,
hasMorePages,
myRegSort,
Expand Down
3 changes: 2 additions & 1 deletion ppr-ui/src/components/dashboard/DashboardTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export default defineComponent({
} = useStore()
const {
// Getters
getRegTableMhSortOptions,
getMhRegTableBaseRegs,
getRegTableBaseRegs,
getRegTableTotalRowCount,
Expand Down Expand Up @@ -133,7 +134,7 @@ export default defineComponent({
}
onMounted(async () => {
await fetchMhRegistrations()
await fetchMhRegistrations(getRegTableMhSortOptions.value)
})
return {
Expand Down
6 changes: 0 additions & 6 deletions ppr-ui/src/components/tables/RegistrationTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@
import {
computed,
defineComponent,
onBeforeMount,
onUpdated,
reactive,
ref,
Expand Down Expand Up @@ -812,11 +811,6 @@ export default defineComponent({
{ deep: true }
)
// Ensures filtering is cleared when returing to dashboard from registrations
onBeforeMount(() => {
clearFilters()
})
onUpdated(() => {
// needed to set overrideWidth to true
if (localState.firstColRef?.value?.length > 0) {
Expand Down
25 changes: 20 additions & 5 deletions ppr-ui/src/composables/mhrInformation/useMhrInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ export const useMhrInformation = () => {
})

/** New Filings / Initializing **/

const initMhrTransfer = (): MhrTransferIF => {
return {
mhrNumber: '',
Expand All @@ -173,6 +172,23 @@ export const useMhrInformation = () => {
}
}

/** Returns true when the lien type is includes in the blocked lien list **/
const includesBlockingLien = (lienType: APIRegistrationTypes) => {
return [
APIRegistrationTypes.SECURITY_AGREEMENT_TAX,
APIRegistrationTypes.TRANSITION_SECURITY_AGREEMENT_TAX,
APIRegistrationTypes.TRANSITION_MH_TAX,
APIRegistrationTypes.SECURITY_AGREEMENT_GOV,
APIRegistrationTypes.TRANSITION_SECURITY_AGREEMENT_GOV,
APIRegistrationTypes.TRANSITION_MH_GOV,
APIRegistrationTypes.MARRIAGE_MH,
APIRegistrationTypes.LAND_TAX_LIEN,
APIRegistrationTypes.MAINTENANCE_LIEN,
APIRegistrationTypes.MANUFACTURED_HOME_NOTICE,
APIRegistrationTypes.SALE_OF_GOODS
].includes(lienType)
}

const parseMhrInformation = async (includeDetails = false): Promise<void> => {
const { data } = await fetchMhRegistration(getMhrInformation.value.mhrNumber)

Expand Down Expand Up @@ -308,20 +324,18 @@ export const useMhrInformation = () => {

// Get information about the lien to help with styling and functionality
const getLienInfo = (): { class: string, msg: string, isSubmissionAllowed: boolean } => {
const isLienRegistrationTypeSA = getLienRegistrationType.value === APIRegistrationTypes.SECURITY_AGREEMENT
const routeName = router.currentRoute.value.name

const isQSorSBC: boolean = isRoleQualifiedSupplier.value || isRoleStaffSbc.value

if (routeName === RouteNames.MHR_INFORMATION &&
(isRoleStaffReg.value || (isLienRegistrationTypeSA && isQSorSBC))) {
(isRoleStaffReg.value || (!localState.hasQsTransferOrExemptionBlockingLien && isQSorSBC))) {
return {
class: 'warning-msg',
msg: LienMessages.defaultWarning,
isSubmissionAllowed: true
}
} else if ((isRoleStaffReg.value && routeName === RouteNames.EXEMPTION_DETAILS) ||
(isRoleQualifiedSupplier.value && isLienRegistrationTypeSA &&
(isRoleQualifiedSupplier.value && !localState.hasQsTransferOrExemptionBlockingLien &&
[RouteNames.EXEMPTION_DETAILS, RouteNames.EXEMPTION_REVIEW].includes(routeName as RouteNames)
)) {
return {
Expand Down Expand Up @@ -575,6 +589,7 @@ export const useMhrInformation = () => {
initDraftMhrInformation,
parseSubmittingPartyInfo,
getLienInfo,
includesBlockingLien,
parseMhrPermitData,
...toRefs(localState)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface RegTableDataI {
newItem: RegTableNewItemI
sortHasMorePages: boolean
sortOptions: RegistrationSortIF
mhSortOptions: RegistrationSortIF
sortPage: number
totalRowCount: number
}
13 changes: 13 additions & 0 deletions ppr-ui/src/store/state/state-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ export const stateModel: StateModelIF = {
startDate: null,
status: ''
},
mhSortOptions: {
endDate: null,
folNum: '',
orderBy: 'createDateTime',
orderVal: 'desc',
regBy: '',
regNum: '',
regParty: '',
regType: '',
secParty: '',
startDate: null,
status: ''
},
sortPage: 1,
totalRowCount: 0
},
Expand Down
23 changes: 8 additions & 15 deletions ppr-ui/src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@ export const useStore = defineStore('assetsStore', () => {
const getRegTableSortOptions = computed<RegistrationSortIF>(() => {
return state.value.registrationTable.sortOptions
})
const getRegTableMhSortOptions = computed<RegistrationSortIF>(() => {
return state.value.registrationTable.mhSortOptions
})
const getRegTableSortPage = computed<number>(() => {
return state.value.registrationTable.sortPage
})
Expand Down Expand Up @@ -957,19 +960,6 @@ export const useStore = defineStore('assetsStore', () => {
prevDraft: ''
}
state.value.registrationTable.sortHasMorePages = true
state.value.registrationTable.sortOptions = {
endDate: null,
folNum: '',
orderBy: 'createDateTime',
orderVal: 'desc',
regBy: '',
regNum: '',
regParty: '',
regType: '',
secParty: '',
startDate: null,
status: ''
}
state.value.registrationTable.sortPage = 1
state.value.registrationTable.totalRowCount = 0
}
Expand Down Expand Up @@ -1223,8 +1213,10 @@ export const useStore = defineStore('assetsStore', () => {
state.value.registrationTable.sortHasMorePages = hasMorePages
}

function setRegTableSortOptions (options: RegistrationSortIF) {
state.value.registrationTable.sortOptions = options
function setRegTableSortOptions (options: RegistrationSortIF, isMhr: boolean = false) {
isMhr
? state.value.registrationTable.mhSortOptions = options
: state.value.registrationTable.sortOptions = options
}

function setRegTableSortPage (page: number) {
Expand Down Expand Up @@ -1644,6 +1636,7 @@ export const useStore = defineStore('assetsStore', () => {
getRegTableDraftsChildReg,
getRegTableNewItem,
getRegTableSortOptions,
getRegTableMhSortOptions,
getRegTableSortPage,
getRegTableTotalRowCount,
hasMorePages,
Expand Down
1 change: 1 addition & 0 deletions ppr-ui/src/utils/mhr-api-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export async function submitMhrRegistration (payloadData, staffPayment) {
* Method to return Mhr registrations.
*
* @param withCollapse // Used to indicate whether api should return registrations collapsed
* @param sortOptions // Used to sort the registration results
* @returns MhRegistrationSummaryIF
*/
export async function mhrRegistrationHistory (withCollapse: boolean = false, sortOptions: RegistrationSortIF = null) {
Expand Down
4 changes: 3 additions & 1 deletion ppr-ui/src/views/mhrInformation/MhrInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ export default defineComponent({
initMhrTransfer,
getUiTransferType,
parseMhrInformation,
includesBlockingLien,
initDraftMhrInformation,
parseSubmittingPartyInfo,
isFrozenMhrDueToUnitNote,
Expand Down Expand Up @@ -1181,7 +1182,8 @@ export default defineComponent({
? await getMHRegistrationSummary(getMhrInformation.value.mhrNumber, false)
: null
if (!!regSum && !!regSum.lienRegistrationType && !isRoleStaffReg.value) {
if (!!regSum && !!regSum.lienRegistrationType && includesBlockingLien(regSum.lienRegistrationType) &&
!isRoleStaffReg.value) {
await setLienType(regSum.lienRegistrationType)
await scrollToFirstError(true)
localState.hasLienInfoDisplayed = true
Expand Down

0 comments on commit 3347153

Please sign in to comment.