2015-03-16 22:45:25 +01:00
|
|
|
@extends('header')
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
|
2015-03-26 07:24:02 +01:00
|
|
|
{!! Former::open($entityType . 's/bulk')->addClass('listForm') !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
<div style="display:none">
|
2015-03-26 07:24:02 +01:00
|
|
|
{!! Former::text('action') !!}
|
2015-10-28 20:22:07 +01:00
|
|
|
{!! Former::text('public_id') !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
</div>
|
|
|
|
|
2015-05-27 18:52:10 +02:00
|
|
|
@if ($entityType == ENTITY_TASK)
|
|
|
|
{!! Button::primary(trans('texts.invoice'))->withAttributes(['class'=>'invoice', 'onclick' =>'submitForm("invoice")'])->appendIcon(Icon::create('check')) !!}
|
|
|
|
@endif
|
|
|
|
|
2015-04-01 17:44:55 +02:00
|
|
|
{!! DropdownButton::normal(trans('texts.archive'))->withContents([
|
2015-04-30 19:54:19 +02:00
|
|
|
['label' => trans('texts.archive_'.$entityType), 'url' => 'javascript:submitForm("archive")'],
|
|
|
|
['label' => trans('texts.delete_'.$entityType), 'url' => 'javascript:submitForm("delete")'],
|
2015-04-01 17:44:55 +02:00
|
|
|
])->withAttributes(['class'=>'archive'])->split() !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
<label for="trashed" style="font-weight:normal; margin-left: 10px;">
|
|
|
|
<input id="trashed" type="checkbox" onclick="setTrashVisible()"
|
2015-09-03 09:32:39 +02:00
|
|
|
{{ Session::get("show_trash:{$entityType}") ? 'checked' : ''}}/> {{ trans('texts.show_archived_deleted')}} {{ Utils::transFlowText($entityType.'s') }}
|
2015-03-16 22:45:25 +01:00
|
|
|
</label>
|
|
|
|
|
|
|
|
<div id="top_right_buttons" class="pull-right">
|
2015-08-04 16:33:30 +02:00
|
|
|
<input id="tableFilter" type="text" style="width:140px;margin-right:17px;background-color: white !important" class="form-control pull-left" placeholder="{{ trans('texts.filter') }}"/>
|
2015-05-27 18:52:10 +02:00
|
|
|
@if (Auth::user()->isPro() && $entityType == ENTITY_INVOICE)
|
|
|
|
{!! Button::normal(trans('texts.quotes'))->asLinkTo(URL::to('/quotes'))->appendIcon(Icon::create('list')) !!}
|
2015-10-29 18:21:00 +01:00
|
|
|
{!! Button::normal(trans('texts.recurring'))->asLinkTo(URL::to('/recurring_invoices'))->appendIcon(Icon::create('list')) !!}
|
2015-06-16 21:35:35 +02:00
|
|
|
@elseif ($entityType == ENTITY_CLIENT)
|
|
|
|
{!! Button::normal(trans('texts.credits'))->asLinkTo(URL::to('/credits'))->appendIcon(Icon::create('list')) !!}
|
2015-05-27 18:52:10 +02:00
|
|
|
@endif
|
2015-08-04 16:33:30 +02:00
|
|
|
|
2015-09-03 09:32:39 +02:00
|
|
|
{!! Button::primary(trans("texts.new_$entityType"))->asLinkTo(URL::to("/{$entityType}s/create"))->appendIcon(Icon::create('plus-sign')) !!}
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
</div>
|
|
|
|
|
2015-03-26 07:24:02 +01:00
|
|
|
{!! Datatable::table()
|
2015-03-16 22:45:25 +01:00
|
|
|
->addColumn($columns)
|
|
|
|
->setUrl(route('api.' . $entityType . 's'))
|
|
|
|
->setOptions('sPaginationType', 'bootstrap')
|
2015-04-28 22:13:52 +02:00
|
|
|
->setOptions('aaSorting', [[isset($sortCol) ? $sortCol : '1', 'desc']])
|
2015-03-26 07:24:02 +01:00
|
|
|
->render('datatable') !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-03-26 07:24:02 +01:00
|
|
|
{!! Former::close() !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
function submitForm(action) {
|
|
|
|
if (action == 'delete') {
|
2015-06-03 19:55:48 +02:00
|
|
|
if (!confirm('{!! trans("texts.are_you_sure") !!}')) {
|
2015-03-16 22:45:25 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#action').val(action);
|
|
|
|
$('form.listForm').submit();
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleteEntity(id) {
|
2015-10-28 20:22:07 +01:00
|
|
|
$('#public_id').val(id);
|
2015-03-16 22:45:25 +01:00
|
|
|
submitForm('delete');
|
|
|
|
}
|
|
|
|
|
|
|
|
function archiveEntity(id) {
|
2015-10-28 20:22:07 +01:00
|
|
|
$('#public_id').val(id);
|
2015-03-16 22:45:25 +01:00
|
|
|
submitForm('archive');
|
|
|
|
}
|
|
|
|
|
|
|
|
function restoreEntity(id) {
|
2015-10-28 20:22:07 +01:00
|
|
|
$('#public_id').val(id);
|
2015-03-16 22:45:25 +01:00
|
|
|
submitForm('restore');
|
|
|
|
}
|
|
|
|
function convertEntity(id) {
|
2015-10-28 20:22:07 +01:00
|
|
|
$('#public_id').val(id);
|
2015-03-16 22:45:25 +01:00
|
|
|
submitForm('convert');
|
|
|
|
}
|
|
|
|
|
2015-10-29 15:42:05 +01:00
|
|
|
function markEntity(id) {
|
2015-10-28 20:22:07 +01:00
|
|
|
$('#public_id').val(id);
|
2015-10-29 15:42:05 +01:00
|
|
|
submitForm('markSent');
|
2015-03-16 22:45:25 +01:00
|
|
|
}
|
|
|
|
|
2015-05-27 18:52:10 +02:00
|
|
|
function stopTask(id) {
|
2015-10-28 20:22:07 +01:00
|
|
|
$('#public_id').val(id);
|
2015-05-27 18:52:10 +02:00
|
|
|
submitForm('stop');
|
|
|
|
}
|
|
|
|
|
|
|
|
function invoiceTask(id) {
|
2015-10-28 20:22:07 +01:00
|
|
|
$('#public_id').val(id);
|
2015-05-27 18:52:10 +02:00
|
|
|
submitForm('invoice');
|
|
|
|
}
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
function setTrashVisible() {
|
|
|
|
var checked = $('#trashed').is(':checked');
|
|
|
|
window.location = '{{ URL::to('view_archive/' . $entityType) }}' + (checked ? '/true' : '/false');
|
|
|
|
}
|
|
|
|
|
2015-05-10 21:02:35 +02:00
|
|
|
$(function() {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#tableFilter').on('keyup', function(){
|
|
|
|
if (searchTimeout) {
|
|
|
|
window.clearTimeout(searchTimeout);
|
|
|
|
}
|
|
|
|
|
|
|
|
searchTimeout = setTimeout(function() {
|
|
|
|
filterTable($('#tableFilter').val());
|
|
|
|
}, 500);
|
|
|
|
})
|
|
|
|
|
|
|
|
window.onDatatableReady = function() {
|
2015-09-17 21:01:06 +02:00
|
|
|
$(':checkbox').click(function() {
|
2015-05-27 18:52:10 +02:00
|
|
|
setBulkActionsEnabled();
|
2015-05-10 21:02:35 +02:00
|
|
|
});
|
|
|
|
|
2015-09-17 21:01:06 +02:00
|
|
|
$('tbody tr').unbind('click').click(function(event) {
|
2015-05-10 21:02:35 +02:00
|
|
|
if (event.target.type !== 'checkbox' && event.target.type !== 'button' && event.target.tagName.toLowerCase() !== 'a') {
|
2015-09-10 19:50:09 +02:00
|
|
|
$checkbox = $(this).closest('tr').find(':checkbox:not(:disabled)');
|
2015-05-10 21:02:35 +02:00
|
|
|
var checked = $checkbox.prop('checked');
|
|
|
|
$checkbox.prop('checked', !checked);
|
2015-05-27 18:52:10 +02:00
|
|
|
setBulkActionsEnabled();
|
2015-05-10 21:02:35 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-11-11 13:17:58 +01:00
|
|
|
actionListHandler();
|
|
|
|
}
|
2015-05-10 21:02:35 +02:00
|
|
|
|
2015-05-27 18:52:10 +02:00
|
|
|
$('.archive, .invoice').prop('disabled', true);
|
2015-05-10 21:02:35 +02:00
|
|
|
$('.archive:not(.dropdown-toggle)').click(function() {
|
|
|
|
submitForm('archive');
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.selectAll').click(function() {
|
|
|
|
$(this).closest('table').find(':checkbox:not(:disabled)').prop('checked', this.checked);
|
|
|
|
});
|
|
|
|
|
2015-05-27 18:52:10 +02:00
|
|
|
function setBulkActionsEnabled() {
|
2015-10-22 20:48:12 +02:00
|
|
|
var buttonLabel = "{{ trans('texts.archive') }}";
|
|
|
|
var count = $('tbody :checkbox:checked').length;
|
|
|
|
$('button.archive, button.invoice').prop('disabled', !count);
|
|
|
|
if (count) {
|
|
|
|
buttonLabel += ' (' + count + ')';
|
|
|
|
}
|
|
|
|
$('button.archive').not('.dropdown-toggle').text(buttonLabel);
|
2015-05-10 21:02:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-05-10 21:02:35 +02:00
|
|
|
</script>
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
@stop
|