mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-06 03:04:36 -04:00
Proposals
This commit is contained in:
parent
a2872d6447
commit
070d2ac853
@ -7,6 +7,7 @@ use App\Http\Requests\ProposalSnippetRequest;
|
||||
use App\Http\Requests\UpdateProposalSnippetRequest;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\ProposalSnippet;
|
||||
use App\Models\ProposalCategory;
|
||||
use App\Ninja\Datatables\ProposalSnippetDatatable;
|
||||
use App\Ninja\Repositories\ProposalSnippetRepository;
|
||||
use App\Services\ProposalSnippetService;
|
||||
@ -53,13 +54,11 @@ class ProposalSnippetController extends BaseController
|
||||
{
|
||||
$data = [
|
||||
'account' => auth()->user()->account,
|
||||
'proposalSnippet' => null,
|
||||
'snippet' => null,
|
||||
'method' => 'POST',
|
||||
'url' => 'proposals/snippets',
|
||||
'title' => trans('texts.new_proposal_snippet'),
|
||||
'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(),
|
||||
'templates' => ProposalSnippet::scope()->orderBy('name')->get(),
|
||||
'quotePublicId' => $request->quote_id,
|
||||
'categories' => ProposalCategory::scope()->orderBy('name')->get(),
|
||||
];
|
||||
|
||||
return View::make('proposals/snippets/edit', $data);
|
||||
@ -78,12 +77,11 @@ class ProposalSnippetController extends BaseController
|
||||
|
||||
$data = [
|
||||
'account' => auth()->user()->account,
|
||||
'proposalSnippet' => $proposalSnippet,
|
||||
'snippet' => $proposalSnippet,
|
||||
'method' => 'PUT',
|
||||
'url' => 'proposals/snippets/' . $proposalSnippet->public_id,
|
||||
'title' => trans('texts.edit_proposal_snippet'),
|
||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
||||
'clientPublicId' => $proposalSnippet->client ? $proposalSnippet->client->public_id : null,
|
||||
'categories' => ProposalCategory::scope()->orderBy('name')->get(),
|
||||
];
|
||||
|
||||
return View::make('proposals/snippets.edit', $data);
|
||||
|
@ -22,6 +22,8 @@ class ProposalSnippet extends EntityModel
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'private_notes',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -24,9 +24,17 @@
|
||||
->id('mainForm')
|
||||
->rules([
|
||||
'quote_id' => 'required',
|
||||
'template_id' => 'required',
|
||||
'template_id' => 'required',
|
||||
]) !!}
|
||||
|
||||
@if ($proposal)
|
||||
{!! Former::populate($proposal) !!}
|
||||
@endif
|
||||
|
||||
<span style="display:none">
|
||||
{!! Former::text('public_id') !!}
|
||||
</span>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
|
@ -23,26 +23,33 @@
|
||||
->method($method)
|
||||
->id('mainForm')
|
||||
->rules([
|
||||
'quote_id' => 'required',
|
||||
'template_id' => 'required',
|
||||
'name' => 'required',
|
||||
'category_id' => 'required',
|
||||
]) !!}
|
||||
|
||||
@if ($snippet)
|
||||
{!! Former::populate($snippet) !!}
|
||||
@endif
|
||||
|
||||
<span style="display:none">
|
||||
{!! Former::text('public_id') !!}
|
||||
</span>
|
||||
|
||||
|
||||
<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') !!}
|
||||
|
||||
{!! Former::text('name') !!}
|
||||
{!! Former::select('category_id')->addOption('', '')
|
||||
->label(trans('texts.category'))
|
||||
->addGroupClass('category-select') !!}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{!! Former::select('template_id')->addOption('', '')
|
||||
->label(trans('texts.template'))
|
||||
->addGroupClass('template-select') !!}
|
||||
|
||||
{!! Former::textarea('private_notes')
|
||||
->style('height:98px') !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -66,8 +73,23 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var categories = {!! $categories !!};
|
||||
var categoryMap = {};
|
||||
|
||||
function onSaveClick() {
|
||||
$('#mainForm').submit();
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
var $proposal_categorySelect = $('select#category_id');
|
||||
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])
|
||||
|
||||
var editor = grapesjs.init({
|
||||
container : '#gjs',
|
||||
components: '',
|
||||
|
@ -24,9 +24,18 @@
|
||||
->id('mainForm')
|
||||
->rules([
|
||||
'quote_id' => 'required',
|
||||
'template_id' => 'required',
|
||||
'template_id' => 'required',
|
||||
]) !!}
|
||||
|
||||
@if ($template)
|
||||
{!! Former::populate($template) !!}
|
||||
@endif
|
||||
|
||||
<span style="display:none">
|
||||
{!! Former::text('public_id') !!}
|
||||
</span>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
|
Loading…
x
Reference in New Issue
Block a user