2015-03-16 22:45:25 +01:00
|
|
|
@extends('accounts.nav')
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
@parent
|
|
|
|
|
2015-04-06 13:46:02 +02:00
|
|
|
{!! Former::open($url)->method($method)
|
2015-06-14 10:55:02 +02:00
|
|
|
->rules(['product_key' => 'required|max:255'])
|
2015-04-06 13:46:02 +02:00
|
|
|
->addClass('col-md-8 col-md-offset-2 warn-on-exit') !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
<div class="panel panel-default">
|
2015-04-22 21:21:04 +02:00
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">{!! $title !!}</h3>
|
|
|
|
</div>
|
2015-04-20 16:34:23 +02:00
|
|
|
<div class="panel-body">
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
@if ($product)
|
|
|
|
{{ Former::populate($product) }}
|
|
|
|
{{ Former::populateField('cost', number_format($product->cost, 2, '.', '')) }}
|
|
|
|
@endif
|
|
|
|
|
2015-04-06 13:46:02 +02:00
|
|
|
{!! Former::text('product_key')->label('texts.product') !!}
|
|
|
|
{!! Former::textarea('notes')->data_bind("value: wrapped_notes, valueUpdate: 'afterkeydown'") !!}
|
|
|
|
{!! Former::text('cost') !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2015-04-06 13:46:02 +02:00
|
|
|
{!! Former::actions(
|
2015-06-04 22:53:58 +02:00
|
|
|
Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/company/products'))->appendIcon(Icon::create('remove-circle')),
|
|
|
|
Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk'))
|
2015-04-06 13:46:02 +02:00
|
|
|
) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-04-06 13:46:02 +02:00
|
|
|
{!! Former::close() !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
function ViewModel(data) {
|
|
|
|
var self = this;
|
|
|
|
@if ($product)
|
|
|
|
self.notes = ko.observable(wordWrapText('{{ str_replace(["\r\n","\r","\n"], '\n', addslashes($product->notes)) }}', 300));
|
|
|
|
@else
|
|
|
|
self.notes = ko.observable('');
|
|
|
|
@endif
|
|
|
|
|
|
|
|
self.wrapped_notes = ko.computed({
|
|
|
|
read: function() {
|
|
|
|
return self.notes();
|
|
|
|
},
|
|
|
|
write: function(value) {
|
|
|
|
value = wordWrapText(value, 235);
|
|
|
|
self.notes(value);
|
|
|
|
},
|
|
|
|
owner: this
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
window.model = new ViewModel();
|
|
|
|
ko.applyBindings(model);
|
|
|
|
|
2015-05-09 20:25:16 +02:00
|
|
|
$(function() {
|
|
|
|
$('#product_key').focus();
|
|
|
|
});
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
@stop
|