Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
feat(consultation): display message
Browse files Browse the repository at this point in the history
  • Loading branch information
lemredd committed Oct 12, 2022
1 parent 761ce60 commit 9e2c785
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
5 changes: 2 additions & 3 deletions components/consultation/form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,10 @@ describe("Component: consultation/form", () => {
await flushPromises()
const selectableDayField = selectableDay.find("select")
await selectableDayField.setValue(dayOptions[1].attributes("value"))
const selectableTime = wrapper.find(".selectable-time")
const timeOptions = selectableTime.findAll("option")
const selectedDayIsPast = wrapper.find(".selected-day-is-past")

// Eliminate options that are after the current hour
expect(timeOptions.length).not.toBeGreaterThan(1)
expect(selectedDayIsPast.exists()).toBeTruthy()
})
})

Expand Down
50 changes: 27 additions & 23 deletions components/consultation/form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
</template>

<template #default>
<!-- TODO: style required field -->
<SearchableChip
v-model="selectedConsultants"
class="consultant required"
Expand All @@ -14,15 +13,14 @@
text-field-label="Type the employee to add"
kind="reachable_employee"/>

<!-- TODO: style required field -->
<div class="required">
<div v-if="selectedConsultants.length" class="required">
<SelectableOptionsField
v-if="selectedConsultants.length"
v-model="addressConsultantAs"
class="consultant-roles mb-5"
class="consultant-roles"
label="Address consultant as:"
:options="consultantRoles"/>
</div>

<SearchableChip
v-model="selectedConsulters"
:current-user-id="userProfileData.id"
Expand All @@ -32,7 +30,6 @@
text-field-label="Type the students to add"
kind="student"/>

<!-- TODO: style required field -->
<div class="required">
<SelectableOptionsField
v-model="chosenReason"
Expand All @@ -42,7 +39,6 @@
:options="reasonOptions"/>
</div>

<!-- TODO: style required field -->
<NonSensitiveTextField
v-if="hasChosenOtherReason"
v-model="otherReason"
Expand All @@ -56,7 +52,6 @@
v-if="consultantSchedules.length"
class="consultant-has-schedules">
<p>Please select the day and time from the consultant's available schedules</p>
<!-- TODO: style required field -->
<div class="required">
<SelectableOptionsField
v-model="chosenDay"
Expand All @@ -73,14 +68,18 @@
</div>
</div>


<!-- TODO: style required field -->
<div v-if="chosenDay" class="required">
<div
v-if="chosenDay"
:class="selectableTimes.length ? 'required' : ''">
<SelectableOptionsField
v-if="selectableTimes.length"
v-model="chosenTime"
class="selectable-time"
label="Time:"
:options="selectableTimes"/>
<p v-else class="selected-day-is-past text-red-500">
This consultant's schedule for this day has ended.
</p>
</div>
</div>
<div v-else class="consultant-no-schedules">
Expand Down Expand Up @@ -115,18 +114,6 @@

<style lang="scss">
@import "@styles/btn.scss";
@import "@styles/variables.scss";
.required{
&::before {
@apply text-xs;
display:block;
color: $color-primary;
content:"* required";
}
}
.btn{
border: none;
Expand Down Expand Up @@ -155,6 +142,23 @@
</style>

<style scoped lang="scss">
@import "@styles/variables.scss";
.required{
&::before {
@apply text-xs;
display:block;
color: $color-primary;
content:"* required";
}
}
.consultant-roles {
@apply mb-5;
}
.schedule-selector {
.selectable-day, .selectable-time {
margin: 1em 0 1em;
Expand Down

0 comments on commit 9e2c785

Please sign in to comment.