-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard): split dialog and form of container creation
- Loading branch information
1 parent
3093b82
commit 6428a17
Showing
5 changed files
with
104 additions
and
53 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
78 changes: 78 additions & 0 deletions
78
apps/dashboard/src/components/container/ContainerActionForm.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,78 @@ | ||
<template> | ||
<form id="createForm" class="flex flex-column gap-3"> | ||
<div class="flex flex-row flex-wrap justify-content-between align-items-center"> | ||
<label for="name" class="mr-8">{{ $t('c_productContainerOperations.Name') }}</label> | ||
<div class="relative"> | ||
<InputText id="name" class="w-18rem" v-model="form.model.name.value.value" | ||
type="text" v-bind="form.model.name.attr.value"/> | ||
<error-span :error="form.context.errors.value.name"/> | ||
</div> | ||
</div> | ||
<div class="flex flex-row flex-wrap justify-content-between align-items-center"> | ||
<label for="owner" class="mr-8"> | ||
{{ $t('c_POSCreate.Owner') }} | ||
<i class="pi pi-exclamation-circle text-red-500 cursor-pointer" | ||
v-tooltip.top="$t('tooltip.owner_revenue')"/> | ||
</label> | ||
<div class="flex flex-column flex-end relative"> | ||
<div v-if="state.create"> | ||
<Dropdown :placeholder="$t('c_POSCreate.Select owner')" :options="organs" optionLabel="firstName" | ||
v-model="form.model.owner.value.value" class="w-18rem" id="owner" | ||
v-bind="form.model.owner.attr.value"/> | ||
<error-span :error="form.context.errors.value.owner"/> | ||
</div> | ||
<div v-else-if="container"> | ||
<p class="my-0">{{ container.owner.firstName + ' ' + container.owner.lastName }}</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="flex flex-row flex-wrap justify-content-between align-items-center"> | ||
<label for="name" class="mr-8">{{ $t('c_containerEditModal.Public') }}</label> | ||
<div class="relative"> | ||
<Checkbox v-model="form.model.public.value.value" v-bind="form.model.public.attr.value" | ||
inputId="publicContainer" | ||
name="public" value="public" :binary="true"/> | ||
<error-span :error="form.context.errors.value.public"/> | ||
</div> | ||
</div> | ||
</form> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { type Form } from "@/utils/formUtil"; | ||
import { createContainerSpec } from "@/utils/validation-schema"; | ||
import InputText from "primevue/inputtext"; | ||
import ErrorSpan from "@/components/ErrorSpan.vue"; | ||
import Dropdown from "primevue/dropdown"; | ||
import { computed, type PropType, ref, type Ref } from "vue"; | ||
import type { ContainerWithProductsResponse } from "@sudosos/sudosos-client"; | ||
import { useI18n } from "vue-i18n"; | ||
import { useAuthStore } from "@sudosos/sudosos-frontend-common"; | ||
import { storeToRefs } from "pinia"; | ||
const { t } = useI18n(); | ||
const props = defineProps({ | ||
form: { | ||
type: Object as Form<typeof createContainerSpec>, | ||
required: true, | ||
}, | ||
container: { | ||
type: Object as PropType<ContainerWithProductsResponse>, | ||
required: false, | ||
}, | ||
}); | ||
const { organs } = storeToRefs(useAuthStore()); | ||
const state = computed(() => { | ||
return { | ||
create: props.container == undefined, | ||
edit: props.container != undefined, | ||
}; | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
</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
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