{% extends 'layouts/report.html.twig' %}
{% block title %}Domain Variations{% endblock %}
{% block report_content %}
<div class="row mb-4">
<div class="col-12 js_message_alert_report text-center">
{% for msg in app.session.flashbag.get('notification-success') %}
<div class="alert alert-success col-md-12" role="alert">
{{ msg }}
</div>
{% endfor %}
</div>
</div>
<div class="row mb-4 js-actions-bar">
<div class="col-12 text-right">
<a class="btn btn-primary" href="{{ path('variation_new') }}" title="New Domain Variation">+ New</a>
</div>
</div>
<div class="row">
<div class="col-12">
<table class="table table-striped display dt-responsive overflow-auto" id="reportTable" width="100%"
data-opsui-base-url="{{ opsui_base_url }}">
<thead>
<tr>
<th scope="col">Id</th>
<th scope="col">Domain Pools</th>
<th scope="col">Created</th>
<th scope="col">Updated</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
{% if lstVariations is empty %}
<tr>
<th colspan="8">There are no variations.</th>
</tr>
{% endif %}
{% for variation in lstVariations %}
<tr>
<td class="align-middle">{{ variation.id }}</td>
<td class="align-middle text-truncate">
<ul>
{% for domain in variation.domainPool %}
<li>{{ domain }}</li>
{% endfor %}
</ul>
</td>
<td class="align-middle">{{ variation.created|date("Y-m-d H:i:s T") }}</td>
<td class="align-middle">{{ variation.updated|date("Y-m-d H:i:s T") }}</td>
<td class="align-middle">
<a class="btn btn-primary" href="{{ path('variation_edit', {id: variation.id}) }}"
title="Edit Variation">Edit</a>
<a class="btn btn-danger" title="Delete Variation"
onclick="onDeleteButtonClicked({{ variation.id }})">Delete</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="modal modal-confirm-delete" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Confirm Deletion</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p>Do you want to delete?</p>
</div>
<div class="modal-footer">
<form action="delete" method="post">
<input type="hidden" name="variationId" id="variationId"/>
<button type="submit" class="btn btn-danger">Confirm</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</form>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
//Initialize DataTables, with no sorting on the 'details' column
$('table#reportTable').DataTable({
paging: true,
columns: [
{"name": "id", orderable: true},
{"name": "domainPool", searchable: true, orderable: true},
{"name": "created", searchable: false, orderable: true},
{"name": "updated", searchable: false, orderable: true},
{"name": "action"}
]
});
});
function onDeleteButtonClicked(id) {
$('input#variationId').val(id);
$('div.modal-confirm-delete').modal();
}
</script>
{% endblock %}