Skip to content

Commit

Permalink
Merge pull request #148 from Fabszn/adjustement_on_front_end
Browse files Browse the repository at this point in the history
adjustments
  • Loading branch information
Fabszn authored Apr 3, 2024
2 parents 4e53660 + 9aa7c1e commit 3bf3ac9
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 61 deletions.
24 changes: 13 additions & 11 deletions front/src/app/components/fillPercentage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<button v-on:click="backMySlots" type="button" class="btn btn-secondary navbtn">
<font-awesome-icon icon="arrow-circle-left" />
</button>
&nbsp;
<!-- &nbsp;
<button v-on:click="sendPicture" type="button" class="btn btn-secondary navbtn">
<font-awesome-icon icon="photo-film" />
</button>
</button>-->
</div>
</div>

<b-modal id="modal-1" body-bg-variant='dark' headerBgVariant='dark' footerBgVariant='dark' button-size="sm" ok-only>
<speaker :slotId=this.$route.params.slotid />
<speaker :slotId=this.$route.params.slotid :externalSource=false />
</b-modal>

<div class="d-flex flex-column justify-content-center">
Expand Down Expand Up @@ -124,6 +124,7 @@ import CircleProgress from "vue3-circle-progress";
import { defineComponent, ref } from "@vue/runtime-core";
import { useToast } from "vue-toastification";
import speaker from "./sub/speaker.vue";
import {TrackHitInfo, Slot} from "../models"
import _ from "lodash";
import VueSlider from "vue-slider-component";
import "vue-slider-component/theme/antd.css";
Expand Down Expand Up @@ -178,13 +179,14 @@ export default defineComponent({
headers: shared.tokenHandle(),
})
.then((response) => response.json())
.then((p) => {
.then((p:TrackHitInfo) => {
this.title = p.slot.title;
this.kind = p.slot.kind;
this.room = p.slot.roomId;
this.day = p.slot.day;
this.fromTime = p.slot.fromTime;
initPercentage.bind(this)(p.hitInfo.percentage);
initPercentage.bind(this)(p.hitInfo);
if (_.isNull(p.overflow)) {
this.value = 0;
} else {
Expand Down Expand Up @@ -254,12 +256,12 @@ export default defineComponent({
},
});
function initPercentage(perc) {
if (!_.isNull(perc)) {
this.currentFill = perc;
this.currentColor = shared.colorByPercentage(perc);
if (perc == 100) {
this.switchOverflow.bind(this)(perc);
function initPercentage(hitInfo) {
if (!_.isNull(hitInfo)) {
this.currentFill = hitInfo.percentage;
this.currentColor = shared.colorByPercentage(hitInfo.percentage);
if (hitInfo.percentage == 100) {
this.switchOverflow.bind(this)(hitInfo.percentage);
}
}
}
Expand Down
58 changes: 41 additions & 17 deletions front/src/app/components/planning.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
</button>
</div>
</div>
<div class="screen-title">Planning</div>
<div>
<tabs>
<div v-for="item in items" :key="item.day">
Expand All @@ -27,11 +26,9 @@
<div v-on:click="show(slot.slot.slotId, slot.user)" v-bind:class="isAffectedClass(slot.user)"
class="block" v-for="slot in room.slots" :key="slot.slot.slotId">
<div v-if="isSlotShouldBeDisplay(slot.user)">
{{ slot.slot.fromTime }} -
{{ slot.slot.fromTime }} -
{{ slot.slot.toTime }}
<displayKind :kind="slot.slot.kind" />


<div class="affected">{{ displayUser(slot.user) }}</div>
</div>
<div v-else></div>
Expand All @@ -52,9 +49,10 @@
<div v-on:click="show(slot.slot.slotId, slot.user)" v-bind:class="isAffectedClass(slot.user)"
class="block" v-for="slot in room.slots" :key="slot.slot.slotId">
<div v-if="isSlotShouldBeDisplay(slot.user)">
{{ slot.slot.fromTime }} -
{{ slot.slot.fromTime }} -
{{ slot.slot.toTime }}
<displayKind :kind="slot.slot.kind" />

<div class="affected">{{ displayUser(slot.user) }}</div>
</div>
<div v-else></div>
Expand All @@ -74,7 +72,7 @@
<div v-on:click="show(slot.slot.slotId, slot.user)" v-bind:class="isAffectedClass(slot.user)"
class="block" v-for="slot in room.slots" :key="slot.slot.slotId">
<div v-if="isSlotShouldBeDisplay(slot.user)">
{{ slot.slot.fromTime }} -
{{ slot.slot.fromTime }} -
{{ slot.slot.toTime }}
<displayKind :kind="slot.slot.kind" />
<div class="affected">{{ displayUser(slot.user) }}</div>
Expand All @@ -96,7 +94,7 @@
<div v-on:click="show(slot.slot.slotId, slot.user)" v-bind:class="isAffectedClass(slot.user)"
class="block" v-for="slot in room.slots" :key="slot.slot.slotId">
<div v-if="isSlotShouldBeDisplay(slot.user)">
{{ slot.slot.fromTime }} -
{{ slot.slot.fromTime }} -
{{ slot.slot.toTime }}
<displayKind :kind="slot.slot.kind" />
<div class="affected">{{ displayUser(slot.user) }}</div>
Expand Down Expand Up @@ -133,19 +131,27 @@

<GDialog v-model="dialogState">
<div class="floxxmodal over">
<div class="modalinfo">
<div>
<div class="d-flex flex-row justify-content-around">
<div class="info-talk">
<p>{{ currentConf.confTitle }}</p>
<p>{{ currentConf.room }} / {{ currentConf.confKind }}</p>
<p>
{{ currentConf.fromTime }} -> {{ currentConf.toTime }} - RedCoat :
{{ actualUserNameSelected }}
</p>

<div v-if="adminState">
<v-select :options="users" v-model="selectedUser"></v-select>
</div>
</div>
<div v-if="adminState">
<v-select :options="users" v-model="selectedUser"></v-select>
<div class="speaker-list">
<p>
<p>Speaker(s)</p>
<speaker :slotId=currentConf.slotId.toString() :withPicture="false" :externalSource=true
:externalSpeaker=currentSpeakers />
</p>

</div>

</div>

<div class="buttonmodal">
Expand All @@ -166,7 +172,7 @@

<script lang="ts">
import shared from "../shared";
import { User, Conference, Mapping } from "../models";
import { User, Conference, Mapping, ISpeaker } from "../models";
import _ from "lodash";
import { defineComponent, onBeforeMount, ref, computed } from "vue";
import { Tabs, Tab } from "vue3-tabs-component";
Expand Down Expand Up @@ -200,6 +206,7 @@ export default defineComponent({
const rooms = computed(() => store.state.rooms)
const actualUserNameSelected = ref("");
const currentConf = ref(new Conference());
const currentSpeakers = ref(new Array<ISpeaker>());
function toNumber(roomId: String): number {
return _.toNumber(roomId)
Expand Down Expand Up @@ -311,7 +318,7 @@ export default defineComponent({
fetch("/api/slots/" + slotId, {
headers: shared.tokenHandle(),
})
.then((response) => response.json())
.then((response) => response.json()) //TODO to be refactor with interface
.then((p) => {
this.currentConf.updateInfo(
p.title,
Expand All @@ -323,6 +330,14 @@ export default defineComponent({
);
});
fetch("/api/speakers/" + slotId, {
headers: shared.tokenHandle(),
})
.then((response) => response.json())
.then((p: Array<ISpeaker>) => {
currentSpeakers.value = p;
});
fetch("/api/users", {
headers: shared.tokenHandle(),
})
Expand Down Expand Up @@ -362,6 +377,7 @@ export default defineComponent({
items,
actualUserNameSelected,
currentConf,
currentSpeakers,
rooms,
toNumber,
backMenu,
Expand Down Expand Up @@ -394,7 +410,7 @@ export default defineComponent({
<style scoped>
.header {
display: flex;
background-color: #61bf9b;
background-color: #044169;
padding: 14px 28px;
font-size: 20px;
cursor: pointer;
Expand Down Expand Up @@ -428,7 +444,7 @@ export default defineComponent({
.affectedBox {
font-weight: bold;
background-color: rgb(4, 55, 38) !important;
background-color: #022b53 !important;
}
.affected {
Expand All @@ -445,9 +461,17 @@ export default defineComponent({
}
@media screen and (max-width: 600px) {
.info-talk{
font-size: 12px;
}
.speaker-list{
font-size: 12px;
}
.header {
display: flex;
background-color: #61bf9b;
background-color: #044169;
padding: 7px 14px;
font-size: 10px;
cursor: pointer;
Expand Down
99 changes: 74 additions & 25 deletions front/src/app/components/sub/speaker.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
<template>
<div class="speaker p-4" v-for="item in speakers">
<b-card bodyBgVariant= 'dark'
:img-src=item.imageUrl
>

<b-card-text>
<div class="speaker">
{{ item.firstname }} {{ item.lastname }}
<div v-if="isExistsSpeaker(selectSource())">
<div class="speaker p-1" v-for="item in selectSource()">
<div v-if="params.withPicture">
<b-card bodyBgVariant='dark' :img-src=computePicture(item.imageUrl)>
<b-card-text>
<div class="speaker">
{{ item.firstname }} {{ item.lastname }}
</div>
</b-card-text>
</b-card>
</div>
<div class="speaker">

</div>
</b-card-text>
</b-card>
<div v-else>
<div class="speaker">
<ul>


<li>{{ item.firstname }} {{ item.lastname }}</li>
</ul>
</div>
</div>
</div>
</div>
<div v-else>
<div class="speaker p-2">No speaker found</div>
</div>


Expand All @@ -25,23 +32,65 @@
import { onBeforeMount, ref, Ref, defineProps } from 'vue';
import shared from "../../shared";
import { ISpeaker } from '../../models'
import _ from "lodash";
const params = defineProps({
slotId: String
slotId: {
type: String,
required: true
},
withPicture: {
type: Boolean,
default: true
},
externalSource: {
type: Boolean,
required: true
},
externalSpeaker: {
type: Array<ISpeaker>,
required: false,
default: new Array<ISpeaker>
}
});
const speakers: Ref<ISpeaker[]> = ref([])
const speakers: Ref<Array<ISpeaker>> = ref(new Array<ISpeaker>())
onBeforeMount(async () => {
function selectSource(): Array<ISpeaker> {
if (params.externalSource) {
return params.externalSpeaker;
} else {
return speakers.value;
}
}
fetch("/api/speakers/" + params.slotId, {
headers: shared.tokenHandle(),
})
.then((response) => response.json())
.then((p: ISpeaker[]) => {
speakers.value = p;
console.log(p);
});
function isExistsSpeaker(speakers: Array<ISpeaker>) {
return !_.isEmpty(speakers)
}
function computePicture(urlImage: string) {
if (_.isUndefined(urlImage) || _.isNull(urlImage)) {
return "https://vistapointe.net/images/unknown-5.jpg"
} else {
return urlImage
}
}
onBeforeMount(async () => {
if (!params.externalSource) {
fetch("/api/speakers/" + params.slotId, {
headers: shared.tokenHandle(),
})
.then((response) => response.json())
.then((p: ISpeaker[]) => {
speakers.value = p;
});
}
})
Expand Down
17 changes: 13 additions & 4 deletions front/src/app/models.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from "lodash";
import { reactive, ref } from "@vue/runtime-core";

class Hit {
export class Hit {
hitid: string;
hitSlotId: string;
percentage: number;
Expand All @@ -16,26 +16,35 @@ class Hit {
}
}

class Slot {
export class Slot {
slotId: string;
roomId: string;
fromTime: string;
toTime: string;
talk?: string;
day: string
kind: string;
title:string;
day: string;
}

class TrackHitInfo {
hitSlotId: string;
slot: Slot;
hitInfo?: Hit;
overflow:IOverflow;
constructor(hitSlotId, slot, hitInfo) {
this.hitSlotId = hitSlotId;
this.slot = slot;
this.hitInfo = hitInfo;
}
}

export interface IOverflow{
slotId:string;
level:number;
datetime:string,
affectedRoom:string
}

class User {
id: string;
label: string;
Expand Down
Loading

0 comments on commit 3bf3ac9

Please sign in to comment.