diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fb3c6d5c..43a932a1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog Fab-manager - Ability to group machines by categories +- Ability to mark a machine as reservable or not - Private note on member's profile - Optional external identifier for users - Ability to disable generation of invoices at zero diff --git a/app/controllers/api/machines_controller.rb b/app/controllers/api/machines_controller.rb index 00513bd78..aabe63c92 100644 --- a/app/controllers/api/machines_controller.rb +++ b/app/controllers/api/machines_controller.rb @@ -49,7 +49,7 @@ class API::MachinesController < API::ApiController end def machine_params - params.require(:machine).permit(:name, :description, :spec, :disabled, :machine_category_id, :plan_ids, + params.require(:machine).permit(:name, :description, :spec, :disabled, :machine_category_id, :plan_ids, :reservable, plan_ids: [], machine_image_attributes: [:attachment], machine_files_attributes: %i[id attachment _destroy], advanced_accounting_attributes: %i[code analytical_section]) diff --git a/app/frontend/src/javascript/components/machines/machine-card.tsx b/app/frontend/src/javascript/components/machines/machine-card.tsx index 8bd97ae06..5a005c367 100644 --- a/app/frontend/src/javascript/components/machines/machine-card.tsx +++ b/app/frontend/src/javascript/components/machines/machine-card.tsx @@ -55,13 +55,13 @@ const MachineCard: React.FC = ({ user, machine, onShowMachine, }; return ( -
+
{machinePicture()}
{machine.name}
- {!machine.disabled && setLoading(true)} onLoadingEnd={() => setLoading(false)} diff --git a/app/frontend/src/javascript/components/machines/machine-form.tsx b/app/frontend/src/javascript/components/machines/machine-form.tsx index 54ea39dab..d777e0dae 100644 --- a/app/frontend/src/javascript/components/machines/machine-form.tsx +++ b/app/frontend/src/javascript/components/machines/machine-form.tsx @@ -110,6 +110,10 @@ export const MachineForm: React.FC = ({ action, machine, onErr id="machine_files_attributes" className="machine-files" /> + !t.disabled); // list of the FabLab machines - $scope.machines = machinesPromise; + $scope.machines = machinesPromise.filter(m => !m.disabled && m.reservable); // List of machine categories $scope.machineCategories = machineCategoriesPromise; @@ -712,7 +712,7 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui $scope.end = end; // machines list - $scope.machines = machinesPromise.filter(function (m) { return !m.disabled; }); + $scope.machines = machinesPromise.filter(function (m) { return !m.disabled && m.reservable; }); // trainings list $scope.trainings = trainingsPromise.filter(function (t) { return !t.disabled; }); diff --git a/app/frontend/src/javascript/models/machine.ts b/app/frontend/src/javascript/models/machine.ts index 392538719..9e1488c0e 100644 --- a/app/frontend/src/javascript/models/machine.ts +++ b/app/frontend/src/javascript/models/machine.ts @@ -18,6 +18,7 @@ export interface Machine { description?: string, spec?: string, disabled: boolean, + reservable: boolean, slug: string, machine_image_attributes?: FileType, machine_files_attributes?: Array, diff --git a/app/frontend/src/stylesheets/modules/machines/machine-card.scss b/app/frontend/src/stylesheets/modules/machines/machine-card.scss index 42be73755..805693ae9 100644 --- a/app/frontend/src/stylesheets/modules/machines/machine-card.scss +++ b/app/frontend/src/stylesheets/modules/machines/machine-card.scss @@ -113,7 +113,10 @@ &.disabled { opacity: 0.5; + } + &.disabled, + &.unreservable { .machine-actions > span { width: 100%; } diff --git a/app/frontend/templates/machines/show.html b/app/frontend/templates/machines/show.html index be0839103..a56e8f9c9 100644 --- a/app/frontend/templates/machines/show.html +++ b/app/frontend/templates/machines/show.html @@ -15,7 +15,7 @@
-