diff --git a/src/pages/clients/components/ClientDetailInfoSection.vue b/src/pages/clients/components/ClientDetailInfoSection.vue index f5e5836..65e0ac2 100644 --- a/src/pages/clients/components/ClientDetailInfoSection.vue +++ b/src/pages/clients/components/ClientDetailInfoSection.vue @@ -4,23 +4,24 @@ ) .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}} - .flex.items-center.gap-x-8(v-if="this.isData") + .flex.items-center.gap-x-8 base-button( - v-if="isChange && !this.isData", + v-if="isChange", @click="saveChange", confirm, rounded, outlined, :size="20" ) - base-button( - v-if="isChange && this.isData", - @click="createNewAddress", - confirm, - rounded, - outlined, - :size="20" - ) + .icon-ok.text-xsm(class="pt-[3px]") + //- base-button( + //- v-if="isChange && this.isData", + //- @click="createNewAddress", + //- confirm, + //- rounded, + //- outlined, + //- :size="20" + //- ) .icon-ok.text-xsm(class="pt-[3px]") .edit.icon-edit.cursor-pointer.text-sm( v-if="!isChange", @@ -145,6 +146,7 @@ export default { lackData: Boolean, dopeAddress: Object, createAddress: Function, + createDocument: Function, }, directives: { mask }, @@ -173,6 +175,11 @@ export default { changeData() { this.isData = true; this.isChange = true; + if (this.section === "pass") { + this.createDocument(); + } else if (this.section === "addresses") { + this.createAddress(); + } }, copyValue(text) { navigator.clipboard.writeText(text); @@ -191,12 +198,6 @@ export default { this.updateAddress(); } }, - createNewAddress() { - this.isOpenChange = false; - this.isChange = false; - this.createAddress(); - this.updateAddress(); - }, openAddingWrap() { if (!this.isChange) { this.isOpenAddingWrap = !this.isOpenAddingWrap; diff --git a/src/pages/clients/components/ClientDetailInfoWrapper.vue b/src/pages/clients/components/ClientDetailInfoWrapper.vue index b19ca9a..ec2438a 100644 --- a/src/pages/clients/components/ClientDetailInfoWrapper.vue +++ b/src/pages/clients/components/ClientDetailInfoWrapper.vue @@ -5,6 +5,7 @@ section="pass" :update-document="updateDocument" :lack-data="lackData" + :create-document="createDocument" ) .flex.flex-col client-detail-info-section( @@ -42,6 +43,7 @@ export default { lackData: Boolean, dopeAddress: Object, createAddress: Function, + createDocument: Function, }, }; diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index f0b1a6f..b22986c 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -78,6 +78,7 @@ :lack-data="lackData" :dope-address="dopeAddress" :create-address="postCreateAddress" + :create-document="postCreateIdentityDocument" ) @@ -128,6 +129,7 @@ export default { docId: "", addressId: "", lackData: true, + lackAddress: true, dopeAddress: { city: "", region: "", @@ -321,10 +323,11 @@ export default { }, saveAddress(data) { this.addressId = data?.id; - if (data?.join_adress) { + if (data?.join_adress && data?.join_adress.substr(0, 4) !== "None") { this.dataAddress = { join_adress: data?.join_adress, }; + this.lackData = true; } else { this.lackData = false; this.dataAddress = { @@ -387,6 +390,13 @@ export default { }) .then(() => this.fetchClientDetail(this.id)); }, + postCreateIdentityDocument() { + fetchWrapper + .post("general/identity_document/create/", { + person_id: this.id, + }) + .then(() => this.fetchClientDetail(this.id)); + }, }, };