Files
powerfulcomputermanager/admin/templates/admincook.tmpl

92 lines
3.7 KiB
Cheetah

{# -*- coding: utf-8 -*- #}
{% extends 'baseadmin.tmpl' %}
{% block content %}
<!-- Modal Delete Group From Cook -->
<div class="modal fade" id="modalDelete" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<form method="get" action="/admin/cook/delgroup">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Delete group from cook {{cookname}}</h5>
</div>
<div class="modal-body">
<div class="form-group">
<input type="text" readonly="readonly" class="form-control" hidden="hidden" name="cooknamedel" id="cooknamedel" value="{{cookname}}"/>
<p>Are you sure?<br>
<label for="groupnamedel" class="col-form-label">Group:</label>
</div>
<input type="text" readonly="readonly" class="form-control" name="groupnamedel" id="groupnamedel">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-danger">Remove</button>
</div>
</div>
</form>
</div>
</div>
<!-- Modal Add Group To Cook -->
<div class="modal fade" id="modalAdd" tabindex="-1" role="dialog" aria-labelledby="modalAddLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<form method="get" action="/admin/cook/addgroup">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modalAddLabel">Add cook to Group {{groupname}}</h5>
</div>
<div class="modal-body">
<div class="form-group">
<p>Add group to cook {{cookname}}<br>
<input type="text" readonly="readonly" class="form-control" hidden="hidden" name="cooknameadd" id="cooknameadd" value="{{cookname}}"/>
<label for="groupidadd" class="col-form-label">Group:</label>
<select class="form-control" name="groupidadd" id="groupidadd">
{% for item in allgroups %}
<option value="{{item.0}}">{{item.1}}</option>
{% endfor %}
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Add</button>
</div>
</div>
</form>
</div>
</div>
<h2>Groups of cook {{cookname}}</h2>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>#</th>
<th>Group Name</th>
<th style="align:right">Delete Group from this Cook</th>
</tr>
</thead>
<tbody>
{% for item in groupscook %} {#['Name']#}
<tr>
<td style='width:64px'>{{item.0}}</td>
<td><a href="/admin/group?ID_G={{item.0}}">{{item.0}}</a></td>
<td><a class="btn btn-outline-danger btn-sm" data-wgroup="{{item.0}}" data-toggle="modal" data-target="#modalDelete">Remove group {{item.0}} from cook {{cookname}}</a></td>
</tr>
{% endfor %}
<tr>
<td>#</td>
<td colspan="2"><a class="btn btn-outline-primary btn-sm" data-toggle="modal" data-target="#modalAdd">Add group to {{cookname}}</a></td>
</tbody>
</table>
</div>
<script>
$('#modalDelete').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('wgroup') // Extract info from data-* attributes
var modal = $(this)
modal.find('#groupnamedel').val(recipient)
})
</script>
{% endblock %}