Skip to content

Commit

Permalink
Added lecture rooms status
Browse files Browse the repository at this point in the history
  • Loading branch information
orkit committed Feb 15, 2024
1 parent a0d62c2 commit d50288e
Show file tree
Hide file tree
Showing 13 changed files with 246 additions and 58 deletions.
26 changes: 26 additions & 0 deletions app/Http/Livewire/Lecturerooms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Http\Livewire;

use Livewire\Component;

class Lecturerooms extends Component
{
public $status;

public function mount()
{
$this->status = false;
}

public function show_status()
{
$this->status = !$this->status;
$this->dispatchBrowserEvent('contentChanged', ['lecturerooms' => $this->status]);
}

public function render()
{
return view('livewire.lecturerooms');
}
}
13 changes: 13 additions & 0 deletions app/Http/Livewire/Roomstatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Http\Livewire;

use Livewire\Component;

class Roomstatus extends Component
{
public function render()
{
return view('livewire.roomstatus');
}
}
18 changes: 14 additions & 4 deletions config/app.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

$file = base_path().'/systemconfig/internt.ini';
if (!file_exists($file)) {
$file = base_path().'/systemconfig/internt.ini.example';
}
$system_config = parse_ini_file($file, true);

use Illuminate\Support\Facades\Facade;
use Illuminate\Support\ServiceProvider;

Expand All @@ -16,7 +22,8 @@
|
*/

'name' => env('APP_NAME', 'Statamic'),
//'name' => env('APP_NAME', 'Statamic'),
'name' => $system_config['global']['app_name'],

/*
|--------------------------------------------------------------------------
Expand All @@ -29,7 +36,8 @@
|
*/

'env' => env('APP_ENV', 'production'),
//'env' => env('APP_ENV', 'production'),
'env' => $system_config['global']['app_env'],

/*
|--------------------------------------------------------------------------
Expand All @@ -42,7 +50,8 @@
|
*/

'debug' => (bool) env('APP_DEBUG', false),
//'debug' => (bool) env('APP_DEBUG', false),
'debug' => (bool) $system_config['global']['app_debug'],

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -70,7 +79,8 @@
|
*/

'timezone' => 'UTC',
//'timezone' => 'UTC',
'timezone' => 'Europe/Stockholm',

/*
|--------------------------------------------------------------------------
Expand Down
20 changes: 13 additions & 7 deletions config/database.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?php
$file = base_path().'/systemconfig/internt.ini';
if (!file_exists($file)) {
$file = base_path().'/systemconfig/internt.ini.example';
}
$system_config = parse_ini_file($file, true);

use Illuminate\Support\Str;

Expand All @@ -15,7 +20,8 @@
|
*/

'default' => env('DB_CONNECTION', 'mysql'),
//'default' => env('DB_CONNECTION', 'mysql'),
'default' => $system_config['database']['db'],

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -46,12 +52,12 @@
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'host' => $system_config['database']['db_host'],
'port' => $system_config['database']['db_port'],
'database' => $system_config['database']['db_database'],
'username' => $system_config['database']['db_username'],
'password' => $system_config['database']['db_password'],
'unix_socket' => $system_config['database']['db_unix_socket'],
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
Expand Down
7 changes: 6 additions & 1 deletion lang/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,10 @@
"Denied by Unit head": "Nekad av Enhetschefen",
"Returned by Unit head": "Återlämnad av Enhetschefen",
"Show": "Visa",
"Download": "Ladda ner"
"Download": "Ladda ner",
"No results found": "Inga resultat funna",
"Room Status": "Rumsstatus",
"Projector status": "Projektor status",
"Recording status": "Inspelnings status",
"Room status": "Rums status"
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"src": "node_modules/@fortawesome/fontawesome-free/webfonts/fa-v4compatibility.woff2"
},
"resources/css/site.css": {
"file": "assets/site-320d1c25.css",
"file": "assets/site-a0eb856f.css",
"isEntry": true,
"src": "resources/css/site.css"
},
Expand Down
55 changes: 39 additions & 16 deletions resources/views/home/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,29 @@
<!-- Card middle-->
<div class="md:order-1 relative border border-gray-200 dark:border-gray-800 rounded-xl">
<div class="relative overflow-hidden w-full h-full rounded-xl">
<div class="p-6 flex flex-col justify-center items-center md:min-h-[480px] text-center rounded-xl dark:border-gray-700">
<p class="bg-clip-text bg-gradient-to-l from-purple-400 to-blue-600 text-transparent text-xs font-semibold uppercase">
{{__("Scheduled for launch")}}
</p>
<span class="bg-clip-text bg-gradient-to-l from-purple-400 to-blue-600 text-transparent text-7xl font-bold">
2024
</span>
<h3 class="mt-6 text-lg md:text-xl font-semibold text-gray-800 dark:text-gray-200">
DSV Intranet
</h3>
<p class="mt-2 text-gray-500">
{{__("The DSV Intranet is under construction. Scheduled for launch 2024")}}
</p>
{{--}}
@include('lectureroom.status')
{{--}}
<livewire:lecturerooms />
<div class="p-6 mt-6 flex flex-col justify-center items-center md:min-h-[480px] text-center rounded-xl dark:border-gray-700">
<div id="middleHolder">
<p class="bg-clip-text bg-gradient-to-l from-purple-400 to-blue-600 text-transparent text-xs font-semibold uppercase">
{{__("Scheduled for launch")}}
</p>
<span class="bg-clip-text bg-gradient-to-l from-purple-400 to-blue-600 text-transparent text-7xl font-bold">
2024
</span>
<h3 class="mt-6 text-lg md:text-xl font-semibold text-gray-800 dark:text-gray-200">
DSV Intranet
</h3>
<p class="mt-2 text-gray-500">
{{__("The DSV Intranet is under construction. Scheduled for launch 2024")}}
</p>
</div>
<div id="lectureroomHolder" style="display: none;">
<livewire:roomstatus />
</div>




</div>

<div class="absolute top-0 inset-x-0 -z-[1] w-full h-full">
Expand Down Expand Up @@ -323,3 +330,19 @@
</div>
<!-- End Grid -->
</div>

<script>
let holder = document.getElementById('middleHolder');
let holderinfo = document.getElementById('lectureroomHolder');
window.addEventListener('contentChanged', e => {
if(e.detail.lecturerooms) {
holder.style.display = 'none';
holderinfo.style.display = 'block';
}
else {
holder.style.display = 'block';
holderinfo.style.display = 'none';
}
})
</script>
24 changes: 0 additions & 24 deletions resources/views/lectureroom/status.blade.php

This file was deleted.

13 changes: 13 additions & 0 deletions resources/views/livewire/lecturerooms.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div>
<div class="p-3 mt-6 flex flex-col justify-center items-center rounded-xl border border-gray-200 dark:border-gray-800">
<label class="inline-flex items-center cursor-pointer">
<input wire:click="show_status" type="checkbox" value="" class="sr-only peer" @if($status == true) checked @endif>
<div class="relative w-9 h-5 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800
rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white
after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4
after:w-4 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600">
</div>
<span class="ms-3 text-sm font-medium text-gray-900 dark:text-gray-300">{{__("Room Status")}}</span>
</label>
</div>
</div>
116 changes: 116 additions & 0 deletions resources/views/livewire/roomstatus.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<div wire:poll.visible>
<!-- TL -->
<style>
.container {
display: flex;
flex-wrap: wrap;
}
.init {
flex: 0 0 auto;
text-align: center;
width: 168px;
height: 42px;
border-radius: 5px;
margin: auto;
background: white;
position: relative;
left: 0;
display: inline-block;
margin-bottom: 40px;
}
.recorder {
flex: 0 0 auto;
text-align: center;
width: 100px;
height: 42px;
margin: auto;
position: relative;
left: 0;
margin-bottom: 40px;
}
.tab {
position: absolute;
top: -20px;
left: -3px;
background: white;
border-left: 1px solid blue;
border-top: 1px solid blue;
border-top-left-radius: 5px;
padding: 5px 10px;
z-index: 1;
}
.recordertab {
position: absolute;
border-top: 1px solid blue;
border-right: 1px solid blue;
top: -20px;
left: -3px;
padding: 5px 10px;
z-index: 1;
}
.light {
width: 28px;
height: 28px;
border-radius: 50%;
margin: 10px;
background: black;
display: inline-block;
position: relative;
z-index: 2;
}
</style>
@foreach(\Statamic\Statamic::tag('collection:roomsstatus') as $page)
<div class="container">
<a href="#" class="init">
<div class="tab">
<p class="mb-2 text-sm font-semibold text-blue-600">{!! $page->title !!}</p>
</div>

<div class="light" data-tooltip-target="first" style="@if($page->projector == true ) background: red @elseif(!empty($page->projector_status)) background: yellow @else background: green @endif"></div>
<div class="light" data-tooltip-target="second" style="@if($page->recorder == true ) background: red @elseif(!empty($page->recorder_status)) background: yellow @else background: green @endif"></div>
<div class="light" data-tooltip-target="third" style="@if($page->room == true ) background: red @elseif(!empty($page->room_status)) background: yellow @else background: green @endif"></div>
</a>
<div class="recorder">
<div class="recordertab">
<p class="mb-2 text-sm font-semibold text-blue-600">Recording</p>
</div>
<div class="mt-6">
<i class="fa-solid fa-xl fa-video-slash"></i>
</div>
</div>
<div>
<a href="{{$page->edit_url}}" >
<svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.1" d="m14.3 4.8 2.9 2.9M7 7H4a1 1 0 0 0-1 1v10c0 .6.4 1 1 1h11c.6 0 1-.4 1-1v-4.5m2.4-10a2 2 0 0 1 0 3l-6.8 6.8L8 14l.7-3.6 6.9-6.8a2 2 0 0 1 2.8 0Z"/>
</svg>
</a>
</div>
</div>

@endforeach

<!-- Tooltips -->
<div id="first" role="tooltip"
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700"
style="position: absolute; inset: auto auto 0px 0px; margin: 0px; transform: translate(1443px, 692px);"
data-popper-placement="top">{{__("Projector status")}}
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
<div id="second" role="tooltip"
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700"
style="position: absolute; inset: auto auto 0px 0px; margin: 0px; transform: translate(1443px, 692px);"
data-popper-placement="top">{{__("Recording status")}}
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
<div id="third" role="tooltip"
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700"
style="position: absolute; inset: auto auto 0px 0px; margin: 0px; transform: translate(1443px, 692px);"
data-popper-placement="top">{{__("Room status")}}
<div class="tooltip-arrow" data-popper-arrow></div>
</div>

</div>
4 changes: 2 additions & 2 deletions resources/views/navbar/navbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<div x-data="{ open: false }" class="relative flex flex-col w-full p-5 mx-auto bg-white md:items-center md:justify-between md:flex-row md:px-6 lg:px-8 dark:border-gray-600 dark:bg-gray-900">
<div class="flex flex-row items-center justify-between lg:justify-start">
<a class="text-lg tracking-tight text-black focus:outline-none focus:ring lg:text-2xl dark:text-white" href="/">
<span class="bg-clip-text bg-blue-600 text-transparent text-lg focus:ring-0 md:text-2xl lg:text-3xl md:font-bold">
{{__('DSVIntranet')}}
<span class="bg-clip-text bg-blue-600 text-transparent text-lg focus:ring-0 md:text-xl lg:text-2xl md:font-bold">
{{ config('app.name')}}
</span>
</a>
<livewire:mobileindicator />
Expand Down
2 changes: 1 addition & 1 deletion resources/views/vendor/live-search/dropdown.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class="w-full py-2 pl-10 pr-4 text-black bg-white border border-gray-200 focus:o
<hr>
</a>
@empty
<div class="block px-4 py-2">No results found</div>
<div class="block px-4 py-2">{{__("No results found")}}</div>
@endforelse
</div>
</div>
Expand Down

0 comments on commit d50288e

Please sign in to comment.