Skip to content

Commit

Permalink
fix fossasia#59 fossasia#53 implement APIs for search and logout func…
Browse files Browse the repository at this point in the history
…tions (fossasia#60)

* Add Home, Room Check-in

* fixed codacy

* clear netlify build

* Update SearchAttendee.vue

* Update ScanSearch

* Fixed navabr

* Update BaseTemplate.vue

* Removed bottom navbar and updated dropdown menu

* Minor fixes

* Added checklist to printModal and simplified router

* Name changes

* Fixed passwordModal and removed password requirement for stats

* Switched to template refs

* minor fixes

* Rearranged and renamed

* Fix codacy issues

* Changed casing

* Fix fossasia#31 Added dropdown list that allows user to choose which details to show on search

* Fixed format

* Fix codacy

* Minor fixes and renaming

* Minor fixes and moved some code to inline

* Fix fossasia#41 and codacy

* fix codacy

* Simplified code

* fix fossasia#48 created standard button component and replaced some buttons

* fix format

* Converted all buttons to standard component

* fixed format

* fix codacy

* Fix fossasia#40 standardised all p-6 except pages with scanners, optimised search function for mobile

* changed prop name

* removed activated classes

* Minor UI fixes

* fix fossasia#52 clicking print on search attendee now opens the print modal and logs name of card

* fix fossasia#51 new layout for print modal

* changed to margin

* removed grow flex

* minor fixes

* fix fossasia#50 created success notification that shows on print

* removed redundant code

* fix  margin of print modal

* changed naming

* switched to camel case, moved some functions to inline

* minor changes

* changed some refs to computed

* fix fossasia#49 fossasia#46 ported everything to stores

* fix codacy

* fix fossasia#59 fossasia#53 search and logout attached to respective APIs

* fix netlify

* fix netlify

* fix netlify

* fix codacy

* fix codacy

* fix codacy

* fix build

* fix codacy

* fix codacy

---------

Co-authored-by: cweitat <[email protected]>
Co-authored-by: lizardon <[email protected]>
  • Loading branch information
3 people committed Jul 29, 2023
1 parent dbc5cd3 commit fe35c97
Show file tree
Hide file tree
Showing 13 changed files with 416 additions and 143 deletions.
6 changes: 4 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import LoadingView from '@/components/Utilities/LoadingView.vue'
</script>

<template>
<RouterView class="m-6 h-screen" />
<LoadingView v-if="useLoadingStore().show"></LoadingView>
<div>
<RouterView />
<LoadingView v-if="useLoadingStore().show"></LoadingView>
</div>
</template>
2 changes: 1 addition & 1 deletion src/components/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function submitLogin() {
</script>

<template>
<div class="flex flex-1 flex-col justify-center my-auto">
<div class="flex flex-1 flex-col justify-center my-auto h-screen">
<div class="sm:mx-auto sm:w-full sm:max-w-sm">
<h2 class="text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">
Sign in to your account
Expand Down
51 changes: 36 additions & 15 deletions src/components/Modals/PasswordModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import { ref } from 'vue'
import { Dialog, DialogPanel, DialogTitle, TransitionChild, TransitionRoot } from '@headlessui/vue'
import { EllipsisHorizontalIcon } from '@heroicons/vue/24/outline'
import StandardButton from '@/components/Shared/StandardButton.vue'
import { usePasswordModalStore } from '@/stores/passwordModal'
import { useAuthStore } from '@/stores/auth'
import { useLoadingStore } from '@/stores/loading'
import { useRouter } from 'vue-router'
const passwordModalStore = usePasswordModalStore()
const authStore = useAuthStore()
const loadingStore = useLoadingStore()
const router = useRouter()
const props = defineProps({
showPasswordModal: Boolean
Expand All @@ -15,18 +20,30 @@ const emit = defineEmits(['hidePasswordModal'])
const passwordField = ref('')
const validPassword = ref(null)
const disableButton = ref(false)
async function checkPassword() {
disableButton.value = true
loadingStore.show = true
const payload = { password: passwordField.value }
const checkPassword = (value) => {
// check password here
if (value === passwordModalStore.password) {
validPassword.value = true
emit('hidePasswordModal', false)
passwordField.value = ''
// sign out
} else {
validPassword.value = false
passwordField.value = ''
}
await authStore.login(payload, 'auth/verify-password').then((res) => { //verify password
if (res.result) {
authStore.logout('auth/logout').then((res) => console.log(res)) // post logout api and clear local storage
validPassword.value = true
emit('hidePasswordModal', false)
// sign out
router.push({
name: 'userAuth'
})
loadingStore.show = false
} else {
loadingStore.show = false
disableButton.value = false
validPassword.value = false
passwordField.value = ''
}
})
}
</script>

Expand Down Expand Up @@ -96,8 +113,12 @@ const checkPassword = (value) => {
<div class="mt-5 sm:mt-6">
<StandardButton
text="Sign Out"
class="bg-blue-600 text-white hover:bg-blue-500 w-full justify-center"
@click="checkPassword(passwordField)"
:disabled="disableButton"
:class="[
disableButton && 'cursor-not-allowed opacity-20',
'bg-blue-600 text-white hover:bg-blue-500 w-full justify-center'
]"
@click="checkPassword()"
/>
</div>
</DialogPanel>
Expand Down
10 changes: 7 additions & 3 deletions src/components/Modals/PrintModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const emit = defineEmits(['hideModal', 'print'])
const disableButton = ref(false)
const printingText = ref(false)
const titleText = computed(() => props.validQRCode ? 'Select items to print' : 'Error!')
const messageText = computed(() => !props.validQRCode ? 'Please scan a valid QR code' : '')
const titleText = computed(() => (props.validQRCode ? 'Select items to print' : 'Error!'))
const messageText = computed(() => (!props.validQRCode ? 'Please scan a valid QR code' : ''))
const printDelay = (delayHideModal, delayPrint) => {
setTimeout(() => emit('hideModal'), delayHideModal)
Expand Down Expand Up @@ -122,8 +122,12 @@ const print = () => {
</div>
<!--Select all button-->
<StandardButton
:text="
printModalStore.selectedOptions.length === 5
? 'Deselect All'
: 'Select All'
"
:disabled="disableButton"
:text="printModalStore.selectedOptions.length === 5 ? 'Deselect All' : 'Select All'"
:class="[
disableButton
? 'cursor-not-allowed opacity-20'
Expand Down
9 changes: 8 additions & 1 deletion src/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ const userNavigation = [
const showNavigation = ref(false)
const eventName = ref('test event')
const showPasswordModal = ref(false)
const componentKey = ref(0)
</script>

<template>
<PasswordModal
:key="componentKey"
:show-password-modal="showPasswordModal"
@hidePasswordModal="showPasswordModal = $event"
@hide-password-modal="
() => {
showPasswordModal = $event
componentKey += 1
}
"
/>
<Disclosure v-slot="{ open }" as="header" class="bg-white shadow sticky top-0 z-20">
<div class="mx-auto max-w-7xl px-2 sm:px-4 lg:divide-y lg:divide-gray-200 lg:px-8">
Expand Down
12 changes: 11 additions & 1 deletion src/components/Registration/Manual/SearchAttendee.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { ref } from 'vue'
import { ref, watch } from 'vue'
import { XCircleIcon, PrinterIcon, MagnifyingGlassIcon } from '@heroicons/vue/20/solid'
import { FunnelIcon } from '@heroicons/vue/24/outline'
Expand All @@ -12,6 +12,16 @@ const emit = defineEmits(['print'])
const menuOpen = ref(false)
const query = ref('')
watch(query, (value) => {
if (value.includes('@')) {
searchAttendeeStore.getAttendee('', value) // is an email
} else if (value == '') {
searchAttendeeStore.clearAttendees()
} else {
searchAttendeeStore.getAttendee(value, '') // is a name
}
})
</script>

<template>
Expand Down
Loading

0 comments on commit fe35c97

Please sign in to comment.