Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement resources and rooms overview #5961

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
kesselb marked this conversation as resolved.
Show resolved Hide resolved
<NcDialog :open="showDialog"
:name="$t('calendar', 'Search room')"
size="large"
@update:open="(e) => $emit('update:show-dialog', e)">
<div class="modal__content__header">
<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"
@click="openRoomAvailability(room)">

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
{{ $t('calendar', 'Check room availability') }}
</NcButton>
</div>
</td>
</tr>
</table>
<div>
<RoomAvailabilityModal v-if="showRoomAvailabilityModal"

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
:show.sync="showRoomAvailabilityModal"
:start-date="calendarObjectInstance.startDate"
:end-date="calendarObjectInstance.endDate"
:rooms="selectedRooms"
:calendar-object-instance="calendarObjectInstance"
:organizer="currentUserPrincipalAsAttendee" />
</div>
</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
</NcDialog>
</template>

<script>
import { NcButton, NcDialog } from '@nextcloud/vue'
import RoomAvailabilityModal from './RoomAvailabilityModal.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 { mapPrincipalObjectToAttendeeObject } from '../../../models/attendee.js'
import { mapStores } from 'pinia'
import usePrincipalsStore from '../../../store/principals.js'

export default {
name: 'RoomAvailabilityList',
components: {
NcButton,

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
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: {

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

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L89-L90

Added lines #L89 - L90 were not covered by tests
...mapStores(usePrincipalsStore),
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;

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

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L116-L117

Added lines #L116 - L117 were not covered by tests
height: 100%;
}
.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;
}

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

View check run for this annotation

Codecov / codecov/patch

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

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

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

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L155-L156

Added lines #L155 - L156 were not covered by tests
margin-top: 20px;
&__title{
h3{
font-weight: 500;

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

View check run for this annotation

Codecov / codecov/patch

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

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

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

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/FreeBusy/RoomAvailabilityList.vue#L168-L169

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

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

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L171 - L172 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
Loading