-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
21570 - Display CAS supplier number and email address for a short name (
- Loading branch information
1 parent
9078259
commit 6855847
Showing
6 changed files
with
339 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
196 changes: 196 additions & 0 deletions
196
auth-web/src/components/pay/eft/ShortNameFinancialDialog.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
<template> | ||
<div | ||
id="short-name-financial-dialog" | ||
> | ||
<ModalDialog | ||
ref="modalDialog" | ||
max-width="720" | ||
:show-icon="false" | ||
:showCloseIcon="true" | ||
dialog-class="lookup-dialog" | ||
:title="dialogTitle()" | ||
@close-dialog="resetAccountLinkingDialog" | ||
> | ||
<template #text> | ||
<p v-if="isDialogTypeEmail"> | ||
Enter the contact email provided in the client's Direct Deposit Application form | ||
</p> | ||
<p v-if="isDialogTypeCasSupplierNumber"> | ||
Enter the supplier number created in CAS for this short name | ||
</p> | ||
<v-text-field | ||
v-if="isDialogTypeEmail" | ||
v-model="email" | ||
filled | ||
label="Email Address" | ||
persistent-hint | ||
/> | ||
<v-text-field | ||
v-if="isDialogTypeCasSupplierNumber" | ||
v-model="casSupplierNumber" | ||
filled | ||
label="CAS Supplier Number" | ||
persistent-hint | ||
/> | ||
</template> | ||
<template #actions> | ||
<div class="d-flex align-center justify-center w-100 h-100 ga-3"> | ||
<v-btn | ||
large | ||
outlined | ||
color="outlined" | ||
data-test="dialog-ok-button" | ||
@click="cancelAndResetAccountLinkingDialog()" | ||
> | ||
Cancel | ||
</v-btn> | ||
<v-btn | ||
large | ||
color="primary" | ||
data-test="dialog-ok-button" | ||
@click="patchShortName()" | ||
> | ||
Save | ||
</v-btn> | ||
</div> | ||
</template> | ||
</ModalDialog> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
import { Ref, computed, defineComponent, reactive, ref, toRefs, watch } from '@vue/composition-api' | ||
import { EFTShortnameResponse } from '@/models/eft-transaction' | ||
import ModalDialog from '@/components/auth/common/ModalDialog.vue' | ||
import PaymentService from '@/services/payment.services' | ||
export default defineComponent({ | ||
name: 'ShortNameFinancialDialog', | ||
components: { ModalDialog }, | ||
props: { | ||
isShortNameFinancialDialogOpen: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
shortName: { | ||
default: {} | ||
}, | ||
shortNameFinancialDialogType: { | ||
type: String, | ||
default: '' | ||
} | ||
}, | ||
emits: ['on-patch', 'close-short-name-email-dialog'], | ||
setup (props, { emit }) { | ||
const modalDialog: Ref<InstanceType<typeof ModalDialog>> = ref(null) | ||
const accountLinkingErrorDialog: Ref<InstanceType<typeof ModalDialog>> = ref(null) | ||
const state = reactive<any>({ | ||
email: '', | ||
casSupplierNumber: '', | ||
isDialogTypeEmail: computed(() => props.shortNameFinancialDialogType === 'EMAIL'), | ||
isDialogTypeCasSupplierNumber: computed(() => props.shortNameFinancialDialogType === 'CAS_SUPPLIER_NUMBER') | ||
}) | ||
function openAccountLinkingDialog (item: EFTShortnameResponse, dialogType) { | ||
state.shortName = item | ||
if (dialogType === 'EMAIL') { | ||
state.email = state.shortName.email | ||
} else if (dialogType === 'CAS_SUPPLIER_NUMBER') { | ||
state.casSupplierNumber = state.shortName.casSupplierNumber | ||
} | ||
modalDialog.value.open() | ||
} | ||
function dialogTitle () { | ||
if (state.isDialogTypeEmail) { | ||
return 'Email' | ||
} else if (state.isDialogTypeCasSupplierNumber) { | ||
return 'CAS Supplier Number' | ||
} | ||
} | ||
function resetAccountLinkingDialog () { | ||
state.email = '' | ||
state.casSupplierNumber = '' | ||
emit('close-short-name-email-dialog') | ||
} | ||
function cancelAndResetAccountLinkingDialog () { | ||
modalDialog.value.close() | ||
resetAccountLinkingDialog() | ||
} | ||
async function patchShortName () { | ||
if (state.isDialogTypeEmail) { | ||
await PaymentService.patchEFTShortName(state.shortName.id, { email: state.email }) | ||
} else if (state.isDialogTypeCasSupplierNumber) { | ||
await PaymentService.patchEFTShortName(state.shortName.id, { casSupplierNumber: state.casSupplierNumber }) | ||
} | ||
emit('on-patch') | ||
cancelAndResetAccountLinkingDialog() | ||
} | ||
watch(() => props.isShortNameFinancialDialogOpen, (shortNameNewValue) => { | ||
if (shortNameNewValue && props.shortName) { | ||
openAccountLinkingDialog(props.shortName, props.shortNameFinancialDialogType) | ||
} | ||
}) | ||
return { | ||
...toRefs(state), | ||
modalDialog, | ||
accountLinkingErrorDialog, | ||
openAccountLinkingDialog, | ||
resetAccountLinkingDialog, | ||
cancelAndResetAccountLinkingDialog, | ||
patchShortName, | ||
dialogTitle | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import '@/assets/scss/theme.scss'; | ||
@import '@/assets/scss/actions.scss'; | ||
@import '@/assets/scss/ShortnameTables.scss'; | ||
.actions-dropdown_item { | ||
cursor: pointer; | ||
padding: 0.5rem 1rem; | ||
&:hover { | ||
background-color: $gray1; | ||
color: $app-blue !important; | ||
} | ||
} | ||
h4 { | ||
color: black; | ||
} | ||
.important { | ||
background-color: #fff7e3; | ||
border: 2px solid #fcba19; | ||
color: #495057; | ||
font-size: 14px; | ||
} | ||
.w-100 { | ||
width: 100%; | ||
} | ||
.h-100 { | ||
height: 100%; | ||
} | ||
.ga-3 { | ||
gap: 12px; | ||
} | ||
::v-deep { | ||
.v-btn.v-btn--outlined { | ||
border-color: var(--v-primary-base); | ||
color: var(--v-primary-base); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.