Skip to content

Commit

Permalink
feat: implement resources and rooms overview
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
  • Loading branch information
st3iny authored and GretaD committed Jul 9, 2024
1 parent 7cd4d83 commit 6d08536
Show file tree
Hide file tree
Showing 9 changed files with 803 additions and 3 deletions.
208 changes: 208 additions & 0 deletions src/components/Editor/FreeBusy/RoomAvailabilityList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
<!--
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<NcDialog :open="showDialog"
:name="t('calendar', 'Availability of rooms')"
size="large"
@update:open="(e) => $emit('update:show-dialog', e)">
<div class="modal__content__header">
<h2>{{ t('calendar', 'Find a room') }}</h2>
<table>
<tr>
<th class="name">
{{ t('calendar', 'Room name') }}
</th>
<th>&nbsp;</th>
</tr>
<tr v-for="room in rooms" :key="room.id">
<td>
<div class="item">
<div>
<div class="item-name">
{{ room.displayname }}
</div>
</div>
</div>
</td>
<td>
<div class="item-actions">
<NcButton type="secondary"
class="rooms__availability"

Check warning on line 32 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L31-L32

Added lines #L31 - L32 were not covered by tests
@click="openRoomAvailability(room)">
{{ t('calendar', 'Check room availability') }}
</NcButton>
</div>
</td>
</tr>
</table>
<div>

Check warning on line 40 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L39-L40

Added lines #L39 - L40 were not covered by tests
<RoomAvailabilityModal v-if="showRoomAvailabilityModal"
:show.sync="showRoomAvailabilityModal"
:start-date="calendarObjectInstance.startDate"
:end-date="calendarObjectInstance.endDate"
:rooms="selectedRooms"
:calendar-object-instance="calendarObjectInstance"
:organizer="currentUserPrincipalAsAttendee" />
</div>

Check warning on line 48 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L47-L48

Added lines #L47 - L48 were not covered by tests
</div>
</NcDialog>
</template>

<script>
import { NcButton, NcDialog } from '@nextcloud/vue'

Check warning on line 54 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L52-L54

Added lines #L52 - L54 were not covered by tests
import RoomAvailabilityModal from './RoomAvailabilityModal.vue'
import { mapPrincipalObjectToAttendeeObject } from '../../../models/attendee.js'
import { mapStores } from 'pinia'
import usePrincipalsStore from '../../../store/principals.js'
export default {
name: 'RoomAvailabilityList',
components: {

Check warning on line 62 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L59-L62

Added lines #L59 - L62 were not covered by tests
NcButton,
NcDialog,
RoomAvailabilityModal,
},
props: {
calendarObjectInstance: {
type: Object,
required: true,

Check warning on line 70 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L70

Added line #L70 was not covered by tests
},
startDate: {
type: Date,
required: true,
},
endDate: {
type: Date,
required: true,
},
showDialog: {
type: Boolean,
default: true,
},
},
data() {
return {
showRoomAvailabilityModal: false,
selectedRooms: [],
}
},
computed: {
...mapStores(usePrincipalsStore),

Check warning on line 92 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L91-L92

Added lines #L91 - L92 were not covered by tests
rooms() {
return this.principalsStore.getRoomPrincipals
},
/**
* Return the current user principal as a ORGANIZER attendee object.
*
* @return {object}
*/
currentUserPrincipalAsAttendee() {
return mapPrincipalObjectToAttendeeObject(
this.principalsStore.getCurrentUserPrincipal,
true,
)
},
},
methods: {
openRoomAvailability(room) {
this.selectedRooms = [room]
this.showRoomAvailabilityModal = true
},
},
}
</script>
<style scoped lang="scss">
.icon-close {
display: block;
height: 100%;

Check warning on line 119 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L118-L119

Added lines #L118 - L119 were not covered by tests
}
.modal__content {
padding: 50px;
//when the calendar is open, it's cut at the bottom, adding a margin fixes it
margin-bottom: 95px;
&__actions{
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
&__select{
width: 260px;
}
&__date{
display: flex;
justify-content: space-between;
align-items: center;
& > *{
margin-left: 5px;
}
}
}
&__header {
padding: 20px;
h3{
font-weight: 500;
}
margin-bottom: 20px;

Check warning on line 147 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L147

Added line #L147 was not covered by tests
&__attendees{
&__user-bubble{
margin-right: 5px;
}
}
}
&__footer{
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 20px;

Check warning on line 158 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L157-L158

Added lines #L157 - L158 were not covered by tests
&__title{
h3{
font-weight: 500;
}

Check warning on line 162 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L162

Added line #L162 was not covered by tests
&__timezone{
color: var(--color-text-lighter);
}
}
}
}
:deep(.vs__search ) {
text-overflow: ellipsis;
}

Check warning on line 171 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L170-L171

Added lines #L170 - L171 were not covered by tests
:deep(.mx-input) {
height: 38px !important;
}

Check warning on line 174 in src/components/Editor/FreeBusy/RoomAvailabilityList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L173-L174

Added lines #L173 - L174 were not covered by tests
</style>
<style lang="scss">
.blocking-event-free-busy {
// Show the blocking event above any other blocks, especially the *blocked for all* one
z-index: 3 !important;
}
.free-busy-block {
opacity: 0.7 !important;
}
.rooms {
&__availability {
margin-bottom: 10px;
}
}
h6 {
margin-top: 10px;
}
.item-name {
font-weight: bold;
}
.item-actions {
text-align: center;
}
.rooms__availability {
margin: 10px 0;
}
.name {
opacity: .8;
}
</style>
Loading

0 comments on commit 6d08536

Please sign in to comment.