Skip to content

Commit

Permalink
24648 - contact_centre_staff role fixes (#3210)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-barraza authored Jan 21, 2025
1 parent 10a99d7 commit 0decdb9
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 23 deletions.
73 changes: 50 additions & 23 deletions auth-web/src/components/auth/common/ProductTOS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</p>
</div>
<v-checkbox
v-if="canAcceptTos"
v-model="termsAccepted"
v-can:EDIT_USER.disabled
color="primary"
class="terms-checkbox align-checkbox-label--top ma-0 pa-0"
hide-details
Expand Down Expand Up @@ -39,34 +39,61 @@
</template>

<script lang="ts">
import { Component, Emit, Prop, Vue, Watch } from 'vue-property-decorator'
import { computed, defineComponent, onMounted, reactive, toRefs, watch } from '@vue/composition-api'
import { Role } from '@/util/constants'
import { useUserStore } from '@/stores/user'
@Component({})
export default class ProductTOS extends Vue {
@Prop({ default: '' }) userName: string
@Prop({ default: '' }) orgName: string
@Prop({ default: false }) isTOSAlreadyAccepted: boolean
@Prop({ default: false }) isApprovalFlow: boolean
termsAccepted: boolean = false
public istosTouched: boolean = false
export default defineComponent({
name: 'ProductTOS',
props: {
userName: {
type: String,
default: ''
},
orgName: {
type: String,
default: ''
},
isTOSAlreadyAccepted: {
type: Boolean,
default: false
},
isApprovalFlow: {
type: Boolean,
default: false
}
},
emits: ['tos-status-changed'],
setup (props, { emit }) {
const userStore = useUserStore()
const state = reactive({
termsAccepted: false,
istosTouched: false,
canAcceptTos: computed(() => !userStore?.currentUser?.roles.includes(Role.ContactCentreStaff))
})
watch(() => props.isTOSAlreadyAccepted, (newTos, oldTos) => {
if (newTos !== oldTos) {
state.termsAccepted = newTos
}
})
@Watch('isTOSAlreadyAccepted')
onisTOSALreadyAcceptedChange (newTos:boolean, oldTos:boolean) {
if (newTos !== oldTos) {
this.termsAccepted = newTos
const tosChanged = () => {
state.istosTouched = true
emit('tos-status-changed', state.termsAccepted)
return state.termsAccepted
}
}
public mounted () {
this.termsAccepted = this.isTOSAlreadyAccepted
}
onMounted(() => {
state.termsAccepted = props.isTOSAlreadyAccepted
})
@Emit('tos-status-changed')
public tosChanged () {
this.istosTouched = true
return this.termsAccepted
return {
...toRefs(state),
tosChanged
}
}
}
})
</script>

<style lang="scss" scoped>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
</v-col>
<v-col
v-if="accountUnderReview.accessType === AccessType.GOVN"
v-can:EDIT_USER.hide
cols="auto"
>
<v-btn
Expand Down
4 changes: 4 additions & 0 deletions auth-web/src/views/auth/staff/StaffDashboardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
no-gutters
>
<v-col
v-can:VIEW_LAUNCH_TITLES.hide
class="pr-2"
cols="6"
>
Expand Down Expand Up @@ -125,7 +126,9 @@
/>
</v-card>
</v-col>

<v-col
v-can:VIEW_LAUNCH_TITLES.hide
class="pl-2"
cols="6"
>
Expand Down Expand Up @@ -251,6 +254,7 @@
<!-- Email Safe List -->
<BaseVExpansionPanel
v-if="isDevOrTest"
v-can:VIEW_LAUNCH_TITLES.hide
info="Please contact #registries-ops to add or remove email addresses from the safe list."
title="Safe Email List (DEV/TEST)"
>
Expand Down

0 comments on commit 0decdb9

Please sign in to comment.