mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-03-15 12:29:16 +01:00
set active tab depending on tour step
This commit is contained in:
parent
fd62062533
commit
3d788579f1
@ -160,11 +160,10 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat
|
||||
// simplified list of machines
|
||||
$scope.machines = machinesPromise;
|
||||
|
||||
// Training to monitor, binded with drop-down selection
|
||||
$scope.monitoring =
|
||||
{ training: null };
|
||||
// Training to monitor, bound with drop-down selection
|
||||
$scope.monitoring = { training: null };
|
||||
|
||||
// list of training availabilies, grouped by date
|
||||
// list of training availabilities, grouped by date
|
||||
$scope.groupedAvailabilities = {};
|
||||
|
||||
// default: accordions are not open
|
||||
@ -183,6 +182,11 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat
|
||||
'all'
|
||||
];
|
||||
|
||||
// default tab: trainings list
|
||||
$scope.tabs = {
|
||||
active: 0
|
||||
};
|
||||
|
||||
/**
|
||||
* In the trainings listing tab, return the stringified list of machines associated with the provided training
|
||||
* @param training {Object} Training object, inherited from $resource
|
||||
@ -393,6 +397,12 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat
|
||||
placement: 'bottom',
|
||||
orphan: true
|
||||
});
|
||||
// on step change, change the active tab if needed
|
||||
uitour.on('stepChanged', function (nextStep) {
|
||||
if (nextStep.stepId === 'filter' || nextStep.stepId === 'machines') {
|
||||
$scope.tabs.active = 0;
|
||||
}
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('trainings') < 0) {
|
||||
|
@ -24,8 +24,8 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12">
|
||||
<uib-tabset justified="true">
|
||||
<uib-tab heading="{{ 'app.admin.trainings.trainings' | translate }}">
|
||||
<uib-tabset justified="true" active="tabs.active">
|
||||
<uib-tab heading="{{ 'app.admin.trainings.trainings' | translate }}" index="0">
|
||||
<div class="m-t m-b">
|
||||
<button type="button" class="btn btn-warning" ui-sref="app.admin.trainings_new">
|
||||
<i class="fa fa-plus m-r"></i>
|
||||
@ -70,7 +70,7 @@
|
||||
</table>
|
||||
</uib-tab>
|
||||
|
||||
<uib-tab heading="{{ 'app.admin.trainings.trainings_monitoring' | translate }}" class="post-tracking">
|
||||
<uib-tab heading="{{ 'app.admin.trainings.trainings_monitoring' | translate }}" class="post-tracking" index="1">
|
||||
<div class="m-lg">
|
||||
<label for="training_select" translate>{{ 'app.admin.trainings.select_a_training' }}</label>
|
||||
<select ng-options="training as training.name for training in trainings" ng-model="monitoring.training" class="form-control" ng-change="selectTrainingToMonitor()" name="training_select">
|
||||
|
Loading…
x
Reference in New Issue
Block a user