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