Skip to content

Commit

Permalink
Misc SBC items and Submission Fixes (#1806)
Browse files Browse the repository at this point in the history
* Pdf Content and misc bug fixes

* clean up and version bump
  • Loading branch information
cameron-eyds authored Apr 3, 2024
1 parent 7bfd9e1 commit e6c4d24
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 29 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.75",
"version": "3.0.76",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
5 changes: 5 additions & 0 deletions ppr-ui/src/components/common/ButtonsStacked.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
class="btn-stacked important-btn"
color="primary"
:disabled="disableSubmitBtn"
:loading="setIsLoading"
@click="submit"
>
{{ setSubmitBtn }}
Expand Down Expand Up @@ -130,6 +131,10 @@ export default defineComponent({
setSaveButton: {
type: String,
default: ''
},
setIsLoading: {
type: Boolean,
default: false
}
},
emits: ['back', 'cancel', 'submit', 'save'],
Expand Down
5 changes: 5 additions & 0 deletions ppr-ui/src/components/common/StickyContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
:setSubmitBtn="setSubmitBtn"
:setSaveButton="saveBtn"
:setDisableSubmitBtn="disableSubmitBtn"
:setIsLoading="setIsLoading"
@back="back()"
@cancel="cancel()"
@submit="submit()"
Expand Down Expand Up @@ -134,6 +135,10 @@ export default defineComponent({
setSaveBtn: {
type: String,
default: ''
},
setIsLoading: {
type: Boolean,
default: false
}
},
emits: ['back', 'cancel', 'submit', 'save'],
Expand Down
6 changes: 3 additions & 3 deletions ppr-ui/src/components/registration/RegistrationBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
fluid
>
<v-btn
v-if="isMhr && (isRoleStaff || isRoleManufacturer)"
v-if="isMhr && (isRoleStaffReg || isRoleManufacturer)"
class="mhr-registration-bar-btn px-5"
@click="newRegistration(MhrRegistrationType)"
>
Expand Down Expand Up @@ -66,7 +66,7 @@ export default defineComponent({
// Getters
getAccountProductSubscriptions,
isRoleQualifiedSupplier,
isRoleStaff,
isRoleStaffReg,
isRoleManufacturer
} = storeToRefs(useStore())
const hasRPPR = computed(() => {
Expand All @@ -84,7 +84,7 @@ export default defineComponent({
return {
hasRPPR,
isRoleStaff,
isRoleStaffReg,
isRoleManufacturer,
isRoleQualifiedSupplier,
newRegistration,
Expand Down
56 changes: 35 additions & 21 deletions ppr-ui/src/components/tables/common/TableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@
</v-btn>
<v-tooltip
v-else-if="!isDraft(item)"
class="pa-2"
contentClass="top-tooltip"
location="top"
transition="fade-transition"
Expand All @@ -271,7 +270,7 @@
mdi-information-outline
</v-icon>
</template>
<div class="pt-2 pb-2">
<div>
<span v-html="tooltipTxtPdf(item)" />
</div>
</v-tooltip>
Expand Down Expand Up @@ -644,7 +643,7 @@
import { computed, defineComponent, reactive, toRefs, watch } from 'vue'
import {
getRegistrationSummary, mhRegistrationPDF, registrationPDF, stripChars,
multipleWordsToTitleCase, getMHRegistrationSummary
multipleWordsToTitleCase, getMHRegistrationSummary, isWithinMinutes
} from '@/utils'
import { useStore } from '@/store/store'
import InfoChip from '@/components/common/InfoChip.vue'
Expand Down Expand Up @@ -776,23 +775,37 @@ export default defineComponent({
})
}
const tooltipTxtPdf = (item: RegistrationSummaryIF): string => {
if (!props.isPpr && (item.submittingParty?.toUpperCase() != getAccountLabel.value?.toUpperCase()) &&
!isRoleStaffReg.value)
{
return 'Documents are only available to the Submitting Party of this filing. To view the details of this ' +
'registration you must conduct a search.'
} else if (!item.registeringName && props.isPpr) {
return 'Verification Statements are only available ' +
'to Secured Parties or the Registering Party of this filing. To ' +
'view the details of this registration you must conduct a search.'
} else {
return 'This document PDF is still being generated. Click the ' +
'<i class="v-icon notranslate mdi mdi-information-outline" style="font-size:18px; margin-bottom:4px;"></i>' +
' icon to see if your PDF is ready to download. <br>' +
'Note: Large documents may take up to 20 minutes to generate.'
const tooltipTxtPdf = (item: RegistrationSummaryIF) => {
// Display Legacy messaging if the filing was flagged as completed in the legacy system
if (item.legacy) {
return 'Document only available in the legacy system.'
}
}
// Display messaging for client accounts when the submitting party doesn't match the current account
const isNotMhrSubmittingParty = !props.isPpr && item.submittingParty?.toUpperCase() !==
getAccountLabel.value?.toUpperCase()
// Sbc Staff can't rely on Submitting Party Match and cannot view all docs like Reg Staff
// Fall through to the 'download' messaging if user is SBC and this filing is recent.
const isRecentSbcFiling = isRoleStaffSbc.value && isWithinMinutes(item.createDateTime, 10)
if (isNotMhrSubmittingParty && !isRoleStaffReg.value && !isRecentSbcFiling) {
return 'Documents are only available to the Submitting Party of this filing. To view the details of this' +
' registration you must conduct a search.'
}
const isVerificationStatement = !item.registeringName && props.isPpr
if (isVerificationStatement) {
return 'Verification Statements are only available to Secured Parties or the Registering Party of this ' +
'filing. To view the details of this registration you must conduct a search.'
}
return 'This document PDF is still being generated. Click the ' +
'<i class="v-icon notranslate mdi mdi-information-outline" style="font-size:18px; margin-bottom:4px;"></i>' +
' icon to see if your PDF is ready to download. <br>' +
'Note: Large documents may take up to 20 minutes to generate.'
};
const downloadPDF = async (item: RegistrationSummaryIF): Promise<any> => {
localState.loadingPDF = item.path
Expand Down Expand Up @@ -994,8 +1007,9 @@ export default defineComponent({
}
// Mhr Handling
} else if (
(item.submittingParty?.toUpperCase() === getAccountLabel.value?.toUpperCase()) || isRoleStaffReg.value
) {
(item.submittingParty?.toUpperCase() === getAccountLabel.value?.toUpperCase()) || isRoleStaffReg.value ||
isRoleStaffSbc.value && isWithinMinutes(item.createDateTime, 10)
) {
const resp = await getMHRegistrationSummary(item.baseRegistrationNumber, true)
if (resp.error) {
// log error, but otherwise ignore it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export interface RegistrationSummaryIF {
lastUpdateDateTime?: string // Included in a successful response. Timestamp of last draft update.
new?: boolean // used to prevent the collapse of a newly added base reg
path: string
legacy?: boolean // Flag indicating if filing was completed in the legacy system
registeringName?: string
registeringParty: string
registrationDescription?: string // Returned on creation.
Expand Down
2 changes: 1 addition & 1 deletion ppr-ui/src/utils/auth-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export async function getRegisteringPartyFromAuth (): Promise<PartyIF> {
).catch(
error => {
throw new Error('Auth API error getting Registering Party: status code = ' +
error?.response?.status?.toString() || StatusCodes.NOT_FOUND.toString())
error?.response?.status?.toString() || StatusCodes?.NOT_FOUND.toString())
}
)
}
Expand Down
23 changes: 22 additions & 1 deletion ppr-ui/src/utils/date-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ export function dateToPacificDate (date: Date, longMonth = false, showWeekday =
return dateStr
}


/**
* Transforms a date string from "YYYY/MM/DD" to "YYYY-MM-DD" format.
* Useful for modern versions of safari where date functions can return non-iso formats
Expand Down Expand Up @@ -232,3 +231,25 @@ export const calendarDates = {
endOfYear: localTodayDate(new Date(new Date().getFullYear(), 11, 31)),
startOfNextYear: localTodayDate(new Date(new Date().getFullYear() + 1, 0, 1))
}

/**
* Checks if the provided date and time is within a specified minute differential
* compared to the current system time.
*
* @param {string} createDateTime - The date and time to compare in ISO 8601 format.
* @param {number} minuteDifferential - The maximum allowed difference in minutes.
* @returns {boolean} Returns true if the provided date and time is within the specified minute differential, otherwise false.
*/
export const isWithinMinutes = (createDateTime: string, minuteDifferential: number) => {
// Convert the provided createDateTime to a Date object
const createTime: Date = new Date(createDateTime)

// Calculate the difference in milliseconds between the createDateTime and current system time
const timeDifference: number = new Date().getTime() - createTime.getTime()

// Convert the time difference from milliseconds to minutes
const minutesDifference: number = Math.abs(timeDifference / (1000 * 60))

// Check if the time difference is within the specified minute differential
return minutesDifference <= minuteDifferential
}
9 changes: 9 additions & 0 deletions ppr-ui/src/views/mhrInformation/MhrInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@
:transferType="isChangeLocationActive
? getUiFeeSummaryLocationType(transportPermitLocationType)
: getUiTransferType()"
:setIsLoading="submitBtnLoading"
data-test-id="fee-summary"
@cancel="goToDashboard()"
@back="isReviewMode = false"
Expand Down Expand Up @@ -812,6 +813,7 @@ export default defineComponent({
enableRoleBasedTransfer: true, // rendering of the transfer/change btn
disableRoleBaseTransfer: false, // disabled state of transfer/change btn
disableRoleBaseLocationChange: false, // disabled state of location change/transport permit btn
submitBtnLoading: false,
// Transport Permit
showCancelTransportPermitDialog: false,
Expand Down Expand Up @@ -1064,6 +1066,8 @@ export default defineComponent({
// If already in review mode, file the transfer
if (localState.isReviewMode) {
localState.submitBtnLoading = true
// Verify no lien exists prior to submitting filing
const regSum = !localState.hasLienInfoDisplayed
? await getMHRegistrationSummary(getMhrInformation.value.mhrNumber, false)
Expand All @@ -1073,12 +1077,14 @@ export default defineComponent({
await setLienType(regSum.lienRegistrationType)
await scrollToFirstError(true)
localState.hasLienInfoDisplayed = true
localState.submitBtnLoading = false
return
}
// Check if any required fields have errors
if (localState.isReviewMode && !isValidTransferReview.value) {
await scrollToFirstError(false)
localState.submitBtnLoading = false
return
}
Expand Down Expand Up @@ -1110,6 +1116,7 @@ export default defineComponent({
}
localState.loading = false
localState.submitBtnLoading = false
return
}
Expand All @@ -1133,6 +1140,7 @@ export default defineComponent({
emitError(transportPermitFilingResp?.error)
}
localState.loading = false
localState.submitBtnLoading = false
return
}
Expand Down Expand Up @@ -1173,6 +1181,7 @@ export default defineComponent({
} else goToDashboard()
} else emitError(mhrTransferFiling?.error)
localState.loading = false
localState.submitBtnLoading = false
}
// If Transfer or Transport Permit is valid, enter review mode
Expand Down

0 comments on commit e6c4d24

Please sign in to comment.