WIP Исправлен null при отсутствии имени, отчества
(cherry picked from commit b6d4b46eed8704d840eb0ca8c6e9e44e9b21db3a)
This commit is contained in:
@@ -45,14 +45,16 @@ export default {
|
|||||||
this.isOpenForm = false;
|
this.isOpenForm = false;
|
||||||
},
|
},
|
||||||
setUpdatedClients() {
|
setUpdatedClients() {
|
||||||
this.updatedClients = true;
|
if (this.$router.currentRoute._value.path === "/clients")
|
||||||
|
this.updatedClients = true;
|
||||||
},
|
},
|
||||||
resetUpdatedClients() {
|
resetUpdatedClients() {
|
||||||
this.updatedClients = false;
|
this.updatedClients = false;
|
||||||
this.createdClientId = "";
|
this.createdClientId = "";
|
||||||
},
|
},
|
||||||
writeCreatedClientId(id) {
|
writeCreatedClientId(id) {
|
||||||
this.createdClientId = id;
|
if (this.$router.currentRoute._value.path === "/clients")
|
||||||
|
this.createdClientId = id;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,15 +65,24 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
ownerName() {
|
ownerName() {
|
||||||
if (this.ownerData.id) {
|
if (this.ownerData.id) {
|
||||||
return `${this.ownerData.last_name} ${this.ownerData.first_name.slice(
|
let checkedFirstName =
|
||||||
0,
|
this.ownerData.first_name !== null
|
||||||
1
|
? this.ownerData.first_name[0] + "."
|
||||||
)}.${this.ownerData.patronymic.slice(0, 1)}.`;
|
: "";
|
||||||
|
let checkedPatronymic =
|
||||||
|
this.ownerData.patronymic !== null
|
||||||
|
? this.ownerData.patronymic[0] + "."
|
||||||
|
: "";
|
||||||
|
return `${this.ownerData.last_name} ${checkedFirstName}${checkedPatronymic}`;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
defaultAvatar() {
|
defaultAvatar() {
|
||||||
return `${this.ownerData.last_name[0]}${this.ownerData.first_name[0]}`;
|
let checkedFirstName =
|
||||||
|
this.ownerData.first_name !== null
|
||||||
|
? this.ownerData.first_name[0]
|
||||||
|
: this.ownerData.last_name[1];
|
||||||
|
return `${this.ownerData.last_name[0]}${checkedFirstName}`;
|
||||||
},
|
},
|
||||||
pixelsPerMinute() {
|
pixelsPerMinute() {
|
||||||
return this.pixelsPerHour / 60;
|
return this.pixelsPerHour / 60;
|
||||||
|
|||||||
@@ -210,7 +210,9 @@ export default {
|
|||||||
return time.slice(11, -4);
|
return time.slice(11, -4);
|
||||||
},
|
},
|
||||||
composeFullName(object) {
|
composeFullName(object) {
|
||||||
return `${object.last_name} ${object.first_name} ${object.patronymic}`;
|
return `${object.last_name} ${object.first_name ?? ""} ${
|
||||||
|
object.patronymic ?? ""
|
||||||
|
}`;
|
||||||
},
|
},
|
||||||
setActiveTheme() {
|
setActiveTheme() {
|
||||||
this.isActive = true;
|
this.isActive = true;
|
||||||
|
|||||||
@@ -140,7 +140,9 @@ export default {
|
|||||||
return time.slice(11, -4);
|
return time.slice(11, -4);
|
||||||
},
|
},
|
||||||
composeFullName(object) {
|
composeFullName(object) {
|
||||||
return `${object.last_name} ${object.first_name} ${object.patronymic}`;
|
return `${object.last_name} ${object.first_name ?? ""} ${
|
||||||
|
object.patronymic ?? ""
|
||||||
|
}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
@@ -357,11 +357,13 @@ export default {
|
|||||||
}
|
}
|
||||||
return counter === 0;
|
return counter === 0;
|
||||||
},
|
},
|
||||||
trimOwnerName(lastName, firsName, patronymic) {
|
trimOwnerName(lastName, firstName, patronymic) {
|
||||||
return `${lastName} ${firsName[0]}.${patronymic[0]}.`;
|
let checkedFirstName = firstName !== null ? firstName[0] + "." : "";
|
||||||
|
let checkedPatronymic = patronymic !== null ? patronymic[0] + "." : "";
|
||||||
|
return `${lastName} ${checkedFirstName}${checkedPatronymic}`;
|
||||||
},
|
},
|
||||||
trimMemberName(lastName, firsName, patronymic) {
|
trimMemberName(lastName, firstName, patronymic) {
|
||||||
return `${lastName} ${firsName} ${patronymic}`;
|
return `${lastName} ${firstName ?? ""} ${patronymic ?? ""}`;
|
||||||
},
|
},
|
||||||
async sendEventData() {
|
async sendEventData() {
|
||||||
if (!this.checkTime()) return;
|
if (!this.checkTime()) return;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
.team-card(v-for="teammate in teamData" :key="teammate.id")
|
.team-card(v-for="teammate in teamData" :key="teammate.id")
|
||||||
base-avatar(:size="32", :color="teammate.color")
|
base-avatar(:size="32", :color="teammate.color")
|
||||||
img.h-full.object-cover(:src="url + teammate.photo", alt="Team member", v-if="teammate.photo")
|
img.h-full.object-cover(:src="url + teammate.photo", alt="Team member", v-if="teammate.photo")
|
||||||
span(v-if="!teammate.photo") {{`${teammate.last_name[0]}${teammate.first_name[0]}`}}
|
span(v-if="!teammate.photo") {{teammateAvatar(teammate)}}
|
||||||
.flex.flex-col.gap-y-4.w-full(v-else, :style="{ color: 'var(--font-dark-blue-color)' }")
|
.flex.flex-col.gap-y-4.w-full(v-else, :style="{ color: 'var(--font-dark-blue-color)' }")
|
||||||
.flex.items-center.justify-between
|
.flex.items-center.justify-between
|
||||||
.flex.text-base.font-bold Команды
|
.flex.text-base.font-bold Команды
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
.flex.items-center
|
.flex.items-center
|
||||||
base-avatar(:size="32", :color="teammate.color")
|
base-avatar(:size="32", :color="teammate.color")
|
||||||
img.h-full.object-cover(:src="url + teammate.photo", alt="Team member", v-if="teammate.photo")
|
img.h-full.object-cover(:src="url + teammate.photo", alt="Team member", v-if="teammate.photo")
|
||||||
span(v-if="!teammate.photo") {{`${teammate.last_name[0]}${teammate.first_name[0]}`}}
|
span(v-if="!teammate.photo") {{teammateAvatar(teammate)}}
|
||||||
.flex.ml-2.not-italic.font-medium.text-xxs {{ changeName(teammate.last_name, teammate.first_name, teammate.patronymic) }}
|
.flex.ml-2.not-italic.font-medium.text-xxs {{ changeName(teammate.last_name, teammate.first_name, teammate.patronymic) }}
|
||||||
span.icon-change-place.cursor-pointer.w-5.flex.items-center.justify-center.w-6.h-6
|
span.icon-change-place.cursor-pointer.w-5.flex.items-center.justify-center.w-6.h-6
|
||||||
</template>
|
</template>
|
||||||
@@ -42,15 +42,22 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeName(lastName, fitstName, patronymic) {
|
changeName(lastName, firstName, patronymic) {
|
||||||
|
let checkedFirstName = firstName !== null ? firstName[0] + "." : "";
|
||||||
|
let checkedPatronymic = patronymic !== null ? patronymic[0] + "." : "";
|
||||||
return lastName.length > this.maxLengthLastName
|
return lastName.length > this.maxLengthLastName
|
||||||
? lastName.slice(0, this.maxLengthLastName) +
|
? lastName.slice(0, this.maxLengthLastName) +
|
||||||
"... " +
|
"... " +
|
||||||
fitstName[0] +
|
checkedFirstName +
|
||||||
"." +
|
checkedPatronymic
|
||||||
patronymic[0] +
|
: lastName + " " + checkedFirstName + checkedPatronymic;
|
||||||
"."
|
},
|
||||||
: lastName + " " + fitstName[0] + "." + patronymic[0] + ".";
|
teammateAvatar(teammate) {
|
||||||
|
let checkedFirstName =
|
||||||
|
teammate.first_name !== null
|
||||||
|
? teammate.first_name[0]
|
||||||
|
: teammate.last_name[1];
|
||||||
|
return `${teammate.last_name[0]}${checkedFirstName}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user