Merge pull request #1097 from batuhawk/master

Print template color feature added
This commit is contained in:
Batuhan Baş 2020-01-08 17:18:47 +03:00 committed by GitHub
commit dfe651b8ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 73 additions and 30 deletions

View File

@ -11,7 +11,6 @@ use App\Traits\Media;
use App\Traits\Recurring; use App\Traits\Recurring;
use App\Traits\Sales; use App\Traits\Sales;
use Bkwld\Cloner\Cloneable; use Bkwld\Cloner\Cloneable;
use Date;
class Invoice extends Model class Invoice extends Model
{ {

View File

@ -678,7 +678,7 @@ table .align-items-center td span.badge {
.print-edge .print-edge
{ {
width: 147px; width: 140px;
} }
/*--------Print Template Finish--------*/ /*--------Print Template Finish--------*/

View File

@ -15326,8 +15326,7 @@
.el-color-dropdown.el-color-picker__panel .el-color-dropdown.el-color-picker__panel
{ {
top: 360px !important; left: 341px !important;
left: 580px !important;
} }
.el-color-picker__color .el-color-picker__color
@ -15394,7 +15393,6 @@
margin-top: 10px !important; margin-top: 10px !important;
} }
/*--------El Select Icon--------*/ /*--------El Select Icon--------*/
.select-icon-position .select-icon-position
{ {

View File

@ -41,7 +41,7 @@ const app = new Vue({
return { return {
form: new Form('category'), form: new Form('category'),
bulk_action: new BulkAction('categories'), bulk_action: new BulkAction('categories'),
color: '#6DA252', color: '#55588b',
predefineColors: [ predefineColors: [
'#3c3f72', '#3c3f72',
'#55588b', '#55588b',

View File

@ -15,9 +15,10 @@ import Global from './../../mixins/global';
import Form from './../../plugins/form'; import Form from './../../plugins/form';
import BulkAction from './../../plugins/bulk-action'; import BulkAction from './../../plugins/bulk-action';
import HtmlEditor from './../../components/Inputs/HtmlEditor'; import HtmlEditor from './../../components/Inputs/HtmlEditor';
import {ColorPicker} from 'element-ui';
// plugin setup // plugin setup
Vue.use(DashboardPlugin); Vue.use(DashboardPlugin, ColorPicker);
const app = new Vue({ const app = new Vue({
el: '#app', el: '#app',
@ -27,7 +28,13 @@ const app = new Vue({
], ],
components: { components: {
HtmlEditor HtmlEditor,
[ColorPicker.name]: ColorPicker,
},
mounted() {
this.onChangeProtocol(this.form.protocol);
this.color = this.form.color;
}, },
data: function () { data: function () {
@ -42,6 +49,7 @@ const app = new Vue({
smtpPassword:true, smtpPassword:true,
smtpEncryption:true, smtpEncryption:true,
}, },
invoice_form: new Form('template'), invoice_form: new Form('template'),
template: { template: {
modal: false, modal: false,
@ -49,17 +57,24 @@ const app = new Vue({
message: '', message: '',
html: '', html: '',
errors: new Error() errors: new Error()
} },
color: '#55588b',
predefineColors:[
'#3c3f72',
'#55588b',
'#e5e5e5',
'#328aef',
'#efad32',
'#ef3232',
'#efef32'
],
} }
}, },
mounted(){
this.onChangeProtocol(this.form.protocol);
},
methods:{ methods:{
onChangeProtocol(protocol){ onChangeProtocol(protocol) {
switch(protocol){ switch(protocol) {
case "smtp": case "smtp":
this.email.sendmailPath = true; this.email.sendmailPath = true;
this.email.smtpHost = false; this.email.smtpHost = false;
@ -68,6 +83,7 @@ const app = new Vue({
this.email.smtpPassword = false; this.email.smtpPassword = false;
this.email.smtpEncryption = false; this.email.smtpEncryption = false;
break; break;
case "sendmail": case "sendmail":
this.email.sendmailPath = false; this.email.sendmailPath = false;
this.email.smtpHost = true; this.email.smtpHost = true;
@ -76,6 +92,7 @@ const app = new Vue({
this.email.smtpPassword = true; this.email.smtpPassword = true;
this.email.smtpEncryption = true; this.email.smtpEncryption = true;
break; break;
default: default:
this.email.sendmailPath = true; this.email.sendmailPath = true;
this.email.smtpHost = true; this.email.smtpHost = true;
@ -97,6 +114,7 @@ const app = new Vue({
addTemplate() { addTemplate() {
if (this.invoice_form.template != 1) { if (this.invoice_form.template != 1) {
this.invoice_form.submit(); this.invoice_form.submit();
this.template.errors = this.invoice_form.errors; this.template.errors = this.invoice_form.errors;
@ -111,5 +129,13 @@ const app = new Vue({
errors: this.invoice_form.errors errors: this.invoice_form.errors
}; };
}, },
onChangeColor() {
this.form.color = this.color;
},
onChangeColorInput() {
this.color = this.form.color;
}
} }
}); });

View File

@ -11,7 +11,7 @@
'novalidate' => true 'novalidate' => true
]) !!} ]) !!}
<div class="row"> <div class="row">
<div class="col-md-4 text-center px-0"> <div class="col-md-4 text-center">
<div class="bg-print border-radius-default print-edge choose" @click="invoice_form.template='default'"> <div class="bg-print border-radius-default print-edge choose" @click="invoice_form.template='default'">
<img src="{{ asset('public/img/invoice_templates/default.png') }}" class="mb-1 mt-3" height="200" alt="Default"/> <img src="{{ asset('public/img/invoice_templates/default.png') }}" class="mb-1 mt-3" height="200" alt="Default"/>
<label> <label>
@ -21,7 +21,7 @@
</div> </div>
</div> </div>
<div class="col-md-4 text-center px-0"> <div class="col-md-4 text-center px-2">
<div class="bg-print border-radius-default print-edge choose" @click="invoice_form.template='classic'"> <div class="bg-print border-radius-default print-edge choose" @click="invoice_form.template='classic'">
<img src="{{ asset('public/img/invoice_templates/classic.png') }}" class="mb-1 mt-3" height="200" alt="Classic"/> <img src="{{ asset('public/img/invoice_templates/classic.png') }}" class="mb-1 mt-3" height="200" alt="Classic"/>
<label> <label>
@ -42,6 +42,24 @@
</div> </div>
</div> </div>
<div class="row mt-4">
@stack('color_input_start')
<div class="form-group col-md-12 {{ $errors->has('color') ? 'has-error' : ''}}">
{!! Form::label('color', trans('general.color'), ['class' => 'form-control-label']) !!}
<div class="input-group input-group-merge" id="invoice-color-picker">
<div class="input-group-prepend">
<span class="input-group-text">
<el-color-picker v-model="invoice_form.color" size="mini" :predefine="predefineColors" @change="onChangeColor"></el-color-picker>
</span>
</div>
{!! Form::text('color', $setting['color'], ['v-model' => 'invoice_form.color', '@input' => 'onChangeColorInput', 'id' => 'color', 'class' => 'form-control color-hex', 'required' => 'required']) !!}
</div>
{!! $errors->first('color', '<p class="help-block">:message</p>') !!}
</div>
@stack('color_input_end')
</div>
{!! Form::hidden('_template', $setting['template']) !!} {!! Form::hidden('_template', $setting['template']) !!}
{!! Form::hidden('_prefix', 'invoice') !!} {!! Form::hidden('_prefix', 'invoice') !!}
{!! Form::close() !!} {!! Form::close() !!}

View File

@ -35,8 +35,8 @@
<div class="row mt-2"> <div class="row mt-2">
<div class="col-33"> <div class="col-33">
<hr class="bg-default invoice-classic-line mb-1 mt-4"> <hr class="invoice-classic-line mb-1 mt-4" style="background-color:{{ setting('invoice.color') }};">
<hr class="bg-default invoice-classic-line"> <hr class="invoice-classic-line" style="background-color:{{ setting('invoice.color') }};">
</div> </div>
<div class="col-33"> <div class="col-33">
@ -53,8 +53,8 @@
</div> </div>
<div class="col-33"> <div class="col-33">
<hr class="bg-default invoice-classic-line mb-1 mt-4"> <hr class="invoice-classic-line mb-1 mt-4" style="background-color:{{ setting('invoice.color') }};">
<hr class="bg-default invoice-classic-line"> <hr class="invoice-classic-line" style="background-color:{{ setting('invoice.color') }};">
</div> </div>
</div> </div>

View File

@ -114,7 +114,9 @@
<div class="col-100"> <div class="col-100">
<div class="text"> <div class="text">
<table class="lines"> <table class="lines">
<thead class="bg-default"> @foreach($invoice as $item)
<thead style="background-color:{{ setting('invoice.color') }};">
@endforeach
<tr> <tr>
@stack('name_th_start') @stack('name_th_start')
<th class="item text-white">{{ trans_choice($text_override['items'], 2) }}</th> <th class="item text-white">{{ trans_choice($text_override['items'], 2) }}</th>

View File

@ -3,7 +3,7 @@
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number) @section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('content') @section('content')
<div class="row bg-primary"> <div class="row" style="background-color:{{ setting('invoice.color') }};">
<div class="col-58 m-first-column"> <div class="col-58 m-first-column">
<div class="text company pl-2 m-fc-left"> <div class="text company pl-2 m-fc-left">
<img src="{{ $logo }}" class="m-logo" alt="{{ setting('company.name') }}"/> <img src="{{ $logo }}" class="m-logo" alt="{{ setting('company.name') }}"/>
@ -12,7 +12,7 @@
<strong class="text-white">{{ setting('company.name') }}</strong> <strong class="text-white">{{ setting('company.name') }}</strong>
</div> </div>
</div> </div>
<div class="col-42"> <div class="col-42">
<div class="text company"> <div class="text company">
<br> <br>
@ -43,7 +43,7 @@
@stack('name_input_start') @stack('name_input_start')
<strong>{{ $invoice->contact_name }}</strong><br><br> <strong>{{ $invoice->contact_name }}</strong><br><br>
@stack('name_input_end') @stack('name_input_end')
@stack('address_input_start') @stack('address_input_start')
{!! nl2br($invoice->contact_address) !!}<br><br> {!! nl2br($invoice->contact_address) !!}<br><br>
@stack('address_input_end') @stack('address_input_end')
@ -53,7 +53,7 @@
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}<br><br> {{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}<br><br>
@endif @endif
@stack('tax_number_input_end') @stack('tax_number_input_end')
@stack('phone_input_start') @stack('phone_input_start')
@if ($invoice->contact_phone) @if ($invoice->contact_phone)
{{ $invoice->contact_phone }}<br><br> {{ $invoice->contact_phone }}<br><br>
@ -105,7 +105,7 @@
<div class="col-100"> <div class="col-100">
<div class="text"> <div class="text">
<table class="m-lines"> <table class="m-lines">
<thead class="bg-default"> <thead style="background-color:{{ setting('invoice.color') }};">
<tr> <tr>
@stack('name_th_start') @stack('name_th_start')
<th class="item text-white">{{ trans_choice($text_override['items'], 2) }}</th> <th class="item text-white">{{ trans_choice($text_override['items'], 2) }}</th>
@ -168,7 +168,7 @@
@stack('notes_input_end') @stack('notes_input_end')
</div> </div>
</div> </div>
<div class="col-42 text-right"> <div class="col-42 text-right">
<div class="text company pr-2"> <div class="text company pr-2">
@foreach ($invoice->totals as $total) @foreach ($invoice->totals as $total)
@ -194,7 +194,7 @@
@if ($invoice->footer) @if ($invoice->footer)
<div class="row mt-7"> <div class="row mt-7">
<div class="col-100 bg-default py-2"> <div class="col-100 py-2" style="background-color:{{ setting('invoice.color') }};">
<div class="text company pl-2"> <div class="text company pl-2">
<strong class="text-white">{!! $invoice->footer !!}</strong> <strong class="text-white">{!! $invoice->footer !!}</strong>
</div> </div>

View File

@ -30,7 +30,7 @@
<el-color-picker v-model="color" size="mini" :predefine="predefineColors" @change="onChangeColor"></el-color-picker> <el-color-picker v-model="color" size="mini" :predefine="predefineColors" @change="onChangeColor"></el-color-picker>
</span> </span>
</div> </div>
{!! Form::text('color', '#6DA252', ['v-model' => 'form.color', '@input' => 'onChangeColorInput', 'id' => 'color', 'class' => 'form-control color-hex', 'required' => 'required']) !!} {!! Form::text('color', '#55588b', ['v-model' => 'form.color', '@input' => 'onChangeColorInput', 'id' => 'color', 'class' => 'form-control color-hex', 'required' => 'required']) !!}
</div> </div>
{!! $errors->first('color', '<p class="help-block">:message</p>') !!} {!! $errors->first('color', '<p class="help-block">:message</p>') !!}
</div> </div>