1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/views/clients/edit.blade.php

138 lines
4.0 KiB
PHP
Raw Normal View History

2013-11-26 13:45:07 +01:00
@extends('header')
@section('onReady')
2013-12-30 21:17:45 +01:00
$('input#first_name').focus();
2013-11-26 13:45:07 +01:00
@stop
@section('content')
<!--<h3>{{ $title }} Client</h3>-->
2013-12-03 23:00:01 +01:00
{{ Former::open($url)->addClass('col-md-10 col-md-offset-1 main_form')->method($method)->rules(array(
2013-12-30 21:17:45 +01:00
'email' => 'email|required'
2013-11-26 13:45:07 +01:00
)); }}
2013-11-28 20:06:38 +01:00
@if ($client)
{{ Former::populate($client) }}
@endif
2013-12-05 21:25:20 +01:00
2013-11-29 13:09:21 +01:00
<div class="row">
<div class="col-md-6">
{{ Former::legend('Contacts') }}
<div data-bind='template: { foreach: contacts,
beforeRemove: hideContact,
afterAdd: showContact }'>
2013-12-05 16:23:24 +01:00
{{ Former::hidden('public_id')->data_bind("value: public_id, valueUpdate: 'afterkeydown'") }}
2013-11-29 13:09:21 +01:00
{{ Former::text('first_name')->data_bind("value: first_name, valueUpdate: 'afterkeydown'") }}
{{ Former::text('last_name')->data_bind("value: last_name, valueUpdate: 'afterkeydown'") }}
{{ Former::text('email')->data_bind("value: email, valueUpdate: 'afterkeydown'") }}
{{ Former::text('phone')->data_bind("value: phone, valueUpdate: 'afterkeydown'") }}
2013-11-26 13:45:07 +01:00
2013-11-29 13:09:21 +01:00
<div class="form-group">
<div class="col-lg-8 col-lg-offset-4">
<span data-bind="visible: $parent.contacts().length > 1">
{{ link_to('#', 'Remove contact', array('data-bind'=>'click: $parent.removeContact')) }}
</span>
<span data-bind="visible: $index() === ($parent.contacts().length - 1)" class="pull-right">
{{ link_to('#', 'Add contact', array('onclick'=>'return addContact()')) }}
</span>
</div>
</div>
</div>
2013-12-11 21:33:44 +01:00
{{ Former::legend('Additional Info') }}
2013-12-31 10:43:39 +01:00
{{ Former::select('payment_terms')->addOption('','')
->fromQuery($paymentTerms, 'name', 'num_days') }}
2013-12-29 18:40:11 +01:00
{{ Former::select('currency_id')->addOption('','')->label('Currency')
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) }}
2013-12-11 21:33:44 +01:00
{{ Former::select('client_size_id')->addOption('','')->label('Size')
->fromQuery($clientSizes, 'name', 'id')->select($client ? $client->client_size_id : '') }}
{{ Former::select('client_industry_id')->addOption('','')->label('Industry')
->fromQuery($clientIndustries, 'name', 'id')->select($client ? $client->client_industry_id : '') }}
2013-12-30 21:17:45 +01:00
{{ Former::textarea('private_notes') }}
</div>
<div class="col-md-6">
{{ Former::legend('Organization') }}
{{ Former::text('name') }}
{{ Former::text('website') }}
{{ Former::text('work_phone')->label('Phone') }}
{{ Former::legend('Address') }}
{{ Former::text('address1')->label('Street') }}
{{ Former::text('address2')->label('Apt/Floor') }}
{{ Former::text('city') }}
{{ Former::text('state') }}
{{ Former::text('postal_code') }}
{{ Former::select('country_id')->addOption('','')->label('Country')
->fromQuery($countries, 'name', 'id')->select($client ? $client->country_id : '') }}
2013-12-11 21:33:44 +01:00
2013-11-29 13:09:21 +01:00
</div>
2013-11-28 20:06:38 +01:00
</div>
2013-11-28 22:10:01 +01:00
2013-11-26 13:45:07 +01:00
2013-11-28 20:06:38 +01:00
{{ Former::hidden('data')->data_bind("value: ko.toJSON(model)") }}
<script type="text/javascript">
2013-11-28 22:10:01 +01:00
$(function() {
$('#country_id').combobox();
});
2013-11-28 20:06:38 +01:00
function ContactModel() {
var self = this;
2013-12-05 16:23:24 +01:00
self.public_id = ko.observable('');
2013-11-28 20:06:38 +01:00
self.first_name = ko.observable('');
self.last_name = ko.observable('');
self.email = ko.observable('');
self.phone = ko.observable('');
}
function ContactsModel() {
var self = this;
self.contacts = ko.observableArray();
}
@if ($client)
window.model = ko.mapping.fromJS({{ $client }});
@else
window.model = new ContactsModel();
addContact();
@endif
2013-11-28 22:10:01 +01:00
model.showContact = function(elem) { if (elem.nodeType === 1) $(elem).hide().slideDown() }
2013-12-05 21:25:20 +01:00
model.hideContact = function(elem) { if (elem.nodeType === 1) $(elem).slideUp(function() { $(elem).remove(); }) }
2013-11-28 22:10:01 +01:00
2013-11-28 20:06:38 +01:00
ko.applyBindings(model);
function addContact() {
model.contacts.push(new ContactModel());
return false;
}
model.removeContact = function() {
model.contacts.remove(this);
}
2013-11-28 22:10:01 +01:00
2013-12-05 21:25:20 +01:00
2013-11-28 20:06:38 +01:00
</script>
2013-12-05 21:25:20 +01:00
<center style="margin-top:16px">
{{ Button::lg_primary_submit('Save') }} &nbsp;|&nbsp;
{{ link_to('clients/' . ($client ? $client->public_id : ''), 'Cancel') }}
</center>
{{ Former::close() }}
2013-11-26 13:45:07 +01:00
@stop