Merge pull request #128 from dderbentsov/UC-66
[WIP] Добавил дополнительные поля адресов и их сохранение
This commit is contained in:
@@ -4,14 +4,22 @@
|
|||||||
)
|
)
|
||||||
.section-header.flex.items-center.justify-between.pl-4.pr-3(:class="{small:settings[section].rowFlex}")
|
.section-header.flex.items-center.justify-between.pl-4.pr-3(:class="{small:settings[section].rowFlex}")
|
||||||
span.text-sm.font-semibold.whitespace-nowrap {{settings[section].title}}
|
span.text-sm.font-semibold.whitespace-nowrap {{settings[section].title}}
|
||||||
.flex.items-center.gap-x-8(v-if="lackPass || lackAddress")
|
.flex.items-center.gap-x-8(v-if="this.isData")
|
||||||
base-button(
|
base-button(
|
||||||
v-if="isChange",
|
v-if="isChange && !this.isData",
|
||||||
@click="saveChange",
|
@click="saveChange",
|
||||||
confirm,
|
confirm,
|
||||||
rounded,
|
rounded,
|
||||||
outlined,
|
outlined,
|
||||||
:size="20"
|
:size="20"
|
||||||
|
)
|
||||||
|
base-button(
|
||||||
|
v-if="isChange && this.isData",
|
||||||
|
@click="createNewAddress",
|
||||||
|
confirm,
|
||||||
|
rounded,
|
||||||
|
outlined,
|
||||||
|
:size="20"
|
||||||
)
|
)
|
||||||
.icon-ok.text-xsm(class="pt-[3px]")
|
.icon-ok.text-xsm(class="pt-[3px]")
|
||||||
.edit.icon-edit.cursor-pointer.text-sm(
|
.edit.icon-edit.cursor-pointer.text-sm(
|
||||||
@@ -40,7 +48,7 @@
|
|||||||
:add-new-additional="addDocAdditional",
|
:add-new-additional="addDocAdditional",
|
||||||
:save-additional="saveDocs"
|
:save-additional="saveDocs"
|
||||||
)
|
)
|
||||||
.section-body.w-full.flex.flex-col.px-4.pt-3.pb-4.gap-y-4(v-if="lackPass || lackAddress")
|
.section-body.w-full.flex.flex-col.px-4.pt-3.pb-4.gap-y-4(v-if="this.isData")
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
.flex.flex-col(v-for="(item, key) in sectionInfo", class="gap-y-1.5")
|
.flex.flex-col(v-for="(item, key) in sectionInfo", class="gap-y-1.5")
|
||||||
span.title-section.font-semibold.text-xs(
|
span.title-section.font-semibold.text-xs(
|
||||||
@@ -71,23 +79,27 @@
|
|||||||
.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")
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
.text-info.text-xxs.font-semibold Город
|
.text-info.text-xxs.font-semibold Город
|
||||||
base-select(placeholder="Выберите город")
|
base-select(
|
||||||
|
placeholder="Выберите город",
|
||||||
|
:items="cities",
|
||||||
|
v-model="dopeAddress.city"
|
||||||
|
)
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
.text-info.text-xxs.font-semibold Область
|
.text-info.text-xxs.font-semibold Область
|
||||||
base-input.input-info(placeholder="Введите область")
|
base-input.input-info(placeholder="Введите область", v-model:value="dopeAddress.region")
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
.text-info.text-xxs.font-semibold Улица
|
.text-info.text-xxs.font-semibold Улица
|
||||||
base-input.input-info(placeholder="Введите улицу")
|
base-input.input-info(placeholder="Введите улицу", v-model:value="dopeAddress.street")
|
||||||
.flex.gap-x-4
|
.flex.gap-x-4
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
.text-info.text-xxs.font-semibold Дом
|
.text-info.text-xxs.font-semibold Дом
|
||||||
base-input.input-info(placeholder="Дом")
|
base-input.input-info(placeholder="Дом", v-model:value="dopeAddress.house")
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
.text-info.text-xxs.font-semibold Квартира
|
.text-info.text-xxs.font-semibold Квартира
|
||||||
base-input.input-info(placeholder="Квартира")
|
base-input.input-info(placeholder="Квартира", v-model:value="dopeAddress.flat")
|
||||||
.flex.flex-col(class="gap-y-1.5")
|
.flex.flex-col(class="gap-y-1.5")
|
||||||
.text-info.text-xxs.font-semibold Индекс
|
.text-info.text-xxs.font-semibold Индекс
|
||||||
base-input.input-info(v-mask="'######'", placeholder="000000")
|
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")
|
||||||
@@ -97,7 +109,10 @@
|
|||||||
@click="(e) => deleteDoc(e)"
|
@click="(e) => deleteDoc(e)"
|
||||||
)
|
)
|
||||||
span.text-sm {{item.title}}
|
span.text-sm {{item.title}}
|
||||||
.section-add-doc.flex.justify-center.items-center.cursor-pointer(v-else)
|
.section-add-doc.flex.justify-center.items-center.cursor-pointer(
|
||||||
|
v-else,
|
||||||
|
@click="changeData"
|
||||||
|
)
|
||||||
span Добавить данные
|
span Добавить данные
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -127,8 +142,9 @@ export default {
|
|||||||
deleteDoc: Function,
|
deleteDoc: Function,
|
||||||
updateDocument: Function,
|
updateDocument: Function,
|
||||||
updateAddress: Function,
|
updateAddress: Function,
|
||||||
lackPass: Boolean,
|
lackData: Boolean,
|
||||||
lackAddress: Boolean,
|
dopeAddress: Object,
|
||||||
|
createAddress: Function,
|
||||||
},
|
},
|
||||||
directives: { mask },
|
directives: { mask },
|
||||||
|
|
||||||
@@ -145,12 +161,19 @@ export default {
|
|||||||
isOpenChange: false,
|
isOpenChange: false,
|
||||||
isChange: false,
|
isChange: false,
|
||||||
settings: detail,
|
settings: detail,
|
||||||
customTokens: {
|
cities: [
|
||||||
Y: { pattern: /[0-9a-zA-Zа-яёА-ЯЁ ]/u },
|
{ id: 1, label: "Рязань" },
|
||||||
},
|
{ id: 1, label: "Москва" },
|
||||||
|
{ id: 1, label: "Луховицы" },
|
||||||
|
],
|
||||||
|
isData: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
changeData() {
|
||||||
|
this.isData = true;
|
||||||
|
this.isChange = true;
|
||||||
|
},
|
||||||
copyValue(text) {
|
copyValue(text) {
|
||||||
navigator.clipboard.writeText(text);
|
navigator.clipboard.writeText(text);
|
||||||
},
|
},
|
||||||
@@ -168,6 +191,12 @@ export default {
|
|||||||
this.updateAddress();
|
this.updateAddress();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
createNewAddress() {
|
||||||
|
this.isOpenChange = false;
|
||||||
|
this.isChange = false;
|
||||||
|
this.createAddress();
|
||||||
|
this.updateAddress();
|
||||||
|
},
|
||||||
openAddingWrap() {
|
openAddingWrap() {
|
||||||
if (!this.isChange) {
|
if (!this.isChange) {
|
||||||
this.isOpenAddingWrap = !this.isOpenAddingWrap;
|
this.isOpenAddingWrap = !this.isOpenAddingWrap;
|
||||||
@@ -197,6 +226,14 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
lackData: {
|
||||||
|
immediate: true,
|
||||||
|
handler(newValue) {
|
||||||
|
this.isData = newValue;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,16 @@
|
|||||||
v-model:section-info="dataDocument"
|
v-model:section-info="dataDocument"
|
||||||
section="pass"
|
section="pass"
|
||||||
:update-document="updateDocument"
|
:update-document="updateDocument"
|
||||||
:lack-pass="lackPass"
|
:lack-data="lackData"
|
||||||
)
|
)
|
||||||
.flex.flex-col
|
.flex.flex-col
|
||||||
client-detail-info-section(
|
client-detail-info-section(
|
||||||
:section-info="dataAddress"
|
:section-info="dataAddress"
|
||||||
section="addresses"
|
section="addresses"
|
||||||
:update-address="updateAddress"
|
:update-address="updateAddress"
|
||||||
:lack-address="lackAddress"
|
:lack-data="lackData"
|
||||||
|
:dope-address="dopeAddress"
|
||||||
|
:create-address="createAddress"
|
||||||
)
|
)
|
||||||
.flex.flex-col
|
.flex.flex-col
|
||||||
client-detail-info-section(
|
client-detail-info-section(
|
||||||
@@ -19,6 +21,7 @@
|
|||||||
section="docs"
|
section="docs"
|
||||||
:save-new-doc="saveNewDoc"
|
:save-new-doc="saveNewDoc"
|
||||||
:delete-doc="deleteDoc"
|
:delete-doc="deleteDoc"
|
||||||
|
:lack-data="lackData"
|
||||||
)
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -36,8 +39,9 @@ export default {
|
|||||||
dataDocument: Object,
|
dataDocument: Object,
|
||||||
updateDocument: Function,
|
updateDocument: Function,
|
||||||
updateAddress: Function,
|
updateAddress: Function,
|
||||||
lackPass: Boolean,
|
lackData: Boolean,
|
||||||
lackAddress: Boolean,
|
dopeAddress: Object,
|
||||||
|
createAddress: Function,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -75,8 +75,9 @@
|
|||||||
:delete-doc="deleteDoc"
|
:delete-doc="deleteDoc"
|
||||||
:update-document="postUpdateIdentityDocument"
|
:update-document="postUpdateIdentityDocument"
|
||||||
:update-address="postUpdateAddress"
|
:update-address="postUpdateAddress"
|
||||||
:lack-pass="lackPass"
|
:lack-data="lackData"
|
||||||
:lack-address="lackAddress"
|
:dope-address="dopeAddress"
|
||||||
|
:create-address="postCreateAddress"
|
||||||
)
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -126,8 +127,15 @@ export default {
|
|||||||
dataClient: {},
|
dataClient: {},
|
||||||
docId: "",
|
docId: "",
|
||||||
addressId: "",
|
addressId: "",
|
||||||
lackPass: true,
|
lackData: true,
|
||||||
lackAddress: true,
|
dopeAddress: {
|
||||||
|
city: "",
|
||||||
|
region: "",
|
||||||
|
street: "",
|
||||||
|
house: "",
|
||||||
|
flat: "",
|
||||||
|
index: "",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@@ -174,7 +182,6 @@ export default {
|
|||||||
priority: this.dataClient.priority,
|
priority: this.dataClient.priority,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
postContactsClient() {
|
postContactsClient() {
|
||||||
let contacts = [...this.dataClient.contacts];
|
let contacts = [...this.dataClient.contacts];
|
||||||
if (
|
if (
|
||||||
@@ -233,7 +240,6 @@ export default {
|
|||||||
postDeleteContact(contact) {
|
postDeleteContact(contact) {
|
||||||
fetchWrapper.del(`general/contact/${contact.id}/delete/`);
|
fetchWrapper.del(`general/contact/${contact.id}/delete/`);
|
||||||
},
|
},
|
||||||
|
|
||||||
addNetwork(network) {
|
addNetwork(network) {
|
||||||
this.dataClient.contacts.push(network);
|
this.dataClient.contacts.push(network);
|
||||||
},
|
},
|
||||||
@@ -270,10 +276,6 @@ export default {
|
|||||||
this.saveAddress(data.address[0]);
|
this.saveAddress(data.address[0]);
|
||||||
this.saveAttachments([...data.attachments]);
|
this.saveAttachments([...data.attachments]);
|
||||||
},
|
},
|
||||||
addDoc() {
|
|
||||||
this.lackPass = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
saveIdentityDocument(data) {
|
saveIdentityDocument(data) {
|
||||||
if (
|
if (
|
||||||
data?.series ||
|
data?.series ||
|
||||||
@@ -294,12 +296,17 @@ export default {
|
|||||||
: "",
|
: "",
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
this.lackPass = false;
|
this.lackData = false;
|
||||||
|
this.dataIdentityDocument = {
|
||||||
|
numba: "",
|
||||||
|
issued_by_org: "",
|
||||||
|
issued_by_org_code: "",
|
||||||
|
issued_by_date: "",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
this.docId = data?.id;
|
this.docId = data?.id;
|
||||||
},
|
},
|
||||||
postUpdateIdentityDocument() {
|
postUpdateIdentityDocument() {
|
||||||
console.log(this.dataIdentityDocument);
|
|
||||||
fetchWrapper
|
fetchWrapper
|
||||||
.post(`general/identity_document/${this.docId}/update/`, {
|
.post(`general/identity_document/${this.docId}/update/`, {
|
||||||
series_number: this.dataIdentityDocument.numba,
|
series_number: this.dataIdentityDocument.numba,
|
||||||
@@ -313,22 +320,41 @@ export default {
|
|||||||
.then(() => this.fetchClientDetail(this.id));
|
.then(() => this.fetchClientDetail(this.id));
|
||||||
},
|
},
|
||||||
saveAddress(data) {
|
saveAddress(data) {
|
||||||
|
this.addressId = data?.id;
|
||||||
if (data?.join_adress) {
|
if (data?.join_adress) {
|
||||||
this.dataAddress = {
|
this.dataAddress = {
|
||||||
join_adress: data?.join_adress,
|
join_adress: data?.join_adress,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
this.lackAddress = false;
|
this.lackData = false;
|
||||||
|
this.dataAddress = {
|
||||||
|
join_adress: "",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
},
|
||||||
this.addressId = data?.id;
|
clearAddress() {
|
||||||
|
this.dopeAddress = {
|
||||||
|
city: "",
|
||||||
|
region: "",
|
||||||
|
street: "",
|
||||||
|
flat: "",
|
||||||
|
house: "",
|
||||||
|
index: "",
|
||||||
|
};
|
||||||
},
|
},
|
||||||
postUpdateAddress() {
|
postUpdateAddress() {
|
||||||
fetchWrapper
|
fetchWrapper
|
||||||
.post(`general/address/${this.addressId}/update/`, {
|
.post(`general/address/${this.addressId}/update/`, {
|
||||||
full_address: this.dataAddress.join_adress,
|
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));
|
||||||
|
this.clearAddress();
|
||||||
},
|
},
|
||||||
saveAttachments(data) {
|
saveAttachments(data) {
|
||||||
this.dataAttachments = [...data];
|
this.dataAttachments = [...data];
|
||||||
@@ -354,6 +380,13 @@ export default {
|
|||||||
(el) => el.id !== e.target.id
|
(el) => el.id !== e.target.id
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
postCreateAddress() {
|
||||||
|
fetchWrapper
|
||||||
|
.post("general/address/create/", {
|
||||||
|
person_id: this.id,
|
||||||
|
})
|
||||||
|
.then(() => this.fetchClientDetail(this.id));
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user