Files
powerfulcomputermanager/admin/templates/admingroup.tmpl

150 lines
6.4 KiB
Cheetah

{# -*- coding: utf-8 -*- #}
{% extends 'baseadmin.tmpl' %}
{% block content %}
<!-- Modal Delete Computer From Group -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<form method="get" action="/admin/group/delcomputer">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Delete computer from Group {{groupname}}</h5>
</div>
<div class="modal-body">
<div class="form-group">
<input type="text" readonly="readonly" class="form-control" hidden="hidden" name="groupid" id="groupid" value="{{groupid}}"/>
<p>Are you sure?<br>
<label for="computername" class="col-form-label">Computer:</label>
</div>
<input type="text" readonly="readonly" class="form-control" name="computernamedel" id="computernamedel">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-danger">Delete</button>
</div>
</div>
</form>
</div>
</div>
<!-- Modal Add Computer To Group -->
<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/group/addcomputer">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modalAddLabel">Add computer to Group {{groupname}}</h5>
</div>
<div class="modal-body">
<div class="form-group">
<p>Add computer to group {{groupname}}<br>
<input type="text" readonly="readonly" class="form-control" hidden="hidden" name="groupid" value="{{groupid}}"/>
<label for="computername2" class="col-form-label">Computer:</label>
<select class="form-control" name="computeridadd" id="computeridadd">
{% for item in computers %}
<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>
<!-- Modal Add Cook To Group -->
<div class="modal fade" id="modalAddCook" tabindex="-1" role="dialog" aria-labelledby="modalAddCookLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<form method="get" action="/admin/group/addcook">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modalAddCookLabel">Add Cook to Group {{groupname}}</h5>
</div>
<div class="modal-body">
<div class="form-group">
<p>Add cook to group {{groupname}}<br>
<input type="text" readonly="readonly" class="form-control" hidden="hidden" name="groupid" value="{{groupid}}"/>
<label for="cookname" class="col-form-label">Cook name:</label>
<select class="form-control" name="cooknameadd" id="cooknameadd">
{% for item in allcooks %}
<option value="{{item.0}}">{{item.0}}</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>Computers of group {{groupname}}</h2>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>#</th>
<th>Computer Name</th>
<th style="align:right">Delete computer from Group</th>
</tr>
</thead>
<tbody>
{% for item in datagroup %} {#['ID_C','Name']#}
<tr>
<td style='width:64px'>{{item.0}}</td>
<td><a href="/admin/computer?ID_C={{item.0}}">{{item.1}}</a></td>
<td><a class="btn btn-outline-danger btn-sm" {#href="/admin/groupcomputerdel?ID_C={{item.0}}&ID_G={{groupid}}"#} data-wcomputer="{{item.1}}" data-toggle="modal" data-target="#exampleModal">Delete {{item.1}} from group {{groupname}}</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 computer to {{groupname}}</a></td>
</tbody>
</table>
</div>
<h2>Cooks of group {{groupname}}</h2>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>Cook Name</th>
<th style="width:64px">Cook Last Revision</th>
<th>Applied to</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3"><a class="btn btn-outline-primary btn-sm" data-toggle="modal" data-target="#modalAddCook">Add new cook to group {{groupname}}</a></td>
</tr>
{% for item in cooksdata %} {#['CookName','LastRevision','AppliedTo']#}
<tr>
<td><a href="/admin/cook?CookName={{item.0}}">{{item.0}}</a></td>
<td>{{item.1}}</td>
<td>
{% for subitem in item.2|sort(attribute='Revision')|sort(attribute='Name') %} {# item.2 = AppliedTo #}
{{subitem.Name}}{% if subitem.Revision|int < item.1|int %}<span style="color:red">({{subitem.Revision}})</span>{% elif subitem.Error > 0 %}<span style="color:orange;font-weigth:bold;font-style:italic" title="{{subitem.ErrorDesc}}">(Error r.{{subitem.Revision}})</span>{% endif %},
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script>
$('#exampleModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('wcomputer') // Extract info from data-* attributes
var modal = $(this)
//modal.find('.modal-title').text('New message to ' + recipient)
modal.find('#computernamedel').val(recipient)
})
</script>
{% endblock %}