diff --git a/public/css/Cis4/Cis.css b/public/css/Cis4/Cis.css index 3056d36b6..91807cd02 100644 --- a/public/css/Cis4/Cis.css +++ b/public/css/Cis4/Cis.css @@ -33,6 +33,10 @@ html { background-color: var(--fhc-primary) !important; } +.fhc-primary-border-color { + border-color: var(--fhc-primary) !important; +} + .fhc-primary-highlight-bg { background-color: var(--fhc-primary-highlight) !important; } @@ -860,4 +864,12 @@ html { border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 0.5rem; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); +} + +#coodleParticipantsSearchResults { + background-color: var(--fhc-background); + border: 1px solid var(--fhc-border); +} +.coodleParticipantSearchResult:hover { + opacity: 80%; } \ No newline at end of file diff --git a/public/js/components/Cis/Coodle/Components/CoodleSurvey.js b/public/js/components/Cis/Coodle/Components/CoodleSurvey.js index c772343b9..2e427b374 100644 --- a/public/js/components/Cis/Coodle/Components/CoodleSurvey.js +++ b/public/js/components/Cis/Coodle/Components/CoodleSurvey.js @@ -1,14 +1,20 @@ -import CoodleSurveyVotingTable from "./CoodleSurveyVotingTable.js"; +import CoodleSurveyVotingTable from "./CoodleSurvey/CoodleSurveyVotingTable.js"; +import CoodleSurveyCalendar from "./CoodleSurvey/CoodleSurveyCalendar.js"; +import CoodleSurveyParticipants from "./CoodleSurvey/CoodleSurveyParticipants.js"; +import CoodleSurveyDurationSelector from "./CoodleSurvey/CoodleSurveyDurationSelector.js"; +import CoodleSurveyBasicInfo from "./CoodleSurvey/CoodleSurveyBasicInfo.js"; -import { - formatDate, - numberPadding, - addMinutesToDate, -} from "../../../../helpers/DateHelpers.js"; +import { formatDate, numberPadding } from "../../../../helpers/DateHelpers.js"; export default { name: "CoodleSurvey", - components: { CoodleSurveyVotingTable }, + components: { + CoodleSurveyVotingTable, + CoodleSurveyCalendar, + CoodleSurveyParticipants, + CoodleSurveyDurationSelector, + CoodleSurveyBasicInfo, + }, props: { survey: { type: Object | null }, uid: { type: String | null }, @@ -75,57 +81,6 @@ export default { return "New survey"; } }, - formattedSurveyDescription() { - return this.$props.survey?.description?.replaceAll("\n", "
"); - }, - formattedSurveyTimeslotDuration() { - const minutes = this.$props.survey.timeslotDuration % 60; - const hours = (this.$props.survey.timeslotDuration - minutes) / 60; - let formattedDuration = hours ? hours + " hr " : ""; - formattedDuration += minutes + " min"; - return formattedDuration; - }, - formattedSurveyEndsAt() { - if (this.$props.survey?.endsAt) { - return formatDate(this.$props.survey.endsAt); - } else { - return ""; - } - }, - formattedSurveyCreatedAt() { - if (this.$props.survey?.createdAt) { - return formatDate(this.$props.survey.createdAt); - } else { - return ""; - } - }, - formattedSurveyUpdatedAt() { - if (this.$props.survey?.updatedAt) { - return formatDate(this.$props.survey.updatedAt); - } else { - return ""; - } - }, - formattedSurveyCanceledAt() { - if (this.$props.survey?.canceledAt) { - return formatDate(this.$props.survey.canceledAt); - } else { - return ""; - } - }, - formattedSurveyCompletedAt() { - if (this.$props.survey?.completedAt) { - return formatDate(this.$props.survey.completedAt); - } else { - return ""; - } - }, - surveyCreatorProfileHref() { - return this.$router.resolve({ - name: "ProfilView", - params: { uid: this.survey?.creator?.uid }, - }).href; - }, parsedSelectedTimeslot() { return this.$props.survey?.selectedTimeslotId ? this.parseTimeslot( @@ -149,7 +104,7 @@ export default { }, watch: { survey: { - handler() { + async handler() { this.setSurveyFormData(); if (!this.survey?.id) { this.isEditInProgress = true; @@ -157,38 +112,52 @@ export default { }, deep: true, }, + isEditInProgress() { + if (!this.isEditInProgress) { + this.setSurveyFormData(); + } + }, }, methods: { setSurveyFormData() { if (this.$props.survey) { this.surveyFormData = { ...this.$props.survey }; - return; + } else { + let defaultEndsAtDate = new Date(); + defaultEndsAtDate.setDate(defaultEndsAtDate.getDate() + 7); + + this.surveyFormData = { + id: null, + creator: null, + title: "", + description: "", + timeslotDuration: 60, + maxSelections: 1, + areParticipantsAnonymized: false, + areSelectionsAnonymized: false, + selectedTimeslot: null, + endsAt: defaultEndsAtDate.toISOString().slice(0, 10), + completedAt: null, + canceledAt: null, + updatedAt: null, + createdAt: null, + timeslots: [], + participants: [], + }; } - this.surveyFormData = { - id: null, - creator: null, - title: "", - description: "", - timeslotDuration: 60, - maxSelections: 1, - areParticipantsAnonymized: false, - areSelectionsAnonymized: false, - selectedTimeslot: null, - endsAt: null, //todo: set to current date + 7 - completedAt: null, - canceledAt: null, - updatedAt: null, - createdAt: null, - timeslots: [], - participants: [], - }; + this.surveyFormData.participants.forEach( + (participant) => { + participant.isCalendarShown = false; + }, + ); }, parseTimeslot(timeslot) { const timeslotStartsAt = new Date(timeslot.startsAt + " UTC"); - const timeslotEndsAt = addMinutesToDate( - timeslotStartsAt, - this.$props.survey?.timeslotDuration ?? 0, + let timeslotEndsAt = new Date(timeslot.startsAt + " UTC"); + timeslotEndsAt.setMinutes( + timeslotEndsAt.getMinutes() + + (this.$props.survey?.timeslotDuration ?? 0), ); return { @@ -224,6 +193,10 @@ export default { console.log("canceling..."); // todo }, + submitForm() { + console.log("submitting..."); + // todo + }, }, created() { this.setSurveyFormData(); @@ -269,91 +242,65 @@ export default { - +
-
- - {{ "This survey was completed on " + formattedSurveyCompletedAt + ". " }} - - {{ - "The timeslot (((timeslot))) was selected.".replace( - "(((timeslot)))", - parsedSelectedTimeslot.weekday + - " " + - parsedSelectedTimeslot.fullDate + - " " + - parsedSelectedTimeslot.startTime + - "-" + - parsedSelectedTimeslot.endTime - ) - }} - - {{ "No timeslot was selected." }} - - - {{ "This survey was canceled on " + formattedSurveyCanceledAt + "." }} - - -
-
- {{ "Created by " }} - {{ this.$props.survey?.creator?.name }} - {{ " on " + formattedSurveyCreatedAt}} -
-
{{ "Last edited on " + formattedSurveyUpdatedAt }}
-
{{ "Planned to end on " + formattedSurveyEndsAt }}
-
-
-
-
- -
- - {{ "Proposed appointment duration: " }} - {{ formattedSurveyTimeslotDuration }} - -
-
-
- -
- - {{ "Maximum selectable timeslots: " }} - {{ $props.survey.maxSelections}} - -
-
-
- -
- - {{ "Are participants anonymized: " }} - {{ $props.survey.areParticipantsAnonymized ? "yes" : "no" }} - -
-
-
- -
- - {{ "Are votes anonymized: " }} - {{ $props.survey.areSelectionsAnonymized ? "yes" : "no" }} - -
-
-
-
+
+ +
+
+
+
+
+ +
+
+
+ + +
+
+
+
+
+
+ {{ "Cancel" }} +
+
+
+
+ {{ "Save" }} +
+
+
+
`, diff --git a/public/js/components/Cis/Coodle/Components/CoodleSurvey/CoodleSurveyBasicInfo.js b/public/js/components/Cis/Coodle/Components/CoodleSurvey/CoodleSurveyBasicInfo.js new file mode 100644 index 000000000..80388a271 --- /dev/null +++ b/public/js/components/Cis/Coodle/Components/CoodleSurvey/CoodleSurveyBasicInfo.js @@ -0,0 +1,235 @@ +import { formatDate } from "../../../../../helpers/DateHelpers.js"; + +export default { + name: "CoodleSurveyBasicInfo", + props: { + survey: Object | null, + surveyFormDataModelValue: Object | null, + parsedSelectedTimeslot: Object | null, + isEditInProgress: Boolean, + }, + emits: ["update:surveyFormDataModelValue"], + computed: { + formattedSurveyDescription() { + return this.$props.survey?.description?.replaceAll("\n", "
"); + }, + formattedSurveyTimeslotDuration() { + const minutes = this.$props.survey.timeslotDuration % 60; + const hours = (this.$props.survey.timeslotDuration - minutes) / 60; + let formattedDuration = hours ? hours + " hr " : ""; + formattedDuration += minutes + " min"; + return formattedDuration; + }, + formattedSurveyEndsAt() { + if (this.$props.survey?.endsAt) { + return formatDate(this.$props.survey.endsAt); + } else { + return ""; + } + }, + formattedSurveyCreatedAt() { + if (this.$props.survey?.createdAt) { + return formatDate(this.$props.survey.createdAt); + } else { + return ""; + } + }, + formattedSurveyUpdatedAt() { + if (this.$props.survey?.updatedAt) { + return formatDate(this.$props.survey.updatedAt); + } else { + return ""; + } + }, + formattedSurveyCanceledAt() { + if (this.$props.survey?.canceledAt) { + return formatDate(this.$props.survey.canceledAt); + } else { + return ""; + } + }, + formattedSurveyCompletedAt() { + if (this.$props.survey?.completedAt) { + return formatDate(this.$props.survey.completedAt); + } else { + return ""; + } + }, + surveyCreatorProfileHref() { + return this.$router.resolve({ + name: "ProfilView", + params: { uid: this.survey?.creator?.uid }, + }).href; + }, + surveyFormData: { + get() { + return this.$props.surveyFormDataModelValue; + }, + set(newValue) { + this.$emit("update:surveyFormDataModelValue", newValue); + }, + }, + }, + template: /*html*/ ` +
+ +