Proposals

This commit is contained in:
Hillel Coren 2018-02-04 21:34:38 +02:00
parent cb54e9e8b7
commit b4bf222d5d
7 changed files with 29 additions and 11 deletions

View File

@ -27,7 +27,7 @@ class UpdateProposalRequest extends ProposalRequest
return [ return [
'quote_id' => 'required', 'quote_id' => 'required',
'template_id' => 'required', 'proposal_template_id' => 'required',
]; ];
} }
} }

View File

@ -23,6 +23,8 @@ class Proposal extends EntityModel
*/ */
protected $fillable = [ protected $fillable = [
'private_notes', 'private_notes',
'html',
'css',
]; ];
/** /**

View File

@ -25,6 +25,8 @@ class ProposalSnippet extends EntityModel
'name', 'name',
'private_notes', 'private_notes',
'proposal_category_id', 'proposal_category_id',
'html',
'css',
]; ];
/** /**

View File

@ -24,6 +24,8 @@ class ProposalTemplate extends EntityModel
protected $fillable = [ protected $fillable = [
'name', 'name',
'private_notes', 'private_notes',
'html',
'css',
]; ];
/** /**

View File

@ -33,6 +33,8 @@
<span style="display:none"> <span style="display:none">
{!! Former::text('public_id') !!} {!! Former::text('public_id') !!}
{!! Former::text('html') !!}
{!! Former::text('css') !!}
</span> </span>
<div class="row"> <div class="row">
@ -81,6 +83,8 @@
var templateMap = {}; var templateMap = {};
function onSaveClick() { function onSaveClick() {
$('#html').val(grapesjsEditor.getHtml());
$('#css').val(grapesjsEditor.getCss());
$('#mainForm').submit(); $('#mainForm').submit();
} }
@ -111,10 +115,10 @@
setComboboxValue($('.template-select'), template.public_id, template.name); setComboboxValue($('.template-select'), template.public_id, template.name);
} }
var editor = grapesjs.init({ window.grapesjsEditor = grapesjs.init({
container : '#gjs', container : '#gjs',
components: '', components: '{!! $proposal ? $proposal->html : '' !!}',
style: '', style: '{!! $proposal ? $proposal->css : '' !!}',
showDevices: false, showDevices: false,
plugins: ['gjs-preset-newsletter'], plugins: ['gjs-preset-newsletter'],
//plugins: ['gjs-blocks-basic'], //plugins: ['gjs-blocks-basic'],

View File

@ -33,6 +33,8 @@
<span style="display:none"> <span style="display:none">
{!! Former::text('public_id') !!} {!! Former::text('public_id') !!}
{!! Former::text('html') !!}
{!! Former::text('css') !!}
</span> </span>
@ -77,6 +79,8 @@
var categoryMap = {}; var categoryMap = {};
function onSaveClick() { function onSaveClick() {
$('#html').val(grapesjsEditor.getHtml());
$('#css').val(grapesjsEditor.getCss());
$('#mainForm').submit(); $('#mainForm').submit();
} }
@ -94,10 +98,10 @@
setComboboxValue($('.category-select'), category.public_id, category.name); setComboboxValue($('.category-select'), category.public_id, category.name);
} }
var editor = grapesjs.init({ window.grapesjsEditor = grapesjs.init({
container : '#gjs', container : '#gjs',
components: '', components: '{!! $snippet ? $snippet->html : '' !!}',
style: '', style: '{!! $snippet ? $snippet->css : '' !!}',
showDevices: false, showDevices: false,
plugins: ['gjs-preset-newsletter'], plugins: ['gjs-preset-newsletter'],
//plugins: ['gjs-blocks-basic'], //plugins: ['gjs-blocks-basic'],

View File

@ -32,6 +32,8 @@
<span style="display:none"> <span style="display:none">
{!! Former::text('public_id') !!} {!! Former::text('public_id') !!}
{!! Former::text('html') !!}
{!! Former::text('css') !!}
</span> </span>
@ -44,7 +46,7 @@
{!! Former::text('name') !!} {!! Former::text('name') !!}
<!-- <!--
{!! Former::select('template_id')->addOption('', '') {!! Former::select('proposal_template_id')->addOption('', '')
->label(trans('texts.template')) ->label(trans('texts.template'))
->addGroupClass('template-select') !!} ->addGroupClass('template-select') !!}
--> -->
@ -77,6 +79,8 @@
var templateMap = {}; var templateMap = {};
function onSaveClick() { function onSaveClick() {
$('#html').val(grapesjsEditor.getHtml());
$('#css').val(grapesjsEditor.getCss());
$('#mainForm').submit(); $('#mainForm').submit();
} }
@ -91,10 +95,10 @@
@include('partials/entity_combobox', ['entityType' => ENTITY_PROPOSAL_TEMPLATE]) @include('partials/entity_combobox', ['entityType' => ENTITY_PROPOSAL_TEMPLATE])
*/ */
var editor = grapesjs.init({ window.grapesjsEditor = grapesjs.init({
container : '#gjs', container : '#gjs',
components: '', components: '{!! $template ? $template->html : '' !!}',
style: '', style: '{!! $template ? $template->css : '' !!}',
showDevices: false, showDevices: false,
plugins: ['gjs-preset-newsletter'], plugins: ['gjs-preset-newsletter'],
//plugins: ['gjs-blocks-basic'], //plugins: ['gjs-blocks-basic'],