Merge branch 'ASTRA-126' into 'master'

Доделала карточки

See merge request andrusyakka/urban-couscous!452
This commit is contained in:
Daria Golova
2023-06-28 15:38:17 +00:00
6 changed files with 87 additions and 31 deletions

View File

@@ -19,8 +19,7 @@ export default {
timeCount() { timeCount() {
return ( return (
this.workingHours.end.split(":")[0] - this.workingHours.end.split(":")[0] -
this.workingHours.start.split(":")[0] + this.workingHours.start.split(":")[0]
1
); );
}, },
}, },

View File

@@ -8,7 +8,8 @@
v-for="record in filteredRecords", v-for="record in filteredRecords",
:key="record?.id", :key="record?.id",
:record="record", :record="record",
:expanded-type="expandedDisplayType" :expanded-type="expandedDisplayType",
:style="eventCardPosition(record.start, record.end)"
) )
.footer.flex.items-center.justify-center.bg-white.h-9(v-if="!expandedDisplayType") .footer.flex.items-center.justify-center.bg-white.h-9(v-if="!expandedDisplayType")
span.text-smm.color-grey 0 записей span.text-smm.color-grey 0 записей
@@ -18,12 +19,20 @@
import * as moment from "moment/moment"; import * as moment from "moment/moment";
import { recordList } from "@/pages/newCalendar/utils/calendarConfig.js"; import { recordList } from "@/pages/newCalendar/utils/calendarConfig.js";
import CalendarRecordCard from "@/pages/newCalendar/components/CalendarRecordCard.vue"; import CalendarRecordCard from "@/pages/newCalendar/components/CalendarRecordCard.vue";
import { verifyTime } from "@/pages/newCalendar/utils/calendarFunctions.js";
export default { export default {
name: "CalendarColumn", name: "CalendarColumn",
components: { CalendarRecordCard }, components: { CalendarRecordCard },
props: { props: {
date: Object, date: Object,
expandedDisplayType: Boolean, expandedDisplayType: Boolean,
dayEndTime: Number,
dayStartTime: Number,
},
data() {
return {
pixelsPerHour: 76,
};
}, },
computed: { computed: {
filteredRecords() { filteredRecords() {
@@ -33,11 +42,37 @@ export default {
this.date.format("YYYY-MM-DD") this.date.format("YYYY-MM-DD")
); );
}, },
pixelsPerMinute() {
return this.pixelsPerHour / 60;
},
}, },
methods: { methods: {
transformDayName(name) { transformDayName(name) {
return name[0]?.toUpperCase() + name?.slice(1); return name[0]?.toUpperCase() + name?.slice(1);
}, },
eventCardPosition(startTime, endTime) {
let start = startTime
.slice(11, -4)
.split(":")
.map((elem) => parseInt(elem, 10));
let end = endTime.slice(11, -4);
let position =
(start[0] - this.dayStartTime) * this.pixelsPerHour +
start[1] * this.pixelsPerMinute +
4;
if (
parseInt(start[0], 10) < this.dayStartTime ||
verifyTime(end) > this.dayEndTime
) {
return {
top: "0px",
visibility: "hidden",
};
}
return {
top: `${position}px`,
};
},
}, },
}; };
</script> </script>
@@ -45,7 +80,6 @@ export default {
<style lang="sass" scoped> <style lang="sass" scoped>
.calendar-column-wrapper .calendar-column-wrapper
border-right: 1px solid var(--border-light-grey-color) border-right: 1px solid var(--border-light-grey-color)
width: 380px
&:last-child &:last-child
border-right: none border-right: none

View File

@@ -1,5 +1,5 @@
<template lang="pug"> <template lang="pug">
.card-wrapper.w-full.flex.gap-y-2px.flex-col .card-wrapper.flex.gap-y-2px.flex-col.absolute
.header.w-full.flex.gap-x-2px.text-sm .header.w-full.flex.gap-x-2px.text-sm
.first-item.color-black.justify-center.gap-x-2(:class="timeClass") .first-item.color-black.justify-center.gap-x-2(:class="timeClass")
span.font-semibold.color-black(v-if="expandedType || expandedTime") {{ recordTime }} span.font-semibold.color-black(v-if="expandedType || expandedTime") {{ recordTime }}
@@ -16,19 +16,16 @@
@click="changeTimeDisplay(true)" @click="changeTimeDisplay(true)"
) )
.color-black.pl-4.flex-1.font-semibold.py-6px.relative( .color-black.pl-4.flex-1.font-semibold.py-6px.relative(
:class="{'pl-6px': expandedTime}" :class="{'pl-6px collapsed-name': expandedTime}"
)
.flex.items-center(
:class="{'collapsed-name': expandedTime}"
) {{trimPatientName(record?.member?.last_name, record?.member?.first_name, record?.member?.patronymic)}} ) {{trimPatientName(record?.member?.last_name, record?.member?.first_name, record?.member?.patronymic)}}
.gradient.absolute.w-5.h-full.right-0(v-if="expandedTime") .gradient.absolute.w-5.h-full.right-0(v-if="expandedTime")
.info-block.justify-center .info-block.justify-center
img.w-5.h-5(:src="recordingStatus?.icon") img.w-5.h-5(:src="recordingStatus?.icon")
.last-item.info-block.justify-center(v-if="expandedType") .last-item.info-block.justify-center(v-if="expandedType")
img.w-5.h-5(:src="medicalСardStatus?.icon") img.w-5.h-5(:src="medicalСardStatus?.icon")
.body.background-grey.flex.flex-col.justify-between.pl-4.pr-2.py-10px.color-grey( .body.background-grey.flex.flex-col.justify-between.pl-4.pr-2.color-grey(
:style="bodyHeight", :style="bodyHeight",
:class="{'py-6px': collapsedDisplayCondition}" :class="bodyPadding"
) )
.flex.gap-x-14(:class="bodyClass") .flex.gap-x-14(:class="bodyClass")
.flex.gap-x-2.items-center( .flex.gap-x-2.items-center(
@@ -59,7 +56,7 @@ export default {
}, },
data() { data() {
return { return {
pixelsPerHalfHour: 33, pixelsPerHalfHour: 38,
servicesCount: 4, servicesCount: 4,
trimPatientName: trimName, trimPatientName: trimName,
expandedTime: false, expandedTime: false,
@@ -113,7 +110,7 @@ export default {
let halfHourCount = parseInt(this.recordDuration / 30, 10) - 1; let halfHourCount = parseInt(this.recordDuration / 30, 10) - 1;
if (halfHourCount) if (halfHourCount)
return { return {
height: `${36 + 40 * (halfHourCount - 1)}px`, height: `${this.pixelsPerHalfHour * halfHourCount}px`,
}; };
return { return {
display: "none", display: "none",
@@ -140,6 +137,15 @@ export default {
collapsed: true, collapsed: true,
}; };
}, },
bodyPadding() {
return this.collapsedDisplayCondition
? {
"py-6px": true,
}
: {
"py-10px": true,
};
},
}, },
methods: { methods: {
changeTimeDisplay(value) { changeTimeDisplay(value) {
@@ -155,6 +161,8 @@ export default {
</script> </script>
<style lang="sass" scoped> <style lang="sass" scoped>
.card-wrapper
width: calc(100% - 8px)
.header .header
height: 30px height: 30px
& > div & > div
@@ -169,7 +177,6 @@ export default {
.collapsed .collapsed
width: 30px width: 30px
.collapsed-name .collapsed-name
width: 30px
overflow: hidden overflow: hidden
white-space: nowrap white-space: nowrap
.gradient .gradient

View File

@@ -4,13 +4,15 @@
) )
calendar-header.w-full.mb-1(v-model="displayType") calendar-header.w-full.mb-1(v-model="displayType")
.schedule-body.h-full.bg-white.w-full .schedule-body.h-full.bg-white.w-full
.column-wrapper.flex.ml-20(:style="expandedDisplayType ? columnWrapperWidth : {}") .column-wrapper.flex.ml-20(:style="columnWrapperWidth")
calendar-column( calendar-column(
v-for="date in dateRange", v-for="date in dateRange",
:key="date", :key="date",
:date="date", :date="date",
:style="columnHeight", :style="columnHeight",
:expanded-display-type="expandedDisplayType" :expanded-display-type="expandedDisplayType",
:day-start-time="validateStartTime"
:day-end-time="validateEndTime"
) )
.flex.relative( .flex.relative(
:style="expandedDisplayType ? backgroundWrapperWidth : {}", :style="expandedDisplayType ? backgroundWrapperWidth : {}",
@@ -40,7 +42,10 @@ import CalendarHeader from "@/pages/newCalendar/components/CalendarHeader";
import CalendarBackground from "@/pages/newCalendar/components/CalendarBackground.vue"; import CalendarBackground from "@/pages/newCalendar/components/CalendarBackground.vue";
import CalendarClockColumn from "@/pages/newCalendar/components/CalendarClockColumn.vue"; import CalendarClockColumn from "@/pages/newCalendar/components/CalendarClockColumn.vue";
import CalendarColumn from "@/pages/newCalendar/components/CalendarColumn.vue"; import CalendarColumn from "@/pages/newCalendar/components/CalendarColumn.vue";
import { convertTime } from "@/pages/newCalendar/utils/calendarFunctions.js"; import {
convertTime,
verifyTime,
} from "@/pages/newCalendar/utils/calendarFunctions.js";
import { mapState } from "vuex"; import { mapState } from "vuex";
import * as moment from "moment/moment"; import * as moment from "moment/moment";
export default { export default {
@@ -99,23 +104,33 @@ export default {
return range; return range;
}, },
validateStartTime() { validateStartTime() {
return this.verifyTime(this.workingHours.start); return verifyTime(this.workingHours.start);
}, },
validateEndTime() { validateEndTime() {
return this.verifyTime(this.workingHours.end); return verifyTime(this.workingHours.end);
}, },
columnHeight() { columnHeight() {
return this.expandedDisplayType return this.expandedDisplayType
? { ? {
height: `${this.timeCoil.length * this.pixelsPerHour + 60}px`, height: `${this.timeCoil.length * this.pixelsPerHour + 60}px`,
width: "380px",
} }
: { : {
height: `${this.timeCoil.length * this.pixelsPerHour + 96}px`, height: `${this.timeCoil.length * this.pixelsPerHour + 96}px`,
width: this.openSidebar
? `calc((100vw - 320px - 80px) / ${this.dateRange.length})`
: `calc((100vw - 160px - 80px) / ${this.dateRange.length})`,
}; };
}, },
columnWrapperWidth() { columnWrapperWidth() {
return { return this.expandedDisplayType
? {
width: `${380 * this.dateRange.length}px`, width: `${380 * this.dateRange.length}px`,
}
: {
width: this.openSidebar
? "calc(100vw - 320px - 80px)"
: "calc(100vw - 160px - 80px)",
}; };
}, },
backgroundWrapperWidth() { backgroundWrapperWidth() {
@@ -135,17 +150,12 @@ export default {
}, },
}, },
methods: { methods: {
verifyTime(dayTime) {
let timeArray = dayTime.split(":").map((elem) => parseInt(elem, 10));
let newTime = timeArray[1] > 30 ? timeArray[0] + 1 : timeArray[0];
return newTime;
},
changeCurrentTime() { changeCurrentTime() {
this.currentTime = moment().format("HH:mm:ss"); this.currentTime = moment().format("HH:mm:ss");
}, },
timeCoilInitialization() { timeCoilInitialization() {
this.timeCoil = []; this.timeCoil = [];
for (let i = this.validateStartTime; i <= this.validateEndTime; i++) { for (let i = this.validateStartTime; i < this.validateEndTime; i++) {
if ( if (
i === this.hours && i === this.hours &&
this.hours !== this.validateEndTime && this.hours !== this.validateEndTime &&

View File

@@ -7,3 +7,9 @@ export function trimName(lastName, firstName, patronymic) {
let checkedPatronymic = patronymic !== null ? patronymic[0] + "." : ""; let checkedPatronymic = patronymic !== null ? patronymic[0] + "." : "";
return `${lastName} ${checkedFirstName}${checkedPatronymic}`; return `${lastName} ${checkedFirstName}${checkedPatronymic}`;
} }
export function verifyTime(dayTime) {
let timeArray = dayTime.split(":").map((elem) => parseInt(elem, 10));
let newTime = timeArray[1] >= 30 ? timeArray[0] + 1 : timeArray[0];
return newTime;
}

View File

@@ -4,7 +4,7 @@ const state = () => ({
currentDate: moment(), currentDate: moment(),
workingHours: { workingHours: {
start: "8:00", start: "8:00",
end: "18:00", end: "19:00",
}, },
selectedDates: { selectedDates: {
from: moment().clone().startOf("week"), from: moment().clone().startOf("week"),