diff --git a/src/components/LoggedInLayout.vue b/src/components/LoggedInLayout.vue index 172f217..90cafa2 100644 --- a/src/components/LoggedInLayout.vue +++ b/src/components/LoggedInLayout.vue @@ -12,7 +12,8 @@ :open-form="openForm", :is-open-form="isOpenForm", :updated-clients="updatedClients", - @reset-updated-clients="resetUpdatedClients" + @reset-updated-clients="resetUpdatedClients", + :url="url" ) the-notification-provider @@ -29,6 +30,7 @@ export default { return { isOpenForm: false, updatedClients: false, + url: "http://45.84.227.122:8080", }; }, methods: { diff --git a/src/components/base/BaseClientFormCreate.vue b/src/components/base/BaseClientFormCreate.vue index 2a8e108..b818312 100644 --- a/src/components/base/BaseClientFormCreate.vue +++ b/src/components/base/BaseClientFormCreate.vue @@ -13,8 +13,8 @@ ) .icon-download.text-xl(v-if="img === defaultIcon") .wrapper-img.flex.w-10.h-10(v-else) - img.current-avatar(:src="img") - base-popup.right-5.top-7(v-if="showPopup", :width="230") + img.current-avatar.object-cover(:src="img") + base-popup.right-5.top-7(v-if="showPopup", v-click-outside="closePopup", :width="230") .flex.items-center.gap-x-2 img(src="@/assets/icons/computer.svg") span.text-smm(@click="changeOpenModal") Загрузить с компьютера @@ -33,8 +33,8 @@ @change="(e) => previewImages(e)" ) .avatar.flex.absolute.items-center.gap-x-6(v-for="img in image") - img.avatar(for="image-upload", :src="img", v-if="img") - base-button(:rounded="true", :size="48", @click="closeModal") + img.avatar.object-cover(for="image-upload", :src="img", v-if="img") + base-button(:rounded="true", :size="48", @click="closeAddImage") .icon-ok base-input.w-full(v-model:value="infoClient.basic.full_name" placeholder="ФИО*") .flex.flex-col.flex-auto.l.gap-y-8 @@ -222,10 +222,6 @@ export default { }, }, methods: { - closeModal() { - this.showModal = false; - this.showPopup = false; - }, previewImages(event) { this.image = []; var pictures = event.target.files; @@ -238,6 +234,13 @@ export default { } this.imageData = [...this.imageData, ...event.target.files]; }, + closeAddImage() { + this.showModal = false; + this.showPopup = false; + }, + closePopup() { + this.showPopup = false; + }, createIdentityDocument(id) { Object.keys( this.filterDataEmptyProperty(this.infoClient.identity_document.pass) @@ -258,6 +261,26 @@ export default { person_id: id, }); }, + createContacts(id) { + if (this.infoClient.phone.username) + fetchWrapper.post("general/contact/create/", { + ...this.filterDataEmptyProperty(this.infoClient.phone), + person_id: id, + }); + if (this.infoClient.email.username) + fetchWrapper.post("general/contact/create/", { + ...this.filterDataEmptyProperty(this.infoClient.email), + person_id: id, + }); + this.infoClient.basic.contacts.forEach((el) => { + if (el.username) + fetchWrapper.post("general/contact/create/", { + kind: el.kind, + username: el.username, + person_id: id, + }); + }); + }, postNewClient() { const formData = new FormData(); formData.append("full_name", this.infoClient.basic.full_name); @@ -269,12 +292,14 @@ export default { let foundElement = this.prioritySettings.settings.find( (el) => el.priority === this.infoClient.basic.priority.id ); - if (foundElement) formData.append("priority", foundElement.priority); + if (foundElement.priority) + formData.append("priority", foundElement.priority); fetchWrapper .post("general/person/create/", formData, "formData") .then((result) => { this.createIdentityDocument(result.id); this.createAddress(result.id); + this.createContacts(result.id); this.addSuccessNotification(); }); this.$emit("update-client"); @@ -385,7 +410,7 @@ export default { watch: { showModal: function () { if (this.showModal === false) { - this.closeModal(); + this.closeAddImage(); } }, }, diff --git a/src/pages/calendar/TheCalendar.vue b/src/pages/calendar/TheCalendar.vue index e8a4d0b..d06bca1 100644 --- a/src/pages/calendar/TheCalendar.vue +++ b/src/pages/calendar/TheCalendar.vue @@ -1,12 +1,14 @@ @@ -30,6 +30,7 @@ export default { props: { teamData: Array, isOpen: Boolean, + url: String, }, components: { BaseButton, diff --git a/src/pages/clients/TheClients.vue b/src/pages/clients/TheClients.vue index b3487ae..273ad2a 100644 --- a/src/pages/clients/TheClients.vue +++ b/src/pages/clients/TheClients.vue @@ -3,7 +3,8 @@ :open-form="openForm", :is-open-form="isOpenForm", :updated-clients="updatedClients", - @reset-updated-clients="transmitReset" + @reset-updated-clients="transmitReset", + :url="url" ) @@ -16,6 +17,7 @@ export default { openForm: Function, isOpenForm: Boolean, updatedClients: Boolean, + url: String, }, methods: { transmitReset() { diff --git a/src/pages/clients/components/ClientsTable.vue b/src/pages/clients/components/ClientsTable.vue index d521202..4ccee00 100644 --- a/src/pages/clients/components/ClientsTable.vue +++ b/src/pages/clients/components/ClientsTable.vue @@ -12,6 +12,7 @@ v-for="client in dataClients", :key="client.id", :id="client.id", + :url="url", :is-check="marked.includes(client.id)", :check="selectedCheck", :client="client", @@ -64,6 +65,7 @@ export default { openForm: Function, isOpenForm: Boolean, updatedClients: Boolean, + url: String, }, data() { diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index cb7e906..dc74cb8 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -10,7 +10,7 @@ .row-body.flex.w-full.cursor-pointer( :id="id", @click="(e) => openDetailInfo(e)", - :class="{'row-overlay-color': rowOverlay}" + :class="{'row-overlay-color': rowOverlay}", ref="rowBody" ) .check-box.flex.justify-center.items-center( @@ -26,7 +26,8 @@ :value="dataClient", :avatar="dataClient.avatar", :avatar-color="dataClient.color", - :photo="dataClient.photo" + :photo="dataClient.photo", + :url="url", :is-open-change="isOpenChange", :width="columnBody.find(el => el.name === 'fullName').width" ) @@ -81,7 +82,7 @@ ) clients-action-popup( v-if="isOpenPopup", - :open-change-data="openChangeData" + :open-change-data="openChangeData", @delete-client="transmitDeleteClient" ) client-detail-info-wrapper( @@ -172,6 +173,7 @@ export default { isCheck: Boolean, client: Object, rowOverlay: Boolean, + url: String, }, computed: { rowSize() { diff --git a/src/pages/clients/components/ClientsWrapper.vue b/src/pages/clients/components/ClientsWrapper.vue index 8ba02d7..b146d32 100644 --- a/src/pages/clients/components/ClientsWrapper.vue +++ b/src/pages/clients/components/ClientsWrapper.vue @@ -4,7 +4,8 @@ :open-form="openForm", :is-open-form="isOpenForm", :updated-clients="updatedClients", - @reset-updated-clients="transmitReset" + @reset-updated-clients="transmitReset", + :url="url" ) @@ -17,6 +18,7 @@ export default { openForm: Function, isOpenForm: Boolean, updatedClients: Boolean, + url: String, }, methods: { transmitReset() { diff --git a/src/pages/clients/components/FormCreateIdentityDocuments.vue b/src/pages/clients/components/FormCreateIdentityDocuments.vue index d938929..82b02f4 100644 --- a/src/pages/clients/components/FormCreateIdentityDocuments.vue +++ b/src/pages/clients/components/FormCreateIdentityDocuments.vue @@ -12,7 +12,7 @@ :width-input="277" ) .flex.flex-col(class="gap-y-1.5") - span.text-sm Кем и когда выдан + span.text-sm Кем выдан base-input.input-info( v-model:value="identityDocument.pass.issued_by_org", placeholder="Точно как в паспорте", @@ -47,7 +47,7 @@ .flex.flex-col(class="gap-y-1.5") span.text-sm Номер ИНН base-input.input-info( - v-mask="'##########'", + v-mask="'############'", v-model:value="identityDocument.inn.numba", placeholder="000000000000", :width-input="277" diff --git a/src/pages/clients/components/cells/TableCellBodyName.vue b/src/pages/clients/components/cells/TableCellBodyName.vue index 16658fb..86553c4 100644 --- a/src/pages/clients/components/cells/TableCellBodyName.vue +++ b/src/pages/clients/components/cells/TableCellBodyName.vue @@ -2,9 +2,9 @@ .flex.box-border.px-4.items-center.gap-x-3.w-full.text-sm(:style="{ minWidth : width + 'px' }") base-avatar(:size="36", :color="avatarColor", v-if="!photo") {{avatar}} base-avatar(:size="36", v-else) - img.h-full(:src="url + photo") + img.h-full.object-cover(:src="url + photo") span.font-semibold(v-if="!isOpenChange") {{value.fullName}} - base-input(v-if="isOpenChange" type="text" v-model:value="value.fullName" :width-input="300") + base-input(v-if="isOpenChange", type="text", v-model:value="value.fullName", :width-input="300")