1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/views/list.blade.php

103 lines
2.4 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
{{ DropdownButton::normal('Archive',
Navigation::links(
array(
2013-12-05 21:25:20 +01:00
array('Archive '.ucwords($entityType), "javascript:submitForm('archive')"),
array('Delete '.ucwords($entityType), "javascript:submitForm('delete')"),
2013-12-01 08:33:17 +01:00
)
)
, array('id'=>'archive'))->split(); }}
2013-12-10 23:10:43 +01:00
{{ Button::primary_link(URL::to($entityType . 's/create'), 'New ' . Utils::getEntityName($entityType), array('class' => 'pull-right')) }}
2013-12-01 08:33:17 +01:00
{{ Datatable::table()
->addColumn($columns)
->setUrl(route('api.' . $entityType . 's'))
->setOptions('sPaginationType', 'bootstrap')
->setOptions('bFilter', false)
->render('datatable') }}
{{ Former::close() }}
<script type="text/javascript">
function submitForm(action) {
2013-12-01 21:58:25 +01:00
if (action == 'delete') {
if (!confirm('Are you sure')) {
return;
}
2013-12-05 16:23:24 +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) {
if (confirm("Are you sure?")) {
2013-12-05 16:23:24 +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');
}
2013-12-01 08:33:17 +01:00
</script>
@stop
@section('onReady')
window.onDatatableReady = function() {
$(':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-01 08:33:17 +01:00
}
$('#archive > button').prop('disabled', true);
$('#archive > button:first').click(function() {
submitForm('archive');
});
$('#selectAll').click(function() {
$(':checkbox').prop('checked', this.checked);
});
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