mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
fix conflicts and issue with add_number_length migration
This commit is contained in:
@ -78,6 +78,10 @@ class Estimate extends Model implements HasMedia
|
||||
->orderBy('estimate_number', 'desc')
|
||||
->first();
|
||||
|
||||
// Get number length config
|
||||
$numberLength = CompanySetting::getSetting('estimate_number_length', request()->header('company'));
|
||||
$numberLengthText = "%0{$numberLength}d";
|
||||
|
||||
if (!$lastOrder) {
|
||||
// We get here if there is no order at all
|
||||
// If there is no number set it to 0, which will be 1 at the end.
|
||||
@ -94,7 +98,7 @@ class Estimate extends Model implements HasMedia
|
||||
// the %05d part makes sure that there are always 6 numbers in the string.
|
||||
// so it adds the missing zero's when needed.
|
||||
|
||||
return sprintf('%06d', intval($number) + 1);
|
||||
return sprintf($numberLengthText, intval($number) + 1);
|
||||
}
|
||||
|
||||
public function emailLogs()
|
||||
@ -379,7 +383,7 @@ class Estimate extends Model implements HasMedia
|
||||
$data['user'] = $this->user->toArray();
|
||||
$data['company'] = $this->company->toArray();
|
||||
$data['body'] = $this->getEmailBody($data['body']);
|
||||
$data['attach']['data'] = ($this->getEmailAttachmentSetting()) ? $this->getPDFData() : null;
|
||||
$data['attach']['data'] = ($this->getEmailAttachmentSetting()) ? $this->getPDFData() : null;
|
||||
|
||||
\Mail::to($data['to'])->send(new SendEstimateMail($data));
|
||||
|
||||
@ -427,6 +431,10 @@ class Estimate extends Model implements HasMedia
|
||||
$estimateTemplate = EstimateTemplate::find($this->estimate_template_id);
|
||||
|
||||
$company = Company::find($this->company_id);
|
||||
$locale = CompanySetting::getSetting('language', $company->id);
|
||||
|
||||
App::setLocale($locale);
|
||||
|
||||
$logo = $company->logo_path;
|
||||
|
||||
view()->share([
|
||||
@ -473,7 +481,7 @@ class Estimate extends Model implements HasMedia
|
||||
{
|
||||
$estimateAsAttachment = CompanySetting::getSetting('estimate_email_attachment', $this->company_id);
|
||||
|
||||
if($estimateAsAttachment == 'NO') {
|
||||
if ($estimateAsAttachment == 'NO') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -82,6 +82,9 @@ class Invoice extends Model implements HasMedia
|
||||
->orderBy('invoice_number', 'desc')
|
||||
->first();
|
||||
|
||||
// Get number length config
|
||||
$numberLength = CompanySetting::getSetting('invoice_number_length', request()->header('company'));
|
||||
$numberLengthText = "%0{$numberLength}d";
|
||||
|
||||
if (!$lastOrder) {
|
||||
// We get here if there is no order at all
|
||||
@ -98,7 +101,7 @@ class Invoice extends Model implements HasMedia
|
||||
// the %06d part makes sure that there are always 6 numbers in the string.
|
||||
// so it adds the missing zero's when needed.
|
||||
|
||||
return sprintf('%06d', intval($number) + 1);
|
||||
return sprintf($numberLengthText, intval($number) + 1);
|
||||
}
|
||||
|
||||
public function emailLogs()
|
||||
@ -429,7 +432,7 @@ class Invoice extends Model implements HasMedia
|
||||
$data['user'] = $this->user->toArray();
|
||||
$data['company'] = Company::find($this->company_id);
|
||||
$data['body'] = $this->getEmailBody($data['body']);
|
||||
$data['attach']['data'] = ($this->getEmailAttachmentSetting()) ? $this->getPDFData() : null;
|
||||
$data['attach']['data'] = ($this->getEmailAttachmentSetting()) ? $this->getPDFData() : null;
|
||||
|
||||
if ($this->status == Invoice::STATUS_DRAFT) {
|
||||
$this->status = Invoice::STATUS_SENT;
|
||||
@ -510,6 +513,9 @@ class Invoice extends Model implements HasMedia
|
||||
$invoiceTemplate = InvoiceTemplate::find($this->invoice_template_id);
|
||||
|
||||
$company = Company::find($this->company_id);
|
||||
$locale = CompanySetting::getSetting('language', $company->id);
|
||||
|
||||
App::setLocale($locale);
|
||||
|
||||
$logo = $company->logo_path;
|
||||
|
||||
@ -531,7 +537,7 @@ class Invoice extends Model implements HasMedia
|
||||
{
|
||||
$invoiceAsAttachment = CompanySetting::getSetting('invoice_email_attachment', $this->company_id);
|
||||
|
||||
if($invoiceAsAttachment == 'NO') {
|
||||
if ($invoiceAsAttachment == 'NO') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -124,7 +124,7 @@ class Payment extends Model implements HasMedia
|
||||
$data['user'] = $this->user->toArray();
|
||||
$data['company'] = Company::find($this->company_id);
|
||||
$data['body'] = $this->getEmailBody($data['body']);
|
||||
$data['attach']['data'] = ($this->getEmailAttachmentSetting()) ? $this->getPDFData() : null;
|
||||
$data['attach']['data'] = ($this->getEmailAttachmentSetting()) ? $this->getPDFData() : null;
|
||||
|
||||
\Mail::to($data['to'])->send(new SendPaymentMail($data));
|
||||
|
||||
@ -271,6 +271,11 @@ class Payment extends Model implements HasMedia
|
||||
$payment = Payment::where('payment_number', 'LIKE', $value . '-%')
|
||||
->orderBy('payment_number', 'desc')
|
||||
->first();
|
||||
|
||||
// Get number length config
|
||||
$numberLength = CompanySetting::getSetting('payment_number_length', request()->header('company'));
|
||||
$numberLengthText = "%0{$numberLength}d";
|
||||
|
||||
if (!$payment) {
|
||||
// We get here if there is no order at all
|
||||
// If there is no number set it to 0, which will be 1 at the end.
|
||||
@ -286,7 +291,7 @@ class Payment extends Model implements HasMedia
|
||||
// the %05d part makes sure that there are always 6 numbers in the string.
|
||||
// so it adds the missing zero's when needed.
|
||||
|
||||
return sprintf('%06d', intval($number) + 1);
|
||||
return sprintf($numberLengthText, intval($number) + 1);
|
||||
}
|
||||
|
||||
public function scopeWhereSearch($query, $search)
|
||||
@ -373,6 +378,9 @@ class Payment extends Model implements HasMedia
|
||||
public function getPDFData()
|
||||
{
|
||||
$company = Company::find($this->company_id);
|
||||
$locale = CompanySetting::getSetting('language', $company->id);
|
||||
|
||||
App::setLocale($locale);
|
||||
|
||||
$logo = $company->logo_path;
|
||||
|
||||
@ -405,7 +413,7 @@ class Payment extends Model implements HasMedia
|
||||
{
|
||||
$paymentAsAttachment = CompanySetting::getSetting('payment_email_attachment', $this->company_id);
|
||||
|
||||
if($paymentAsAttachment == 'NO') {
|
||||
if ($paymentAsAttachment == 'NO') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Crater\Models\CompanySetting;
|
||||
use Crater\Models\User;
|
||||
|
||||
class AddNumberLengthSetting extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$user = User::where('role', 'super admin')->first();
|
||||
|
||||
if ($user) {
|
||||
$invoice_number_length = CompanySetting::getSetting('invoice_number_length', $user->company_id);
|
||||
if (empty($invoice_number_length)) {
|
||||
CompanySetting::setSettings(['invoice_number_length' => '6'], $user->company_id);
|
||||
}
|
||||
|
||||
$estimate_number_length = CompanySetting::getSetting('estimate_number_length', $user->company_id);
|
||||
if (empty($estimate_number_length)) {
|
||||
CompanySetting::setSettings(['estimate_number_length' => '6'], $user->company_id);
|
||||
}
|
||||
|
||||
$payment_number_length = CompanySetting::getSetting('payment_number_length', $user->company_id);
|
||||
if (empty($payment_number_length)) {
|
||||
CompanySetting::setSettings(['payment_number_length' => '6'], $user->company_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@ -53,16 +53,19 @@ class DefaultSettingsSeeder extends Seeder
|
||||
'notify_estimate_viewed' => 'NO',
|
||||
'tax_per_item' => 'NO',
|
||||
'discount_per_item' => 'NO',
|
||||
'invoice_auto_generate' => 'YES',
|
||||
'invoice_prefix' => 'INV',
|
||||
'invoice_auto_generate' => 'YES',
|
||||
'invoice_number_length' => 6,
|
||||
'invoice_email_attachment' => 'NO',
|
||||
'estimate_prefix' => 'EST',
|
||||
'estimate_auto_generate' => 'YES',
|
||||
'estimate_number_length' => 6,
|
||||
'estimate_email_attachment' => 'NO',
|
||||
'payment_prefix' => 'PAY',
|
||||
'payment_auto_generate' => 'YES',
|
||||
'save_pdf_to_disk' => 'NO',
|
||||
'invoice_email_attachment' => 'NO',
|
||||
'estimate_email_attachment' => 'NO',
|
||||
'payment_number_length' => 6,
|
||||
'payment_email_attachment' => 'NO',
|
||||
'save_pdf_to_disk' => 'NO',
|
||||
];
|
||||
|
||||
CompanySetting::setSettings($settings, $user->company_id);
|
||||
|
||||
2
public/assets/css/crater.css
vendored
2
public/assets/css/crater.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -22,33 +22,6 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/*!
|
||||
*
|
||||
* Copyright 2009-2017 Kris Kowal under the terms of the MIT
|
||||
* license found at https://github.com/kriskowal/q/blob/v1/LICENSE
|
||||
*
|
||||
* With parts by Tyler Close
|
||||
* Copyright 2007-2009 Tyler Close under the terms of the MIT X license found
|
||||
* at http://www.opensource.org/licenses/mit-license.html
|
||||
* Forked at ref_send.js version: 2009-05-11
|
||||
*
|
||||
* With parts by Mark Miller
|
||||
* Copyright (C) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Chart.js v2.9.4
|
||||
* https://www.chartjs.org
|
||||
@ -56,37 +29,12 @@
|
||||
* Released under the MIT License
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Sizzle CSS Selector Engine v2.3.5
|
||||
* https://sizzlejs.com/
|
||||
*
|
||||
* Copyright JS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://js.foundation/
|
||||
*
|
||||
* Date: 2020-03-14
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Vue.js v2.6.12
|
||||
* (c) 2014-2020 Evan You
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* jQuery JavaScript Library v3.5.1
|
||||
* https://jquery.com/
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
* https://sizzlejs.com/
|
||||
*
|
||||
* Copyright JS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2020-05-04T22:49Z
|
||||
*/
|
||||
|
||||
/*!
|
||||
* vue2-transitions v0.3.0
|
||||
* (c) 2019-present cristij <joracristi@gmail.com>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"/assets/js/app.js": "/assets/js/app.js?id=a1b33d55e1412b350c40",
|
||||
"/assets/css/crater.css": "/assets/css/crater.css?id=d2ff90e64c851af08712"
|
||||
"/assets/js/app.js": "/assets/js/app.js?id=99e62cc9d198dabcb199",
|
||||
"/assets/css/crater.css": "/assets/css/crater.css?id=6ba60df7635dc2f5fbc5"
|
||||
}
|
||||
|
||||
@ -750,6 +750,7 @@
|
||||
"title": "Rechnungen",
|
||||
"notes": "Hinweise",
|
||||
"invoice_prefix": "Rechnung Präfix",
|
||||
"invoice_number_length": "Rechnungsnummerlänge",
|
||||
"default_invoice_email_body": "Standard Rechnung E-Mail Inhalt",
|
||||
"invoice_settings": "Rechnungseinstellungen",
|
||||
"autogenerate_invoice_number": "Rechnungsnummer automatisch generieren",
|
||||
@ -764,6 +765,7 @@
|
||||
"estimates": {
|
||||
"title": "Kostenvoranschläge",
|
||||
"estimate_prefix": "Kostenvoranschlag Präfix",
|
||||
"estimate_number_length": "Angebotsnummerlänge",
|
||||
"default_estimate_email_body": "Rechnung - E-Mail Text",
|
||||
"estimate_settings": "Einstellungen Kostenvoranschlag",
|
||||
"autogenerate_estimate_number": "Kostenvoranschlagsnummer automatisch generieren",
|
||||
@ -778,6 +780,7 @@
|
||||
"title": "Zahlungen",
|
||||
"description": "Transaktionsmodi für Zahlungen",
|
||||
"payment_prefix": "Zahlung Präfix",
|
||||
"payment_number_length": "Zahlungsnummerlänge",
|
||||
"default_payment_email_body": "Zahlung - E-Mail Text",
|
||||
"payment_settings": "Zahlung Einstellungen",
|
||||
"autogenerate_payment_number": "Zahlungsnummer automatisch generieren",
|
||||
@ -1139,7 +1142,8 @@
|
||||
"address_maxlength": "Die Adresse sollte nicht länger als 255 Zeichen sein.",
|
||||
"ref_number_maxlength": "Ref Number sollte nicht länger als 255 Zeichen sein.",
|
||||
"prefix_maxlength": "Das Präfix sollte nicht länger als 5 Zeichen sein.",
|
||||
"something_went_wrong": "Da ist etwas schief gelaufen"
|
||||
"something_went_wrong": "Da ist etwas schief gelaufen",
|
||||
"number_length_minvalue": "Nummernlänge sollte größer als 0 sein"
|
||||
},
|
||||
"pdf_estimate_label": "Kostenvoranschlag",
|
||||
"pdf_estimate_number": "Kostenvoran. Nummer",
|
||||
|
||||
@ -751,6 +751,7 @@
|
||||
"title": "Invoices",
|
||||
"notes": "Notes",
|
||||
"invoice_prefix": "Invoice Prefix",
|
||||
"invoice_number_length": "Invoice number length",
|
||||
"default_invoice_email_body": "Default Invoice Email Body",
|
||||
"invoice_settings": "Invoice Settings",
|
||||
"autogenerate_invoice_number": "Auto-generate Invoice Number",
|
||||
@ -767,6 +768,7 @@
|
||||
"estimates": {
|
||||
"title": "Estimates",
|
||||
"estimate_prefix": "Estimate Prefix",
|
||||
"estimate_number_length": "Estimate number length",
|
||||
"default_estimate_email_body": "Default Estimate Email Body",
|
||||
"estimate_settings": "Estimate Settings",
|
||||
"autogenerate_estimate_number": "Auto-generate Estimate Number",
|
||||
@ -783,6 +785,7 @@
|
||||
"title": "Payments",
|
||||
"description": "Modes of transaction for payments",
|
||||
"payment_prefix": "Payment Prefix",
|
||||
"payment_number_length": "Payment number lenght",
|
||||
"default_payment_email_body": "Default Payment Email Body",
|
||||
"payment_settings": "Payment Settings",
|
||||
"autogenerate_payment_number": "Auto-generate Payment Number",
|
||||
@ -1148,7 +1151,8 @@
|
||||
"address_maxlength": "Address should not be greater than 255 characters.",
|
||||
"ref_number_maxlength": "Ref Number should not be greater than 255 characters.",
|
||||
"prefix_maxlength": "Prefix should not be greater than 5 characters.",
|
||||
"something_went_wrong": "something went wrong"
|
||||
"something_went_wrong": "something went wrong",
|
||||
"number_length_minvalue": "Number lenght should be greater than 0"
|
||||
},
|
||||
"pdf_estimate_label": "Estimate",
|
||||
"pdf_estimate_number": "Estimate Number",
|
||||
|
||||
@ -61,14 +61,17 @@ export default {
|
||||
'payment_auto_generate',
|
||||
'payment_email_attachment',
|
||||
'payment_prefix',
|
||||
'payment_number_length',
|
||||
'payment_mail_body',
|
||||
'invoice_auto_generate',
|
||||
'invoice_email_attachment',
|
||||
'invoice_prefix',
|
||||
'invoice_number_length',
|
||||
'invoice_mail_body',
|
||||
'estimate_auto_generate',
|
||||
'estimate_email_attachment',
|
||||
'estimate_prefix',
|
||||
'estimate_number_length',
|
||||
'estimate_mail_body',
|
||||
'invoice_billing_address_format',
|
||||
'invoice_shipping_address_format',
|
||||
|
||||
@ -14,6 +14,19 @@
|
||||
/>
|
||||
</sw-input-group>
|
||||
|
||||
<sw-input-group
|
||||
:label="$t('settings.customization.estimates.estimate_number_length')"
|
||||
:error="estimateNumberLengthError"
|
||||
class="mt-6 mb-4"
|
||||
>
|
||||
<sw-input
|
||||
v-model="estimates.estimate_number_length"
|
||||
:invalid="$v.estimates.estimate_number_length.$error"
|
||||
type="number"
|
||||
style="max-width: 60px"
|
||||
/>
|
||||
</sw-input-group>
|
||||
|
||||
<sw-input-group
|
||||
:label="
|
||||
$t('settings.customization.estimates.default_estimate_email_body')
|
||||
@ -127,14 +140,19 @@
|
||||
|
||||
<script>
|
||||
import { mapActions } from 'vuex'
|
||||
const { required, maxLength, alpha } = require('vuelidate/lib/validators')
|
||||
const {
|
||||
required,
|
||||
maxLength,
|
||||
minValue,
|
||||
alpha,
|
||||
numeric,
|
||||
} = require('vuelidate/lib/validators')
|
||||
|
||||
export default {
|
||||
props: {
|
||||
settings: {
|
||||
type: Object,
|
||||
require: true,
|
||||
default: false,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
@ -145,6 +163,7 @@ export default {
|
||||
|
||||
estimates: {
|
||||
estimate_prefix: null,
|
||||
estimate_number_length: null,
|
||||
estimate_mail_body: null,
|
||||
estimate_terms_and_conditions: null,
|
||||
company_address_format: null,
|
||||
@ -193,6 +212,23 @@ export default {
|
||||
return this.$t('validation.characters_only')
|
||||
}
|
||||
},
|
||||
estimateNumberLengthError() {
|
||||
if (!this.$v.estimates.estimate_number_length.$error) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (!this.$v.estimates.estimate_number_length.required) {
|
||||
return this.$t('validation.required')
|
||||
}
|
||||
|
||||
if (!this.$v.estimates.estimate_number_length.minValue) {
|
||||
return this.$t('validation.number_length_minvalue')
|
||||
}
|
||||
|
||||
if (!this.$v.estimates.estimate_number_length.numeric) {
|
||||
return this.$t('validation.numbers_only')
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
validations: {
|
||||
@ -202,12 +238,20 @@ export default {
|
||||
maxLength: maxLength(5),
|
||||
alpha,
|
||||
},
|
||||
estimate_number_length: {
|
||||
required,
|
||||
minValue: minValue(1),
|
||||
numeric,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
settings(val) {
|
||||
this.estimates.estimate_prefix = val ? val.estimate_prefix : ''
|
||||
this.estimates.estimate_number_length = val
|
||||
? val.estimate_number_length
|
||||
: ''
|
||||
|
||||
this.estimates.estimate_mail_body = val ? val.estimate_mail_body : ''
|
||||
this.estimates.company_address_format = val
|
||||
@ -278,6 +322,7 @@ export default {
|
||||
let data = {
|
||||
settings: {
|
||||
estimate_prefix: this.estimates.estimate_prefix,
|
||||
estimate_number_length: this.estimates.estimate_number_length,
|
||||
estimate_mail_body: this.estimates.estimate_mail_body,
|
||||
estimate_company_address_format: this.estimates
|
||||
.company_address_format,
|
||||
|
||||
@ -14,6 +14,19 @@
|
||||
/>
|
||||
</sw-input-group>
|
||||
|
||||
<sw-input-group
|
||||
:label="$t('settings.customization.invoices.invoice_number_length')"
|
||||
:error="invoicenumberLengthError"
|
||||
class="mt-6 mb-4"
|
||||
>
|
||||
<sw-input
|
||||
v-model="invoices.invoice_number_length"
|
||||
:invalid="$v.invoices.invoice_number_length.$error"
|
||||
type="number"
|
||||
style="max-width: 60px"
|
||||
/>
|
||||
</sw-input-group>
|
||||
|
||||
<sw-input-group
|
||||
:label="
|
||||
$t('settings.customization.invoices.default_invoice_email_body')
|
||||
@ -132,7 +145,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const { required, maxLength, alpha } = require('vuelidate/lib/validators')
|
||||
const { required, maxLength, minValue, alpha, numeric } = require('vuelidate/lib/validators')
|
||||
import { mapActions, mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
@ -151,6 +164,7 @@ export default {
|
||||
|
||||
invoices: {
|
||||
invoice_prefix: null,
|
||||
invoice_number_length: null,
|
||||
invoice_mail_body: null,
|
||||
company_address_format: null,
|
||||
shipping_address_format: null,
|
||||
@ -193,11 +207,29 @@ export default {
|
||||
return this.$t('validation.characters_only')
|
||||
}
|
||||
},
|
||||
invoicenumberLengthError() {
|
||||
if (!this.$v.invoices.invoice_number_length.$error) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (!this.$v.invoices.invoice_number_length.required) {
|
||||
return this.$t('validation.required')
|
||||
}
|
||||
|
||||
if (!this.$v.invoices.invoice_number_length.minValue) {
|
||||
return this.$t('validation.number_length_minvalue')
|
||||
}
|
||||
|
||||
if (!this.$v.invoices.invoice_number_length.numeric) {
|
||||
return this.$t('validation.numbers_only')
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
settings(val) {
|
||||
this.invoices.invoice_prefix = val ? val.invoice_prefix : ''
|
||||
this.invoices.invoice_number_length = val ? val.invoice_number_length : ''
|
||||
|
||||
this.invoices.invoice_mail_body = val ? val.invoice_mail_body : null
|
||||
this.invoices.company_address_format = val
|
||||
@ -235,6 +267,11 @@ export default {
|
||||
maxLength: maxLength(5),
|
||||
alpha,
|
||||
},
|
||||
invoice_number_length: {
|
||||
required,
|
||||
minValue: minValue(1),
|
||||
numeric
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -278,6 +315,7 @@ export default {
|
||||
let data = {
|
||||
settings: {
|
||||
invoice_prefix: this.invoices.invoice_prefix,
|
||||
invoice_number_length: this.invoices.invoice_number_length,
|
||||
invoice_mail_body: this.invoices.invoice_mail_body,
|
||||
invoice_company_address_format: this.invoices.company_address_format,
|
||||
invoice_billing_address_format: this.invoices.billing_address_format,
|
||||
|
||||
@ -15,6 +15,19 @@
|
||||
/>
|
||||
</sw-input-group>
|
||||
|
||||
<sw-input-group
|
||||
:label="$t('settings.customization.payments.payment_number_length')"
|
||||
:error="paymentnumberLengthError"
|
||||
class="mt-6 mb-4"
|
||||
>
|
||||
<sw-input
|
||||
v-model="payments.payment_number_length"
|
||||
:invalid="$v.payments.payment_number_length.$error"
|
||||
type="number"
|
||||
style="max-width: 60px"
|
||||
/>
|
||||
</sw-input-group>
|
||||
|
||||
<sw-input-group
|
||||
:label="
|
||||
$t('settings.customization.payments.default_payment_email_body')
|
||||
@ -121,7 +134,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapActions, mapGetters } from 'vuex'
|
||||
const { required, maxLength, alpha } = require('vuelidate/lib/validators')
|
||||
const { required, maxLength, minValue, alpha, numeric } = require('vuelidate/lib/validators')
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -139,6 +152,7 @@ export default {
|
||||
|
||||
payments: {
|
||||
payment_prefix: null,
|
||||
payment_number_length: null,
|
||||
payment_mail_body: null,
|
||||
from_customer_address_format: null,
|
||||
company_address_format: null,
|
||||
@ -179,6 +193,23 @@ export default {
|
||||
return this.$t('validation.characters_only')
|
||||
}
|
||||
},
|
||||
paymentnumberLengthError() {
|
||||
if (!this.$v.payments.payment_number_length.$error) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (!this.$v.payments.payment_number_length.required) {
|
||||
return this.$t('validation.required')
|
||||
}
|
||||
|
||||
if (!this.$v.payments.payment_number_length.minValue) {
|
||||
return this.$t('validation.number_length_minvalue')
|
||||
}
|
||||
|
||||
if (!this.$v.payments.payment_number_length.numeric) {
|
||||
return this.$t('validation.numbers_only')
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
validations: {
|
||||
@ -188,12 +219,18 @@ export default {
|
||||
maxLength: maxLength(5),
|
||||
alpha,
|
||||
},
|
||||
payment_number_length: {
|
||||
required,
|
||||
minValue: minValue(1),
|
||||
numeric
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
settings(val) {
|
||||
this.payments.payment_prefix = val ? val.payment_prefix : ''
|
||||
this.payments.payment_number_length = val ? val.payment_number_length : ''
|
||||
|
||||
this.payments.payment_mail_body = val ? val.payment_mail_body : ''
|
||||
|
||||
@ -263,6 +300,7 @@ export default {
|
||||
let data = {
|
||||
settings: {
|
||||
payment_prefix: this.payments.payment_prefix,
|
||||
payment_number_length: this.payments.payment_number_length,
|
||||
payment_mail_body: this.payments.payment_mail_body,
|
||||
payment_company_address_format: this.payments.company_address_format,
|
||||
payment_from_customer_address_format: this.payments
|
||||
|
||||
40
yarn.lock
40
yarn.lock
@ -3239,11 +3239,6 @@ es6-iterator@2.0.3, es6-iterator@~2.0.3:
|
||||
es5-ext "^0.10.35"
|
||||
es6-symbol "^3.1.1"
|
||||
|
||||
es6-object-assign@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c"
|
||||
integrity sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=
|
||||
|
||||
es6-symbol@^3.1.1, es6-symbol@~3.1.3:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18"
|
||||
@ -4719,11 +4714,6 @@ jest-worker@^26.6.1:
|
||||
merge-stream "^2.0.0"
|
||||
supports-color "^7.0.0"
|
||||
|
||||
jquery@>=1.12.0:
|
||||
version "3.5.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.1.tgz#d7b4d08e1bfdb86ad2f1a3d039ea17304717abb5"
|
||||
integrity sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==
|
||||
|
||||
js-tokens@^3.0.0, js-tokens@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
|
||||
@ -6342,11 +6332,6 @@ progress@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
|
||||
integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==
|
||||
|
||||
promise-polyfill@^6.0.2:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-6.1.0.tgz#dfa96943ea9c121fca4de9b5868cb39d3472e057"
|
||||
integrity sha1-36lpQ+qcEh/KTem1hoyznTRy4Fc=
|
||||
|
||||
prosemirror-collab@^1.2.2:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/prosemirror-collab/-/prosemirror-collab-1.2.2.tgz#8d2c0e82779cfef5d051154bd0836428bd6d9c4a"
|
||||
@ -7478,13 +7463,10 @@ sweet-modal-vue@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/sweet-modal-vue/-/sweet-modal-vue-2.0.0.tgz#205ee28b7e5c8579e44303544b500ef7f4fcab21"
|
||||
integrity sha512-1/F7G3I3dWU5O2RGnHEirf6zw2AeR/CdfxiIlcEjxeyxGqgPtQmhjHoHQbem6bZTg1rFS5asVCOXMrTOyZgeJg==
|
||||
|
||||
sweetalert@^2.1.2:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/sweetalert/-/sweetalert-2.1.2.tgz#010baaa80d0dbdc86f96bfcaa96b490728594b79"
|
||||
integrity sha512-iWx7X4anRBNDa/a+AdTmvAzQtkN1+s4j/JJRWlHpYE8Qimkohs8/XnFcWeYHH2lMA8LRCa5tj2d244If3S/hzA==
|
||||
dependencies:
|
||||
es6-object-assign "^1.1.0"
|
||||
promise-polyfill "^6.0.2"
|
||||
sweetalert2@10.x:
|
||||
version "10.16.0"
|
||||
resolved "https://registry.yarnpkg.com/sweetalert2/-/sweetalert2-10.16.0.tgz#33d527af90689baab1078bf447b1986b796d4c75"
|
||||
integrity sha512-qJp4nIpx0MPDnAdY6MurwH/mAovfCzWo07hFoQ41C46XGLpNkxiqBbJDNdhGfMFwbDY1e9jfttNFxe5IsrkEtA==
|
||||
|
||||
table@4.0.2:
|
||||
version "4.0.2"
|
||||
@ -7700,13 +7682,6 @@ to-regex@^3.0.1, to-regex@^3.0.2:
|
||||
regex-not "^1.0.2"
|
||||
safe-regex "^1.1.0"
|
||||
|
||||
toastr@^2.1.4:
|
||||
version "2.1.4"
|
||||
resolved "https://registry.yarnpkg.com/toastr/-/toastr-2.1.4.tgz#8b43be64fb9d0c414871446f2db8e8ca4e95f181"
|
||||
integrity sha1-i0O+ZPudDEFIcURvLbjoyk6V8YE=
|
||||
dependencies:
|
||||
jquery ">=1.12.0"
|
||||
|
||||
toidentifier@1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"
|
||||
@ -8038,6 +8013,13 @@ vue-style-loader@^4.1.0:
|
||||
hash-sum "^1.0.2"
|
||||
loader-utils "^1.0.2"
|
||||
|
||||
vue-sweetalert2@^4.2.1:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/vue-sweetalert2/-/vue-sweetalert2-4.2.1.tgz#708c6b2bb0b19304ffa57c1ea5a1833916aa9cf4"
|
||||
integrity sha512-0YWUXxrzMp/xv348OZgqh4ICq3OUAc3Tt5N0e/0vAtze92vi2E27z+VRDIHtUOarNdjCmkV7w9PSRJzjq9xSNg==
|
||||
dependencies:
|
||||
sweetalert2 "10.x"
|
||||
|
||||
vue-template-compiler@^2.6.10:
|
||||
version "2.6.12"
|
||||
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.12.tgz#947ed7196744c8a5285ebe1233fe960437fcc57e"
|
||||
|
||||
Reference in New Issue
Block a user