1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

filter and hide disabled spaces in list

This commit is contained in:
Sylvain 2017-10-11 15:15:30 +02:00
parent 1c8d362f11
commit f8f45bcb69
7 changed files with 69 additions and 37 deletions

View File

@ -92,6 +92,17 @@ Application.Controllers.controller 'SpacesController', ['$scope', '$state', 'spa
##
$scope.reserveSpace = (space) ->
$state.go('app.logged.space_reserve', { id: space.slug })
## Default: we show only enabled spaces
$scope.spaceFiltering = 'enabled'
## Available options for filtering spaces by status
$scope.filterDisabled = [
'enabled',
'disabled',
'all',
]
]

View File

@ -599,12 +599,12 @@ padding: 10px;
}
}
.machine-card {
.reservable-card {
@media only screen and (min-width: 768px) {
height: 24em;
}
}
.disabled-machine {
.disabled-reservable {
opacity: 0.5 !important;
}

View File

@ -32,7 +32,7 @@
</div>
<div class="col-xs-12 col-sm-6 col-lg-4 machine-card" ng-class="{'disabled-machine' : machine.disabled && machineFiltering === 'all'}" ng-repeat="machine in machines | filterDisabled:machineFiltering">
<div class="col-xs-12 col-sm-6 col-lg-4 reservable-card" ng-class="{'disabled-reservable' : machine.disabled && machineFiltering === 'all'}" ng-repeat="machine in machines | filterDisabled:machineFiltering">
<div class="widget panel panel-default">
<div class="panel-heading picture" ng-if="!machine.machine_image" ng-click="showMachine(machine)">
<img src="data:image/png;base64," data-src="holder.js/100%x100%/text:&#xf03e;/font:FontAwesome/icon" bs-holder class="img-responsive">

View File

@ -7,13 +7,13 @@
</div>
<div class="col-xs-10 col-sm-10 col-md-8 b-l b-r-md">
<section class="heading-title">
<h1 translate>{{ 'the_spaces' }}</h1>
<h1 translate>{{ 'spaces_list.the_spaces' }}</h1>
</section>
</div>
<div class="col-xs-12 col-sm-12 col-md-3 b-t hide-b-md" ng-if="isAuthorized('admin')">
<section class="heading-actions wrapper">
<a class="btn btn-lg btn-warning bg-white b-2x rounded m-t-xs" ui-sref="app.admin.space_new" role="button" translate>{{ 'add_a_space' }}</a>
<a class="btn btn-lg btn-warning bg-white b-2x rounded m-t-xs" ui-sref="app.admin.space_new" role="button" translate>{{ 'spaces_list.add_a_space' }}</a>
</section>
</div>
</div>
@ -22,41 +22,47 @@
<section class="m-lg">
<div class="row" ng-repeat="space in (spaces.length/3 | array)">
<div class="col-xs-12 col-sm-6 col-md-4" ng-repeat="space in spaces.slice(3*$index, 3*$index + 3)">
<div class="form-group row">
<div class="input-group col-md-3 m-l-lg m-b">
<span class="input-group-addon"><i class="fa fa-filter"></i></span>
<select ng-model="spaceFiltering" class="form-control">
<option ng-repeat="status in filterDisabled" value="{{status}}" translate>{{ 'spaces_list.status_'+status }}</option>
</select>
</div>
</div>
<div class="widget panel panel-default">
<div class="panel-heading picture" ng-if="!space.space_image" ng-click="showSpace(space)">
<img src="data:image/png;base64," data-src="holder.js/100%x100%/text:&#xf03e;/font:FontAwesome/icon" bs-holder class="img-responsive">
</div>
<div class="panel-heading picture" style="background-image:url({{space.space_image}})" ng-if="space.space_image" ng-click="showSpace(space)">
</div>
<div class="panel-body">
<h1 class="text-center m-b">{{space.name}}</h1>
</div>
<div class="panel-footer no-padder">
<div class="text-center clearfix">
<div class="col-sm-6 b-r no-padder">
<div class="btn btn-default btn-block no-b padder-v red" ng-click="reserveSpace(space, $event)">
<i class="fa fa-bookmark"></i> {{ 'book' | translate }}
</div>
</div>
<div class="col-sm-6 no-padder">
<div class="btn btn-default btn-block padder-v no-b red" ng-click="showSpace(space)">
<i class="fa fa-eye"></i> {{ 'consult' | translate }}
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4 reservable-card" ng-class="{'disabled-reservable' : space.disabled && spaceFiltering === 'all'}" ng-repeat="space in spaces | filterDisabled:spaceFiltering">
<div class="widget panel panel-default">
<div class="panel-heading picture" ng-if="!space.space_image" ng-click="showSpace(space)">
<img src="data:image/png;base64," data-src="holder.js/100%x100%/text:&#xf03e;/font:FontAwesome/icon" bs-holder class="img-responsive">
</div>
<div class="panel-heading picture" style="background-image:url({{space.space_image}})" ng-if="space.space_image" ng-click="showSpace(space)">
</div>
<div class="panel-body">
<h1 class="text-center m-b">{{space.name}}</h1>
</div>
<div class="panel-footer no-padder">
<div class="text-center clearfix">
<div class="col-sm-6 b-r no-padder">
<div class="btn btn-default btn-block no-b padder-v red" ng-click="reserveSpace(space, $event)" ng-hide="space.disabled">
<i class="fa fa-bookmark m-r-xs"></i>
<span class="hidden-sm" translate>{{ 'spaces_list.book' }}</span>
</div>
</div>
<div class="no-padder" ng-class="{'col-sm-6': !space.disabled}">
<div class="btn btn-default btn-block padder-v no-b red" ng-click="showSpace(space)">
<i class="fa fa-eye m-r-xs"></i>
<span class="hidden-sm" translate>{{ 'consult' }}</span>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -270,8 +270,13 @@ en:
spaces_list:
# list of spaces
the_spaces: "The spaces"
add_a_space: "Add a space"
spaces_list:
the_spaces: "The spaces"
add_a_space: "Add a space"
status_enabled: "Enabled"
status_disabled: "Disabled"
status_all: "All"
book: "Book"
space_show:
# display the details of a space

View File

@ -272,8 +272,13 @@ fr:
spaces_list:
# liste des espaces
the_spaces: "Les espaces"
add_a_space: "Ajouter un espace"
spaces_list:
the_spaces: "Les espaces"
add_a_space: "Ajouter un espace"
status_enabled: "Activés"
status_disabled: "Désactivés"
status_all: "Tous"
book: "Réserver"
space_show:
# affichage des détails d'un espace

View File

@ -270,8 +270,13 @@ pt:
spaces_list:
# list of spaces
the_spaces: "Os espaços"
add_a_space: "Adicionar espaço"
spaces_list:
the_spaces: "Os espaços"
add_a_space: "Adicionar espaço"
status_enabled: "Ativos" # TODO
status_disabled: "Desabilitados" # TODO
status_all: "Todos" # TODO
book: "Reservar"
space_show:
# display the details of a space