Skip to content

Commit

Permalink
🗑🔧 fix(falguiere) Add treeLocation config for Falguiere's rooms + cle…
Browse files Browse the repository at this point in the history
…an code not used

GitOrigin-RevId: 081314988fcf935d962875f4fecbd3b97332bb61
  • Loading branch information
petitbenjamin authored and p-bizouard committed Feb 21, 2024
1 parent 4058336 commit b430471
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 52 deletions.
5 changes: 0 additions & 5 deletions back/src/webservice/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ async function getAvailableRooms(
To convert a date object to an ISO 8601 string, use : date.toISOString()
*/

const oStartDate = new Date(startDate);
const oEndDate = new Date(endDate);
const diffInMilliseconds = oEndDate - oStartDate;
const diffInHours = diffInMilliseconds / (1000 * 60 * 60); // Conversion en heures

const rooms = await getAllRooms(agendaClient, guid);

const availableIds = await getAvailableRoomIds(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"92": "Saclay",
"94": "Metz",
"107": "Rennes",
"1025": "Lumen"
"1025": "Lumen",
"1080": "Falguière"
},
"campus": {
"CodPro": "SIT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"92": "Saclay",
"94": "Metz",
"107": "Rennes",
"1025": "Lumen"
"1025": "Lumen",
"1080": "Falguière"
},
"campus": {
"CodPro": "SIT",
Expand Down
96 changes: 51 additions & 45 deletions front/src/components/partials/RoomResource.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// lib
import React from "react";
import PropTypes from "prop-types";
import FontAwesomeIcon from "@fortawesome/react-fontawesome";
import React from 'react';
import PropTypes from 'prop-types';
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
import {
faVideo,
faTv,
Expand All @@ -14,105 +14,111 @@ import {
faShieldAlt,
faTimesCircle,
faDoorOpen,
} from "@fortawesome/fontawesome-free-solid";
} from '@fortawesome/fontawesome-free-solid';

const RoomResource = ({ memberOf, resource, showBuilding }) => {
if (
resource.type !== "buildingAndCampus" &&
resource.type !== "wingAndFloor" &&
resource.type !== 'buildingAndCampus' &&
resource.type !== 'wingAndFloor' &&
!resource.value
) {
return null;
}

if (resource.type === "buildingAndCampus" && !showBuilding) {
if (resource.type === 'buildingAndCampus' && !showBuilding) {
return null;
}

let value = "";
let value = '';
let icon;
const classNames = ["col-12"];
const classNames = ['col-12'];

if (resource.type === "capacity") {
if (resource.type === 'capacity') {
icon = faUsers;
value = (
<span>
{resource.value}
&nbsp;personnes
</span>
);
} else if (resource.type === "buildingAndCampus") {
} else if (resource.type === 'buildingAndCampus') {
icon = faBuilding;
// value = `Bâtiment ${resource.building} (campus de ${resource.campus})`;
value = `Bâtiment ${resource.building}`;
} else if (resource.type === "wingAndFloor") {
} else if (resource.type === 'wingAndFloor') {
icon = faMapSigns;

const friendlyFloorName = {
"-1": "sous-sol",
0: "rez-de-chaussée",
1: "1er étage",
2: "2e étage",
3: "3e étage",
4: "4e étage",
5: "5e étage",
'-1': 'sous-sol',
0: 'rez-de-chaussée',
1: '1er étage',
2: '2e étage',
3: '3e étage',
4: '4e étage',
5: '5e étage',
};

if (resource.wing) {
value = `Univers ${resource.wing}, ${friendlyFloorName[resource.floor]}`;
if (friendlyFloorName[resource.floor]) {
if (resource.wing) {
value = `Univers ${resource.wing}, ${
friendlyFloorName[resource.floor]
}`;
} else {
value = `${friendlyFloorName[resource.floor]}`;
}
} else {
value = `${friendlyFloorName[resource.floor]}`;
value = 'Non défini';
}
} else if (resource.type === "video") {
} else if (resource.type === 'video') {
icon = faTv;
value = "Projection vidéo";
} else if (resource.type === "videoConference") {
value = 'Projection vidéo';
} else if (resource.type === 'videoConference') {
icon = faVideo;
value = "Visioconférence";
} else if (resource.type === "donator") {
value = 'Visioconférence';
} else if (resource.type === 'donator') {
icon = faUserCircle;
value = `Donateur : ${resource.value}`;
} else if (resource.type === "roomType") {
} else if (resource.type === 'roomType') {
icon = faChevronCircleRight;
({ value } = resource);
} else if (resource.type === "needConfirmation") {
} else if (resource.type === 'needConfirmation') {
icon = faShieldAlt;
const belongsTo =
resource.belongsTo &&
resource.belongsTo.find(({ groupId }) => memberOf.includes(groupId));
if (belongsTo) {
value = `Autorisé (${belongsTo.label})`;
classNames.push("font-weight-bold");
classNames.push("text-success");
classNames.push('font-weight-bold');
classNames.push('text-success');
} else {
value = "Nécessite validation";
value = 'Nécessite validation';
if (resource.belongsTo && resource.belongsTo.length > 0) {
value = `${value} (${resource.belongsTo
.map(({ label }) => label)
.join(" ou ")})`;
.join(' ou ')})`;
}
classNames.push("font-weight-bold");
classNames.push("custom-text-color-cs");
classNames.push('font-weight-bold');
classNames.push('custom-text-color-cs');
}
} else if (resource.type === "notAvailable") {
} else if (resource.type === 'notAvailable') {
icon = faTimesCircle;
value = "Non disponible à cet horaire";
} else if (resource.type === "videoRecording") {
value = 'Non disponible à cet horaire';
} else if (resource.type === 'videoRecording') {
icon = faCamera;
value = "Captation vidéo";
} else if (resource.type === "openSpace") {
value = 'Captation vidéo';
} else if (resource.type === 'openSpace') {
icon = faDoorOpen;
value = "Espace ouvert";
classNames.push("text-success");
} else if (resource.type === "modular") {
value = 'Espace ouvert';
classNames.push('text-success');
} else if (resource.type === 'modular') {
icon = faDoorOpen;
value = "Salle décloisonnée";
value = 'Salle décloisonnée';
}

return (
<li>
<div className="row no-gutters">
<div className={classNames.join(" ")}>
<div className={classNames.join(' ')}>
<FontAwesomeIcon icon={icon} />
&nbsp;&nbsp;
{value}
Expand Down

0 comments on commit b430471

Please sign in to comment.