mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-20 14:54:15 +01:00
summary screen
TODO: eventModal.html.erb:167
This commit is contained in:
parent
2cccbd3486
commit
22251e6516
@ -378,8 +378,8 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
|
||||
/**
|
||||
* Controller used in the slot creation modal window
|
||||
*/
|
||||
Application.Controllers.controller('CreateEventModalController', ['$scope', '$uibModalInstance', 'moment', 'start', 'end', 'machinesPromise', 'Availability', 'trainingsPromise', 'spacesPromise', 'Tag', 'growl', '_t',
|
||||
function ($scope, $uibModalInstance, moment, start, end, machinesPromise, Availability, trainingsPromise, spacesPromise, Tag, growl, _t) {
|
||||
Application.Controllers.controller('CreateEventModalController', ['$scope', '$uibModalInstance', '$sce', 'moment', 'start', 'end', 'machinesPromise', 'Availability', 'trainingsPromise', 'spacesPromise', 'Tag', 'growl', '_t',
|
||||
function ($scope, $uibModalInstance, $sce, moment, start, end, machinesPromise, Availability, trainingsPromise, spacesPromise, Tag, growl, _t) {
|
||||
// $uibModal parameter
|
||||
$scope.start = start;
|
||||
|
||||
@ -426,9 +426,19 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
|
||||
$scope.availability = {
|
||||
start_at: start,
|
||||
end_at: end,
|
||||
available_type: 'machines' // default
|
||||
available_type: 'machines', // default
|
||||
is_recurrent: false,
|
||||
period: 'week',
|
||||
nb_periods: 1,
|
||||
end_date: undefined // recurrence end
|
||||
};
|
||||
|
||||
// recurrent slots
|
||||
$scope.occurrences = [];
|
||||
|
||||
// localized name(s) of the reservable item(s)
|
||||
$scope.reservableName = '';
|
||||
|
||||
/**
|
||||
* Adds or removes the provided machine from the current slot
|
||||
* @param machine {Object}
|
||||
@ -583,9 +593,56 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
|
||||
return growl.error(_t('admin_calendar.select_end_date'));
|
||||
}
|
||||
}
|
||||
// settings are ok
|
||||
computeOccurrences();
|
||||
computeName();
|
||||
$scope.step++;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compute the various occurrences of the availability, according to the recurrence settings
|
||||
*/
|
||||
const computeOccurrences = function () {
|
||||
$scope.occurrences = [];
|
||||
|
||||
if ($scope.availability.is_recurrent) {
|
||||
const date = moment($scope.availability.start_at);
|
||||
const diff = moment($scope.availability.start_at).diff($scope.availability.end_at);
|
||||
const end = moment($scope.availability.end_date).endOf('day');
|
||||
while (date.isBefore(end)) {
|
||||
const occur_end = moment(date).add(diff, 'ms');
|
||||
$scope.occurrences.push({
|
||||
start_at: date.toDate(),
|
||||
end_at: occur_end.toDate()
|
||||
});
|
||||
date.add($scope.availability.nb_periods, $scope.availability.period);
|
||||
}
|
||||
} else {
|
||||
$scope.occurrences.push({
|
||||
start_at: $scope.availability.start_at,
|
||||
end_at: $scope.availability.end_at
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const computeName = function () {
|
||||
$scope.reservableName = '';
|
||||
switch ($scope.availability.available_type) {
|
||||
case 'machines':
|
||||
const reservableNames = $scope.selectedMachines.map(function (m) { return $sce.trustAsHtml(`<strong>${m.name}</strong>`); });
|
||||
$scope.reservableName = reservableNames.slice(0, -1).join(', ') + ` ${_t('and')} ` + reservableNames[reservableNames.length - 1];
|
||||
break;
|
||||
case 'training':
|
||||
$scope.reservableName = $scope.selectedTraining.name;
|
||||
break;
|
||||
case 'space':
|
||||
$scope.reservableName = $scope.selectedSpace.name;
|
||||
break;
|
||||
default:
|
||||
$scope.reservableName = '';
|
||||
}
|
||||
}
|
||||
|
||||
// !!! MUST BE CALLED AT THE END of the controller
|
||||
return initialize();
|
||||
}
|
||||
|
@ -154,7 +154,18 @@
|
||||
<div class="m-t-sm">
|
||||
<p class="text-center font-sbold" translate>{{ 'admin_calendar.summary' }}</p>
|
||||
<div class="row">
|
||||
lorem ipsum
|
||||
<span>{{ 'admin_calendar.about_to_create' | translate:{NUMBER:occurrences.length,TYPE:availability.available_type}:'messageformat'}}</span>
|
||||
<ul>
|
||||
<li ng-repeat="slot in occurrences">{{slot.start_at | amDateFormat:'L LT'}} - {{slot.end_at | amDateFormat:'LT'}}</li>
|
||||
</ul>
|
||||
<div>
|
||||
<span translate>{{ 'admin_calendar.reservable' }}</span>
|
||||
<span ng-bind-html="reservableName"></span>
|
||||
</div>
|
||||
<div class="m-t">
|
||||
<span translate>{{ 'admin_calendar.labels' }}</span>
|
||||
<span>{{availability.tag_ids.join(', ') || ('admin_calendar.none' | translate)}}</span><!-- TODO change tag_ids with a localized list of names -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -55,6 +55,10 @@ en:
|
||||
select_period: "Please select a period for the recurrence"
|
||||
select_nb_period: "Please select a number of periods for the recurrence"
|
||||
select_end_date: "Please select the date of the last occurrence"
|
||||
about_to_create: "You are about to create the following {TYPE, select, machines{machine} training{training} space{space} other{other}} {NUMBER, plural, one{slot} other{slots}}, {NAME}:" # messageFormat interpolation
|
||||
reservable: "Reservable(s):"
|
||||
labels: "Label(s):"
|
||||
none: "None"
|
||||
the_slot_START-END_has_been_successfully_deleted: "The slot {{START}} - {{END}} has been successfully deleted" # angular interpolation
|
||||
unable_to_delete_the_slot_START-END_because_it_s_already_reserved_by_a_member: "Unable to delete the slot {{START}} - {{END}} because it's already reserved by a member" # angular interpolation
|
||||
you_should_select_at_least_a_machine: "You should select at least one machine on this slot."
|
||||
|
@ -55,6 +55,10 @@ es:
|
||||
select_period: "Please select a period for the recurrence" # translation_missing
|
||||
select_nb_period: "Please select a number of periods for the recurrence" # translation_missing
|
||||
select_end_date: "Please select the date of the last occurrence" # translation_missing
|
||||
about_to_create: "You are about to create the following {TYPE, select, machines{machine} training{training} space{space} other{other}} {NUMBER, plural, one{slot} other{slots}}, {NAME}:" # messageFormat interpolation # translation_missing
|
||||
reservable: "Reservable(s):" # translation_missing
|
||||
labels: "Etiqueta(s):"
|
||||
none: "Ninguna"
|
||||
the_slot_START-END_has_been_successfully_deleted: "La ranura {{START}} - {{END}} se ha eliminado correctamente" # angular interpolation
|
||||
unable_to_delete_the_slot_START-END_because_it_s_already_reserved_by_a_member: "No se puede eliminar la ranura {{START}} - {{END}} porque ya está reservada por un miembror" # angular interpolation
|
||||
you_should_select_at_least_a_machine: "Debe seleccionar al menos una máquina en esta ranura."
|
||||
|
@ -55,6 +55,10 @@ fr:
|
||||
select_period: "Veuillez choisir une période pour la récurrence"
|
||||
select_nb_period: "Veuillez choisir un nombre de périodes pour la récurrence"
|
||||
select_end_date: "Veuillez choisir la date de dernière occurrence"
|
||||
about_to_create: "Vous vous apprêtez à créer {NUMBER, plural, one{le créneau} other{les créneaux}} {TYPE, select, machines{machine} training{formation} space{espace} other{autre}} {NAME} suivant :" # messageFormat interpolation
|
||||
reservable: "Réservable(s) :"
|
||||
labels: "Étiquette(s) :"
|
||||
none: "Aucune"
|
||||
the_slot_START-END_has_been_successfully_deleted: "Le créneau {{START}} - {{END}} a bien été supprimé" # angular interpolation
|
||||
unable_to_delete_the_slot_START-END_because_it_s_already_reserved_by_a_member: "Le créneau {{START}} - {{END}} n'a pu être supprimé car il est déjà réservé par un membre" # angular interpolation
|
||||
you_should_select_at_least_a_machine: "Vous devriez sélectionner au moins une machine pour ce créneau."
|
||||
|
@ -55,6 +55,10 @@ pt:
|
||||
select_period: "Please select a period for the recurrence" # translation_missing
|
||||
select_nb_period: "Please select a number of periods for the recurrence" # translation_missing
|
||||
select_end_date: "Please select the date of the last occurrence" # translation_missing
|
||||
about_to_create: "You are about to create the following {TYPE, select, machines{machine} training{training} space{space} other{other}} {NUMBER, plural, one{slot} other{slots}}, {NAME}:" # messageFormat interpolation # translation_missing
|
||||
reservable: "Reservable(s) :" # translation_missing
|
||||
labels: "Etiqueta(s):"
|
||||
none: "Nenhuma"
|
||||
the_slot_START-END_has_been_successfully_deleted: "O slot {{START}} - {{END}} foi deletado com sucesso" # angular interpolation
|
||||
unable_to_delete_the_slot_START-END_because_it_s_already_reserved_by_a_member: "Não é possível deletar o slot {{START}} - {{END}} porque já foi reservado por um membro" # angular interpolation
|
||||
you_should_select_at_least_a_machine: "Você deveria selecionar a última máquina neste slot."
|
||||
|
@ -79,6 +79,7 @@ en:
|
||||
to_date: "to" # context: date. eg: "from 01/01 to 01/05"
|
||||
to_time: "to" # context: time. eg. "from 18:00 to 21:00"
|
||||
or: "or"
|
||||
and: "and"
|
||||
change_my_data: "Change my data"
|
||||
sync_my_profile: "Sync my profile"
|
||||
once_your_data_are_up_to_date_: "Once your data are up to date,"
|
||||
|
@ -79,6 +79,7 @@ es:
|
||||
to_date: "Hasta" # context: date. eg: "Hasta 01/01 to 01/05"
|
||||
to_time: "Hasta" # context: time. eg. "Hasta 18:00 to 21:00"
|
||||
or: "ó"
|
||||
and: "y"
|
||||
change_my_data: "Cambiar mis datos"
|
||||
sync_my_profile: "Sincronizar mi perfil"
|
||||
once_your_data_are_up_to_date_: "Una vez sus datos hayan sido actualizados,"
|
||||
|
@ -79,6 +79,7 @@ fr:
|
||||
to_date: "au" # context: date. eg: "from 01/01 to 01/05"
|
||||
to_time: "à" # context: time. eg. "from 18:00 to 21:00"
|
||||
or: "ou"
|
||||
and: "et"
|
||||
change_my_data: "Modifier mes données"
|
||||
sync_my_profile: "Synchroniser mon profil"
|
||||
once_your_data_are_up_to_date_: "Une fois vos données à jour,"
|
||||
|
@ -79,6 +79,7 @@ pt:
|
||||
to_date: "até" # context: date. eg: "from 01/01 to 01/05"
|
||||
to_time: "até" # context: time. eg. "from 18:00 to 21:00"
|
||||
or: "ou"
|
||||
and: "e"
|
||||
change_my_data: "Alterar meus dados"
|
||||
sync_my_profile: "Sincronizar meu perfil"
|
||||
once_your_data_are_up_to_date_: "Uma vez que seus dados estão atualizados,"
|
||||
|
Loading…
x
Reference in New Issue
Block a user