2018-01-30 19:58:55 +01:00
|
|
|
@extends('header')
|
|
|
|
|
|
|
|
@section('head')
|
|
|
|
@parent
|
|
|
|
|
|
|
|
<script src="{{ asset('js/grapesjs.min.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
|
|
|
|
<link href="{{ asset('css/grapesjs.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.gjs-four-color {
|
|
|
|
color: white !important;
|
|
|
|
}
|
|
|
|
.gjs-block.fa {
|
|
|
|
font-size: 4em !important;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
@stop
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
|
2018-02-01 07:47:17 +01:00
|
|
|
{!! Former::open($url)
|
|
|
|
->method($method)
|
|
|
|
->id('mainForm')
|
|
|
|
->rules([
|
|
|
|
'quote_id' => 'required',
|
2018-02-04 17:42:13 +01:00
|
|
|
'proposal_template_id' => 'required',
|
2018-02-01 07:47:17 +01:00
|
|
|
]) !!}
|
2018-01-30 19:58:55 +01:00
|
|
|
|
2018-02-01 10:24:53 +01:00
|
|
|
@if ($proposal)
|
|
|
|
{!! Former::populate($proposal) !!}
|
|
|
|
@endif
|
|
|
|
|
|
|
|
<span style="display:none">
|
|
|
|
{!! Former::text('public_id') !!}
|
|
|
|
</span>
|
|
|
|
|
2018-01-30 19:58:55 +01:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-12">
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-body">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
{!! Former::select('quote_id')->addOption('', '')
|
|
|
|
->label(trans('texts.quote'))
|
|
|
|
->addGroupClass('quote-select') !!}
|
2018-02-04 17:42:13 +01:00
|
|
|
{!! Former::select('proposal_template_id')->addOption('', '')
|
2018-01-30 19:58:55 +01:00
|
|
|
->label(trans('texts.template'))
|
|
|
|
->addGroupClass('template-select') !!}
|
|
|
|
|
2018-02-01 07:47:17 +01:00
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
2018-02-04 17:42:13 +01:00
|
|
|
{!! Former::textarea('private_notes')
|
|
|
|
->style('height: 100px') !!}
|
2018-01-30 19:58:55 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<center class="buttons">
|
|
|
|
{!! Button::normal(trans('texts.cancel'))
|
|
|
|
->appendIcon(Icon::create('remove-circle'))
|
|
|
|
->asLinkTo(HTMLUtils::previousUrl('/proposals')) !!}
|
|
|
|
|
|
|
|
{!! Button::success(trans("texts.save"))
|
|
|
|
->withAttributes(array('id' => 'saveButton', 'onclick' => 'onSaveClick()'))
|
|
|
|
->appendIcon(Icon::create('floppy-disk')) !!}
|
|
|
|
</center>
|
|
|
|
|
|
|
|
{!! Former::close() !!}
|
|
|
|
|
|
|
|
<div id="gjs"></div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
var quotes = {!! $quotes !!};
|
|
|
|
var quoteMap = {};
|
|
|
|
|
|
|
|
var templates = {!! $templates !!};
|
|
|
|
var templateMap = {};
|
|
|
|
|
2018-02-01 07:47:17 +01:00
|
|
|
function onSaveClick() {
|
|
|
|
$('#mainForm').submit();
|
|
|
|
}
|
|
|
|
|
2018-01-30 19:58:55 +01:00
|
|
|
$(function() {
|
2018-02-01 07:47:17 +01:00
|
|
|
var quoteId = {{ ! empty($quotePublicId) ? $quotePublicId : 0 }};
|
2018-01-30 19:58:55 +01:00
|
|
|
var $quoteSelect = $('select#quote_id');
|
|
|
|
for (var i = 0; i < quotes.length; i++) {
|
|
|
|
var quote = quotes[i];
|
|
|
|
quoteMap[quote.public_id] = quote;
|
|
|
|
$quoteSelect.append(new Option(quote.invoice_number + ' - ' + getClientDisplayName(quote.client), quote.public_id));
|
|
|
|
}
|
|
|
|
@include('partials/entity_combobox', ['entityType' => ENTITY_QUOTE])
|
2018-02-04 17:42:13 +01:00
|
|
|
if (quoteId) {
|
|
|
|
var quote = quoteMap[quoteId];
|
|
|
|
setComboboxValue($('.quote-select'), quote.public_id, quote.invoice_number + ' - ' + getClientDisplayName(quote.client));
|
|
|
|
}
|
2018-01-30 19:58:55 +01:00
|
|
|
|
2018-02-04 17:42:13 +01:00
|
|
|
var templateId = {{ ! empty($templatePublicId) ? $templatePublicId : 0 }};
|
|
|
|
var $proposal_templateSelect = $('select#proposal_template_id');
|
2018-01-30 19:58:55 +01:00
|
|
|
for (var i = 0; i < templates.length; i++) {
|
|
|
|
var template = templates[i];
|
|
|
|
templateMap[template.public_id] = template;
|
2018-02-01 07:47:17 +01:00
|
|
|
$proposal_templateSelect.append(new Option(template.name, template.public_id));
|
2018-01-30 19:58:55 +01:00
|
|
|
}
|
|
|
|
@include('partials/entity_combobox', ['entityType' => ENTITY_PROPOSAL_TEMPLATE])
|
2018-02-04 17:42:13 +01:00
|
|
|
if (templateId) {
|
|
|
|
var template = templateMap[templateId];
|
|
|
|
setComboboxValue($('.template-select'), template.public_id, template.name);
|
|
|
|
}
|
2018-01-30 19:58:55 +01:00
|
|
|
|
|
|
|
var editor = grapesjs.init({
|
|
|
|
container : '#gjs',
|
|
|
|
components: '',
|
|
|
|
style: '',
|
|
|
|
showDevices: false,
|
|
|
|
plugins: ['gjs-preset-newsletter'],
|
|
|
|
//plugins: ['gjs-blocks-basic'],
|
|
|
|
storageManager: {type: 'none'},
|
|
|
|
panels: {
|
|
|
|
Xdefaults : [{
|
|
|
|
id : 'commands',
|
|
|
|
buttons : [{
|
|
|
|
id : 'smile',
|
|
|
|
className : 'fa fa-smile-o',
|
|
|
|
attributes : { title: 'Smile' }
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
/*
|
|
|
|
var blockManager = editor.BlockManager;
|
|
|
|
blockManager.add('h1-block', {
|
|
|
|
label: 'Heading',
|
|
|
|
category: 'Basic',
|
|
|
|
content: '<h1>Put your title here</h1>',
|
|
|
|
attributes: {
|
|
|
|
title: 'Insert h1 block',
|
|
|
|
class:'fa fa-smile-o'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
})
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
@stop
|