feat: เรียกใช้ ProfileUplode
This commit is contained in:
parent
3d336eed58
commit
f4d7d43ba6
1 changed files with 111 additions and 14 deletions
|
|
@ -1,14 +1,54 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
import SelectorList from 'components/SelectorList.vue';
|
import SelectorList from 'components/SelectorList.vue';
|
||||||
import StatCardComponent from 'components/StatCardComponent.vue';
|
import StatCardComponent from 'components/StatCardComponent.vue';
|
||||||
import TooltipComponent from 'components/TooltipComponent.vue';
|
import TooltipComponent from 'components/TooltipComponent.vue';
|
||||||
import AddButton from 'components/AddButton.vue';
|
import AddButton from 'components/AddButton.vue';
|
||||||
import AppBox from 'components/app/AppBox.vue';
|
import AppBox from 'components/app/AppBox.vue';
|
||||||
|
import ItemCard from 'src/components/ItemCard.vue';
|
||||||
|
import FormDialog from 'src/components/FormDialog.vue';
|
||||||
|
import ProfileUpload from 'src/components/ProfileUpload.vue';
|
||||||
|
|
||||||
const costomerStats = [
|
const statusToggle = ref<boolean>(false);
|
||||||
|
const profileSubmit = ref<boolean>(false);
|
||||||
|
const profileFile = ref<File | undefined>(undefined);
|
||||||
|
const profileUrl = ref<string | null>('');
|
||||||
|
|
||||||
|
const inputFile = (() => {
|
||||||
|
const element = document.createElement('input');
|
||||||
|
element.type = 'file';
|
||||||
|
element.accept = 'image/*';
|
||||||
|
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.addEventListener('load', () => {
|
||||||
|
if (typeof reader.result === 'string') profileUrl.value = reader.result;
|
||||||
|
});
|
||||||
|
|
||||||
|
element.addEventListener('change', () => {
|
||||||
|
profileFile.value = element.files?.[0];
|
||||||
|
if (profileFile.value) {
|
||||||
|
reader.readAsDataURL(profileFile.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return element;
|
||||||
|
})();
|
||||||
|
|
||||||
|
const itemCard = [
|
||||||
|
{
|
||||||
|
icon: 'mdi:office-building',
|
||||||
|
text: 'customerLegalEntity',
|
||||||
|
color: 'var(--purple-8)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'heroicons:user-solid',
|
||||||
|
text: 'customerNaturalPerson',
|
||||||
|
color: 'var(--green-9)',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const customerStats = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
count: 2,
|
count: 2,
|
||||||
|
|
@ -24,17 +64,38 @@ const costomerStats = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const dialogCustomerType = ref<boolean>(false);
|
||||||
|
const dialogInputForm = ref<boolean>(false);
|
||||||
|
|
||||||
const selectorLabel = ref<string>('');
|
const selectorLabel = ref<string>('');
|
||||||
const selectorList = computed(() => [
|
const selectorList = computed(() => [
|
||||||
{ label: 'EMPLOYER', count: 0 },
|
{ label: 'EMPLOYER', count: 0 },
|
||||||
{ label: 'WORKER', count: 0 },
|
{ label: 'WORKER', count: 0 },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const customerType = ref<'customerLegalEntity' | 'customerNaturalPerson'>(
|
||||||
|
'customerLegalEntity',
|
||||||
|
);
|
||||||
|
|
||||||
|
function triggerCreate(type: 'customerLegalEntity' | 'customerNaturalPerson') {
|
||||||
|
customerType.value = type;
|
||||||
|
openDialogInputForm();
|
||||||
|
dialogCustomerType.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function openDialogCustomerType() {
|
||||||
|
dialogCustomerType.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function openDialogInputForm() {
|
||||||
|
dialogInputForm.value = true;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="column q-pb-lg">
|
<div class="column q-pb-lg">
|
||||||
<div class="text-h6 text-weight-bold q-mb-md">
|
<div class="text-h6 text-weight-bold q-mb-md">
|
||||||
{{ $t('costomerManagement') }}
|
{{ $t('customerManagement') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row full-width q-mb-md no-wrap">
|
<div class="row full-width q-mb-md no-wrap">
|
||||||
|
|
@ -47,13 +108,13 @@ const selectorList = computed(() => [
|
||||||
<!-- stat -->
|
<!-- stat -->
|
||||||
<AppBox bordered class="column full-width">
|
<AppBox bordered class="column full-width">
|
||||||
<div class="text-weight-bold text-subtitle1">
|
<div class="text-weight-bold text-subtitle1">
|
||||||
{{ $t('costomerStatTitle') }}
|
{{ $t('customerStatTitle') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="row full-width q-py-md" style="overflow-x: auto">
|
<div class="row full-width q-py-md" style="overflow-x: auto">
|
||||||
<StatCardComponent
|
<StatCardComponent
|
||||||
v-if="costomerStats"
|
v-if="customerStats"
|
||||||
:branch="
|
:branch="
|
||||||
costomerStats.map((v) => ({
|
customerStats.map((v) => ({
|
||||||
count: v.count,
|
count: v.count,
|
||||||
label: $i18n.locale === 'en-US' ? v.nameEN : v.name,
|
label: $i18n.locale === 'en-US' ? v.nameEN : v.name,
|
||||||
}))
|
}))
|
||||||
|
|
@ -70,8 +131,8 @@ const selectorList = computed(() => [
|
||||||
<div class="col-1 self-end">
|
<div class="col-1 self-end">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<TooltipComponent
|
<TooltipComponent
|
||||||
title="costomerTooltipTitle"
|
title="customerTooltipTitle"
|
||||||
caption="costomerTooltipCaption"
|
caption="customerTooltipCaption"
|
||||||
imgSrc="personnel-table-"
|
imgSrc="personnel-table-"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -82,17 +143,53 @@ const selectorList = computed(() => [
|
||||||
style="display: flex; flex-grow: 1; align-items: center"
|
style="display: flex; flex-grow: 1; align-items: center"
|
||||||
>
|
>
|
||||||
<AddButton
|
<AddButton
|
||||||
:label="'costomerAdd'"
|
:label="'customerAdd'"
|
||||||
:cyanOn="true"
|
:cyanOn="true"
|
||||||
@trigger="
|
@trigger="openDialogCustomerType()"
|
||||||
() => {
|
|
||||||
console.log('add');
|
|
||||||
}
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</AppBox>
|
</AppBox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<FormDialog
|
||||||
|
v-model:modal="dialogCustomerType"
|
||||||
|
:title="$t('customerCardUserType')"
|
||||||
|
no-footer
|
||||||
|
no-app-box
|
||||||
|
:max-width="80"
|
||||||
|
>
|
||||||
|
<template #body>
|
||||||
|
<div class="row q-gutter-xl q-pa-sm">
|
||||||
|
<ItemCard
|
||||||
|
v-for="i in itemCard"
|
||||||
|
:key="i.text"
|
||||||
|
:icon="i.icon"
|
||||||
|
:text="i.text"
|
||||||
|
:color="i.color"
|
||||||
|
@trigger="
|
||||||
|
() => {
|
||||||
|
triggerCreate(
|
||||||
|
i.text as 'customerLegalEntity' | 'customerNaturalPerson',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</FormDialog>
|
||||||
|
|
||||||
|
<FormDialog v-model:modal="dialogInputForm" :title="`test`">
|
||||||
|
<template #prepend>
|
||||||
|
<ProfileUpload
|
||||||
|
v-model:url-profile="profileUrl"
|
||||||
|
v-model:status-toggle="statusToggle"
|
||||||
|
v-model:profile-submit="profileSubmit"
|
||||||
|
@input-file="inputFile.click()"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #information>asdasdsa</template>
|
||||||
|
</FormDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue