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
|
|
|
|
2018-02-09 15:35:36 +01:00
|
|
|
<style>
|
|
|
|
.icon-select {
|
|
|
|
font-family: FontAwesome, sans-serif;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
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-01 10:24:53 +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 ($snippet)
|
|
|
|
{!! Former::populate($snippet) !!}
|
|
|
|
@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-01 10:24:53 +01:00
|
|
|
{!! Former::text('name') !!}
|
2018-02-04 16:16:55 +01:00
|
|
|
{!! Former::select('proposal_category_id')->addOption('', '')
|
2018-02-01 10:24:53 +01:00
|
|
|
->label(trans('texts.category'))
|
|
|
|
->addGroupClass('category-select') !!}
|
2018-02-04 22:03:26 +01:00
|
|
|
{!! Former::select('icon')
|
|
|
|
->addGroupClass('icon-select')
|
2018-02-04 22:50:57 +01:00
|
|
|
->addOption('', '')
|
2018-02-04 22:03:26 +01:00
|
|
|
->options($icons) !!}
|
2018-01-31 12:51:18 +01:00
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
2018-02-01 10:24:53 +01:00
|
|
|
{!! Former::textarea('private_notes')
|
2018-02-04 22:50:57 +01:00
|
|
|
->style('height:160px') !!}
|
2018-01-31 12:51:18 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<center class="buttons">
|
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')) !!}
|
|
|
|
|
|
|
|
{!! Button::success(trans("texts.save"))
|
2018-02-09 14:54:21 +01:00
|
|
|
->submit()
|
2018-01-31 12:51:18 +01:00
|
|
|
->appendIcon(Icon::create('floppy-disk')) !!}
|
|
|
|
</center>
|
|
|
|
|
|
|
|
{!! Former::close() !!}
|
|
|
|
|
|
|
|
<div id="gjs"></div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
2018-02-01 10:24:53 +01:00
|
|
|
var categories = {!! $categories !!};
|
|
|
|
var categoryMap = {};
|
|
|
|
|
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-01 10:24:53 +01:00
|
|
|
}
|
|
|
|
|
2018-01-31 12:51:18 +01:00
|
|
|
$(function() {
|
2018-02-04 16:16:55 +01:00
|
|
|
var categoryId = {{ $categoryPublicId ?: 0 }};
|
|
|
|
var $proposal_categorySelect = $('select#proposal_category_id');
|
2018-02-08 12:01:51 +01:00
|
|
|
@if (Auth::user()->can('create', ENTITY_PROPOSAL_CATEGORY))
|
|
|
|
$proposal_categorySelect.append(new Option("{{ trans('texts.create_proposal_category') }}: $name", '-1'));
|
|
|
|
@endif
|
2018-02-01 10:24:53 +01:00
|
|
|
for (var i = 0; i < categories.length; i++) {
|
|
|
|
var category = categories[i];
|
|
|
|
categoryMap[category.public_id] = category;
|
|
|
|
$proposal_categorySelect.append(new Option(category.name, category.public_id));
|
|
|
|
}
|
|
|
|
@include('partials/entity_combobox', ['entityType' => ENTITY_PROPOSAL_CATEGORY])
|
2018-02-04 16:16:55 +01:00
|
|
|
if (categoryId) {
|
|
|
|
var category = categoryMap[categoryId];
|
|
|
|
setComboboxValue($('.category-select'), category.public_id, category.name);
|
|
|
|
}
|
2018-02-01 10:24:53 +01:00
|
|
|
|
2018-02-04 22:03:26 +01:00
|
|
|
$('#icon').combobox();
|
|
|
|
})
|
2018-01-31 12:51:18 +01:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
2018-02-04 22:03:26 +01:00
|
|
|
@include('proposals.grapesjs', ['entity' => $snippet])
|
|
|
|
|
2018-01-31 12:51:18 +01:00
|
|
|
@stop
|