diff --git a/src/assets/icons/exel.svg b/src/assets/icons/exel.svg new file mode 100644 index 0000000..0021913 --- /dev/null +++ b/src/assets/icons/exel.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/assets/icons/pdf.svg b/src/assets/icons/pdf.svg new file mode 100644 index 0000000..40a0cce --- /dev/null +++ b/src/assets/icons/pdf.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/assets/icons/word.svg b/src/assets/icons/word.svg new file mode 100644 index 0000000..0e1f046 --- /dev/null +++ b/src/assets/icons/word.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/pages/clients/components/ClientDetailInfoSection.vue b/src/pages/clients/components/ClientDetailInfoSection.vue index c9c0f40..7bed452 100644 --- a/src/pages/clients/components/ClientDetailInfoSection.vue +++ b/src/pages/clients/components/ClientDetailInfoSection.vue @@ -40,7 +40,9 @@ :add-new-additional="addDocAdditional", :save-additional="saveDocs" ) - .section-body.w-full.flex.flex-col.px-4.pt-3.pb-4.gap-y-4(v-if="this.isData || this.isAddress") + .section-body.w-full.flex.flex-col.px-4.pt-3.pb-4.gap-y-4( + v-if="this.isData || this.isAddress || this.isAttachments" + ) .flex.flex-col.gap-y-4 .flex.flex-col(v-for="(item, key) in sectionInfo", class="gap-y-1.5") span.title-section.font-semibold.text-xs( @@ -54,7 +56,7 @@ :placeholder="settings[section].placeholder[key]" ) base-input.max-h-10.py-2.pl-3( - v-if="settings[section].options[key] === 'Дата выдачи' && isChange", + v-else-if="isChange && section !== 'docs'", type="date", v-model:value="sectionInfo.issued_by_date" :max-date="`${currentYear}-12-31`", @@ -83,13 +85,15 @@ ) .flex(v-if="item.name && !isChange") span.text-sm.w-fit {{item.title}} - .flex.items-center(v-if="item.title") + .flex.items-center .icon-cancel.cancel.cursor-pointer.pr-3.text-xsm( v-if="isChange", :id="item.id", - @click="(e) => deleteDoc(e)" + @click="deleteDoc(item.id)" ) + img(:src="iconDictionary[item?.document?.split('.')[1]]") span.text-sm {{item.title}} + span.text-sm(v-if="item.document") {{`. ${item?.document?.split(".")[1]}`}} .section-add-doc.flex.justify-center.items-center.cursor-pointer( v-else, @click="openAddDoc" @@ -105,6 +109,9 @@ import TableAddingNewAdditional from "@/pages/clients/components/TableAddingNewA import ClientDetailSectionAddress from "@/pages/clients/components/ClientDetailSectionAddress"; import BaseInput from "@/components/base/BaseInput"; import { detail } from "@/pages/clients/utils/tableConfig"; +import pdfIcon from "@/assets/icons/pdf.svg"; +import wordIcon from "@/assets/icons/word.svg"; +import exelIcon from "@/assets/icons/exel.svg"; export default { name: "ClientDetailInfoSection", components: { @@ -124,16 +131,17 @@ export default { updateAddress: Function, lackData: Boolean, lackAddress: Boolean, + lackAttachments: Boolean, dopeAddress: Object, createAddress: Function, createDocument: Function, addressId: String, + attachmentId: String, docId: String, currentYear: Number, }, data() { return { - tip: "text", additionalData: { header: "", value: "", @@ -151,6 +159,8 @@ export default { ], isData: true, isAddress: true, + isAttachments: true, + iconDictionary: { doc: wordIcon, pdf: pdfIcon, xls: exelIcon }, }; }, computed: { @@ -167,6 +177,8 @@ export default { this.isData = true; } else if (this.section === "addresses") { this.isAddress = true; + } else if (this.section === "docs") { + this.isAttachments = true; } }, changeDoc() { @@ -235,6 +247,12 @@ export default { this.isAddress = newValue; }, }, + lackAttachments: { + immediate: true, + handler(newValue) { + this.isAttachments = newValue; + }, + }, }, }; diff --git a/src/pages/clients/components/ClientDetailInfoWrapper.vue b/src/pages/clients/components/ClientDetailInfoWrapper.vue index f88b6a6..9ff0204 100644 --- a/src/pages/clients/components/ClientDetailInfoWrapper.vue +++ b/src/pages/clients/components/ClientDetailInfoWrapper.vue @@ -25,6 +25,8 @@ section="docs", :save-new-doc="saveNewDoc", :delete-doc="deleteDoc" + :lack-attachments="lackAttachments" + :attachment-id="attachmentId" ) @@ -44,10 +46,12 @@ export default { updateAddress: Function, lackData: Boolean, lackAddress: Boolean, + lackAttachments: Boolean, dopeAddress: Object, createAddress: Function, createDocument: Function, addressId: String, + attachmentId: String, docId: String, currentYear: Number, }, diff --git a/src/pages/clients/components/ClientsTable.vue b/src/pages/clients/components/ClientsTable.vue index d326564..3998e5f 100644 --- a/src/pages/clients/components/ClientsTable.vue +++ b/src/pages/clients/components/ClientsTable.vue @@ -80,7 +80,6 @@ export default { immediate: true, handler(newValue) { if (newValue === false) { - console.log("work"); this.fetchDataClients(); } }, diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index 2471321..4dcfe05 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -78,9 +78,11 @@ :lack-data="lackData" :lack-address="lackAddress" :dope-address="dopeAddress" + :lack-attachments="lackAttachments" :create-address="postCreateAddress" :create-document="postCreateIdentityDocument" :address-id="addressId" + :attachment-id="attachmentId" :doc-id="docId" :current-year="currentYear" ) @@ -132,8 +134,10 @@ export default { dataClient: {}, docId: "", addressId: "", + attachmentId: "", lackData: true, lackAddress: true, + lackAttachments: true, dopeAddress: { city: "", region: "", @@ -364,7 +368,14 @@ export default { this.clearAddress(); }, saveAttachments(data) { - this.dataAttachments = [...data]; + this.dataAttachments = [""]; + if (data.find((e) => e.id)) { + this.dataAttachments = [...data]; + this.lackAttachments = true; + this.attachmentId = this.dataAttachments[0].id; + } else { + this.lackAttachments = false; + } }, openPopup(e) { e.target.focus(); @@ -381,11 +392,10 @@ export default { saveNewDoc(data) { this.dataAttachments = [...this.dataDetail, ...data]; }, - deleteDoc(e) { - e.stopPropagation(); - this.dataAttachments = this.dataAttachments.filter( - (el) => el.id !== e.target.id - ); + deleteDoc(id) { + fetchWrapper + .del(`general/attachment/${id}/delete/`) + .then(() => this.fetchClientDetail(this.id)); }, postCreateAddress() { fetchWrapper @@ -416,7 +426,7 @@ export default {