map to new back

This commit is contained in:
kandrusyak
2023-07-25 02:11:01 +03:00
parent dcaa7b7995
commit 35ff1150e7
5 changed files with 120 additions and 12497 deletions

View File

@@ -141,7 +141,7 @@ export default {
},
computed: {
dataClientsPresence() {
return this.dataClients[0]?.initialization;
return this.dataClients?.[0]?.initialization;
},
},
methods: {
@@ -184,12 +184,11 @@ export default {
}
},
async fetchDataClients() {
let response = {};
if (this.textSearch) {
response = await fetchWrapper.get(
`general/person/?last_name=${this.textSearch}&limit=${
this.limit
}&offset=${(this.currentTablePage - 1) * this.limit}`
const response = await fetchWrapper.get(
`persons/?limit=${this.limit}&offset=${
(this.currentTablePage - 1) * this.limit
}`
);
this.saveDataClients(response);
this.saveFilteredClientsCount(response);
@@ -198,8 +197,8 @@ export default {
length: this.calculatePageCount(this.filteredClientsCount),
};
} else {
response = await fetchWrapper.get(
`general/person/?limit=${this.limit}&offset=${
const response = await fetchWrapper.get(
`persons/?limit=${this.limit}&offset=${
(this.currentTablePage - 1) * this.limit
}`
);
@@ -212,18 +211,16 @@ export default {
}
},
async fetchCreatedClientData() {
fetchWrapper
.get(`general/person/${this.createdClientId}/detail/`)
.then((response) => {
this.dataClients = [response];
this.createdClientName = `${response.last_name ?? ""} ${
response?.first_name ?? ""
} ${response?.patronymic ?? ""}`;
this.paginationInfo = {
currentPage: 0,
length: 0,
};
});
fetchWrapper.get(`persons/${this.createdClientId}/`).then((response) => {
this.dataClients = [response];
this.createdClientName = `${response.last_name ?? ""} ${
response?.first_name ?? ""
} ${response?.patronymic ?? ""}`;
this.paginationInfo = {
currentPage: 0,
length: 0,
};
});
},
calculatePageCount(count) {
return Math.ceil(count / this.limit);