2015-03-16 22:45:25 +01:00
|
|
|
@extends('header')
|
|
|
|
|
2015-12-07 22:41:48 +01:00
|
|
|
@section('head')
|
|
|
|
@parent
|
|
|
|
|
|
|
|
@include('money_script')
|
2016-02-03 09:08:28 +01:00
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
.input-group-addon {
|
|
|
|
min-width: 40px;
|
|
|
|
}
|
|
|
|
</style>
|
2015-12-07 22:41:48 +01:00
|
|
|
@stop
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
@section('content')
|
2016-10-10 10:40:04 +02:00
|
|
|
|
2016-11-02 12:15:02 +01:00
|
|
|
{!! Former::open($url)
|
2017-01-02 21:23:29 +01:00
|
|
|
->addClass('col-md-10 col-md-offset-1 warn-on-exit main-form')
|
2016-11-02 12:15:02 +01:00
|
|
|
->onsubmit('onFormSubmit(event)')
|
|
|
|
->method($method)
|
|
|
|
->rules(array(
|
|
|
|
'client' => 'required',
|
|
|
|
'invoice' => 'required',
|
|
|
|
'amount' => 'required',
|
|
|
|
)) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
@if ($payment)
|
2015-04-06 02:28:43 +02:00
|
|
|
{!! Former::populate($payment) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
@endif
|
2015-04-20 16:34:23 +02:00
|
|
|
|
2015-10-28 20:22:07 +01:00
|
|
|
<span style="display:none">
|
|
|
|
{!! Former::text('public_id') !!}
|
2017-01-02 21:23:29 +01:00
|
|
|
{!! Former::text('action') !!}
|
2015-10-28 20:22:07 +01:00
|
|
|
</span>
|
2016-10-10 10:40:04 +02:00
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
<div class="row">
|
2015-04-22 21:21:04 +02:00
|
|
|
<div class="col-md-10 col-md-offset-1">
|
2015-04-20 16:34:23 +02:00
|
|
|
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-body">
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2016-12-25 12:15:58 +01:00
|
|
|
@if ($payment)
|
|
|
|
{!! Former::plaintext()->label('client')->value($payment->client->getDisplayName()) !!}
|
|
|
|
{!! Former::plaintext()->label('invoice')->value($payment->invoice->getDisplayName()) !!}
|
|
|
|
{!! Former::plaintext()->label('amount')->value($payment->present()->amount) !!}
|
|
|
|
@else
|
2015-03-31 19:42:37 +02:00
|
|
|
{!! Former::select('client')->addOption('', '')->addGroupClass('client-select') !!}
|
|
|
|
{!! Former::select('invoice')->addOption('', '')->addGroupClass('invoice-select') !!}
|
|
|
|
{!! Former::text('amount') !!}
|
2015-11-04 08:48:47 +01:00
|
|
|
|
|
|
|
@if (isset($paymentTypeId) && $paymentTypeId)
|
|
|
|
{!! Former::populateField('payment_type_id', $paymentTypeId) !!}
|
|
|
|
@endif
|
2015-03-16 22:45:25 +01:00
|
|
|
@endif
|
|
|
|
|
2015-06-10 10:34:20 +02:00
|
|
|
@if (!$payment || !$payment->account_gateway_id)
|
2015-09-01 20:40:30 +02:00
|
|
|
{!! Former::select('payment_type_id')
|
|
|
|
->addOption('','')
|
|
|
|
->fromQuery($paymentTypes, 'name', 'id')
|
|
|
|
->addGroupClass('payment-type-select') !!}
|
2015-06-10 10:34:20 +02:00
|
|
|
@endif
|
|
|
|
|
2015-09-07 11:07:55 +02:00
|
|
|
{!! Former::text('payment_date')
|
|
|
|
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))
|
|
|
|
->addGroupClass('payment_date')
|
|
|
|
->append('<i class="glyphicon glyphicon-calendar"></i>') !!}
|
2015-03-31 19:42:37 +02:00
|
|
|
{!! Former::text('transaction_reference') !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-06-14 19:30:01 +02:00
|
|
|
@if (!$payment)
|
2017-01-09 16:01:51 +01:00
|
|
|
{!! Former::checkbox('email_receipt')->label(' ')->text(trans('texts.email_receipt'))->value(1) !!}
|
2015-06-14 19:30:01 +02:00
|
|
|
@endif
|
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
<center class="buttons">
|
2015-06-04 22:53:58 +02:00
|
|
|
{!! Button::normal(trans('texts.cancel'))->appendIcon(Icon::create('remove-circle'))->asLinkTo(URL::to('/payments'))->large() !!}
|
2016-10-10 10:40:04 +02:00
|
|
|
@if (!$payment || !$payment->is_deleted)
|
2016-11-02 12:15:02 +01:00
|
|
|
{!! Button::success(trans('texts.save'))->withAttributes(['id' => 'saveButton'])->appendIcon(Icon::create('floppy-disk'))->submit()->large() !!}
|
2016-10-10 10:40:04 +02:00
|
|
|
@endif
|
2017-01-02 21:23:29 +01:00
|
|
|
|
|
|
|
@if ($payment)
|
|
|
|
{!! DropdownButton::normal(trans('texts.more_actions'))
|
|
|
|
->withContents($actions)
|
|
|
|
->large()
|
|
|
|
->dropup() !!}
|
|
|
|
@endif
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
</center>
|
|
|
|
|
2017-02-09 11:46:58 +01:00
|
|
|
@include('partials/refund_payment')
|
|
|
|
|
2015-03-31 19:42:37 +02:00
|
|
|
{!! Former::close() !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
2015-03-31 19:42:37 +02:00
|
|
|
var invoices = {!! $invoices !!};
|
|
|
|
var clients = {!! $clients !!};
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
$(function() {
|
|
|
|
|
|
|
|
@if ($payment)
|
|
|
|
$('#payment_date').datepicker('update', '{{ $payment->payment_date }}')
|
2016-12-06 10:53:37 +01:00
|
|
|
@if ($payment->payment_type_id != PAYMENT_TYPE_CREDIT)
|
|
|
|
$("#payment_type_id option[value='{{ PAYMENT_TYPE_CREDIT }}']").remove();
|
|
|
|
@endif
|
2015-03-16 22:45:25 +01:00
|
|
|
@else
|
|
|
|
$('#payment_date').datepicker('update', new Date());
|
|
|
|
populateInvoiceComboboxes({{ $clientPublicId }}, {{ $invoicePublicId }});
|
|
|
|
@endif
|
|
|
|
|
2016-10-10 10:40:04 +02:00
|
|
|
$('#payment_type_id').combobox();
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-05-10 21:02:35 +02:00
|
|
|
@if (!$payment && !$clientPublicId)
|
2015-05-09 20:25:16 +02:00
|
|
|
$('.client-select input.form-control').focus();
|
2015-05-10 21:02:35 +02:00
|
|
|
@elseif (!$payment && !$invoicePublicId)
|
2015-05-09 20:25:16 +02:00
|
|
|
$('.invoice-select input.form-control').focus();
|
|
|
|
@elseif (!$payment)
|
|
|
|
$('#amount').focus();
|
|
|
|
@endif
|
2015-09-07 11:07:55 +02:00
|
|
|
|
|
|
|
$('.payment_date .input-group-addon').click(function() {
|
|
|
|
toggleDatePicker('payment_date');
|
|
|
|
});
|
2015-03-16 22:45:25 +01:00
|
|
|
});
|
|
|
|
|
2016-11-02 12:15:02 +01:00
|
|
|
function onFormSubmit(event) {
|
|
|
|
$('#saveButton').attr('disabled', true);
|
|
|
|
}
|
|
|
|
|
2017-01-02 21:23:29 +01:00
|
|
|
function submitAction(action) {
|
|
|
|
$('#action').val(action);
|
|
|
|
$('.main-form').submit();
|
|
|
|
}
|
|
|
|
|
2017-02-09 11:46:58 +01:00
|
|
|
function submitForm_payment(action) {
|
|
|
|
submitAction(action);
|
|
|
|
}
|
|
|
|
|
2017-01-02 21:23:29 +01:00
|
|
|
function onDeleteClick() {
|
|
|
|
sweetConfirm(function() {
|
|
|
|
submitAction('delete');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
</script>
|
|
|
|
|
2016-10-10 10:40:04 +02:00
|
|
|
@stop
|