misc_pterodactyl-panel/resources/views/admin/locations/index.blade.php

89 lines
3.2 KiB
PHP
Raw Normal View History

2016-01-11 00:22:21 +00:00
@extends('layouts.admin')
@section('title')
Location List
@endsection
@section('content')
<div class="col-md-12">
<ul class="breadcrumb">
<li><a href="/admin">Admin Control</a></li>
<li class="active">Locations</li>
</ul>
2016-01-11 00:22:21 +00:00
<h3>All Locations</h3><hr />
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Location</th>
2016-01-11 00:22:21 +00:00
<th>Description</th>
<th class="text-center">Nodes</th>
2016-01-11 00:22:21 +00:00
<th class="text-center">Servers</th>
2016-01-17 03:29:35 +00:00
<th class="text-center"></th>
<th class="text-center"></th>
</tr>
</thead>
<tbody>
@foreach ($locations as $location)
<tr>
2016-01-17 03:29:35 +00:00
<td><code>{{ $location->short }}</code></td>
2016-01-11 00:22:21 +00:00
<td>{{ $location->long }}</td>
<td class="text-center">{{ $location->a_nodeCount }}</td>
<td class="text-center">{{ $location->a_serverCount }}</td>
2016-01-17 03:29:35 +00:00
<td class="text-center"><a href="#edit"><i class="fa fa-wrench" data-action="edit" data-id="{{ $location->id }}" data-short="{{ $location->short }}" data-long="{{ $location->long }}"></i></a></td>
<td class="text-center"><a href="#delete" class="text-danger" data-action="delete" data-id="{{ $location->id }}"><i class="fa fa-trash-o"></i></a></td>
</tr>
@endforeach
</tbody>
</table>
2016-01-11 00:22:21 +00:00
<div class="row">
<div class="col-md-12 text-center">{!! $locations->render() !!}</div>
</div>
2016-01-17 03:29:35 +00:00
<div class="well">
<div class="row">
<div class="col-md-12">
<button class="btn btn-sm btn-success" id="addNewLocation">Add New Location</button>
</div>
</div>
</div>
2016-01-11 00:22:21 +00:00
</div>
<script>
$(document).ready(function () {
$('#sidebar_links').find("a[href='/admin/locations']").addClass('active');
2016-01-17 03:29:35 +00:00
$('[data-action="delete"]').click(function (event) {
event.preventDefault();
var self = $(this);
swal({
type: 'warning',
title: '',
text: 'Do you really want to delete this location?',
showCancelButton: true,
closeOnConfirm: false,
showLoaderOnConfirm: true
}, function () {
$.ajax({
method: 'DELETE',
url: '{{ route('admin.locations') }}/' + self.data('id'),
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
}).done(function () {
swal({
type: 'success',
title: '',
text: 'Location was successfully deleted.'
});
self.parent().parent().slideUp();
}).fail(function (jqXHR) {
console.error(jqXHR);
swal({
type: 'error',
title: 'Whoops!',
text: (typeof jqXHR.responseJSON !== 'undefined') ? jqXHR.responseJSON.error : 'An error occured while processing this request.'
});
});
});
});
2016-01-11 00:22:21 +00:00
});
</script>
@endsection