1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/views/list.blade.php

149 lines
3.9 KiB
PHP
Raw Normal View History

2013-12-01 08:33:17 +01:00
@extends('header')
@section('content')
2013-12-03 18:32:33 +01:00
{{ Former::open($entityType . 's/bulk')->addClass('listForm') }}
2013-12-05 16:23:24 +01:00
<div style="display:none">
{{ Former::text('action') }}
{{ Former::text('id') }}
</div>
2013-12-01 08:33:17 +01:00
2014-03-27 13:25:31 +01:00
{{ DropdownButton::normal(trans('texts.archive'),
2013-12-01 08:33:17 +01:00
Navigation::links(
array(
2014-03-27 13:25:31 +01:00
array(trans('texts.archive_'.$entityType), "javascript:submitForm('archive')"),
array(trans('texts.delete_'.$entityType), "javascript:submitForm('delete')"),
2013-12-01 08:33:17 +01:00
)
)
, array('id'=>'archive'))->split(); }}
&nbsp;<label for="trashed" style="font-weight:normal; margin-left: 10px;">
2014-02-18 22:56:18 +01:00
<input id="trashed" type="checkbox" onclick="setTrashVisible()"
2014-07-30 09:08:01 +02:00
{{ Session::get("show_trash:{$entityType}") ? 'checked' : ''}}/> {{ trans('texts.show_archived_deleted')}} {{ strtolower(trans('texts.'.$entityType.'s')) }}
2014-02-18 22:56:18 +01:00
</label>
2013-12-01 08:33:17 +01:00
2013-12-11 21:33:44 +01:00
<div id="top_right_buttons" class="pull-right">
2014-03-27 13:25:31 +01:00
<input id="tableFilter" type="text" style="width:140px;margin-right:17px" class="form-control pull-left" placeholder="{{ trans('texts.filter') }}"/>
{{ Button::success_link(URL::to($entityType . 's/create'), trans("texts.new_$entityType"), array('class' => 'pull-right'))->append_with_icon('plus-sign'); }}
2013-12-11 21:33:44 +01:00
</div>
2013-12-11 12:11:59 +01:00
@if (isset($secEntityType))
{{ Datatable::table()
->addColumn($secColumns)
->setUrl(route('api.' . $secEntityType . 's'))
->setOptions('sPaginationType', 'bootstrap')
->render('datatable') }}
@endif
2013-12-01 08:33:17 +01:00
{{ Datatable::table()
->addColumn($columns)
->setUrl(route('api.' . $entityType . 's'))
->setOptions('sPaginationType', 'bootstrap')
->render('datatable') }}
2013-12-11 12:11:59 +01:00
2013-12-01 08:33:17 +01:00
{{ Former::close() }}
<script type="text/javascript">
function submitForm(action) {
2013-12-01 21:58:25 +01:00
if (action == 'delete') {
2014-05-26 11:43:46 +02:00
if (!confirm('Are you sure?')) {
2013-12-01 21:58:25 +01:00
return;
}
2013-12-05 16:23:24 +01:00
}
2013-12-11 21:33:44 +01:00
2013-12-01 08:33:17 +01:00
$('#action').val(action);
2013-12-03 18:32:33 +01:00
$('form.listForm').submit();
2013-12-01 08:33:17 +01:00
}
2013-12-01 21:58:25 +01:00
function deleteEntity(id) {
2014-01-14 12:52:56 +01:00
$('#id').val(id);
submitForm('delete');
2013-12-01 21:58:25 +01:00
}
2013-12-05 16:23:24 +01:00
function archiveEntity(id) {
$('#id').val(id);
submitForm('archive');
}
2014-02-18 22:56:18 +01:00
function setTrashVisible() {
var checked = $('#trashed').is(':checked');
window.location = '{{ URL::to('view_archive/' . $entityType) }}' + (checked ? '/true' : '/false');
}
2013-12-01 08:33:17 +01:00
</script>
@stop
@section('onReady')
2013-12-11 21:33:44 +01:00
var tableFilter = '';
var searchTimeout = false;
var oTable0 = $('#DataTables_Table_0').dataTable();
var oTable1 = $('#DataTables_Table_1').dataTable();
function filterTable(val) {
if (val == tableFilter) {
return;
}
tableFilter = val;
oTable0.fnFilter(val);
@if (isset($secEntityType))
oTable1.fnFilter(val);
@endif
}
$('#tableFilter').on('keyup', function(){
if (searchTimeout) {
window.clearTimeout(searchTimeout);
}
searchTimeout = setTimeout(function() {
filterTable($('#tableFilter').val());
}, 1000);
})
2014-01-06 19:03:00 +01:00
window.onDatatableReady = function() {
2013-12-01 08:33:17 +01:00
$(':checkbox').click(function() {
setArchiveEnabled();
});
$('tbody tr').click(function(event) {
2013-12-01 21:58:25 +01:00
if (event.target.type !== 'checkbox' && event.target.type !== 'button' && event.target.tagName.toLowerCase() !== 'a') {
2013-12-01 08:33:17 +01:00
$checkbox = $(this).closest('tr').find(':checkbox');
var checked = $checkbox.prop('checked');
$checkbox.prop('checked', !checked);
setArchiveEnabled();
}
});
2013-12-01 21:58:25 +01:00
$('tbody tr').mouseover(function() {
2013-12-05 16:23:24 +01:00
$(this).closest('tr').find('.tr-action').css('visibility','visible');
2013-12-01 21:58:25 +01:00
}).mouseout(function() {
$dropdown = $(this).closest('tr').find('.tr-action');
if (!$dropdown.hasClass('open')) {
2013-12-05 16:23:24 +01:00
$dropdown.css('visibility','hidden');
}
2013-12-01 21:58:25 +01:00
});
2013-12-11 21:33:44 +01:00
2013-12-01 08:33:17 +01:00
}
$('#archive > button').prop('disabled', true);
$('#archive > button:first').click(function() {
submitForm('archive');
});
2013-12-11 12:11:59 +01:00
$('.selectAll').click(function() {
$(this).closest('table').find(':checkbox').prop('checked', this.checked);
2013-12-01 08:33:17 +01:00
});
function setArchiveEnabled() {
var checked = $('tbody :checkbox:checked').length > 0;
$('#archive > button').prop('disabled', !checked);
}
2013-12-01 21:58:25 +01:00
2013-12-01 08:33:17 +01:00
@stop