1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-16 16:13:20 +01:00
invoiceninja/resources/views/clients/edit.blade.php

317 lines
11 KiB
PHP
Raw Normal View History

2015-03-16 22:45:25 +01:00
@extends('header')
@section('onReady')
$('input#name').focus();
@stop
@section('content')
2015-10-28 20:22:07 +01:00
@if ($errors->first('contacts'))
<div class="alert alert-danger">{{ trans($errors->first('contacts')) }}</div>
@endif
2015-03-16 22:45:25 +01:00
<div class="row">
2015-07-07 22:08:16 +02:00
{!! Former::open($url)
2015-11-09 15:53:18 +01:00
->autocomplete('off')
2015-07-07 22:08:16 +02:00
->rules(
['email' => 'email']
)->addClass('col-md-12 warn-on-exit')
->method($method) !!}
2016-09-06 09:20:51 +02:00
2015-11-09 15:53:18 +01:00
@include('partials.autocomplete_fix')
2015-03-16 22:45:25 +01:00
@if ($client)
2015-03-26 07:24:02 +01:00
{!! Former::populate($client) !!}
{!! Former::populateField('task_rate', floatval($client->task_rate) ? Utils::roundSignificant($client->task_rate) : '') !!}
2015-10-28 20:22:07 +01:00
{!! Former::hidden('public_id') !!}
2017-03-29 10:46:52 +02:00
@else
{!! Former::populateField('invoice_number_counter', 1) !!}
{!! Former::populateField('quote_number_counter', 1) !!}
@if ($account->client_number_counter)
{!! Former::populateField('id_number', $account->getNextNumber()) !!}
@endif
2015-03-16 22:45:25 +01:00
@endif
<div class="row">
<div class="col-md-6">
2016-09-06 09:20:51 +02:00
<div class="panel panel-default" style="min-height: 380px">
2015-04-20 16:34:23 +02:00
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.organization') !!}</h3>
</div>
<div class="panel-body">
2016-09-06 09:20:51 +02:00
2015-03-26 07:24:02 +01:00
{!! Former::text('name')->data_bind("attr { placeholder: placeholderName }") !!}
2017-01-04 09:11:32 +01:00
{!! Former::text('id_number')->placeholder($account->clientNumbersEnabled() ? $account->getNextNumber() : ' ') !!}
2017-01-03 20:48:40 +01:00
{!! Former::text('vat_number') !!}
{!! Former::text('website') !!}
2015-03-26 07:24:02 +01:00
{!! Former::text('work_phone') !!}
2016-09-06 09:20:51 +02:00
@if (Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS))
2015-03-16 22:45:25 +01:00
@if ($customLabel1)
2017-08-04 15:39:11 +02:00
{!! Former::text('custom_value1')->label(e($customLabel1)) !!}
2015-03-16 22:45:25 +01:00
@endif
@if ($customLabel2)
2017-08-04 15:39:11 +02:00
{!! Former::text('custom_value2')->label(e($customLabel2)) !!}
2015-03-16 22:45:25 +01:00
@endif
@endif
2017-03-29 10:46:52 +02:00
@if ($account->usesClientInvoiceCounter())
{!! Former::text('invoice_number_counter')->label('invoice_counter') !!}
2017-04-02 19:35:10 +02:00
@if (! $account->share_counter)
{!! Former::text('quote_number_counter')->label('quote_counter') !!}
@endif
2017-03-29 10:46:52 +02:00
@endif
2015-04-20 16:34:23 +02:00
</div>
2017-03-29 10:46:52 +02:00
</div>
2015-04-20 16:34:23 +02:00
2017-05-16 15:00:56 +02:00
<div class="panel panel-default">
2015-04-20 16:34:23 +02:00
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.address') !!}</h3>
</div>
<div class="panel-body">
2016-09-06 09:20:51 +02:00
2015-03-26 07:24:02 +01:00
{!! Former::text('address1') !!}
{!! Former::text('address2') !!}
{!! Former::text('city') !!}
{!! Former::text('state') !!}
{!! Former::text('postal_code') !!}
{!! Former::select('country_id')->addOption('','')
->fromQuery($countries, 'name', 'id') !!}
2015-03-16 22:45:25 +01:00
2015-04-20 16:34:23 +02:00
</div>
</div>
2015-03-16 22:45:25 +01:00
</div>
<div class="col-md-6">
2015-04-20 16:34:23 +02:00
2016-09-06 09:20:51 +02:00
<div class="panel panel-default" style="min-height: 380px">
2015-04-20 16:34:23 +02:00
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.contacts') !!}</h3>
</div>
<div class="panel-body">
2015-03-16 22:45:25 +01:00
<div data-bind='template: { foreach: contacts,
beforeRemove: hideContact,
afterAdd: showContact }'>
2015-10-28 20:22:07 +01:00
{!! Former::hidden('public_id')->data_bind("value: public_id, valueUpdate: 'afterkeydown',
attr: {name: 'contacts[' + \$index() + '][public_id]'}") !!}
2016-09-06 09:20:51 +02:00
{!! Former::text('first_name')->data_bind("value: first_name, valueUpdate: 'afterkeydown',
2015-10-28 20:22:07 +01:00
attr: {name: 'contacts[' + \$index() + '][first_name]'}") !!}
{!! Former::text('last_name')->data_bind("value: last_name, valueUpdate: 'afterkeydown',
attr: {name: 'contacts[' + \$index() + '][last_name]'}") !!}
2016-09-06 09:20:51 +02:00
{!! Former::text('email')->data_bind("value: email, valueUpdate: 'afterkeydown',
2015-10-28 20:22:07 +01:00
attr: {name: 'contacts[' + \$index() + '][email]', id:'email'+\$index()}") !!}
{!! Former::text('phone')->data_bind("value: phone, valueUpdate: 'afterkeydown',
attr: {name: 'contacts[' + \$index() + '][phone]'}") !!}
@if ($account->hasFeature(FEATURE_CLIENT_PORTAL_PASSWORD) && $account->enable_portal_password)
2016-02-29 22:46:27 +01:00
{!! Former::password('password')->data_bind("value: password()?'-%unchanged%-':'', valueUpdate: 'afterkeydown',
attr: {name: 'contacts[' + \$index() + '][password]'}")->autocomplete('new-password') !!}
2016-02-29 22:46:27 +01:00
@endif
2017-04-16 13:31:14 +02:00
@if (Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS))
@if ($account->custom_contact_label1)
{!! Former::text('custom_contact1')->data_bind("value: custom_value1, valueUpdate: 'afterkeydown',
attr: {name: 'contacts[' + \$index() + '][custom_value1]'}")
2017-08-04 15:39:11 +02:00
->label(e($account->custom_contact_label1)) !!}
2017-04-16 13:31:14 +02:00
@endif
@if ($account->custom_contact_label2)
{!! Former::text('custom_contact2')->data_bind("value: custom_value2, valueUpdate: 'afterkeydown',
attr: {name: 'contacts[' + \$index() + '][custom_value2]'}")
2017-08-04 15:39:11 +02:00
->label(e($account->custom_contact_label2)) !!}
2017-04-16 13:31:14 +02:00
@endif
@endif
2015-03-16 22:45:25 +01:00
<div class="form-group">
<div class="col-lg-8 col-lg-offset-4 bold">
<span class="redlink bold" data-bind="visible: $parent.contacts().length > 1">
2015-03-26 07:24:02 +01:00
{!! link_to('#', trans('texts.remove_contact').' -', array('data-bind'=>'click: $parent.removeContact')) !!}
2016-09-06 09:20:51 +02:00
</span>
2015-03-16 22:45:25 +01:00
<span data-bind="visible: $index() === ($parent.contacts().length - 1)" class="pull-right greenlink bold">
2015-03-26 07:24:02 +01:00
{!! link_to('#', trans('texts.add_contact').' +', array('onclick'=>'return addContact()')) !!}
2015-03-16 22:45:25 +01:00
</span>
</div>
</div>
</div>
2015-04-20 16:34:23 +02:00
</div>
</div>
2015-03-16 22:45:25 +01:00
2017-05-16 15:00:56 +02:00
<div class="panel panel-default">
2015-04-20 16:34:23 +02:00
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.additional_info') !!}</h3>
</div>
<div class="panel-body">
2016-09-06 09:20:51 +02:00
2015-04-20 16:34:23 +02:00
{!! Former::select('currency_id')->addOption('','')
->placeholder($account->currency ? $account->currency->name : '')
2015-04-20 16:34:23 +02:00
->fromQuery($currencies, 'name', 'id') !!}
{!! Former::select('language_id')->addOption('','')
->placeholder($account->language ? trans('texts.lang_'.$account->language->name) : '')
->fromQuery($languages, 'name', 'id') !!}
2015-03-26 07:24:02 +01:00
{!! Former::select('payment_terms')->addOption('','')
->fromQuery(\App\Models\PaymentTerm::getSelectOptions(), 'name', 'num_days')
2017-01-16 13:06:22 +01:00
->placeholder($account->present()->paymentTerms)
2015-07-07 22:08:16 +02:00
->help(trans('texts.payment_terms_help')) !!}
@if ($account->isModuleEnabled(ENTITY_TASK))
{!! Former::text('task_rate')
->placeholder($account->present()->taskRate)
->help('task_rate_help') !!}
@endif
2015-03-26 07:24:02 +01:00
{!! Former::select('size_id')->addOption('','')
->fromQuery($sizes, 'name', 'id') !!}
{!! Former::select('industry_id')->addOption('','')
->fromQuery($industries, 'name', 'id') !!}
2017-05-16 15:00:56 +02:00
{!! Former::textarea('public_notes') !!}
2015-03-26 07:24:02 +01:00
{!! Former::textarea('private_notes') !!}
2017-05-08 10:38:57 +02:00
</div>
</div>
@if (Auth::user()->account->isNinjaAccount())
2017-05-08 10:38:57 +02:00
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.pro_plan_product') !!}</h3>
</div>
<div class="panel-body">
2015-10-22 20:48:12 +02:00
@if (isset($planDetails))
{!! Former::populateField('plan', $planDetails['plan']) !!}
{!! Former::populateField('plan_term', $planDetails['term']) !!}
2017-05-08 10:18:35 +02:00
{!! Former::populateField('plan_price', $planDetails['plan_price']) !!}
@if (!empty($planDetails['paid']))
{!! Former::populateField('plan_paid', $planDetails['paid']->format('Y-m-d')) !!}
@endif
@if (!empty($planDetails['expires']))
{!! Former::populateField('plan_expires', $planDetails['expires']->format('Y-m-d')) !!}
@endif
@if (!empty($planDetails['started']))
{!! Former::populateField('plan_started', $planDetails['started']->format('Y-m-d')) !!}
@endif
@endif
{!! Former::select('plan')
->addOption(trans('texts.plan_free'), PLAN_FREE)
->addOption(trans('texts.plan_pro'), PLAN_PRO)
->addOption(trans('texts.plan_enterprise'), PLAN_ENTERPRISE)!!}
{!! Former::select('plan_term')
->addOption()
->addOption(trans('texts.plan_term_yearly'), PLAN_TERM_YEARLY)
->addOption(trans('texts.plan_term_monthly'), PLAN_TERM_MONTHLY)!!}
2017-05-08 10:18:35 +02:00
{!! Former::text('plan_price') !!}
{!! Former::text('plan_started')
->data_date_format('yyyy-mm-dd')
->addGroupClass('plan_start_date')
->append('<i class="glyphicon glyphicon-calendar"></i>') !!}
{!! Former::text('plan_paid')
->data_date_format('yyyy-mm-dd')
->addGroupClass('plan_paid_date')
->append('<i class="glyphicon glyphicon-calendar"></i>') !!}
{!! Former::text('plan_expires')
2015-11-09 20:24:22 +01:00
->data_date_format('yyyy-mm-dd')
->addGroupClass('plan_expire_date')
2015-11-09 20:24:22 +01:00
->append('<i class="glyphicon glyphicon-calendar"></i>') !!}
<script type="text/javascript">
$(function() {
$('#plan_started, #plan_paid, #plan_expires').datepicker();
2015-11-09 20:24:22 +01:00
});
</script>
2015-04-20 16:34:23 +02:00
</div>
</div>
@endif
2015-03-16 22:45:25 +01:00
</div>
</div>
2015-03-26 07:24:02 +01:00
{!! Former::hidden('data')->data_bind("value: ko.toJSON(model)") !!}
2015-03-16 22:45:25 +01:00
<script type="text/javascript">
$(function() {
$('#country_id').combobox();
});
function ContactModel(data) {
var self = this;
self.public_id = ko.observable('');
self.first_name = ko.observable('');
self.last_name = ko.observable('');
self.email = ko.observable('');
self.phone = ko.observable('');
2016-03-08 19:38:28 +01:00
self.password = ko.observable('');
2017-04-16 13:31:14 +02:00
self.custom_value1 = ko.observable('');
self.custom_value2 = ko.observable('');
2015-03-16 22:45:25 +01:00
if (data) {
2015-10-28 20:22:07 +01:00
ko.mapping.fromJS(data, {}, this);
}
2015-03-16 22:45:25 +01:00
}
2015-10-28 20:22:07 +01:00
function ClientModel(data) {
2015-03-16 22:45:25 +01:00
var self = this;
2015-10-28 20:22:07 +01:00
self.contacts = ko.observableArray();
2015-03-16 22:45:25 +01:00
self.mapping = {
'contacts': {
create: function(options) {
return new ContactModel(options.data);
}
}
2015-10-28 20:22:07 +01:00
}
2015-03-16 22:45:25 +01:00
if (data) {
2015-10-28 20:22:07 +01:00
ko.mapping.fromJS(data, self.mapping, this);
2015-03-16 22:45:25 +01:00
} else {
self.contacts.push(new ContactModel());
}
self.placeholderName = ko.computed(function() {
if (self.contacts().length == 0) return '';
var contact = self.contacts()[0];
if (contact.first_name() || contact.last_name()) {
return contact.first_name() + ' ' + contact.last_name();
} else {
return contact.email();
}
2016-09-06 09:20:51 +02:00
});
2015-03-16 22:45:25 +01:00
}
2015-10-28 20:22:07 +01:00
@if ($data)
window.model = new ClientModel({!! $data !!});
@else
window.model = new ClientModel({!! $client !!});
@endif
2015-03-16 22:45:25 +01:00
model.showContact = function(elem) { if (elem.nodeType === 1) $(elem).hide().slideDown() }
model.hideContact = function(elem) { if (elem.nodeType === 1) $(elem).slideUp(function() { $(elem).remove(); }) }
ko.applyBindings(model);
function addContact() {
model.contacts.push(new ContactModel());
return false;
}
model.removeContact = function() {
model.contacts.remove(this);
}
</script>
<center class="buttons">
2015-05-19 21:14:00 +02:00
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/clients/' . ($client ? $client->public_id : '')))->appendIcon(Icon::create('remove-circle')) !!}
2015-06-04 22:53:58 +02:00
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
2015-03-16 22:45:25 +01:00
</center>
2015-03-26 07:24:02 +01:00
{!! Former::close() !!}
2015-03-16 22:45:25 +01:00
</div>
@stop