[WIP] Добавил сохранение адресов и паспортных данных
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
.flex.items-center.gap-x-8
|
.flex.items-center.gap-x-8
|
||||||
base-button(
|
base-button(
|
||||||
v-if="isChange",
|
v-if="isChange",
|
||||||
@click="saveChange",
|
@click="changeDoc",
|
||||||
confirm,
|
confirm,
|
||||||
rounded,
|
rounded,
|
||||||
outlined,
|
outlined,
|
||||||
@@ -69,29 +69,10 @@
|
|||||||
.line.absolute
|
.line.absolute
|
||||||
.text-separation.span.text-sm.separator.px-2 или
|
.text-separation.span.text-sm.separator.px-2 или
|
||||||
.flex.flex-col.gap-y-4(v-if="section === 'addresses' && isChange")
|
.flex.flex-col.gap-y-4(v-if="section === 'addresses' && isChange")
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
client-detail-section-address(
|
||||||
.text-info.text-xxs.font-semibold Город
|
:dope-address="dopeAddress"
|
||||||
base-select(
|
:cities="cities"
|
||||||
placeholder="Выберите город",
|
|
||||||
:items="cities",
|
|
||||||
v-model="dopeAddress.city"
|
|
||||||
)
|
)
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
|
||||||
.text-info.text-xxs.font-semibold Область
|
|
||||||
base-input.input-info(placeholder="Введите область", v-model:value="dopeAddress.region")
|
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
|
||||||
.text-info.text-xxs.font-semibold Улица
|
|
||||||
base-input.input-info(placeholder="Введите улицу", v-model:value="dopeAddress.street")
|
|
||||||
.flex.gap-x-4
|
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
|
||||||
.text-info.text-xxs.font-semibold Дом
|
|
||||||
base-input.input-info(placeholder="Дом", v-model:value="dopeAddress.house")
|
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
|
||||||
.text-info.text-xxs.font-semibold Квартира
|
|
||||||
base-input.input-info(placeholder="Квартира", v-model:value="dopeAddress.flat")
|
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
|
||||||
.text-info.text-xxs.font-semibold Индекс
|
|
||||||
base-input.input-info(v-mask="'######'", placeholder="000000", v-model:value="dopeAddress.index")
|
|
||||||
.flex(v-if="item.name && !isChange")
|
.flex(v-if="item.name && !isChange")
|
||||||
span.text-sm.w-fit {{item.title}}
|
span.text-sm.w-fit {{item.title}}
|
||||||
.flex.items-center(v-if="item.title")
|
.flex.items-center(v-if="item.title")
|
||||||
@@ -103,7 +84,7 @@
|
|||||||
span.text-sm {{item.title}}
|
span.text-sm {{item.title}}
|
||||||
.section-add-doc.flex.justify-center.items-center.cursor-pointer(
|
.section-add-doc.flex.justify-center.items-center.cursor-pointer(
|
||||||
v-else,
|
v-else,
|
||||||
@click="changeData"
|
@click="openAddDoc"
|
||||||
)
|
)
|
||||||
span Добавить данные
|
span Добавить данные
|
||||||
</template>
|
</template>
|
||||||
@@ -111,21 +92,18 @@
|
|||||||
<script>
|
<script>
|
||||||
import ClientDetailInput from "@/pages/clients/components/ClientDetailInput";
|
import ClientDetailInput from "@/pages/clients/components/ClientDetailInput";
|
||||||
import BaseButton from "@/components/base/BaseButton";
|
import BaseButton from "@/components/base/BaseButton";
|
||||||
import BaseInput from "@/components/base/BaseInput";
|
|
||||||
import BaseSelect from "@/components/base/BaseSelect";
|
|
||||||
import TableAddingNewDoc from "@/pages/clients/components/TableAddingNewDoc";
|
import TableAddingNewDoc from "@/pages/clients/components/TableAddingNewDoc";
|
||||||
import TableAddingNewAdditional from "@/pages/clients/components/TableAddingNewAdditional";
|
import TableAddingNewAdditional from "@/pages/clients/components/TableAddingNewAdditional";
|
||||||
|
import ClientDetailSectionAddress from "@/pages/clients/components/ClientDetailSectionAddress";
|
||||||
import { detail } from "@/pages/clients/utils/tableConfig";
|
import { detail } from "@/pages/clients/utils/tableConfig";
|
||||||
import { mask } from "vue-the-mask";
|
|
||||||
export default {
|
export default {
|
||||||
name: "ClientDetailInfoSection",
|
name: "ClientDetailInfoSection",
|
||||||
components: {
|
components: {
|
||||||
TableAddingNewAdditional,
|
TableAddingNewAdditional,
|
||||||
BaseButton,
|
BaseButton,
|
||||||
BaseInput,
|
|
||||||
BaseSelect,
|
|
||||||
ClientDetailInput,
|
ClientDetailInput,
|
||||||
TableAddingNewDoc,
|
TableAddingNewDoc,
|
||||||
|
ClientDetailSectionAddress,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
saveNewDoc: Function,
|
saveNewDoc: Function,
|
||||||
@@ -139,9 +117,9 @@ export default {
|
|||||||
dopeAddress: Object,
|
dopeAddress: Object,
|
||||||
createAddress: Function,
|
createAddress: Function,
|
||||||
createDocument: Function,
|
createDocument: Function,
|
||||||
|
addressId: String,
|
||||||
|
docId: String,
|
||||||
},
|
},
|
||||||
directives: { mask },
|
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
additionalData: {
|
additionalData: {
|
||||||
@@ -164,14 +142,21 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeData() {
|
openAddDoc() {
|
||||||
this.isChange = true;
|
this.isChange = true;
|
||||||
if (this.section === "pass") {
|
if (this.section === "pass") {
|
||||||
this.isData = true;
|
this.isData = true;
|
||||||
this.createDocument();
|
|
||||||
} else if (this.section === "addresses") {
|
} else if (this.section === "addresses") {
|
||||||
this.isAddress = true;
|
this.isAddress = true;
|
||||||
this.createAddress();
|
}
|
||||||
|
},
|
||||||
|
changeDoc() {
|
||||||
|
this.isChange = false;
|
||||||
|
if (this.section === "pass") {
|
||||||
|
this.docId ? this.updateDocument() : this.createDocument();
|
||||||
|
}
|
||||||
|
if (this.section === "addresses") {
|
||||||
|
this.addressId ? this.updateAddress() : this.createAddress();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
copyValue(text) {
|
copyValue(text) {
|
||||||
@@ -287,8 +272,4 @@ export default {
|
|||||||
width: 38px
|
width: 38px
|
||||||
z-index: 1
|
z-index: 1
|
||||||
background: white
|
background: white
|
||||||
.input-info
|
|
||||||
color: var(--font-dark-blue-color)
|
|
||||||
.text-info
|
|
||||||
color: var(--font-grey-color)
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
:update-document="updateDocument"
|
:update-document="updateDocument"
|
||||||
:lack-data="lackData"
|
:lack-data="lackData"
|
||||||
:create-document="createDocument"
|
:create-document="createDocument"
|
||||||
|
:doc-id="docId"
|
||||||
)
|
)
|
||||||
.flex.flex-col
|
.flex.flex-col
|
||||||
client-detail-info-section(
|
client-detail-info-section(
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
:lack-address="lackAddress"
|
:lack-address="lackAddress"
|
||||||
:dope-address="dopeAddress"
|
:dope-address="dopeAddress"
|
||||||
:create-address="createAddress"
|
:create-address="createAddress"
|
||||||
|
:address-id="addressId"
|
||||||
)
|
)
|
||||||
.flex.flex-col
|
.flex.flex-col
|
||||||
client-detail-info-section(
|
client-detail-info-section(
|
||||||
@@ -44,6 +46,8 @@ export default {
|
|||||||
dopeAddress: Object,
|
dopeAddress: Object,
|
||||||
createAddress: Function,
|
createAddress: Function,
|
||||||
createDocument: Function,
|
createDocument: Function,
|
||||||
|
addressId: String,
|
||||||
|
docId: String,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
51
src/pages/clients/components/ClientDetailSectionAddress.vue
Normal file
51
src/pages/clients/components/ClientDetailSectionAddress.vue
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
.flex.flex-col.gap-y-4
|
||||||
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
|
.text-info.text-xxs.font-semibold Город
|
||||||
|
base-select(
|
||||||
|
placeholder="Выберите город",
|
||||||
|
:items="cities",
|
||||||
|
v-model="dopeAddress.city"
|
||||||
|
)
|
||||||
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
|
.text-info.text-xxs.font-semibold Область
|
||||||
|
base-input.input-info(placeholder="Введите область", v-model:value="dopeAddress.region")
|
||||||
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
|
.text-info.text-xxs.font-semibold Улица
|
||||||
|
base-input.input-info(placeholder="Введите улицу", v-model:value="dopeAddress.street")
|
||||||
|
.flex.gap-x-4
|
||||||
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
|
.text-info.text-xxs.font-semibold Дом
|
||||||
|
base-input.input-info(placeholder="Дом", v-model:value="dopeAddress.house")
|
||||||
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
|
.text-info.text-xxs.font-semibold Квартира
|
||||||
|
base-input.input-info(placeholder="Квартира", v-model:value="dopeAddress.flat")
|
||||||
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
|
.text-info.text-xxs.font-semibold Индекс
|
||||||
|
base-input.input-info(v-mask="'######'", placeholder="000000", v-model:value="dopeAddress.index")
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import BaseInput from "@/components/base/BaseInput";
|
||||||
|
import BaseSelect from "@/components/base/BaseSelect";
|
||||||
|
import { mask } from "vue-the-mask";
|
||||||
|
export default {
|
||||||
|
name: "ClientDetailSectionAddress",
|
||||||
|
components: {
|
||||||
|
BaseInput,
|
||||||
|
BaseSelect,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
dopeAddress: Object,
|
||||||
|
cities: Array,
|
||||||
|
},
|
||||||
|
directives: { mask },
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
.input-info
|
||||||
|
color: var(--font-dark-blue-color)
|
||||||
|
.text-info
|
||||||
|
color: var(--font-grey-color)
|
||||||
|
</style>
|
||||||
@@ -80,6 +80,8 @@
|
|||||||
:dope-address="dopeAddress"
|
:dope-address="dopeAddress"
|
||||||
:create-address="postCreateAddress"
|
:create-address="postCreateAddress"
|
||||||
:create-document="postCreateIdentityDocument"
|
:create-document="postCreateIdentityDocument"
|
||||||
|
:address-id="addressId"
|
||||||
|
:doc-id="docId"
|
||||||
)
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -280,13 +282,8 @@ export default {
|
|||||||
this.saveAttachments([...data.attachments]);
|
this.saveAttachments([...data.attachments]);
|
||||||
},
|
},
|
||||||
saveIdentityDocument(data) {
|
saveIdentityDocument(data) {
|
||||||
if (
|
if (data?.id) {
|
||||||
data?.series ||
|
this.docId = data.id;
|
||||||
data?.numba ||
|
|
||||||
data?.issued_by_org ||
|
|
||||||
data?.issued_by_org_code ||
|
|
||||||
data?.issued_by_date
|
|
||||||
) {
|
|
||||||
this.dataIdentityDocument = {
|
this.dataIdentityDocument = {
|
||||||
numba:
|
numba:
|
||||||
data.series && data.numba ? data?.series + " " + data?.numba : "",
|
data.series && data.numba ? data?.series + " " + data?.numba : "",
|
||||||
@@ -308,7 +305,6 @@ export default {
|
|||||||
issued_by_date: "",
|
issued_by_date: "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.docId = data?.id;
|
|
||||||
},
|
},
|
||||||
postUpdateIdentityDocument() {
|
postUpdateIdentityDocument() {
|
||||||
fetchWrapper
|
fetchWrapper
|
||||||
@@ -389,6 +385,13 @@ export default {
|
|||||||
fetchWrapper
|
fetchWrapper
|
||||||
.post("general/address/create/", {
|
.post("general/address/create/", {
|
||||||
person_id: this.id,
|
person_id: this.id,
|
||||||
|
full_address:
|
||||||
|
this.dopeAddress.city +
|
||||||
|
this.dopeAddress.region +
|
||||||
|
this.dopeAddress.street +
|
||||||
|
this.dopeAddress.house +
|
||||||
|
this.dopeAddress.flat +
|
||||||
|
this.dopeAddress.index || this.dataAddress.join_adress,
|
||||||
})
|
})
|
||||||
.then(() => this.fetchClientDetail(this.id));
|
.then(() => this.fetchClientDetail(this.id));
|
||||||
},
|
},
|
||||||
@@ -396,7 +399,7 @@ export default {
|
|||||||
fetchWrapper
|
fetchWrapper
|
||||||
.post("general/identity_document/create/", {
|
.post("general/identity_document/create/", {
|
||||||
person_id: this.id,
|
person_id: this.id,
|
||||||
kind: "ПАСПОРТ",
|
kind: "PASSPORT",
|
||||||
series_number: this.dataIdentityDocument.numba,
|
series_number: this.dataIdentityDocument.numba,
|
||||||
issued_by_org: this.dataIdentityDocument.issued_by_org,
|
issued_by_org: this.dataIdentityDocument.issued_by_org,
|
||||||
issued_by_org_code: this.dataIdentityDocument.issued_by_org_code,
|
issued_by_org_code: this.dataIdentityDocument.issued_by_org_code,
|
||||||
|
|||||||
Reference in New Issue
Block a user