Исправила отображение контактов на записи

This commit is contained in:
Daria Golova
2023-08-25 14:26:53 +03:00
parent d1c5dc5683
commit 15e31ebcd7
10 changed files with 164 additions and 299 deletions

View File

@@ -64,7 +64,7 @@ export default {
data() {
return {
protocolData: {
date: null,
date: "",
startTime: null,
},
};
@@ -96,19 +96,27 @@ export default {
...mapActions({
createProtocol: "createProtocol",
}),
checkFormat(date) {
return date && date?.length === 10 ? date : null;
},
saveProtocol() {
if (
!Object.keys(this.protocolData).every((key) => this.protocolData[key])
) {
)
return;
}
let time = this.protocolData.startTime.split(":");
let start = moment(this.protocolData.date).hour(time[0]).minute(time[1]);
let start = moment(this.checkFormat(this.protocolData.date))
?.hour(time[0])
?.minute(time[1]);
let createdProtocol = {
start: start.isValid() ? start.format() : null,
end: start.isValid() ? start.add(30, "m").format() : null,
status: null,
};
if (
Object.keys(createdProtocol)?.some((elem) => !createdProtocol?.[elem])
)
return;
createdProtocol.status = null;
this.createProtocol(createdProtocol);
this.changeShownCreateModal(false);
this.createInspection();