1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-22 01:11:34 +02:00
invoiceninja/resources/views/payments/edit.blade.php

147 lines
4.3 KiB
PHP
Raw Normal View History

2015-03-16 22:45:25 +01:00
@extends('header')
@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>
@stop
2015-03-16 22:45:25 +01:00
@section('content')
2016-10-10 10:40:04 +02:00
{!! Former::open($url)
->addClass('col-md-10 col-md-offset-1 warn-on-exit main-form')
->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') !!}
{!! 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
@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
@if (!$payment)
{!! Former::checkbox('email_receipt')->label('&nbsp;')->text(trans('texts.email_receipt'))->value(1) !!}
@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)
{!! Button::success(trans('texts.save'))->withAttributes(['id' => 'saveButton'])->appendIcon(Icon::create('floppy-disk'))->submit()->large() !!}
2016-10-10 10:40:04 +02:00
@endif
@if ($payment)
{!! DropdownButton::normal(trans('texts.more_actions'))
->withContents($actions)
->large()
->dropup() !!}
@endif
2015-03-16 22:45:25 +01:00
</center>
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 }}')
@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
});
function onFormSubmit(event) {
$('#saveButton').attr('disabled', true);
}
function submitAction(action) {
$('#action').val(action);
$('.main-form').submit();
}
function onDeleteClick() {
sweetConfirm(function() {
submitAction('delete');
});
}
2015-03-16 22:45:25 +01:00
</script>
2016-10-10 10:40:04 +02:00
@stop