mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on L5
This commit is contained in:
parent
7f69991ca8
commit
194eb9e28a
@ -4,8 +4,13 @@ use Auth;
|
||||
use Utils;
|
||||
use View;
|
||||
use URL;
|
||||
use Validator;
|
||||
use Input;
|
||||
use Session;
|
||||
use Redirect;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\Contact;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Size;
|
||||
use App\Models\PaymentTerm;
|
||||
@ -103,13 +108,13 @@ class ClientController extends BaseController
|
||||
Utils::trackViewed($client->getDisplayName(), ENTITY_CLIENT);
|
||||
|
||||
$actionLinks = [
|
||||
[trans('texts.create_invoice'), URL::to('invoices/create/'.$client->public_id)],
|
||||
[trans('texts.enter_payment'), URL::to('payments/create/'.$client->public_id)],
|
||||
[trans('texts.enter_credit'), URL::to('credits/create/'.$client->public_id)],
|
||||
['label' => trans('texts.create_invoice'), 'url' => URL::to('invoices/create/'.$client->public_id)],
|
||||
['label' => trans('texts.enter_payment'), 'url' => URL::to('payments/create/'.$client->public_id)],
|
||||
['label' => trans('texts.enter_credit'), 'url' => URL::to('credits/create/'.$client->public_id)],
|
||||
];
|
||||
|
||||
if (Utils::isPro()) {
|
||||
array_unshift($actionLinks, [trans('texts.create_quote'), URL::to('quotes/create/'.$client->public_id)]);
|
||||
array_unshift($actionLinks, ['label' => trans('texts.create_quote'), 'url' => URL::to('quotes/create/'.$client->public_id)]);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
|
@ -6,6 +6,9 @@ use Redirect;
|
||||
use Session;
|
||||
use Utils;
|
||||
use View;
|
||||
use Validator;
|
||||
|
||||
use App\Models\Client;
|
||||
|
||||
use App\Ninja\Repositories\CreditRepository;
|
||||
|
||||
|
@ -94,100 +94,6 @@ class Client extends EntityModel
|
||||
return ENTITY_CLIENT;
|
||||
}
|
||||
|
||||
public function getAddress()
|
||||
{
|
||||
$str = '';
|
||||
|
||||
if ($this->address1) {
|
||||
$str .= $this->address1.'<br/>';
|
||||
}
|
||||
if ($this->address2) {
|
||||
$str .= $this->address2.'<br/>';
|
||||
}
|
||||
if ($this->city) {
|
||||
$str .= $this->city.', ';
|
||||
}
|
||||
if ($this->state) {
|
||||
$str .= $this->state.' ';
|
||||
}
|
||||
if ($this->postal_code) {
|
||||
$str .= $this->postal_code;
|
||||
}
|
||||
if ($this->country) {
|
||||
$str .= '<br/>'.$this->country->name;
|
||||
}
|
||||
|
||||
if ($str) {
|
||||
$str = '<p>'.$str.'</p>';
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function getPhone()
|
||||
{
|
||||
$str = '';
|
||||
|
||||
if ($this->work_phone) {
|
||||
$str .= '<i class="fa fa-phone" style="width: 20px"></i>'.Utils::formatPhoneNumber($this->work_phone);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function getVatNumber()
|
||||
{
|
||||
$str = '';
|
||||
|
||||
if ($this->vat_number) {
|
||||
$str .= '<i class="fa fa-vat-number" style="width: 20px"></i>'.trans('texts.vat_number').': '.$this->vat_number;
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function getNotes()
|
||||
{
|
||||
$str = '';
|
||||
|
||||
if ($this->private_notes) {
|
||||
$str .= '<i>'.$this->private_notes.'</i>';
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function getIndustry()
|
||||
{
|
||||
$str = '';
|
||||
|
||||
if ($this->client_industry) {
|
||||
$str .= $this->client_industry->name.' ';
|
||||
}
|
||||
|
||||
if ($this->client_size) {
|
||||
$str .= $this->client_size->name;
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function getCustomFields()
|
||||
{
|
||||
$str = '';
|
||||
$account = $this->account;
|
||||
|
||||
if ($account->custom_client_label1 && $this->custom_value1) {
|
||||
$str .= "{$account->custom_client_label1}: {$this->custom_value1}<br/>";
|
||||
}
|
||||
|
||||
if ($account->custom_client_label2 && $this->custom_value2) {
|
||||
$str .= "{$account->custom_client_label2}: {$this->custom_value2}<br/>";
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function getWebsite()
|
||||
{
|
||||
if (!$this->website) {
|
||||
|
@ -55,27 +55,4 @@ class Contact extends EntityModel
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function getDetails()
|
||||
{
|
||||
$str = '';
|
||||
|
||||
if ($this->first_name || $this->last_name) {
|
||||
$str .= '<b>'.$this->first_name.' '.$this->last_name.'</b><br/>';
|
||||
}
|
||||
|
||||
if ($this->email) {
|
||||
$str .= '<i class="fa fa-envelope" style="width: 20px"></i>'.HTML::mailto($this->email, $this->email).'<br/>';
|
||||
}
|
||||
|
||||
if ($this->phone) {
|
||||
$str .= '<i class="fa fa-phone" style="width: 20px"></i>'.Utils::formatPhoneNumber($this->phone);
|
||||
}
|
||||
|
||||
if ($str) {
|
||||
$str = '<p>'.$str.'</p>';
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ function ContactsModel() {
|
||||
}
|
||||
|
||||
@if ($client)
|
||||
window.model = ko.mapping.fromJS({{ $client }});
|
||||
window.model = ko.mapping.fromJS({!! $client !!});
|
||||
@else
|
||||
window.model = new ContactsModel();
|
||||
addContact();
|
||||
|
@ -138,7 +138,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
window.model = new ContactsModel({{ $client }});
|
||||
window.model = new ContactsModel({!! $client !!});
|
||||
|
||||
model.showContact = function(elem) { if (elem.nodeType === 1) $(elem).hide().slideDown() }
|
||||
model.hideContact = function(elem) { if (elem.nodeType === 1) $(elem).slideUp(function() { $(elem).remove(); }) }
|
||||
@ -159,7 +159,7 @@
|
||||
</script>
|
||||
|
||||
<center class="buttons">
|
||||
{!! Button::primary(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo('clients/' . ($client ? $client->public_id : ''))->appendIcon(Icon::create('remove-circle')) !!}
|
||||
</center>
|
||||
|
||||
|
@ -27,7 +27,9 @@
|
||||
]
|
||||
)->split() !!}
|
||||
|
||||
{!! DropdownButton::primary(trans('texts.create_invoice'), Navigation::links($actionLinks), ['id'=>'primaryDropDown'])->split() !!}
|
||||
{!! DropdownButton::primary(trans('texts.create_invoice'))
|
||||
->withAttributes(['class'=>'primaryDropDown'])
|
||||
->withContents($actionLinks)->split() !!}
|
||||
@endif
|
||||
{!! Former::close() !!}
|
||||
|
||||
@ -46,22 +48,72 @@
|
||||
<div class="col-md-3">
|
||||
<h3>{{ trans('texts.details') }}</h3>
|
||||
@if ($client->id_number)
|
||||
<p><i class="fa fa-id-number" style="width: 20px"></i>{{ trans('texts.id_number').': '.$this->id_number }}</p>
|
||||
<p><i class="fa fa-id-number" style="width: 20px"></i>{{ trans('texts.id_number').': '.$client->id_number }}</p>
|
||||
@endif
|
||||
<p>{{ $client->getVatNumber() }}</p>
|
||||
<p>{{ $client->getAddress() }}</p>
|
||||
<p>{{ $client->getCustomFields() }}</p>
|
||||
<p>{{ $client->getPhone() }}</p>
|
||||
<p>{{ $client->getNotes() }}</p>
|
||||
<p>{{ $client->getIndustry() }}</p>
|
||||
<p>{{ $client->getWebsite() }}</p>
|
||||
@if ($client->vat_number)
|
||||
<p><i class="fa fa-vat-number" style="width: 20px"></i>{{ trans('texts.vat_number').': '.$client->vat_number }}</p>
|
||||
@endif
|
||||
|
||||
@if ($client->address1)
|
||||
{{ $client->address1 }}<br/>
|
||||
@endif
|
||||
@if ($client->address2)
|
||||
{{ $client->address2 }}<br/>
|
||||
@endif
|
||||
@if ($client->city)
|
||||
{{ $client->city }},
|
||||
@endif
|
||||
@if ($client->state)
|
||||
{{ $client->state }}
|
||||
@endif
|
||||
@if ($client->postal_code)
|
||||
{{ $client->postal_code }}
|
||||
@endif
|
||||
@if ($client->country)
|
||||
<br/>{{ $client->country->name }}
|
||||
@endif
|
||||
|
||||
@if ($client->account->custom_client_label1 && $client->custom_value1)
|
||||
{{ $client->account->custom_client_label1 . ': ' . $client->custom_value1 }}<br/>
|
||||
@endif
|
||||
@if ($client->account->custom_client_label2 && $client->custom_value2)
|
||||
{{ $client->account->custom_client_label2 . ': ' . $client->custom_value2 }}<br/>
|
||||
@endif
|
||||
|
||||
@if ($client->work_phone)
|
||||
<i class="fa fa-phone" style="width: 20px"></i>{{ Utils::formatPhoneNumber($client->work_phone) }}
|
||||
@endif
|
||||
|
||||
@if ($client->private_notes)
|
||||
<p><i>{{ $client->private_notes }}</i></p>
|
||||
@endif
|
||||
|
||||
@if ($client->client_industry)
|
||||
{{ $client->client_industry->name }}<br/>
|
||||
@endif
|
||||
@if ($client->client_size)
|
||||
{{ $client->client_size->name }}<br/>
|
||||
@endif
|
||||
|
||||
@if ($client->website)
|
||||
<p>{!! $client->getWebsite() !!}</p>
|
||||
@endif
|
||||
|
||||
<p>{{ $client->payment_terms ? trans('texts.payment_terms') . ": Net " . $client->payment_terms : '' }}</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<h3>{{ trans('texts.contacts') }}</h3>
|
||||
@foreach ($client->contacts as $contact)
|
||||
{{ $contact->getDetails() }}
|
||||
@if ($contact->first_name || $contact->last_name)
|
||||
<b>{{ $contact->first_name.' '.$contact->last_name }}</b><br/>
|
||||
@endif
|
||||
@if ($contact->email)
|
||||
<i class="fa fa-envelope" style="width: 20px"></i>{!! HTML::mailto($contact->email, $contact->email) !!}<br/>
|
||||
@endif
|
||||
@if ($contact->phone)
|
||||
<i class="fa fa-phone" style="width: 20px"></i>{!! Utils::formatPhoneNumber($contact->phone) !!}
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@ -204,10 +256,10 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
$('.normalDropDown').click(function() {
|
||||
$('.normalDropDown:not(.dropdown-toggle)').click(function() {
|
||||
window.location = '{{ URL::to('clients/' . $client->public_id . '/edit') }}';
|
||||
});
|
||||
$('.primaryDropDown').click(function() {
|
||||
$('.primaryDropDown:not(.dropdown-toggle)').click(function() {
|
||||
window.location = '{{ URL::to('invoices/create/' . $client->public_id ) }}';
|
||||
});
|
||||
});
|
||||
|
@ -8,20 +8,18 @@
|
||||
@section('content')
|
||||
|
||||
|
||||
{{ Former::open($url)->addClass('col-md-10 col-md-offset-1 warn-on-exit')->method($method)->rules(array(
|
||||
{!! Former::open($url)->addClass('col-md-10 col-md-offset-1 warn-on-exit')->method($method)->rules(array(
|
||||
'client' => 'required',
|
||||
'amount' => 'required',
|
||||
)); }}
|
||||
)) !!}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
|
||||
{{ Former::select('client')->addOption('', '')->addGroupClass('client-select') }}
|
||||
{{ Former::text('amount') }}
|
||||
{{ Former::text('credit_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') }}
|
||||
{{-- Former::select('currency_id')->addOption('','')
|
||||
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) --}}
|
||||
{{ Former::textarea('private_notes') }}
|
||||
{!! Former::select('client')->addOption('', '')->addGroupClass('client-select') !!}
|
||||
{!! Former::text('amount') !!}
|
||||
{!! Former::text('credit_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') !!}
|
||||
{!! Former::textarea('private_notes') !!}
|
||||
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@ -29,16 +27,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<center class="buttons">
|
||||
{{ Button::lg_primary_submit_success(trans('texts.save'))->append_with_icon('floppy-disk') }}
|
||||
{{ Button::lg_default_link('credits/' . ($credit ? $credit->public_id : ''), trans('texts.cancel'))->append_with_icon('remove-circle'); }}
|
||||
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo('/credits')->appendIcon(Icon::create('remove-circle')) !!}
|
||||
</center>
|
||||
|
||||
{{ Former::close() }}
|
||||
{!! Former::close() !!}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
var clients = {{ $clients }};
|
||||
var clients = {!! $clients !!};
|
||||
|
||||
$(function() {
|
||||
|
||||
|
@ -9,14 +9,10 @@
|
||||
{!! Former::text('id') !!}
|
||||
</div>
|
||||
|
||||
{!! DropdownButton::normal(trans('texts.archive'),
|
||||
Navigation::links(
|
||||
array(
|
||||
array(trans('texts.archive_'.$entityType), "javascript:submitForm('archive')"),
|
||||
array(trans('texts.delete_'.$entityType), "javascript:submitForm('delete')"),
|
||||
)
|
||||
)
|
||||
, array('id'=>'archive'))->split() !!}
|
||||
{!! 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() !!}
|
||||
|
||||
<label for="trashed" style="font-weight:normal; margin-left: 10px;">
|
||||
<input id="trashed" type="checkbox" onclick="setTrashVisible()"
|
||||
@ -145,8 +141,8 @@
|
||||
|
||||
}
|
||||
|
||||
$('#archive > button').prop('disabled', true);
|
||||
$('#archive > button:first').click(function() {
|
||||
$('.archive').prop('disabled', true);
|
||||
$('.archive:not(.dropdown-toggle)').click(function() {
|
||||
submitForm('archive');
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user