1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

Fix a bug: hide project categories filter if there is no project categories, Improvement : dialog confirm to remove a project category

This commit is contained in:
Nicolas Florentin 2023-07-21 10:21:08 +02:00
parent a4d6723413
commit f466826e8b
6 changed files with 26 additions and 9 deletions

View File

@ -1,6 +1,8 @@
# Changelog Fab-manager # Changelog Fab-manager
- Fix a bug: incorrect date range in statistics - Fix a bug: incorrect date range in statistics
- Fix a bug: hide project categories filter if there is no project categories
- Improvement : dialog confirm to remove a project category
## v6.0.10 2023 July 13 ## v6.0.10 2023 July 13

View File

@ -12,8 +12,8 @@
*/ */
'use strict'; 'use strict';
Application.Controllers.controller('AdminProjectsController', ['$scope', '$state', 'Component', 'Licence', 'Theme', 'ProjectCategory', 'componentsPromise', 'licencesPromise', 'themesPromise', 'projectCategoriesPromise', '_t', 'Member', 'uiTourService', 'settingsPromise', 'growl', Application.Controllers.controller('AdminProjectsController', ['$scope', '$state', 'Component', 'Licence', 'Theme', 'ProjectCategory', 'componentsPromise', 'licencesPromise', 'themesPromise', 'projectCategoriesPromise', '_t', 'Member', 'uiTourService', 'settingsPromise', 'growl', 'dialogs',
function ($scope, $state, Component, Licence, Theme, ProjectCategory, componentsPromise, licencesPromise, themesPromise, projectCategoriesPromise, _t, Member, uiTourService, settingsPromise, growl) { function ($scope, $state, Component, Licence, Theme, ProjectCategory, componentsPromise, licencesPromise, themesPromise, projectCategoriesPromise, _t, Member, uiTourService, settingsPromise, growl, dialogs) {
// Materials list (plastic, wood ...) // Materials list (plastic, wood ...)
$scope.components = componentsPromise; $scope.components = componentsPromise;
@ -136,8 +136,20 @@ Application.Controllers.controller('AdminProjectsController', ['$scope', '$state
* @param index {number} project category index in the $scope.projectCategories array * @param index {number} project category index in the $scope.projectCategories array
*/ */
$scope.removeProjectCategory = function (index) { $scope.removeProjectCategory = function (index) {
return dialogs.confirm({
resolve: {
object () {
return {
title: _t('app.admin.project_categories.delete_dialog_title'),
msg: _t('app.admin.project_categories.delete_dialog_info')
};
}
}
}
, function () { // cancel confirmed
ProjectCategory.delete($scope.projectCategories[index]); ProjectCategory.delete($scope.projectCategories[index]);
return $scope.projectCategories.splice(index, 1); $scope.projectCategories.splice(index, 1);
});
}; };
/** /**

View File

@ -15,7 +15,6 @@
</span> </span>
</td> </td>
<td> <td>
<!-- form -->
<form editable-form name="rowform" onbeforesave="saveProjectCategory($data, projectCategory.id)" ng-show="rowform.$visible" class="form-buttons form-inline" shown="inserted == projectCategory"> <form editable-form name="rowform" onbeforesave="saveProjectCategory($data, projectCategory.id)" ng-show="rowform.$visible" class="form-buttons form-inline" shown="inserted == projectCategory">
<button type="submit" ng-disabled="rowform.$waiting" class="btn btn-warning"> <button type="submit" ng-disabled="rowform.$waiting" class="btn btn-warning">
<i class="fa fa-check"></i> <i class="fa fa-check"></i>

View File

@ -61,7 +61,7 @@
<option value="" translate>{{ 'app.public.projects_list.all_themes' }}</option> <option value="" translate>{{ 'app.public.projects_list.all_themes' }}</option>
</select> </select>
<select ng-model="search.project_category_id" ng-change="setUrlQueryParams(search) && triggerSearch()" class="form-control" ng-options="pc.id as pc.name for pc in projectCategories"> <select ng-show="projectCategories.length" ng-model="search.project_category_id" ng-change="setUrlQueryParams(search) && triggerSearch()" class="form-control" ng-options="pc.id as pc.name for pc in projectCategories">
<option value="" translate>{{ projectCategoriesFilterPlaceholder }}</option> <option value="" translate>{{ projectCategoriesFilterPlaceholder }}</option>
</select> </select>

View File

@ -451,6 +451,8 @@ en:
project_categories: Categories project_categories: Categories
project_categories: project_categories:
name: "Name" name: "Name"
delete_dialog_title: "Confirmation required"
delete_dialog_info: "The associations between this category and the projects will me deleted."
projects_setting: projects_setting:
add: "Add" add: "Add"
actions_controls: "Actions" actions_controls: "Actions"

View File

@ -451,6 +451,8 @@ fr:
project_categories: Personnalisation du filtre Catégories project_categories: Personnalisation du filtre Catégories
project_categories: project_categories:
name: "Nom" name: "Nom"
delete_dialog_title: "Confirmation requise"
delete_dialog_info: "Les associations de cette catégorie avec des projets seront supprimées."
projects_setting: projects_setting:
add: "Ajouter" add: "Ajouter"
actions_controls: "Actions" actions_controls: "Actions"