Files
opensem/resources/views/users/teams/list.blade.php
Ludovic CANDELLIER 36267139a1 [WIP] Setup of skeleton
2020-03-25 00:08:27 +01:00

108 lines
2.7 KiB
PHP

@extends('boilerplate::layout.index', [
'title' => __('team.title'),
'subtitle' => __('team.list.title'),
'breadcrumb' => [__('team.list.title')]
])
@section('content')
<div class="box">
<div class="box-body">
<table class="table table-striped table-hover va-middle" id="teams-table">
<thead>
<tr>
<th>{{ __('team.label') }}</th>
<th>{{ __('team.description') }}</th>
<th>{{ __('team.list.nbusers') }}</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
@endsection
@prepend('js')
@include('components.js.ie11')
@include('components.js', ['js' => '/js/laroute.js'])
@include('components.js', ['js' => '/js/main.min.js'])
@include('components.js', ['js' => '/js/datatables.min.js'])
@endprepend
@push('css')
@include('components.css', ['css' => '/css/main.min.css'])
@include('components.css', ['css' => '/css/datatables.min.css'])
@endpush
@push('js')
<script>
$(function() {
var columns = [
{
data: 'name',
render: function (data, type, row) {
if (data) {
tpl = '<strong>' + data + '</strong>';
} else {
tpl = "Non défini";
}
return tpl;
}
},
{
data: 'description',
render: function (data, type, row) {
var tpl = '';
if (row.societe) {
if (row.societe.manager_prenom) {
tpl += row.societe.manager_prenom;
}
if (row.societe.manager_nom) {
tpl += ' - ' + row.societe.manager_nom;
}
}
return tpl;
}
},
{ data: "users_count"},
{
data: "id",
name: "action",
orderable: false,
searchable: false,
render: function (data, type, row) {
tpl = "<span class='pull-right'>";
tpl += " <a data-id=" + data + " class='btn btn-xs btn-primary edit' href='" + laroute.route('boilerplate.Users.Teams.edit', {id: data}) + "'><i class='fa fa-pencil fa-fw'></i></a>";
tpl += " <a data-id=" + data + " class='btn btn-xs btn-danger destroy' href='#'><i class='fa fa-trash fa-fw'></i></a>";
tpl += "</span>";
return tpl;
}
},
];
var options = {
columns: columns,
}
var model = "teams";
var route = '{!! route('boilerplate.Users.Teams.getTable') !!}';
var table = getDataTables(options,route,model);
tpl = '<a href="' + laroute.route('boilerplate.Users.Teams.create') + '" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> &nbsp;&nbsp;Création d\'un groupe</a>';
$('div.col-md-4.add').html(tpl);
$('#teams-table').on('click', '.destroy', function (e) {
e.preventDefault();
var id = $(this).data('id');
confirm_delete(id, laroute.route('boilerplate.Users.Teams.destroy'), function() {
table.draw();
// growl("{{ __('boilerplate::teams.list.deletesuccess') }}", 'success');
});
});
});
</script>
@endpush