-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard/components): added FormSection component
feat(dashboard/user-profile): removed dialog for changing pin, added form section for changing pin
- Loading branch information
1 parent
5764a5d
commit 4e6c8f3
Showing
3 changed files
with
104 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<template> | ||
<div class="flex flex-column gap-2"> | ||
<div class="flex flex-row align-items-center"> | ||
<h4 class="flex-grow-1">{{ header }}</h4> | ||
<div class="flex flex-row "> | ||
<Button v-if="simpleSave" icon="pi pi-save" class="my-0" @click="toggleEdit(true)" label="Save" ></Button> | ||
<Button v-else-if="!edit" icon="pi pi-pencil" class="my-0" @click="toggleEdit(true)" label="Edit" ></Button> | ||
<div v-else class="flex flex-row gap-2"> | ||
<Button icon ="pi pi-check" class="my-0" @click="handleSave" /> | ||
<Button icon="pi pi-times" class="my-0" @click="cancel" /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<slot :edit="edit" /> | ||
<Divider class="w-full" v-if="divider" /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import {onMounted, ref} from "vue"; | ||
import Divider from "primevue/divider"; | ||
import Button from "primevue/button"; | ||
const props = defineProps({ | ||
header: { | ||
type: String, | ||
required: true | ||
}, | ||
enableEdit: { | ||
type: Boolean, | ||
required: false, | ||
default: false, | ||
}, | ||
modelValue: { | ||
type: Boolean, | ||
required: false, | ||
}, | ||
divider: { | ||
type: Boolean, | ||
required: false, | ||
default: false, | ||
}, | ||
simpleSave: { | ||
type: Boolean, | ||
required: false, | ||
default: false, | ||
} | ||
}); | ||
const emit = defineEmits(['update:modelValue', 'save', 'cancel']); | ||
const edit = ref(props.modelValue); | ||
const toggleEdit = (value: boolean) => { | ||
edit.value = value; | ||
emit('update:modelValue', value); | ||
}; | ||
const cancel = () => { | ||
emit('cancel'); | ||
toggleEdit(false); | ||
}; | ||
const handleSave = () => { | ||
emit('save'); | ||
toggleEdit(false); | ||
}; | ||
onMounted(() => { | ||
if (props.simpleSave) { | ||
toggleEdit(true); | ||
} | ||
}); | ||
</script> | ||
|
||
<style scoped> | ||
</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