1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/resources/views/list.blade.php

273 lines
8.7 KiB
PHP
Raw Normal View History

2015-03-16 22:45:25 +01:00
@extends('header')
2016-11-17 15:29:02 +01:00
@section('head')
@parent
<script src="{{ asset('js/select2.min.js') }}" type="text/javascript"></script>
<link href="{{ asset('css/select2.css') }}" rel="stylesheet" type="text/css"/>
<style type="text/css">
.select2-selection {
border: 1px solid #dfe0e1 !important;
border-radius: 2px;
padding: 2px;
}
</style>
@stop
2015-03-16 22:45:25 +01:00
@section('content')
2016-07-06 20:35:16 +02:00
{!! Former::open(Utils::pluralizeEntityType($entityType) . '/bulk')->addClass('listForm') !!}
2016-01-05 20:12:50 +01:00
2015-03-16 22:45:25 +01:00
<div style="display:none">
2015-03-26 07:24:02 +01:00
{!! Former::text('action') !!}
2016-01-05 20:12:50 +01:00
{!! Former::text('public_id') !!}
2016-09-19 15:30:46 +02:00
{!! Former::text('datatable')->value('true') !!}
2015-03-16 22:45:25 +01:00
</div>
2016-04-26 03:53:39 +02:00
@can('create', 'invoice')
@if ($entityType == ENTITY_TASK)
{!! Button::primary(trans('texts.invoice'))->withAttributes(['class'=>'invoice', 'onclick' =>'submitForm("invoice")'])->appendIcon(Icon::create('check')) !!}
@endif
@if ($entityType == ENTITY_EXPENSE)
{!! Button::primary(trans('texts.invoice'))->withAttributes(['class'=>'invoice', 'onclick' =>'submitForm("invoice")'])->appendIcon(Icon::create('check')) !!}
@endif
2016-04-26 03:53:39 +02:00
@endcan
2015-05-27 18:52:10 +02:00
2016-11-13 08:20:30 +01:00
@if (in_array($entityType, [ENTITY_EXPENSE_CATEGORY, ENTITY_PRODUCT]))
2016-07-06 20:35:16 +02:00
{!! Button::normal(trans('texts.archive'))->asLinkTo('javascript:submitForm("archive")')->appendIcon(Icon::create('trash')) !!}
@else
{!! DropdownButton::normal(trans('texts.archive'))->withContents([
['label' => trans('texts.archive_'.$entityType), 'url' => 'javascript:submitForm("archive")'],
['label' => trans('texts.delete_'.$entityType), 'url' => 'javascript:submitForm("delete")'],
])->withAttributes(['class'=>'archive'])->split() !!}
@endif
2016-11-17 15:29:02 +01:00
&nbsp;
<label for="trashed" style="font-weight:normal; margin-left: 10px;">
<!--
2016-07-06 20:35:16 +02:00
<input id="trashed" type="checkbox" onclick="setTrashVisible()"
2016-11-17 15:29:02 +01:00
{{ Session::get("show_trash:{$entityType}") ? 'checked' : ''}}/>&nbsp; {{ trans('texts.show_archived_deleted')}}
-->
{!! Former::multiselect('statuses')
->select('Active')
->style('width: 200px')
->options($statuses)
->raw() !!}
2015-03-16 22:45:25 +01:00
</label>
<div id="top_right_buttons" class="pull-right">
2016-07-06 20:35:16 +02:00
<input id="tableFilter" type="text" style="width:140px;margin-right:17px;background-color: white !important"
2016-01-05 20:12:50 +01:00
class="form-control pull-left" placeholder="{{ trans('texts.filter') }}" value="{{ Input::get('filter') }}"/>
2016-08-23 19:28:45 +02:00
@if ($entityType == ENTITY_EXPENSE)
2016-07-06 20:35:16 +02:00
{!! Button::normal(trans('texts.categories'))->asLinkTo(URL::to('/expense_categories'))->appendIcon(Icon::create('list')) !!}
2015-05-27 18:52:10 +02:00
@endif
2015-08-04 16:33:30 +02:00
@if (Auth::user()->can('create', $entityType))
2016-07-06 20:35:16 +02:00
{!! Button::primary(trans("texts.new_{$entityType}"))->asLinkTo(url(Utils::pluralizeEntityType($entityType) . '/create'))->appendIcon(Icon::create('plus-sign')) !!}
2016-03-16 00:08:00 +01:00
@endif
2016-07-06 20:35:16 +02:00
2015-03-16 22:45:25 +01:00
</div>
2016-07-06 20:35:16 +02:00
{!! Datatable::table()
2015-03-16 22:45:25 +01:00
->addColumn($columns)
2016-07-06 20:35:16 +02:00
->setUrl(route('api.' . Utils::pluralizeEntityType($entityType)))
->setCustomValues('rightAlign', isset($rightAlign) ? $rightAlign : [])
2015-03-16 22:45:25 +01:00
->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') !!}
2016-04-23 22:40:19 +02:00
@if ($entityType == ENTITY_PAYMENT)
<div class="modal fade" id="paymentRefundModal" tabindex="-1" role="dialog" aria-labelledby="paymentRefundModalLabel" aria-hidden="true">
<div class="modal-dialog" style="min-width:150px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="paymentRefundModalLabel">{{ trans('texts.refund_payment') }}</h4>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="form-group">
<label for="refundAmount" class="col-sm-offset-2 col-sm-2 control-label">{{ trans('texts.amount') }}</label>
<div class="col-sm-4">
<div class="input-group">
<span class="input-group-addon" id="refundCurrencySymbol"></span>
<input type="number" class="form-control" id="refundAmount" name="amount" step="0.01" min="0.01" placeholder="{{ trans('texts.amount') }}">
</div>
<div class="help-block">{{ trans('texts.refund_max') }} <span id="refundMax"></span></div>
</div>
</div>
</div>
</div>
<div class="modal-footer" style="margin-top: 0px">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
<button type="button" class="btn btn-primary" id="completeRefundButton">{{ trans('texts.refund') }}</button>
</div>
</div>
</div>
</div>
@endif
2015-03-26 07:24:02 +01:00
{!! Former::close() !!}
2016-09-19 15:30:46 +02:00
2015-03-16 22:45:25 +01:00
<script type="text/javascript">
function submitForm(action) {
if (action == 'delete') {
2016-07-28 18:55:23 +02:00
sweetConfirm(function() {
$('#action').val(action);
2016-08-23 19:28:45 +02:00
$('form.listForm').submit();
2016-07-28 18:55:23 +02:00
});
} else {
$('#action').val(action);
$('form.listForm').submit();
}
2015-03-16 22:45:25 +01:00
}
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');
}
2016-01-21 23:29:10 +01:00
function invoiceEntity(id) {
2015-10-28 20:22:07 +01:00
$('#public_id').val(id);
2015-05-27 18:52:10 +02:00
submitForm('invoice');
}
2016-07-06 20:35:16 +02:00
2016-04-23 22:40:19 +02:00
@if ($entityType == ENTITY_PAYMENT)
var paymentId = null;
function showRefundModal(id, amount, formatted, symbol){
paymentId = id;
$('#refundCurrencySymbol').text(symbol);
$('#refundMax').text(formatted);
$('#refundAmount').val(amount).attr('max', amount);
$('#paymentRefundModal').modal('show');
}
2016-07-06 20:35:16 +02:00
2016-04-23 22:40:19 +02:00
function handleRefundClicked(){
$('#public_id').val(paymentId);
submitForm('refund');
}
@endif
2015-05-27 18:52:10 +02:00
2016-11-17 15:29:02 +01:00
/*
2015-03-16 22:45:25 +01:00
function setTrashVisible() {
var checked = $('#trashed').is(':checked');
var url = '{{ URL::to('view_archive/' . $entityType) }}' + (checked ? '/true' : '/false');
$.get(url, function(data) {
refreshDatatable();
})
2015-03-16 22:45:25 +01:00
}
2016-11-17 15:29:02 +01:00
*/
2015-03-16 22:45:25 +01:00
2015-05-10 21:02:35 +02:00
$(function() {
var tableFilter = '';
var searchTimeout = false;
var oTable0 = $('#DataTables_Table_0').dataTable();
2016-07-06 20:35:16 +02:00
var oTable1 = $('#DataTables_Table_1').dataTable();
function filterTable(val) {
2015-05-10 21:02:35 +02:00
if (val == tableFilter) {
return;
}
tableFilter = val;
oTable0.fnFilter(val);
}
$('#tableFilter').on('keyup', function(){
if (searchTimeout) {
window.clearTimeout(searchTimeout);
}
searchTimeout = setTimeout(function() {
filterTable($('#tableFilter').val());
2016-01-05 20:12:50 +01:00
}, 500);
2015-05-10 21:02:35 +02:00
})
2016-01-05 20:12:50 +01:00
if ($('#tableFilter').val()) {
filterTable($('#tableFilter').val());
}
2016-07-06 20:35:16 +02:00
window.onDatatableReady = function() {
2015-09-17 21:01:06 +02:00
$(':checkbox').click(function() {
2015-05-27 18:52:10 +02:00
setBulkActionsEnabled();
2016-07-06 20:35:16 +02:00
});
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') {
$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();
}
2016-07-06 20:35:16 +02:00
2016-04-23 22:40:19 +02:00
@if ($entityType == ENTITY_PAYMENT)
$('#completeRefundButton').click(handleRefundClicked)
@endif
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;
2016-07-06 20:35:16 +02:00
$('button.archive, button.invoice').prop('disabled', !count);
2015-10-22 20:48:12 +02:00
if (count) {
buttonLabel += ' (' + count + ')';
}
$('button.archive').not('.dropdown-toggle').text(buttonLabel);
2015-05-10 21:02:35 +02:00
}
2016-11-17 15:29:02 +01:00
$('#statuses').select2({
placeholder: "{{ trans('texts.status') }}",
}).on('change', function() {
refreshDatatable();
}).val([0]).trigger('change');
//$('#statuses').select2().val([0,1,2]).trigger('change');
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
2016-07-06 20:35:16 +02:00
@stop