1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-30 11:24:21 +01:00
fab-manager/app/assets/templates/admin/pricing/credits.html.erb

149 lines
6.4 KiB
Plaintext

<h2 class="m-t-lg" translate>{{ 'pricing.trainings' }}</h2>
<table class="table">
<thead>
<tr>
<th style="width:20%" translate>{{ 'pricing.subscription' }}</th>
<th style="width:10%" translate>{{ 'pricing.credits' }}</th>
<th style="width:50%" translate>{{ 'pricing.related_trainings' }}</th>
<th style="width:20%"></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="(planId, trainingIds) in trainingCreditsGroups" ng-init="plan = getPlanFromId(planId)" ng-hide="plan.disabled">
<td>
{{ plan | humanReadablePlanName: groups }}
</td>
<td>
<span editable-text="plan.training_credit_nb" e-form="rowform" e-name="training_credits" e-required>
{{ plan.training_credit_nb }}
</span>
</td>
<td>
<span editable-checklist="trainingIds" e-form="rowform" e-name="training_ids" e-ng-options="t.id as t.name for t in trainings" e-required>
{{ showTrainings(trainingIds) }}
</span>
</td>
<td>
<form editable-form name="rowform" onbeforesave="saveTrainingCredits($data, planId)" ng-show="rowform.$visible" class="form-buttons form-inline" shown="inserted == trainingIds">
<button type="submit" ng-disabled="rowform.$waiting" class="btn btn-warning">
<i class="fa fa-check"></i>
</button>
<button type="button" ng-disabled="rowform.$waiting" ng-click="cancelTrainingCredit(rowform)" class="btn btn-default">
<i class="fa fa-times"></i>
</button>
</form>
<div class="buttons" ng-show="!rowform.$visible">
<button class="btn btn-default" ng-click="rowform.$show()">
<i class="fa fa-edit"></i> {{ 'edit' | translate }}
</button>
</div>
</td>
</tr>
</tbody>
</table>
<h2 class="m-t-lg" translate>{{ 'pricing.machines' }}</h2>
<div class="btn-group m-t-md m-b-md">
<button type="button" class="btn btn-warning" ng-click="addMachineCredit($event)" translate>{{ 'pricing.add_a_machine_credit' }}</button>
</div>
<table class="table">
<thead>
<tr>
<th style="width:20%" translate>{{ 'pricing.machine' }}</th>
<th style="width:10%" translate>{{ 'pricing.hours' }}</th>
<th style="width:50%" translate>{{ 'pricing.related_subscriptions' }}</th>
<th style="width:20%"></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="mc in machineCredits" ng-init="plan = getPlanFromId(mc.plan_id)" ng-hide="plan.disabled">
<td>
<span editable-select="mc.creditable_id" e-name="creditable_id" e-form="rowform" e-ng-options="m.id as m.name+' ( id. '+m.id+' )' for m in machines" e-required>
{{ showCreditableName(mc) }}
</span>
</td>
<td>
<span editable-number="mc.hours" e-name="hours" e-form="rowform" e-required>
{{ mc.hours }}
</span>
</td>
<td>
<span editable-select="mc.plan_id" e-ng-options="p.id as humanReadablePlanName(p, groups, 'short') for p in enabledPlans" e-name="plan_id" e-form="rowform">
{{ plan | humanReadablePlanName: groups: 'short' }}
</span>
</td>
<td>
<form editable-form name="rowform" onbeforesave="saveMachineCredit($data, mc.id)" ng-show="rowform.$visible" class="form-buttons form-inline" shown="inserted == mc">
<button type="submit" ng-disabled="rowform.$waiting" class="btn btn-warning">
<i class="fa fa-check"></i>
</button>
<button type="button" ng-disabled="rowform.$waiting" ng-click="cancelMachineCredit(rowform, $index)" class="btn btn-default">
<i class="fa fa-times"></i>
</button>
</form>
<div class="buttons" ng-show="!rowform.$visible">
<button class="btn btn-default" ng-click="rowform.$show()">
<i class="fa fa-edit"></i> {{ 'edit' | translate }}
</button>
<button class="btn btn-danger" ng-click="removeMachineCredit($index)">
<i class="fa fa-trash-o"></i> {{ 'delete' | translate }} (!)
</button>
</div>
</td>
</tr>
</tbody>
</table>
<h2 ng-hide="fablabWithoutSpaces" class="m-t-lg" translate>{{ 'pricing.spaces' }}</h2>
<div ng-hide="fablabWithoutSpaces" class="btn-group m-t-md m-b-md">
<button type="button" class="btn btn-warning" ng-click="addSpaceCredit($event)" translate>{{ 'pricing.add_a_space_credit' }}</button>
</div>
<table ng-hide="fablabWithoutSpaces" class="table">
<thead>
<tr>
<th style="width:20%" translate>{{ 'pricing.space' }}</th>
<th style="width:10%" translate>{{ 'pricing.hours' }}</th>
<th style="width:50%" translate>{{ 'pricing.related_subscriptions' }}</th>
<th style="width:20%"></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="sc in spaceCredits" ng-init="plan = getPlanFromId(sc.plan_id)" ng-hide="plan.disabled">
<td>
<span editable-select="sc.creditable_id" e-name="creditable_id" e-form="rowform" e-ng-options="s.id as s.name for s in spaces" e-required>
{{ showCreditableName(sc) }}
</span>
</td>
<td>
<span editable-number="sc.hours" e-name="hours" e-form="rowform" e-required>
{{ sc.hours }}
</span>
</td>
<td>
<span editable-select="sc.plan_id" e-ng-options="p.id as humanReadablePlanName(p, groups, 'short') for p in enabledPlans" e-name="plan_id" e-form="rowform">
{{ plan | humanReadablePlanName: groups: 'short' }}
</span>
</td>
<td>
<form editable-form name="rowform" onbeforesave="saveSpaceCredit($data, sc.id)" ng-show="rowform.$visible" class="form-buttons form-inline" shown="inserted == sc">
<button type="submit" ng-disabled="rowform.$waiting" class="btn btn-warning">
<i class="fa fa-check"></i>
</button>
<button type="button" ng-disabled="rowform.$waiting" ng-click="cancelSpaceCredit(rowform, $index)" class="btn btn-default">
<i class="fa fa-times"></i>
</button>
</form>
<div class="buttons" ng-show="!rowform.$visible">
<button class="btn btn-default" ng-click="rowform.$show()">
<i class="fa fa-edit"></i> {{ 'edit' | translate }}
</button>
<button class="btn btn-danger" ng-click="removeSpaceCredit($index)">
<i class="fa fa-trash-o"></i> {{ 'delete' | translate }} (!)
</button>
</div>
</td>
</tr>
</tbody>
</table>