-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #892 from bcgov/gurj/refresh-pw
feat: refresh password
- Loading branch information
Showing
10 changed files
with
253 additions
and
9 deletions.
There are no files selected for viewing
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
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
63 changes: 63 additions & 0 deletions
63
services/tenant-ui/frontend/src/components/innkeeper/reservation/RefreshPassword.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,63 @@ | ||
<template> | ||
<Button | ||
:label="$t('reservations.refreshPassword')" | ||
class="p-button-rounded p-button-text" | ||
icon="pi pi-refresh" | ||
@click="refresh" | ||
/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
import { useI18n } from 'vue-i18n'; | ||
import Button from 'primevue/button'; | ||
import { useToast } from 'vue-toastification'; | ||
import { useInnkeeperTenantsStore } from '@/store'; | ||
import { useConfigStore } from '@/store'; | ||
import { storeToRefs } from 'pinia'; | ||
const { config } = storeToRefs(useConfigStore()); | ||
const innkeeperTenantsStore = useInnkeeperTenantsStore(); | ||
const toast = useToast(); | ||
const { t } = useI18n(); | ||
const props = defineProps({ | ||
id: { | ||
type: String, | ||
required: true, | ||
}, | ||
email: { | ||
type: String, | ||
required: true, | ||
}, | ||
}); | ||
const emit = defineEmits(['success']); | ||
const displayModal = ref(false); | ||
const reason = ref(''); | ||
const refresh = async () => { | ||
try { | ||
const res = await innkeeperTenantsStore.refreshCheckInPassword( | ||
props.id, | ||
props.email, | ||
{ | ||
state_notes: reason.value, | ||
} | ||
); | ||
if (config.value.frontend.showInnkeeperReservationPassword) { | ||
// Have to handle the dialog up a level or it deletes when the rows re-draw after reload | ||
emit('success', res.reservation_pwd, props.email); | ||
toast.success(t('reservations.approved.toast', { email: props.email })); | ||
} else { | ||
toast.success(t('reservations.approved.text', { email: props.email })); | ||
} | ||
} catch (error) { | ||
toast.error(`Failure: ${error}`); | ||
} finally { | ||
innkeeperTenantsStore.listReservations(); | ||
} | ||
}; | ||
</script> |
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
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
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.