1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-16 08:02:40 +01:00
invoiceninja/resources/views/proposals/templates/edit.blade.php

126 lines
3.5 KiB
PHP
Raw Normal View History

2018-01-31 12:51:18 +01:00
@extends('header')
@section('head')
@parent
2018-02-05 20:04:49 +01:00
@include('proposals.grapesjs_header')
2018-01-31 12:51:18 +01:00
@stop
@section('content')
2018-02-01 07:47:17 +01:00
{!! Former::open($url)
->method($method)
2018-02-09 14:54:21 +01:00
->onsubmit('return onFormSubmit(event)')
2018-02-11 09:18:05 +01:00
->addClass('warn-on-exit')
2018-02-01 07:47:17 +01:00
->rules([
2018-02-04 17:42:13 +01:00
'name' => 'required',
2018-02-01 07:47:17 +01:00
]) !!}
2018-01-31 12:51:18 +01:00
2018-02-01 10:24:53 +01:00
@if ($template)
{!! Former::populate($template) !!}
@endif
<span style="display:none">
{!! Former::text('public_id') !!}
2018-02-04 20:34:38 +01:00
{!! Former::text('html') !!}
{!! Former::text('css') !!}
2018-02-01 10:24:53 +01:00
</span>
2018-01-31 12:51:18 +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">
2018-02-04 17:42:13 +01:00
{!! Former::text('name') !!}
</div>
<div class="col-md-6">
{!! Former::textarea('private_notes') !!}
2018-01-31 12:51:18 +01:00
</div>
</div>
</div>
</div>
</div>
</div>
<center class="buttons">
2018-02-12 13:30:27 +01:00
{!! Former::select()
->style('display:inline;width:170px;background-color:white !important')
->placeholder(trans('texts.load_template'))
->onchange('onTemplateSelectChange()')
->addClass('template-select')
->options($templateOptions)
->raw() !!}
2018-02-09 13:31:53 +01:00
@include('proposals.grapesjs_help')
2018-01-31 12:51:18 +01:00
{!! Button::normal(trans('texts.cancel'))
->appendIcon(Icon::create('remove-circle'))
->asLinkTo(HTMLUtils::previousUrl('/proposals')) !!}
2018-02-09 14:54:21 +01:00
{!! Button::success(trans('texts.save'))
->submit()
2018-01-31 12:51:18 +01:00
->appendIcon(Icon::create('floppy-disk')) !!}
2018-02-09 14:54:21 +01:00
@if ($template)
{!! Button::primary(trans('texts.new_proposal'))
2018-02-09 15:02:28 +01:00
->appendIcon(Icon::create('plus-sign'))
2018-02-09 14:54:21 +01:00
->asLinkTo(url('/proposals/create/0/' . $template->public_id)) !!}
@endif
2018-01-31 12:51:18 +01:00
</center>
{!! Former::close() !!}
<div id="gjs"></div>
<script type="text/javascript">
2018-02-12 13:30:27 +01:00
var customTemplates = {!! $customTemplates !!};
var customTemplateMap = {};
var defaultTemplates = {!! $defaultTemplates !!};
var defaultTemplateMap = {};
2018-01-31 12:51:18 +01:00
2018-02-09 14:54:21 +01:00
function onFormSubmit() {
2018-02-04 20:34:38 +01:00
$('#html').val(grapesjsEditor.getHtml());
$('#css').val(grapesjsEditor.getCss());
2018-02-09 14:54:21 +01:00
return true;
2018-02-04 17:42:13 +01:00
}
2018-02-12 13:30:27 +01:00
function onTemplateSelectChange() {
var templateId = $('.template-select').val();
var group = $('.template-select :selected').parent().attr('label');
if (group == "{{ trans('texts.default') }}") {
var template = defaultTemplateMap[templateId];
} else {
var template = customTemplateMap[templateId];
}
2018-02-12 13:55:56 +01:00
grapesjsEditor.CssComposer.getAll().reset();
grapesjsEditor.setComponents(template.html);
grapesjsEditor.setStyle(template.css);
2018-02-12 13:30:27 +01:00
$('.template-select').val(null).blur();
}
2018-01-31 12:51:18 +01:00
$(function() {
2018-02-12 13:30:27 +01:00
for (var i=0; i<customTemplates.length; i++) {
var template = customTemplates[i];
customTemplateMap[template.public_id] = template;
}
for (var i=0; i<defaultTemplates.length; i++) {
var template = defaultTemplates[i];
defaultTemplateMap[template.public_id] = template;
2018-01-31 12:51:18 +01:00
}
2018-02-04 22:03:26 +01:00
})
2018-01-31 12:51:18 +01:00
</script>
2018-02-04 22:03:26 +01:00
@include('proposals.grapesjs', ['entity' => $template])
2018-01-31 12:51:18 +01:00
@stop