Skip to content

Commit

Permalink
Check fullscreen view
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkortas committed Jul 28, 2021
1 parent 2a4a801 commit f6c0f86
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 16 deletions.
3 changes: 3 additions & 0 deletions src/View/Components/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Table extends Component
public $requestFilters;
public $twoDimensionalHeader;
public $actionButtons;
public $fullscreen;

public function __construct(
$model = [],
Expand All @@ -28,6 +29,7 @@ public function __construct(
$indexable = [],
$tableFilters = false,
$actionButtons = false,
$fullscreen = false,
$resource = ''
)
{
Expand All @@ -41,6 +43,7 @@ public function __construct(
$this->tableFilters = $tableFilters;
$this->requestFilters = \request()->only('tableFilters')['tableFilters'] ?? [];
$this->actionButtons = $actionButtons;
$this->fullscreen = $fullscreen;
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/View/Components/Wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Wrapper extends Component
public $indexable;
public $model;
public $modelName;
public $fullscreen;

public function __construct(
$title = '',
Expand All @@ -32,7 +33,8 @@ public function __construct(
$actionButtons = true,
$items = [],
$requestFilters = [],
$modelName = []
$modelName = [],
$fullscreen = true
)
{
$this->create = $create;
Expand All @@ -47,6 +49,7 @@ public function __construct(
$this->indexable = $this->getIndexable($this->model);
$this->title = $title ?? $this->model->indexTitle ?? '';
$this->description = $description ?? $this->model->indexDescription ?? '';
$this->fullscreen = $fullscreen;
}

/**
Expand Down
20 changes: 12 additions & 8 deletions src/resources/scss/indexable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@
}

.index-full-screen {
overflow: scroll;
overflow: auto;
height: calc(100vh - 182px);
}

.index-normal-screen {
overflow: auto;
}

.index {
overflow: scroll;
}
Expand Down Expand Up @@ -93,19 +97,19 @@
position: sticky;
left: 0;
z-index: 25;

}

[scope=row]:not(.td-actions) {
background-color: #ffffff !important;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.2);
color: #000;
font-size: 0.8rem;
a {color: #000;}
}

[scope=row]:not(.td-actions) {

}
}

Expand All @@ -117,18 +121,18 @@
max-width: 150px !important;
font-size: 0.8rem;
}

.td-truncate {
max-width: 200px !important;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

tbody tr {
transition: color 0.2s;
td, th.td-actions {

border-bottom: 1px solid #eee !important;
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/resources/views/components/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
<table class="table table-hover table-borderless table-sticky">
<thead class="thead-dark thead-sticky">
<tr>

@if($fullscreen)
<th></th>
@endif
@foreach($indexable ?? [] as $path => $name)
@if(is_array($name))
<th colspan="{{count($name)}}">{{$path}}</th>
Expand All @@ -24,8 +25,9 @@
</thead>
@if($twoDimensionalHeader)
<thead class="thead-dark thead-sticky">

@if($fullscreen)
<th></th>
@endif
@foreach($indexable ?? [] as $path => $name)
@if(is_array($name))
@foreach($name ?? [] as $subPath => $subName)
Expand All @@ -42,6 +44,7 @@
<tbody>
@foreach($items ?? [] as $item)
<tr>
@if($fullscreen)
<td class="td-actions">
<div class="btn-toolbar" role="toolbar" aria-label="Możliwe akcje">
<div class="btn-group btn-group-sm" role="group" aria-label="Możliwe akcje">
Expand Down Expand Up @@ -70,7 +73,7 @@
</div>

</td>

@endif
@foreach($columns ?? [] as $path => $name)
<x-indexable-td
:columns="$columns"
Expand Down
13 changes: 9 additions & 4 deletions src/resources/views/components/wrapper.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<div class="d-sm-flex justify-content-between">

<h1 class="h5 mb-0 text-gray-800">
<h1 class="h5 mb-0 text-gray-800 @if(!$fullscreen) mb-2 @endif">
{{$title}} <small class="text-muted">{{$description}}</small>
</h1>

@if($fullscreen)
<div class="d-flex justify-content-end">
<div>
@if($create)
Expand All @@ -24,10 +26,11 @@
<x-index.pagination :attributes="$attributes" />
</div>
</div>

@endif
</div>
<div class="card shadow mb-4 index-full-screen">
<div class="card shadow mb-4 @if($fullscreen) index-full-screen @else index-normal-screen @endif">
<div class="card-body p-0">
@if($fullscreen)
<div class="table-wait w-100 h-100 d-flex justify-content-center align-items-center">
<div class="text-center">
<div class="spinner-border text-primary mb-2 font-weight-bold" style="width: 5rem; height: 5rem;" role="status">
Expand All @@ -37,7 +40,8 @@
</div>

</div>
<div class="table-data d-none">
@endif
<div class="table-data @if($fullscreen) d-none @endif">
<x-indexable-table
:model="$model"
:modelName="$modelName"
Expand All @@ -46,6 +50,7 @@
:tableFilters="$tableFilters"
:indexable="$indexable"
:actionButtons="$actionButtons"
:fullscreen="$fullscreen"
>

@isset($actions)
Expand Down

0 comments on commit f6c0f86

Please sign in to comment.