WIP Почти доделана форма создания клиента
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
:url="url",
|
:url="url",
|
||||||
:is-open-form="isOpenForm",
|
:is-open-form="isOpenForm",
|
||||||
:close-form="closeForm",
|
:close-form="closeForm",
|
||||||
|
:open-form="openForm",
|
||||||
:set-updated-clients="setUpdatedClients",
|
:set-updated-clients="setUpdatedClients",
|
||||||
:write-created-client-id="writeCreatedClientId"
|
:write-created-client-id="writeCreatedClientId"
|
||||||
)
|
)
|
||||||
@@ -38,13 +39,10 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openForm() {
|
openForm() {
|
||||||
console.log("before open", this.isOpenForm);
|
|
||||||
this.isOpenForm = true;
|
this.isOpenForm = true;
|
||||||
console.log("after open", this.isOpenForm);
|
|
||||||
},
|
},
|
||||||
closeForm() {
|
closeForm() {
|
||||||
this.isOpenForm = false;
|
this.isOpenForm = false;
|
||||||
console.log("close", this.isOpenForm);
|
|
||||||
},
|
},
|
||||||
setUpdatedClients() {
|
setUpdatedClients() {
|
||||||
if (this.$router.currentRoute._value.path === "/clients")
|
if (this.$router.currentRoute._value.path === "/clients")
|
||||||
@@ -59,14 +57,5 @@ export default {
|
|||||||
this.createdClientId = id;
|
this.createdClientId = id;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
isOpenForm: {
|
|
||||||
immediate: true,
|
|
||||||
deep: true,
|
|
||||||
handler(newValue, oldValue) {
|
|
||||||
console.log("layout", newValue, oldValue);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.header-wrapper.relative.flex.justify-center.box-border.py-2.pl-4_75px.pr-6
|
.header-wrapper.relative.flex.justify-center.box-border.py-2.pl-4_75px.pr-6
|
||||||
transition(name="form")
|
|
||||||
base-client-form-create(
|
|
||||||
v-if="isOpenForm",
|
|
||||||
:close-form="closeForm",
|
|
||||||
:set-updated-clients="setUpdatedClients",
|
|
||||||
:write-created-client-id="writeCreatedClientId",
|
|
||||||
)
|
|
||||||
.flex.items-center.box-border.cursor-pointer.mr-auto
|
.flex.items-center.box-border.cursor-pointer.mr-auto
|
||||||
img.logo-img.mr-29_25px(src="@/assets/images/logo.svg", alt="Logo")
|
img.logo-img.mr-29_25px(src="@/assets/images/logo.svg", alt="Logo")
|
||||||
header-inputs
|
header-inputs
|
||||||
@@ -15,7 +8,6 @@
|
|||||||
color="primary",
|
color="primary",
|
||||||
dense,
|
dense,
|
||||||
padding="4px 22px",
|
padding="4px 22px",
|
||||||
@click="openForm"
|
|
||||||
)
|
)
|
||||||
q-icon(
|
q-icon(
|
||||||
name="app:icon-plus",
|
name="app:icon-plus",
|
||||||
@@ -27,6 +19,14 @@
|
|||||||
size="18px",
|
size="18px",
|
||||||
style="margin-left: 4px"
|
style="margin-left: 4px"
|
||||||
)
|
)
|
||||||
|
q-menu(
|
||||||
|
v-model="isOpenFormInternal",
|
||||||
|
)
|
||||||
|
base-client-form-create(
|
||||||
|
v-model="isOpenFormInternal",
|
||||||
|
:set-updated-clients="setUpdatedClients",
|
||||||
|
:write-created-client-id="writeCreatedClientId",
|
||||||
|
)
|
||||||
q-btn.mr-8(
|
q-btn.mr-8(
|
||||||
flat,
|
flat,
|
||||||
dense,
|
dense,
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
padding="4px 8px"
|
padding="4px 8px"
|
||||||
icon="app:icon-bell",
|
icon="app:icon-bell",
|
||||||
size="18px",
|
size="18px",
|
||||||
round
|
round,
|
||||||
)
|
)
|
||||||
.flex.justify-centflexer.items-center.relative
|
.flex.justify-centflexer.items-center.relative
|
||||||
base-avatar.mr-2(:size="36", :color="userData?.color", v-if="!userData?.photo") {{changeName}}
|
base-avatar.mr-2(:size="36", :color="userData?.color", v-if="!userData?.photo") {{changeName}}
|
||||||
@@ -75,8 +75,8 @@ export default {
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
url: String,
|
url: String,
|
||||||
openForm: Function,
|
|
||||||
closeForm: Function,
|
closeForm: Function,
|
||||||
|
openForm: Function,
|
||||||
isOpenForm: Boolean,
|
isOpenForm: Boolean,
|
||||||
setUpdatedClients: Function,
|
setUpdatedClients: Function,
|
||||||
writeCreatedClientId: Function,
|
writeCreatedClientId: Function,
|
||||||
@@ -98,6 +98,15 @@ export default {
|
|||||||
this.userData?.first_name || ""
|
this.userData?.first_name || ""
|
||||||
} ${this.userData?.patronymic || ""}`;
|
} ${this.userData?.patronymic || ""}`;
|
||||||
},
|
},
|
||||||
|
isOpenFormInternal: {
|
||||||
|
get() {
|
||||||
|
return this.isOpenForm;
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
if (!val) this.closeForm();
|
||||||
|
else this.openForm();
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
logout() {
|
logout() {
|
||||||
|
|||||||
@@ -1,23 +1,19 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.wrapper-create.flex.flex-col.fixed.right-6.bottom-6.px-8.py-7.gap-y-8(
|
.wrapper-create.flex.flex-col.fixed.right-6.bottom-6.px-8.py-7.gap-y-8
|
||||||
v-click-outside="closeModal"
|
|
||||||
)
|
|
||||||
.icon-cancel.close.absolute.top-5.right-5.cursor-pointer(@click="closeForm")
|
.icon-cancel.close.absolute.top-5.right-5.cursor-pointer(@click="closeForm")
|
||||||
span.title.text-xl.font-bold Создание клиента
|
span.title.text-xl.font-bold Создание клиента
|
||||||
.flex.gap-x-4.h-fit
|
.flex.gap-x-4.h-fit
|
||||||
.flex.gap-x-3.w-full
|
.flex.gap-x-3.w-full
|
||||||
q-btn.relative(
|
q-btn(
|
||||||
color="secondary",
|
color="secondary",
|
||||||
text-color="primary",
|
text-color="primary",
|
||||||
v-for="img in image",
|
|
||||||
@click="changeOpenPopup",
|
|
||||||
style="width: 40px; height: 40px",
|
style="width: 40px; height: 40px",
|
||||||
rounded
|
rounded
|
||||||
no-caps
|
no-caps
|
||||||
padding="0 16px"
|
padding="0 16px"
|
||||||
)
|
)
|
||||||
q-icon(
|
q-icon(
|
||||||
v-if="img === defaultIcon"
|
v-if="image === defaultIcon"
|
||||||
name="app:icon-download",
|
name="app:icon-download",
|
||||||
)
|
)
|
||||||
q-avatar(
|
q-avatar(
|
||||||
@@ -25,14 +21,27 @@
|
|||||||
size="40px",
|
size="40px",
|
||||||
round
|
round
|
||||||
)
|
)
|
||||||
img(:src="img")
|
img(:src="image")
|
||||||
base-popup.right-5.top-7(v-if="showPopup", v-click-outside="closePopup", :width="230")
|
q-menu(
|
||||||
.flex.items-center.gap-x-2
|
anchor="bottom middle",
|
||||||
img(src="@/assets/icons/computer.svg")
|
self="top right",
|
||||||
span.text-smm(@click="changeOpenModal") Загрузить с компьютера
|
v-model="showPopup"
|
||||||
.flex.items-center.gap-x-2
|
)
|
||||||
img(src="@/assets/icons/camera.svg")
|
.flex.flex-col.p-4.gap-y-3
|
||||||
span.text-smm Сделать фото
|
.flex.items-center.gap-x-2.cursor-pointer(@click="changeOpenModal")
|
||||||
|
q-icon(
|
||||||
|
name="app:computer",
|
||||||
|
size="18px",
|
||||||
|
color="primary"
|
||||||
|
)
|
||||||
|
span.text-smm.title Загрузить с компьютера
|
||||||
|
.flex.items-center.gap-x-2.cursor-pointer
|
||||||
|
q-icon(
|
||||||
|
name="app:camera",
|
||||||
|
size="18px",
|
||||||
|
color="primary"
|
||||||
|
)
|
||||||
|
span.text-smm.title Сделать фото
|
||||||
base-modal(v-model="showModal", title="Загрузить изображение")
|
base-modal(v-model="showModal", title="Загрузить изображение")
|
||||||
.flex.flex-col.items-center.justify-center(
|
.flex.flex-col.items-center.justify-center(
|
||||||
:style="{padding: '153px 370px'}"
|
:style="{padding: '153px 370px'}"
|
||||||
@@ -43,10 +52,10 @@
|
|||||||
type="file",
|
type="file",
|
||||||
id="image-upload",
|
id="image-upload",
|
||||||
accept="image/*",
|
accept="image/*",
|
||||||
@change="(e) => previewImages(e)"
|
@change="(e) => previewImage(e)"
|
||||||
)
|
)
|
||||||
.avatar.flex.absolute.items-center.gap-x-6(v-for="img in image")
|
.avatar.flex.absolute.items-center.gap-x-6
|
||||||
img.avatar.object-cover(for="image-upload", :src="img", v-if="img")
|
img.avatar.object-cover(for="image-upload", :src="image", v-if="image")
|
||||||
q-btn(
|
q-btn(
|
||||||
round,
|
round,
|
||||||
color="primary",
|
color="primary",
|
||||||
@@ -114,9 +123,10 @@ export default {
|
|||||||
TheNotificationProvider,
|
TheNotificationProvider,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
closeForm: Function,
|
//closeForm: Function,
|
||||||
setUpdatedClients: Function,
|
setUpdatedClients: Function,
|
||||||
writeCreatedClientId: Function,
|
writeCreatedClientId: Function,
|
||||||
|
modelValue: Boolean,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -221,8 +231,8 @@ export default {
|
|||||||
defaultIcon: addImageIcon,
|
defaultIcon: addImageIcon,
|
||||||
showModal: false,
|
showModal: false,
|
||||||
showPopup: false,
|
showPopup: false,
|
||||||
image: [addImageIcon],
|
image: addImageIcon,
|
||||||
imageData: [],
|
imageData: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -233,17 +243,17 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
previewImages(event) {
|
closeForm() {
|
||||||
this.image = [];
|
this.$emit("update:model-value", false);
|
||||||
var pictures = event.target.files;
|
},
|
||||||
for (var i = 0; i < pictures.length; i++) {
|
previewImage(event) {
|
||||||
var reader = new FileReader();
|
let picture = event.target.files;
|
||||||
|
let reader = new FileReader();
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
this.image.push(e.target.result);
|
this.image = e.target.result;
|
||||||
};
|
};
|
||||||
reader.readAsDataURL(pictures[i]);
|
reader.readAsDataURL(picture[0]);
|
||||||
}
|
this.imageData = [...event.target.files];
|
||||||
this.imageData = [...this.imageData, ...event.target.files];
|
|
||||||
},
|
},
|
||||||
closeAddImage() {
|
closeAddImage() {
|
||||||
this.showModal = false;
|
this.showModal = false;
|
||||||
@@ -319,9 +329,7 @@ export default {
|
|||||||
postNewClient() {
|
postNewClient() {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("full_name", this.infoClient.basic.full_name);
|
formData.append("full_name", this.infoClient.basic.full_name);
|
||||||
this.imageData.forEach((e) => {
|
formData.append("photo", this.imageData[0]);
|
||||||
formData.append("photo", e);
|
|
||||||
});
|
|
||||||
if (this.infoClient.basic.birth_date)
|
if (this.infoClient.basic.birth_date)
|
||||||
formData.append(
|
formData.append(
|
||||||
"birth_date",
|
"birth_date",
|
||||||
@@ -386,9 +394,9 @@ export default {
|
|||||||
this.showModal = true;
|
this.showModal = true;
|
||||||
this.showPopup = false;
|
this.showPopup = false;
|
||||||
},
|
},
|
||||||
changeOpenPopup() {
|
/*changeOpenPopup() {
|
||||||
this.showPopup = true;
|
this.showPopup = true;
|
||||||
},
|
},*/
|
||||||
saveDocFile(e) {
|
saveDocFile(e) {
|
||||||
this.infoClient.doc = e.target.files;
|
this.infoClient.doc = e.target.files;
|
||||||
},
|
},
|
||||||
@@ -529,4 +537,12 @@ export default {
|
|||||||
background-repeat: no-repeat
|
background-repeat: no-repeat
|
||||||
background-position: center
|
background-position: center
|
||||||
background-image: url(@/assets/icons/download.svg)
|
background-image: url(@/assets/icons/download.svg)
|
||||||
|
|
||||||
|
.modal
|
||||||
|
max-width: 1220px
|
||||||
|
max-height: 794px
|
||||||
|
width: 1220px
|
||||||
|
height: 794px
|
||||||
|
background-color: var(--default-white)
|
||||||
|
//padding: 32px 370px 153px 370px
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,36 +1,22 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
teleport(:to="appContainer")
|
q-dialog(v-model="value")
|
||||||
transition
|
.base-content
|
||||||
.base-overlay(:class="{'base-overlay-bg': !hideOverlay}", :style="styleOverlay", v-if="value")
|
|
||||||
.base-content(v-click-outside="clickOutside", :style="styleContent")
|
|
||||||
.base-header
|
.base-header
|
||||||
.header-title.text {{ title }}
|
.header-title.text {{ title }}
|
||||||
.icon-cancel.text-sm(@click="value = false", v-if="!showIcon")
|
.icon-cancel.text-sm(@click="value = false", v-if="!showIcon")
|
||||||
slot
|
slot
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "BaseModal",
|
name: "BaseModal",
|
||||||
props: {
|
props: {
|
||||||
hideOverlay: Boolean,
|
|
||||||
styleOverlay: Object,
|
|
||||||
styleContent: Object,
|
|
||||||
title: String,
|
title: String,
|
||||||
modelValue: Boolean,
|
modelValue: Boolean,
|
||||||
showIcon: Boolean,
|
showIcon: Boolean,
|
||||||
},
|
},
|
||||||
emits: ["update:modelValue"],
|
emits: ["update:modelValue"],
|
||||||
methods: {
|
|
||||||
clickOutside() {
|
|
||||||
this.value = false;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
appContainer() {
|
|
||||||
return this.$.appContext.app._container;
|
|
||||||
},
|
|
||||||
value: {
|
value: {
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
@@ -43,7 +29,7 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="sass">
|
<style lang="sass" scoped>
|
||||||
.base-overlay
|
.base-overlay
|
||||||
z-index: 10000
|
z-index: 10000
|
||||||
position: absolute
|
position: absolute
|
||||||
@@ -53,12 +39,8 @@ export default {
|
|||||||
justify-content: center
|
justify-content: center
|
||||||
align-items: center
|
align-items: center
|
||||||
|
|
||||||
.base-overlay-bg
|
|
||||||
background: rgba(37, 40, 80, 0.2)
|
|
||||||
backdrop-filter: blur(4px)
|
|
||||||
width: 100vw
|
|
||||||
height: 100vh
|
|
||||||
.base-content
|
.base-content
|
||||||
|
width: auto
|
||||||
padding: 32px 40px
|
padding: 32px 40px
|
||||||
background-color: var(--default-white)
|
background-color: var(--default-white)
|
||||||
box-shadow: 4px 4px 8px rgba(9, 10, 21, 0.1), -4px -4px 8px rgba(9, 10, 21, 0.1)
|
box-shadow: 4px 4px 8px rgba(9, 10, 21, 0.1), -4px -4px 8px rgba(9, 10, 21, 0.1)
|
||||||
@@ -78,13 +60,13 @@ export default {
|
|||||||
margin-right: -11px
|
margin-right: -11px
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
color: var(--font-grey-color)
|
color: var(--font-grey-color)
|
||||||
|
</style>
|
||||||
.v-enter-active,
|
<style lang="sass">
|
||||||
.v-leave-active
|
.q-dialog__backdrop
|
||||||
transition: opacity 0.3s ease-in-out
|
background: rgba(37, 40, 80, 0.2) !important
|
||||||
|
backdrop-filter: blur(4px) !important
|
||||||
|
|
||||||
.v-enter-from,
|
@media (min-width: 600px)
|
||||||
.v-leave-to
|
.q-dialog__inner--minimized > div
|
||||||
opacity: 0
|
max-width: 100vh !important
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user