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