[WIP] Исправил логику добавления адресов

This commit is contained in:
megavrilinvv
2022-11-15 12:18:30 +03:00
parent 016e08cf71
commit fc99c79dfa
3 changed files with 30 additions and 17 deletions

View File

@@ -4,23 +4,24 @@
) )
.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="this.isData") .flex.items-center.gap-x-8
base-button( base-button(
v-if="isChange && !this.isData", v-if="isChange",
@click="saveChange", @click="saveChange",
confirm, confirm,
rounded, rounded,
outlined, outlined,
:size="20" :size="20"
) )
base-button( .icon-ok.text-xsm(class="pt-[3px]")
v-if="isChange && this.isData", //- base-button(
@click="createNewAddress", //- v-if="isChange && this.isData",
confirm, //- @click="createNewAddress",
rounded, //- confirm,
outlined, //- rounded,
:size="20" //- 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(
v-if="!isChange", v-if="!isChange",
@@ -145,6 +146,7 @@ export default {
lackData: Boolean, lackData: Boolean,
dopeAddress: Object, dopeAddress: Object,
createAddress: Function, createAddress: Function,
createDocument: Function,
}, },
directives: { mask }, directives: { mask },
@@ -173,6 +175,11 @@ export default {
changeData() { changeData() {
this.isData = true; this.isData = true;
this.isChange = true; this.isChange = true;
if (this.section === "pass") {
this.createDocument();
} else if (this.section === "addresses") {
this.createAddress();
}
}, },
copyValue(text) { copyValue(text) {
navigator.clipboard.writeText(text); navigator.clipboard.writeText(text);
@@ -191,12 +198,6 @@ 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;

View File

@@ -5,6 +5,7 @@
section="pass" section="pass"
:update-document="updateDocument" :update-document="updateDocument"
:lack-data="lackData" :lack-data="lackData"
:create-document="createDocument"
) )
.flex.flex-col .flex.flex-col
client-detail-info-section( client-detail-info-section(
@@ -42,6 +43,7 @@ export default {
lackData: Boolean, lackData: Boolean,
dopeAddress: Object, dopeAddress: Object,
createAddress: Function, createAddress: Function,
createDocument: Function,
}, },
}; };
</script> </script>

View File

@@ -78,6 +78,7 @@
:lack-data="lackData" :lack-data="lackData"
:dope-address="dopeAddress" :dope-address="dopeAddress"
:create-address="postCreateAddress" :create-address="postCreateAddress"
:create-document="postCreateIdentityDocument"
) )
</template> </template>
@@ -128,6 +129,7 @@ export default {
docId: "", docId: "",
addressId: "", addressId: "",
lackData: true, lackData: true,
lackAddress: true,
dopeAddress: { dopeAddress: {
city: "", city: "",
region: "", region: "",
@@ -321,10 +323,11 @@ export default {
}, },
saveAddress(data) { saveAddress(data) {
this.addressId = data?.id; this.addressId = data?.id;
if (data?.join_adress) { if (data?.join_adress && data?.join_adress.substr(0, 4) !== "None") {
this.dataAddress = { this.dataAddress = {
join_adress: data?.join_adress, join_adress: data?.join_adress,
}; };
this.lackData = true;
} else { } else {
this.lackData = false; this.lackData = false;
this.dataAddress = { this.dataAddress = {
@@ -387,6 +390,13 @@ export default {
}) })
.then(() => this.fetchClientDetail(this.id)); .then(() => this.fetchClientDetail(this.id));
}, },
postCreateIdentityDocument() {
fetchWrapper
.post("general/identity_document/create/", {
person_id: this.id,
})
.then(() => this.fetchClientDetail(this.id));
},
}, },
}; };
</script> </script>