2019-11-02 15:44:19 +01:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import * as React from 'react';
|
|
|
|
import WebViewScreen from "../components/WebViewScreen";
|
2019-11-07 17:58:02 +01:00
|
|
|
import i18n from "i18n-js";
|
2019-11-02 15:44:19 +01:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
navigation: Object,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-11-08 02:37:38 +01:00
|
|
|
const ROOM_URL = 'http://planex.insa-toulouse.fr/salles.php';
|
|
|
|
const PC_URL = 'http://planex.insa-toulouse.fr/sallesInfo.php';
|
|
|
|
const BIB_URL = 'https://bibbox.insa-toulouse.fr/';
|
|
|
|
const CUSTOM_CSS_GENERAL = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/rooms/customMobile.css';
|
|
|
|
const CUSTOM_CSS_Bib = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/rooms/customBibMobile.css';
|
2019-11-02 15:44:19 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class defining the app's planex screen.
|
|
|
|
* This screen uses a webview to render the planex page
|
|
|
|
*/
|
|
|
|
export default class AvailableRoomScreen extends React.Component<Props> {
|
|
|
|
|
|
|
|
customInjectedJS: string;
|
2019-11-08 02:37:38 +01:00
|
|
|
customBibInjectedJS: string;
|
2019-11-02 15:44:19 +01:00
|
|
|
|
|
|
|
constructor() {
|
|
|
|
super();
|
2019-11-08 02:37:38 +01:00
|
|
|
this.customInjectedJS =
|
|
|
|
'document.querySelector(\'head\').innerHTML += \'<meta name="viewport" content="width=device-width, initial-scale=1.0">\';' +
|
|
|
|
'document.querySelector(\'head\').innerHTML += \'<link rel="stylesheet" href="' + CUSTOM_CSS_GENERAL + '" type="text/css"/>\';' +
|
|
|
|
'let header = $(".table tbody tr:first");' +
|
2019-11-08 03:56:29 +01:00
|
|
|
'$("table").prepend("<thead></thead>");true;' + // Fix for crash on ios
|
|
|
|
'$("thead").append(header);true;';
|
2019-11-08 02:37:38 +01:00
|
|
|
|
|
|
|
this.customBibInjectedJS =
|
|
|
|
'document.querySelector(\'head\').innerHTML += \'<meta name="viewport" content="width=device-width, initial-scale=1.0">\';' +
|
2019-11-08 16:47:28 +01:00
|
|
|
'document.querySelector(\'head\').innerHTML += \'<link rel="stylesheet" href="' + CUSTOM_CSS_Bib + '" type="text/css"/>\';' +
|
|
|
|
'if ($(".hero-unit-form").length > 0 && $("#customBackButton").length === 0)' +
|
|
|
|
'$(".hero-unit-form").append("' +
|
|
|
|
'<div style=\'width: 100%; display: flex\'>' +
|
|
|
|
'<a style=\'margin: auto\' href=\'' + BIB_URL + '\'>' +
|
|
|
|
'<button id=\'customBackButton\' class=\'btn btn-primary\'>Retour</button>' +
|
|
|
|
'</a>' +
|
2019-11-09 16:50:28 +01:00
|
|
|
'</div>");true;';
|
2019-11-02 15:44:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const nav = this.props.navigation;
|
|
|
|
return (
|
|
|
|
<WebViewScreen
|
|
|
|
navigation={nav}
|
2019-11-08 02:37:38 +01:00
|
|
|
data={[
|
|
|
|
{
|
|
|
|
url: ROOM_URL,
|
|
|
|
icon: 'file-document-outline',
|
|
|
|
name: i18n.t('availableRoomScreen.normalRoom'),
|
|
|
|
customJS: this.customInjectedJS
|
|
|
|
},
|
|
|
|
{
|
|
|
|
url: PC_URL,
|
|
|
|
icon: 'monitor',
|
|
|
|
name: i18n.t('availableRoomScreen.computerRoom'),
|
|
|
|
customJS: this.customInjectedJS
|
|
|
|
},
|
|
|
|
{
|
|
|
|
url: BIB_URL,
|
|
|
|
icon: 'book',
|
|
|
|
name: i18n.t('availableRoomScreen.bibRoom'),
|
|
|
|
customJS: this.customBibInjectedJS
|
|
|
|
},
|
|
|
|
]}
|
2019-11-02 15:44:19 +01:00
|
|
|
customInjectedJS={this.customInjectedJS}
|
2019-11-07 17:58:02 +01:00
|
|
|
headerTitle={i18n.t('screens.availableRooms')}
|
2019-11-02 15:44:19 +01:00
|
|
|
hasHeaderBackButton={true}
|
2019-11-08 02:37:38 +01:00
|
|
|
hasSideMenu={false}
|
|
|
|
hasFooter={false}/>
|
2019-11-02 15:44:19 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|