From 4839e57791f7a1b5409564ed9734fa140dd604a4 Mon Sep 17 00:00:00 2001 From: yogesh_gohil Date: Tue, 12 Nov 2019 17:21:06 +0530 Subject: [PATCH 01/21] connect mail settings to api --- .../Controllers/EnvironmentController.php | 19 +++++++++- .../assets/js/components/base/BaseInput.vue | 18 ++++++++-- .../assets/js/views/settings/MailConfig.vue | 35 +++++++++++-------- .../js/views/wizard/EmailConfiguration.vue | 3 +- .../assets/plugins/vue-font-awesome/index.js | 4 ++- routes/api.php | 15 ++++++++ 6 files changed, 74 insertions(+), 20 deletions(-) diff --git a/app/Http/Controllers/EnvironmentController.php b/app/Http/Controllers/EnvironmentController.php index 2ce919e9..0ef07962 100755 --- a/app/Http/Controllers/EnvironmentController.php +++ b/app/Http/Controllers/EnvironmentController.php @@ -57,13 +57,30 @@ class EnvironmentController extends Controller */ public function saveMailEnvironment(MailEnvironmentRequest $request) { + $setting = Setting::getSetting('profile_complete'); $results = $this->EnvironmentManager->saveMailVariables($request); - Setting::setSetting('profile_complete', 4); + if ($setting !== 'COMPLETED') + { + Setting::setSetting('profile_complete', 4); + } return response()->json($results); } + public function getMailEnvironment() + { + $MailData = [ + 'mail_driver' => config('mail.driver'), + 'mail_host' => config('mail.host'), + 'mail_port' => config('mail.port'), + 'mail_username' => config('mail.username'), + 'mail_password' => config('mail.password'), + 'mail_encryption' => config('mail.encryption') + ]; + + return response()->json($MailData); + } /** * diff --git a/resources/assets/js/components/base/BaseInput.vue b/resources/assets/js/components/base/BaseInput.vue index 08a85bfd..09936d55 100644 --- a/resources/assets/js/components/base/BaseInput.vue +++ b/resources/assets/js/components/base/BaseInput.vue @@ -4,7 +4,7 @@ +
+ +
@@ -77,12 +80,17 @@ export default { autocomplete: { type: String, default: 'on' + }, + showPassword: { + type: Boolean, + default: false } }, data () { return { inputValue: this.value, - focus: false + focus: false, + showPass: false } }, computed: { @@ -94,6 +102,12 @@ export default { return true } return false + }, + toggleType () { + if (this.showPass) { + return 'text' + } + return this.type } }, watch: { diff --git a/resources/assets/js/views/settings/MailConfig.vue b/resources/assets/js/views/settings/MailConfig.vue index e3f83ac6..418803fa 100644 --- a/resources/assets/js/views/settings/MailConfig.vue +++ b/resources/assets/js/views/settings/MailConfig.vue @@ -66,8 +66,9 @@
@@ -121,7 +122,7 @@ color="theme" type="submit" > - {{ $t('wizard.save_cont') }} + {{ $t('general.save') }}
@@ -141,12 +142,12 @@ export default { data () { return { mailConfigData: { - mail_driver: 'smtp', - mail_host: 'mailtrap.io', - mail_port: 2525, - mail_username: 'cc3c64516febd4', - mail_password: 'e6a0176301f587', - mail_encryption: 'tls' + mail_driver: '', + mail_host: '', + mail_port: null, + mail_username: '', + mail_password: '', + mail_encryption: '' }, loading: false, mail_drivers: [] @@ -176,18 +177,22 @@ export default { } }, mounted () { - // this.getMailDrivers() + this.loadData() }, methods: { - async getMailDrivers () { + async loadData () { this.loading = true - let response = await window.axios.get('/api/admin/onboarding/environment/mail') + let mailDrivers = await window.axios.get('/api/settings/environment/mail') + let mailData = await window.axios.get('/api/settings/environment/mail-env') - if (response.data) { - this.mail_drivers = response.data - this.loading = false + if (mailDrivers.data) { + this.mail_drivers = mailDrivers.data } + if (mailData.data) { + this.mailConfigData = mailData.data + } + this.loading = false }, async saveEmailConfig () { this.$v.mailConfigData.$touch() @@ -196,7 +201,7 @@ export default { } this.loading = true try { - let response = await window.axios.post('/api/admin/onboarding/environment/mail', this.mailConfigData) + let response = await window.axios.post('/api/settings/environment/mail', this.mailConfigData) if (response.data.success) { window.toastr['success'](this.$t('wizard.success.' + response.data.success)) } else { diff --git a/resources/assets/js/views/wizard/EmailConfiguration.vue b/resources/assets/js/views/wizard/EmailConfiguration.vue index f90c6a04..ecc92ad5 100644 --- a/resources/assets/js/views/wizard/EmailConfiguration.vue +++ b/resources/assets/js/views/wizard/EmailConfiguration.vue @@ -61,7 +61,8 @@ diff --git a/resources/assets/plugins/vue-font-awesome/index.js b/resources/assets/plugins/vue-font-awesome/index.js index fd85606a..f2cfac9b 100644 --- a/resources/assets/plugins/vue-font-awesome/index.js +++ b/resources/assets/plugins/vue-font-awesome/index.js @@ -50,7 +50,8 @@ import { faShare, faEllipsisH, faCopy, - faPaperPlane + faPaperPlane, + faEyeSlash } from '@fortawesome/free-solid-svg-icons' import { far } from '@fortawesome/free-regular-svg-icons' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' @@ -108,6 +109,7 @@ library.add( faFilePdf, faEnvelope, faEye, + faEyeSlash, faShare, faEllipsisH, faCopy, diff --git a/routes/api.php b/routes/api.php index 4fa230ff..6fca466d 100644 --- a/routes/api.php +++ b/routes/api.php @@ -323,6 +323,21 @@ Route::group(['middleware' => 'api'], function () { 'uses' => 'CompanyController@updateSetting' ]); + Route::get('/environment/mail', [ + 'as' => 'admin.environment.mail', + 'uses' => 'EnvironmentController@getMailDrivers' + ]); + + Route::get('/environment/mail-env', [ + 'as' => 'admin.mail.env', + 'uses' => 'EnvironmentController@getMailEnvironment' + ]); + + Route::post('/environment/mail', [ + 'as' => 'admin.environment.mail.save', + 'uses' => 'EnvironmentController@saveMailEnvironment' + ]); + }); }); From a144b67a4eff39a64f4e7bc88df2c74dc1e20f45 Mon Sep 17 00:00:00 2001 From: jayvirsinh_gohil Date: Tue, 12 Nov 2019 18:26:29 +0530 Subject: [PATCH 02/21] validation and status changes --- app/Http/Controllers/InvoicesController.php | 1 + app/Http/Controllers/PaymentController.php | 23 +++---------------- app/Http/Requests/CustomerRequest.php | 4 ++++ app/Http/Requests/EstimatesRequest.php | 15 +++++++++--- app/Http/Requests/ExpenseRequest.php | 2 +- app/Http/Requests/InvoicesRequest.php | 15 +++++++++--- app/Http/Requests/ItemsRequest.php | 2 +- app/Http/Requests/PaymentRequest.php | 2 +- app/Http/Requests/ProfileRequest.php | 4 ++++ .../2017_04_11_081227_create_items_table.php | 2 +- ...017_04_12_090759_create_invoices_table.php | 12 +++++----- ...4_12_091015_create_invoice_items_table.php | 12 +++++----- ...17_05_05_055609_create_estimates_table.php | 10 ++++---- ..._02_123501_create_estimate_items_table.php | 12 +++++----- ...018_11_02_133956_create_expenses_table.php | 2 +- ...019_09_03_135234_create_payments_table.php | 2 +- .../2019_09_21_052548_create_taxes_table.php | 2 +- database/seeds/EstimateTemplateSeeder.php | 6 ++--- database/seeds/InvoiceTemplateSeeder.php | 6 ++--- 19 files changed, 72 insertions(+), 62 deletions(-) diff --git a/app/Http/Controllers/InvoicesController.php b/app/Http/Controllers/InvoicesController.php index ce434e24..7eaebb7b 100644 --- a/app/Http/Controllers/InvoicesController.php +++ b/app/Http/Controllers/InvoicesController.php @@ -260,6 +260,7 @@ class InvoicesController extends Controller 'error' => 'invalid_due_amount' ]); } elseif ($invoice->due_amount != 0 && $invoice->paid_status == Invoice::STATUS_PAID) { + $invoice->status = $invoice->getPreviousStatus(); $invoice->paid_status = Invoice::STATUS_PARTIALLY_PAID; } diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php index e141fd7c..9ebc8203 100644 --- a/app/Http/Controllers/PaymentController.php +++ b/app/Http/Controllers/PaymentController.php @@ -170,6 +170,7 @@ class PaymentController extends Controller $invoice->status = Invoice::STATUS_COMPLETED; $invoice->paid_status = Invoice::STATUS_PAID; } else { + $invoice->status = $invoice->getPreviousStatus(); $invoice->paid_status = Invoice::STATUS_PARTIALLY_PAID; } @@ -211,16 +212,7 @@ class PaymentController extends Controller $invoice->paid_status = Invoice::STATUS_PARTIALLY_PAID; } - if ($invoice->due_date < Carbon::now()) { - $invoice->status = Invoice::STATUS_OVERDUE; - } elseif ($invoice->viewed) { - $invoice->status = Invoice::STATUS_VIEWED; - } elseif ($invoice->sent) { - $invoice->status = Invoice::STATUS_SENT; - } else { - $invoice->status = Invoice::STATUS_DRAFT; - } - + $invoice->status = $invoice->getPreviousStatus(); $invoice->save(); } @@ -246,16 +238,7 @@ class PaymentController extends Controller $invoice->paid_status = Invoice::STATUS_PARTIALLY_PAID; } - if ($invoice->due_date < Carbon::now()) { - $invoice->status = Invoice::STATUS_OVERDUE; - } elseif ($invoice->sent) { - $invoice->status = Invoice::STATUS_SENT; - } elseif ($invoice->viewed) { - $invoice->status = Invoice::STATUS_VIEWED; - } else { - $invoice->status = Invoice::STATUS_DRAFT; - } - + $invoice->status = $invoice->getPreviousStatus(); $invoice->save(); } diff --git a/app/Http/Requests/CustomerRequest.php b/app/Http/Requests/CustomerRequest.php index 9a55be44..0973264c 100644 --- a/app/Http/Requests/CustomerRequest.php +++ b/app/Http/Requests/CustomerRequest.php @@ -26,12 +26,16 @@ class CustomerRequest extends FormRequest case 'POST': return [ 'name' => 'required', + 'addresses.*.address_street_1' => 'max:255', + 'addresses.*.address_street_2' => 'max:255', 'email' => 'email|nullable|unique:users,email', ]; break; case 'PUT': return [ 'name' => 'required', + 'addresses.*.address_street_1' => 'max:255', + 'addresses.*.address_street_2' => 'max:255', ]; break; default: diff --git a/app/Http/Requests/EstimatesRequest.php b/app/Http/Requests/EstimatesRequest.php index 61b96d65..5a9c760e 100644 --- a/app/Http/Requests/EstimatesRequest.php +++ b/app/Http/Requests/EstimatesRequest.php @@ -27,13 +27,22 @@ class EstimatesRequest extends FormRequest 'expiry_date' => 'required', 'estimate_number' => 'required|unique:estimates,estimate_number', 'user_id' => 'required', - 'discount' => 'required', + 'discount' => 'required|digits_between:1,20', + 'discount_val' => 'required|digits_between:1,20', + 'sub_total' => 'required|digits_between:1,20', + 'total' => 'required|digits_between:1,20', + 'tax' => 'required|digits_between:1,20', 'estimate_template_id' => 'required', 'items' => 'required|array', + 'items.*.description' => 'max:255', 'items.*' => 'required|max:255', 'items.*.name' => 'required', - 'items.*.quantity' => 'required|numeric', - 'items.*.price' => 'required|numeric', + 'items.*.quantity' => 'required|digits_between:1,20', + 'items.*.price' => 'required|digits_between:1,20', + 'items.*.discount' => 'digits_between:1,20', + 'items.*.discount_val' => 'digits_between:1,20', + 'items.*.tax' => 'digits_between:1,20', + 'items.*.total' => 'digits_between:1,20', ]; if ($this->getMethod() == 'PUT') { diff --git a/app/Http/Requests/ExpenseRequest.php b/app/Http/Requests/ExpenseRequest.php index 576d69f5..3c03bd67 100644 --- a/app/Http/Requests/ExpenseRequest.php +++ b/app/Http/Requests/ExpenseRequest.php @@ -25,7 +25,7 @@ class ExpenseRequest extends FormRequest return [ 'expense_date' => 'required', 'expense_category_id' => 'required', - 'amount' => 'required' + 'amount' => 'required|digits_between:1,20' ]; } } diff --git a/app/Http/Requests/InvoicesRequest.php b/app/Http/Requests/InvoicesRequest.php index 2724e323..3b9306ce 100644 --- a/app/Http/Requests/InvoicesRequest.php +++ b/app/Http/Requests/InvoicesRequest.php @@ -27,13 +27,22 @@ class InvoicesRequest extends FormRequest 'due_date' => 'required', 'invoice_number' => 'required|unique:invoices,invoice_number', 'user_id' => 'required', - 'discount' => 'required', + 'discount' => 'required|digits_between:1,20', + 'discount_val' => 'required|digits_between:1,20', + 'sub_total' => 'required|digits_between:1,20', + 'total' => 'required|digits_between:1,20', + 'tax' => 'required|digits_between:1,20', 'invoice_template_id' => 'required', 'items' => 'required|array', 'items.*' => 'required|max:255', + 'items.*.description' => 'max:255', 'items.*.name' => 'required', - 'items.*.quantity' => 'required|numeric', - 'items.*.price' => 'required|numeric', + 'items.*.quantity' => 'required|digits_between:1,20', + 'items.*.price' => 'required|digits_between:1,20', + 'items.*.discount' => 'digits_between:1,20', + 'items.*.discount_val' => 'digits_between:1,20', + 'items.*.tax' => 'digits_between:1,20', + 'items.*.total' => 'digits_between:1,20', ]; if ($this->getMethod() == 'PUT') { diff --git a/app/Http/Requests/ItemsRequest.php b/app/Http/Requests/ItemsRequest.php index 1aa535f3..d24e29ef 100644 --- a/app/Http/Requests/ItemsRequest.php +++ b/app/Http/Requests/ItemsRequest.php @@ -24,7 +24,7 @@ class ItemsRequest extends FormRequest { return [ 'name' => 'required', - 'price' => 'required', + 'price' => 'required|digits_between:1,20', ]; } } diff --git a/app/Http/Requests/PaymentRequest.php b/app/Http/Requests/PaymentRequest.php index 9f326d1d..cc8a9718 100644 --- a/app/Http/Requests/PaymentRequest.php +++ b/app/Http/Requests/PaymentRequest.php @@ -26,7 +26,7 @@ class PaymentRequest extends FormRequest 'payment_date' => 'required', 'payment_number' => 'required|unique:payments,payment_number', 'user_id' => 'required', - 'amount' => 'required', + 'amount' => 'required|digits_between:1,20', ]; if ($this->getMethod() == 'PUT') { diff --git a/app/Http/Requests/ProfileRequest.php b/app/Http/Requests/ProfileRequest.php index 0a9b2e6c..6d96742d 100644 --- a/app/Http/Requests/ProfileRequest.php +++ b/app/Http/Requests/ProfileRequest.php @@ -31,6 +31,8 @@ class ProfileRequest extends FormRequest return [ 'name' => 'required', 'password' => 'required', + 'address_street_1' => 'max:255', + 'address_street_2' => 'max:255', 'email' => [ 'required', 'email', @@ -41,6 +43,8 @@ class ProfileRequest extends FormRequest case 'PUT': return [ 'name' => 'required', + 'address_street_1' => 'max:255', + 'address_street_2' => 'max:255', 'email' => 'required|email' ]; break; diff --git a/database/migrations/2017_04_11_081227_create_items_table.php b/database/migrations/2017_04_11_081227_create_items_table.php index e1041517..f383ff1f 100644 --- a/database/migrations/2017_04_11_081227_create_items_table.php +++ b/database/migrations/2017_04_11_081227_create_items_table.php @@ -18,7 +18,7 @@ class CreateItemsTable extends Migration $table->string('name'); $table->string('description')->nullable(); $table->string('unit')->nullable(); - $table->integer('price'); + $table->unsignedBigInteger('price'); $table->integer('company_id')->unsigned()->nullable(); $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade'); $table->timestamps(); diff --git a/database/migrations/2017_04_12_090759_create_invoices_table.php b/database/migrations/2017_04_12_090759_create_invoices_table.php index 3f30011c..7089c847 100644 --- a/database/migrations/2017_04_12_090759_create_invoices_table.php +++ b/database/migrations/2017_04_12_090759_create_invoices_table.php @@ -24,13 +24,13 @@ class CreateInvoicesTable extends Migration $table->string('tax_per_item'); $table->string('discount_per_item'); $table->text('notes')->nullable(); - $table->decimal('discount', 15, 0)->nullable(); $table->string('discount_type')->nullable(); - $table->integer('discount_val')->nullable(); - $table->integer('sub_total'); - $table->integer('total'); - $table->integer('tax'); - $table->integer('due_amount'); + $table->unsignedBigInteger('discount')->nullable(); + $table->unsignedBigInteger('discount_val')->nullable(); + $table->unsignedBigInteger('sub_total'); + $table->unsignedBigInteger('total'); + $table->unsignedBigInteger('tax'); + $table->unsignedBigInteger('due_amount'); $table->boolean('sent')->default(false); $table->boolean('viewed')->default(false); $table->string('unique_hash')->nullable(); diff --git a/database/migrations/2017_04_12_091015_create_invoice_items_table.php b/database/migrations/2017_04_12_091015_create_invoice_items_table.php index 343b6a77..26af22bf 100644 --- a/database/migrations/2017_04_12_091015_create_invoice_items_table.php +++ b/database/migrations/2017_04_12_091015_create_invoice_items_table.php @@ -17,13 +17,13 @@ class CreateInvoiceItemsTable extends Migration $table->increments('id'); $table->string('name'); $table->string('description')->nullable(); - $table->integer('quantity'); - $table->integer('price'); $table->string('discount_type'); - $table->integer('discount_val'); - $table->decimal('discount', 15, 0); - $table->integer('tax'); - $table->integer('total'); + $table->unsignedBigInteger('quantity'); + $table->unsignedBigInteger('price'); + $table->unsignedBigInteger('discount_val'); + $table->unsignedBigInteger('discount'); + $table->unsignedBigInteger('tax'); + $table->unsignedBigInteger('total'); $table->integer('invoice_id')->unsigned(); $table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade'); $table->integer('item_id')->unsigned()->nullable(); diff --git a/database/migrations/2017_05_05_055609_create_estimates_table.php b/database/migrations/2017_05_05_055609_create_estimates_table.php index 77c43e68..cfd5b536 100644 --- a/database/migrations/2017_05_05_055609_create_estimates_table.php +++ b/database/migrations/2017_05_05_055609_create_estimates_table.php @@ -23,12 +23,12 @@ class CreateEstimatesTable extends Migration $table->string('tax_per_item'); $table->string('discount_per_item'); $table->string('notes')->nullable(); - $table->decimal('discount', 15, 0)->nullable(); $table->string('discount_type')->nullable(); - $table->integer('discount_val')->nullable(); - $table->integer('sub_total'); - $table->integer('total'); - $table->integer('tax'); + $table->unsignedBigInteger('discount')->nullable(); + $table->unsignedBigInteger('discount_val')->nullable(); + $table->unsignedBigInteger('sub_total'); + $table->unsignedBigInteger('total'); + $table->unsignedBigInteger('tax'); $table->string('unique_hash')->nullable(); $table->integer('user_id')->unsigned()->nullable(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); diff --git a/database/migrations/2017_10_02_123501_create_estimate_items_table.php b/database/migrations/2017_10_02_123501_create_estimate_items_table.php index 400086c6..a2222dcb 100644 --- a/database/migrations/2017_10_02_123501_create_estimate_items_table.php +++ b/database/migrations/2017_10_02_123501_create_estimate_items_table.php @@ -17,13 +17,13 @@ class CreateEstimateItemsTable extends Migration $table->increments('id'); $table->string('name'); $table->string('description')->nullable(); - $table->integer('quantity'); $table->string('discount_type'); - $table->decimal('discount', 15, 0); - $table->integer('discount_val'); - $table->integer('price'); - $table->integer('tax'); - $table->integer('total'); + $table->unsignedBigInteger('quantity'); + $table->unsignedBigInteger('discount'); + $table->unsignedBigInteger('discount_val'); + $table->unsignedBigInteger('price'); + $table->unsignedBigInteger('tax'); + $table->unsignedBigInteger('total'); $table->integer('item_id')->unsigned()->nullable(); $table->foreign('item_id')->references('id')->on('items')->onDelete('cascade'); $table->integer('estimate_id')->unsigned(); diff --git a/database/migrations/2018_11_02_133956_create_expenses_table.php b/database/migrations/2018_11_02_133956_create_expenses_table.php index ae3e1f2c..25912644 100644 --- a/database/migrations/2018_11_02_133956_create_expenses_table.php +++ b/database/migrations/2018_11_02_133956_create_expenses_table.php @@ -17,7 +17,7 @@ class CreateExpensesTable extends Migration $table->increments('id'); $table->date('expense_date'); $table->string('attachment_receipt')->nullable(); - $table->integer('amount'); + $table->unsignedBigInteger('amount'); $table->string('notes')->nullable(); $table->integer('expense_category_id')->unsigned(); $table->foreign('expense_category_id')->references('id')->on('expense_categories')->onDelete('cascade'); diff --git a/database/migrations/2019_09_03_135234_create_payments_table.php b/database/migrations/2019_09_03_135234_create_payments_table.php index 7797905c..d34af4f2 100644 --- a/database/migrations/2019_09_03_135234_create_payments_table.php +++ b/database/migrations/2019_09_03_135234_create_payments_table.php @@ -19,7 +19,7 @@ class CreatePaymentsTable extends Migration $table->string('payment_mode')->nullable(); $table->date('payment_date'); $table->text('notes')->nullable(); - $table->decimal('amount', 15, 0); + $table->unsignedBigInteger('amount'); $table->integer('user_id')->unsigned(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->integer('invoice_id')->unsigned()->nullable(); diff --git a/database/migrations/2019_09_21_052548_create_taxes_table.php b/database/migrations/2019_09_21_052548_create_taxes_table.php index 56622267..f5ae90f9 100644 --- a/database/migrations/2019_09_21_052548_create_taxes_table.php +++ b/database/migrations/2019_09_21_052548_create_taxes_table.php @@ -30,7 +30,7 @@ class CreateTaxesTable extends Migration $table->integer('company_id')->unsigned()->nullable(); $table->foreign('company_id')->references('id')->on('companies'); $table->string('name'); - $table->decimal('amount', 15, 0); + $table->unsignedBigInteger('amount'); $table->decimal('percent', 5, 2); $table->tinyInteger('compound_tax')->default(0); $table->timestamps(); diff --git a/database/seeds/EstimateTemplateSeeder.php b/database/seeds/EstimateTemplateSeeder.php index 63263e17..13219dc9 100644 --- a/database/seeds/EstimateTemplateSeeder.php +++ b/database/seeds/EstimateTemplateSeeder.php @@ -13,19 +13,19 @@ class EstimateTemplateSeeder extends Seeder public function run() { EstimateTemplate::create([ - 'name' => 'Estimate Template1', + 'name' => 'Template 1', 'view' => 'estimate1', 'path' => '/assets/img/PDF/Template1.png' ]); EstimateTemplate::create([ - 'name' => 'Estimate Template2', + 'name' => 'Template 2', 'view' => 'estimate2', 'path' => '/assets/img/PDF/Template2.png' ]); EstimateTemplate::create([ - 'name' => 'Estimate Template3', + 'name' => 'Template 3', 'view' => 'estimate3', 'path' => '/assets/img/PDF/Template3.png' ]); diff --git a/database/seeds/InvoiceTemplateSeeder.php b/database/seeds/InvoiceTemplateSeeder.php index aade6397..b0fcb647 100644 --- a/database/seeds/InvoiceTemplateSeeder.php +++ b/database/seeds/InvoiceTemplateSeeder.php @@ -13,19 +13,19 @@ class InvoiceTemplateSeeder extends Seeder public function run() { InvoiceTemplate::create([ - 'name' => 'Invoice Template1', + 'name' => 'Template 1', 'view' => 'invoice1', 'path' => '/assets/img/PDF/Template1.png' ]); InvoiceTemplate::create([ - 'name' => 'Invoice Template2', + 'name' => ' Template 2', 'view' => 'invoice2', 'path' => '/assets/img/PDF/Template2.png' ]); InvoiceTemplate::create([ - 'name' => 'Invoice Template3', + 'name' => 'Template 3', 'view' => 'invoice3', 'path' => '/assets/img/PDF/Template3.png' ]); From 81f34b8912e6e9d33ba038f46951bc9fc172f2b3 Mon Sep 17 00:00:00 2001 From: jayvirsinh_gohil Date: Tue, 12 Nov 2019 18:30:17 +0530 Subject: [PATCH 03/21] add previous status method in invoice model --- app/Invoice.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/Invoice.php b/app/Invoice.php index 0bbd845a..31a1425e 100644 --- a/app/Invoice.php +++ b/app/Invoice.php @@ -113,6 +113,19 @@ class Invoice extends Model return $this->belongsTo(InvoiceTemplate::class); } + public function getPreviousStatus() + { + if ($this->due_date < Carbon::now()) { + return self::STATUS_OVERDUE; + } elseif ($this->viewed) { + return self::STATUS_VIEWED; + } elseif ($this->sent) { + return self::STATUS_SENT; + } else { + return self::STATUS_DRAFT; + } + } + private function strposX($haystack, $needle, $number) { if ($number == '1') { From 1b28b082d2212f5b02829ee691b5c013004e6f96 Mon Sep 17 00:00:00 2001 From: jayvirsinh_gohil Date: Tue, 12 Nov 2019 18:44:49 +0530 Subject: [PATCH 04/21] add auto update feature --- app/Events/UpdateFinished.php | 34 ++++++++ app/Http/Controllers/UpdateController.php | 18 +++++ app/Listeners/Updates/Listener.php | 31 ++++++++ app/Listeners/Updates/V10/Version101.php | 28 +++++++ app/Providers/EventServiceProvider.php | 4 +- app/Space/SiteApi.php | 35 ++++++++ app/Space/Updater.php | 97 +++++++++++++++++++++++ routes/api.php | 9 +++ 8 files changed, 254 insertions(+), 2 deletions(-) create mode 100644 app/Events/UpdateFinished.php create mode 100644 app/Http/Controllers/UpdateController.php create mode 100644 app/Listeners/Updates/Listener.php create mode 100644 app/Listeners/Updates/V10/Version101.php create mode 100644 app/Space/SiteApi.php create mode 100644 app/Space/Updater.php diff --git a/app/Events/UpdateFinished.php b/app/Events/UpdateFinished.php new file mode 100644 index 00000000..d9700d93 --- /dev/null +++ b/app/Events/UpdateFinished.php @@ -0,0 +1,34 @@ +alias = $alias; + $this->old = $old; + $this->new = $new; + } +} diff --git a/app/Http/Controllers/UpdateController.php b/app/Http/Controllers/UpdateController.php new file mode 100644 index 00000000..db8a3a55 --- /dev/null +++ b/app/Http/Controllers/UpdateController.php @@ -0,0 +1,18 @@ +alias, $request->installed, $request->version); + + return response()->json($json); + } +} diff --git a/app/Listeners/Updates/Listener.php b/app/Listeners/Updates/Listener.php new file mode 100644 index 00000000..cc63c94b --- /dev/null +++ b/app/Listeners/Updates/Listener.php @@ -0,0 +1,31 @@ +alias != static::ALIAS) { + return false; + } + + // Do not apply to the same or newer versions + if (version_compare($event->old, static::VERSION, '>=')) { + return false; + } + + return true; + } +} diff --git a/app/Listeners/Updates/V10/Version101.php b/app/Listeners/Updates/V10/Version101.php new file mode 100644 index 00000000..6bd9c226 --- /dev/null +++ b/app/Listeners/Updates/V10/Version101.php @@ -0,0 +1,28 @@ +check($event)) { + return; + } + } +} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 94b27038..ea9d4fea 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -13,8 +13,8 @@ class EventServiceProvider extends ServiceProvider * @var array */ protected $listen = [ - 'Laraspace\Events\SomeEvent' => [ - 'Laraspace\Listeners\EventListener', + 'Laraspace\Events\UpdateFinished' => [ + 'Laraspace\Listeners\Updates\V10\Version101', ], Registered::class => [ SendEmailVerificationNotification::class, diff --git a/app/Space/SiteApi.php b/app/Space/SiteApi.php new file mode 100644 index 00000000..6952208b --- /dev/null +++ b/app/Space/SiteApi.php @@ -0,0 +1,35 @@ + false, 'base_uri' => $base]); + + $headers['headers'] = array( + 'Accept' => 'application/json', + 'Referer' => url('/'), + 'crater' => getFullVersion() + ); + + $data['http_errors'] = false; + + $data = array_merge($data, $headers); + + try { + $result = $client->get($url, $data); + } catch (RequestException $e) { + $result = $e; + } + + return $result; + } +} diff --git a/app/Space/Updater.php b/app/Space/Updater.php new file mode 100644 index 00000000..21997506 --- /dev/null +++ b/app/Space/Updater.php @@ -0,0 +1,97 @@ + 50, 'track_redirects' => true]); + + // Exception + if ($response instanceof RequestException) { + return [ + 'success' => false, + 'errors' => 'Download Exception', + 'data' => [ + 'path' => $path + ] + ]; + } + + if ($response && ($response->getStatusCode() == 200)) { + $data = $response->getBody()->getContents(); + } + + // Create temp directory + $path = 'temp-' . md5(mt_rand()); + $path2 = 'temp2-' . md5(mt_rand()); + $temp_path = storage_path('app/temp') . '/' . $path; + $temp_path2 = storage_path('app/temp') . '/' . $path2; + + if (!File::isDirectory($temp_path)) { + File::makeDirectory($temp_path); + File::makeDirectory($temp_path2); + } + + $file = $temp_path . '/upload.zip'; + + // Add content to the Zip file + $uploaded = is_int(file_put_contents($file, $data)) ? true : false; + + if (!$uploaded) { + return false; + } + + // Unzip the file + $zip = new ZipArchive(); + + if ($zip->open($file)) { + $zip->extractTo($temp_path2); + } + + $zip->close(); + + // Delete zip file + File::delete($file); + + if (!File::copyDirectory($temp_path2, base_path())) { + return false; + } + + // Delete temp directory + File::deleteDirectory($temp_path); + File::deleteDirectory($temp_path2); + + Artisan::call('cache:clear'); + + try { + event(new UpdateFinished($alias, $installed, $version)); + + return [ + 'success' => true, + 'errors' => false, + 'data' => [] + ]; + } catch (\Exception $e) { + return [ + 'success' => false, + 'errors' => 'Update error', + 'data' => [] + ]; + } + } +} diff --git a/routes/api.php b/routes/api.php index 4fa230ff..2d1cc49b 100644 --- a/routes/api.php +++ b/routes/api.php @@ -106,6 +106,8 @@ Route::group(['middleware' => 'redirect-if-installed'], function () { 'uses' => 'OnboardingController@companySettings' ]); }); + + // App version // ---------------------------------- @@ -120,6 +122,13 @@ Route::group(['middleware' => 'api'], function () { 'middleware' => 'admin' ], function () { + // Auto update routes + //---------------------------------- + Route::post('/update', [ + 'as' => 'auto.update', + 'uses' => 'UpdateController@update' + ]); + Route::get('/bootstrap', [ 'as' => 'bootstrap', 'uses' => 'UsersController@getBootstrap' From 19f8d3c042399e09f449bc2fc7dd4d5cb19c2677 Mon Sep 17 00:00:00 2001 From: jayvirsinh_gohil Date: Tue, 12 Nov 2019 18:56:24 +0530 Subject: [PATCH 05/21] refactor update finished event --- app/Events/UpdateFinished.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Events/UpdateFinished.php b/app/Events/UpdateFinished.php index d9700d93..65949f76 100644 --- a/app/Events/UpdateFinished.php +++ b/app/Events/UpdateFinished.php @@ -12,7 +12,7 @@ use Illuminate\Queue\SerializesModels; class UpdateFinished { - use Dispatchable, InteractsWithSockets, SerializesModels; + use Dispatchable; public $alias; From 4923392db180d371f9f3003693027a0b378d5f0d Mon Sep 17 00:00:00 2001 From: jayvirsinh_gohil Date: Tue, 12 Nov 2019 19:37:04 +0530 Subject: [PATCH 06/21] refactor environment controller and login validation --- app/Http/Controllers/Auth/AccessTokensController.php | 2 +- app/Http/Controllers/EnvironmentController.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Auth/AccessTokensController.php b/app/Http/Controllers/Auth/AccessTokensController.php index 0441aa57..73396b11 100644 --- a/app/Http/Controllers/Auth/AccessTokensController.php +++ b/app/Http/Controllers/Auth/AccessTokensController.php @@ -54,7 +54,7 @@ class AccessTokensController extends Controller { $request->validate([ 'username' => 'required|email', - 'password' => 'required|string', + 'password' => 'required|string|min:8', ]); if ($this->hasTooManyLoginAttempts($request)) { diff --git a/app/Http/Controllers/EnvironmentController.php b/app/Http/Controllers/EnvironmentController.php index 2ce919e9..bc9a02bc 100755 --- a/app/Http/Controllers/EnvironmentController.php +++ b/app/Http/Controllers/EnvironmentController.php @@ -39,8 +39,8 @@ class EnvironmentController extends Controller if(array_key_exists("success", $results)) { Artisan::call('config:clear'); - Artisan::call('migrate --seed'); - Artisan::call('migrate', ['--path' => 'vendor/laravel/passport/database/migrations']); + Artisan::call('migrate --seed --force'); + Artisan::call('migrate', ['--path' => 'vendor/laravel/passport/database/migrations', '--force' => true]); \Storage::disk('local')->put('database_created', 'database_created'); From 3efc3357c181325fe6c51eac3accd7bd80918e05 Mon Sep 17 00:00:00 2001 From: jayvirsinh_gohil Date: Tue, 12 Nov 2019 20:25:00 +0530 Subject: [PATCH 07/21] add key generate command --- app/Http/Controllers/EnvironmentController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Controllers/EnvironmentController.php b/app/Http/Controllers/EnvironmentController.php index 2ce919e9..9760514e 100755 --- a/app/Http/Controllers/EnvironmentController.php +++ b/app/Http/Controllers/EnvironmentController.php @@ -39,6 +39,7 @@ class EnvironmentController extends Controller if(array_key_exists("success", $results)) { Artisan::call('config:clear'); + Artisan::call('key:generate --force'); Artisan::call('migrate --seed'); Artisan::call('migrate', ['--path' => 'vendor/laravel/passport/database/migrations']); From fa1ddae78ccef38eb1a678bfd986e9a9cd2d32d1 Mon Sep 17 00:00:00 2001 From: jayvirsinh_gohil Date: Wed, 13 Nov 2019 20:14:46 +0530 Subject: [PATCH 08/21] refactor updater --- app/Space/SiteApi.php | 5 +++-- app/Space/Updater.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Space/SiteApi.php b/app/Space/SiteApi.php index 6952208b..35f5f6ab 100644 --- a/app/Space/SiteApi.php +++ b/app/Space/SiteApi.php @@ -4,20 +4,21 @@ namespace Laraspace\Space; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; +use Laraspace\Setting; trait SiteApi { protected static function getRemote($url, $data = array()) { - $base = 'https://codeload.github.com/'; + $base = 'http://download-test.test/'; $client = new Client(['verify' => false, 'base_uri' => $base]); $headers['headers'] = array( 'Accept' => 'application/json', 'Referer' => url('/'), - 'crater' => getFullVersion() + 'crater' => Setting::getSetting('version') ); $data['http_errors'] = false; diff --git a/app/Space/Updater.php b/app/Space/Updater.php index 21997506..967ea492 100644 --- a/app/Space/Updater.php +++ b/app/Space/Updater.php @@ -17,9 +17,9 @@ class Updater $data = null; $path = null; - $url = 'laraspace/laraspace/zip/master'; + $url = '/api/download'; - $response = static::getRemote($url, ['timeout' => 50, 'track_redirects' => true]); + $response = static::getRemote($url, ['timeout' => 100, 'track_redirects' => true]); // Exception if ($response instanceof RequestException) { From 2dda0baa3fb40a3f28c5dadd027dfa7980c55ddb Mon Sep 17 00:00:00 2001 From: yogesh_gohil Date: Thu, 14 Nov 2019 15:51:48 +0530 Subject: [PATCH 09/21] fix conflicts --- database/seeds/UsersTableSeeder.php | 4 +- laravel-echo-server.json | 27 ---- npm-debug.log | 37 ----- public/assets/icon/check-circle-solid.svg | 17 +++ public/assets/icon/envelope-solid.svg | 13 ++ public/assets/icon/paper-plane-solid.svg | 14 ++ public/assets/icon/times-circle-solid.svg | 14 ++ public/assets/icon/trash-solid.svg | 14 ++ resources/assets/js/plugins/en.js | 23 +++- resources/assets/js/plugins/es.js | 21 ++- resources/assets/js/plugins/fr.js | 22 ++- resources/assets/js/router.js | 6 + resources/assets/js/views/auth/Login.vue | 15 +- .../assets/js/views/customers/Create.vue | 25 ++-- resources/assets/js/views/customers/Index.vue | 4 +- .../assets/js/views/dashboard/Dashboard.vue | 4 +- resources/assets/js/views/estimates/Index.vue | 130 ++++++++++++------ resources/assets/js/views/estimates/View.vue | 24 +++- resources/assets/js/views/expenses/Index.vue | 4 +- resources/assets/js/views/invoices/Index.vue | 60 +++++--- resources/assets/js/views/invoices/View.vue | 24 +++- resources/assets/js/views/items/Index.vue | 4 +- resources/assets/js/views/payments/Create.vue | 4 +- resources/assets/js/views/payments/Index.vue | 4 +- .../js/views/reports/ExpensesReport.vue | 9 +- .../js/views/reports/ProfitLossReport.vue | 9 +- .../assets/js/views/reports/SalesReports.vue | 9 +- .../assets/js/views/reports/TaxReport.vue | 11 +- .../js/views/settings/ExpenseCategory.vue | 24 +++- .../assets/js/views/settings/MailConfig.vue | 4 +- .../assets/js/views/settings/TaxTypes.vue | 35 ++--- .../assets/js/views/settings/UpdateApp.vue | 55 ++++++++ .../assets/js/views/settings/UserProfile.vue | 6 +- .../assets/js/views/settings/layout/Index.vue | 6 + .../assets/js/views/wizard/CompanyInfo.vue | 18 ++- .../assets/js/views/wizard/UserProfile.vue | 4 +- .../assets/plugins/vue-font-awesome/index.js | 4 +- resources/assets/sass/base.scss | 4 + .../sass/components/vue-multi-select.scss | 38 ++++- resources/assets/sass/pages/customers.scss | 3 - resources/assets/sass/pages/dashboard.scss | 19 +++ .../assets/sass/pages/estimates/index.scss | 4 +- .../assets/sass/pages/invoices/create.scss | 3 +- .../assets/sass/pages/invoices/index.scss | 4 +- resources/assets/sass/pages/wizard.scss | 3 + .../app/pdf/estimate/estimate1.blade.php | 2 + .../app/pdf/estimate/estimate2.blade.php | 2 + .../app/pdf/estimate/estimate3.blade.php | 2 + .../views/app/pdf/invoice/invoice1.blade.php | 2 + .../views/app/pdf/invoice/invoice2.blade.php | 4 +- .../views/app/pdf/invoice/invoice3.blade.php | 4 +- 51 files changed, 576 insertions(+), 226 deletions(-) delete mode 100644 laravel-echo-server.json delete mode 100644 npm-debug.log create mode 100644 public/assets/icon/check-circle-solid.svg create mode 100644 public/assets/icon/envelope-solid.svg create mode 100644 public/assets/icon/paper-plane-solid.svg create mode 100644 public/assets/icon/times-circle-solid.svg create mode 100644 public/assets/icon/trash-solid.svg create mode 100644 resources/assets/js/views/settings/UpdateApp.vue diff --git a/database/seeds/UsersTableSeeder.php b/database/seeds/UsersTableSeeder.php index 273e354f..3f3e480f 100644 --- a/database/seeds/UsersTableSeeder.php +++ b/database/seeds/UsersTableSeeder.php @@ -15,10 +15,10 @@ class UsersTableSeeder extends Seeder public function run() { User::create([ - 'email' => 'admin@crater.in', + 'email' => 'admin@craterapp.com', 'name' => 'Jane Doe', 'role' => 'admin', - 'password' => Hash::make('admin@123') + 'password' => Hash::make('crater@123') ]); Setting::setSetting('profile_complete', 0); diff --git a/laravel-echo-server.json b/laravel-echo-server.json deleted file mode 100644 index e72cdecc..00000000 --- a/laravel-echo-server.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "authHost": "http://crater-vue.test", - "authEndpoint": "/broadcasting/auth", - "clients": [], - "database": "redis", - "databaseConfig": { - "redis": {}, - "sqlite": { - "databasePath": "/database/laravel-echo-server.sqlite" - } - }, - "devMode": true, - "host": null, - "port": "6001", - "protocol": "http", - "socketio": {}, - "sslCertPath": "", - "sslKeyPath": "", - "sslCertChainPath": "", - "sslPassphrase": "", - "apiOriginAllow": { - "allowCors": false, - "allowOrigin": "", - "allowMethods": "", - "allowHeaders": "" - } -} \ No newline at end of file diff --git a/npm-debug.log b/npm-debug.log deleted file mode 100644 index b8c9d9e1..00000000 --- a/npm-debug.log +++ /dev/null @@ -1,37 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', -1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', -1 verbose cli 'run', -1 verbose cli 'watch' ] -2 info using npm@3.10.10 -3 info using node@v6.11.2 -4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ] -5 info lifecycle @~prewatch: @ -6 silly lifecycle @~prewatch: no script for prewatch, continuing -7 info lifecycle @~watch: @ -8 verbose lifecycle @~watch: unsafe-perm in lifecycle true -9 verbose lifecycle @~watch: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\laragon2\www\crater-vue\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\laragon2\bin\php\php-7.2.5-Win32-VC15-x86;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\laragon2\bin\yarn\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Java\jdk-10.0.1\bin;C:\Users\bytefury\AppData\Roaming\Composer\vendor\bin;C:\laragon\www\wp\node_modules\.bin;C:\laragon\www\Laravel\node_modules\webpack\bin;C:\Users\bytefury\AppData\Roaming\npm;C:\Program Files\Microsoft VS Code\bin;C:\Users\bytefury\AppData\Local\Microsoft\WindowsApps; -10 verbose lifecycle @~watch: CWD: C:\laragon2\www\crater-vue -11 silly lifecycle @~watch: Args: [ '/d /s /c', -11 silly lifecycle 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ] -12 verbose stack Error: kill ENOSYS -12 verbose stack at exports._errnoException (util.js:1020:11) -12 verbose stack at process.kill (internal/process.js:190:13) -12 verbose stack at process.listener (C:\Program Files\nodejs\node_modules\npm\node_modules\npmlog\node_modules\gauge\node_modules\signal-exit\index.js:86:15) -12 verbose stack at emitNone (events.js:91:20) -12 verbose stack at process.emit (events.js:185:7) -12 verbose stack at processEmit (C:\Program Files\nodejs\node_modules\npm\node_modules\npmlog\node_modules\gauge\node_modules\signal-exit\index.js:146:32) -12 verbose stack at processEmit (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\node_modules\npmlog\node_modules\gauge\node_modules\signal-exit\index.js:146:32) -12 verbose stack at Signal.wrap.onsignal (internal/process.js:217:44) -13 verbose cwd C:\laragon2\www\crater-vue -14 error Windows_NT 10.0.17134 -15 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch" -16 error node v6.11.2 -17 error npm v3.10.10 -18 error code ENOSYS -19 error errno ENOSYS -20 error syscall kill -21 error kill ENOSYS -22 error If you need help, you may report this error at: -22 error -23 verbose exit [ 1, true ] diff --git a/public/assets/icon/check-circle-solid.svg b/public/assets/icon/check-circle-solid.svg new file mode 100644 index 00000000..2c21c410 --- /dev/null +++ b/public/assets/icon/check-circle-solid.svg @@ -0,0 +1,17 @@ + + + + diff --git a/public/assets/icon/envelope-solid.svg b/public/assets/icon/envelope-solid.svg new file mode 100644 index 00000000..5102d95a --- /dev/null +++ b/public/assets/icon/envelope-solid.svg @@ -0,0 +1,13 @@ + diff --git a/public/assets/icon/paper-plane-solid.svg b/public/assets/icon/paper-plane-solid.svg new file mode 100644 index 00000000..771707c5 --- /dev/null +++ b/public/assets/icon/paper-plane-solid.svg @@ -0,0 +1,14 @@ + diff --git a/public/assets/icon/times-circle-solid.svg b/public/assets/icon/times-circle-solid.svg new file mode 100644 index 00000000..f64cfebc --- /dev/null +++ b/public/assets/icon/times-circle-solid.svg @@ -0,0 +1,14 @@ + diff --git a/public/assets/icon/trash-solid.svg b/public/assets/icon/trash-solid.svg new file mode 100644 index 00000000..6d52f5b6 --- /dev/null +++ b/public/assets/icon/trash-solid.svg @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/resources/assets/js/plugins/en.js b/resources/assets/js/plugins/en.js index 76fab629..404bebda 100644 --- a/resources/assets/js/plugins/en.js +++ b/resources/assets/js/plugins/en.js @@ -228,6 +228,10 @@ export default { save_estimate: 'Save Estimate', confirm_conversion: 'You want to convert this Estimate into Invoice?', conversion_message: 'Conversion successful', + confirm_send_estimate: 'This estimate will be sent via email to the customer', + confirm_mark_as_sent: 'This estimate will be marked as sent', + confirm_mark_as_accepted: 'This estimate will be marked as Accepted', + confirm_mark_as_rejected: 'This estimate will be marked as Rejected', no_matching_estimates: 'There are no matching estimates!', errors: { required: 'Field is required' @@ -303,7 +307,9 @@ export default { send_invoice: 'Send Invoice', invoice_template: 'Invoice Template', template: 'Template', - mark_as_sent: 'Mark as Sent', + mark_as_sent: 'Mark as sent', + invoice_mark_as_sent: 'This invoice will be marked as sent', + confirm_send: 'This invoice will be sent via email to the customer', invoice_date: 'Invoice Date', record_payment: 'Record Payment', add_new_invoice: 'Add New Invoice', @@ -522,7 +528,8 @@ export default { preferences: 'Preferences', notifications: 'Notifications', tax_types: 'Tax Types', - expense_category: 'Expense Categories' + expense_category: 'Expense Categories', + update_app: 'Update App' }, title: 'Settings', setting: 'Settings | Settings', @@ -624,6 +631,7 @@ export default { created_message: 'Sales tax created successfully', updated_message: 'Sales tax updated successfully', deleted_message: 'Sales tax deleted successfully', + confirm_delete: 'You will not be able to recover this Tax Type', already_in_use: 'Tax is already in use' }, expense_category: { @@ -636,6 +644,7 @@ export default { created_message: 'Category created successfully', deleted_message: 'Expense category deleted successfully', updated_message: 'Expense category updated successfully', + confirm_delete: 'You will not be able to recover this Expense Category', already_in_use: 'Category is already in use' }, preferences: { @@ -656,6 +665,11 @@ export default { select_time_zone: 'select Time Zone', select_date_formate: 'select Date Formate', select_financial_year: 'select financial year' + }, + update_app: { + title: 'Update App', + description: 'update app description', + update: 'Update' } }, wizard: { @@ -745,6 +759,7 @@ export default { invalid_url: 'Invalid url (ex: http://www.crater.com)', required: 'Field is required', email_incorrect: 'Incorrect Email.', + email_already_taken: 'The email has already been taken.', email_does_not_exist: "User with given email doesn't exist", send_reset_link: 'Send Reset Link', not_yet: 'Not yet? Send it again', @@ -761,9 +776,9 @@ export default { payment_greater_than_due_amount: 'Entered Payment is more than due amount of this invoice.', quantity_maxlength: 'Quantity should not be greater than 10 digits.', price_maxlength: 'Price should not be greater than 10 digits.', - price_minvalue: 'Price should be greater than 0 digits', + price_minvalue: 'Price should be greater than 0.', amount_maxlength: 'Amount should not be greater than 10 digits.', - amount_minvalue: 'Amount should be greater than 0 digits', + amount_minvalue: 'Amount should be greater than 0.', description_maxlength: 'Description should not be greater than 255 characters.', maximum_options_error: 'Maximum of {max} options selected. First remove a selected option to select another.', notes_maxlength: 'Notes should not be greater than 255 characters.', diff --git a/resources/assets/js/plugins/es.js b/resources/assets/js/plugins/es.js index 5369025a..73454af7 100644 --- a/resources/assets/js/plugins/es.js +++ b/resources/assets/js/plugins/es.js @@ -228,12 +228,15 @@ export default { estimate_template: 'Plantilla de estimación', convert_to_invoice: 'Convertir a factura', mark_as_sent: 'Marcar como enviado', - send_estimate: 'Enviar presupuesto', record_payment: 'Registro de pago', add_estimate: 'Agregar presupuesto', save_estimate: 'Guardar estimación', confirm_conversion: '¿Quiere convertir esta estimación en factura?', conversion_message: 'Conversión exitosa', + confirm_send_estimate: 'Esta estimación se enviará por correo electrónico al cliente', + confirm_mark_as_sent: 'Esta estimación se marcará como enviada', + confirm_mark_as_accepted: 'Esta estimación se marcará como Aceptada', + confirm_mark_as_rejected: 'Esta estimación se marcará como Rechazada', errors: { required: 'Se requiere campo' }, @@ -309,6 +312,8 @@ export default { invoice_template: 'Plantilla de factura', template: 'Modelo', mark_as_sent: 'Marcar como enviado', + invoice_mark_as_sent: 'Esta factura se marcará como enviada', + confirm_send: 'Estas facturas se enviarán por correo electrónico al cliente.', invoice_date: 'Fecha de la factura', record_payment: 'Registro de pago', add_new_invoice: 'Añadir nueva factura', @@ -551,6 +556,16 @@ export default { action: 'Acción', add_currency: 'Agregar moneda' }, + mail: { + host: 'Host de correo', + port: 'Puerto de correo', + driver: 'Conductor de correo', + password: 'Contraseña de correo', + username: 'Nombre de usuario de correo', + mail_config: 'Configuración de correo', + encryption: 'Cifrado de correo', + mail_config_desc: 'Los detalles a continuación se utilizarán para actualizar el entorno de correo. También puede cambiar los detalles en cualquier momento después de iniciar sesión.' + }, pdf: { title: 'Configuración de PDF', footer_text: 'Texto de pie de página', @@ -613,6 +628,7 @@ export default { created_message: 'Impuesto sobre las ventas creado con éxito', updated_message: 'Impuesto sobre ventas actualizado con éxito', deleted_message: 'Impuesto sobre las ventas eliminado con éxito', + confirm_delete: 'No podrá recuperar este tipo de impuesto', already_in_use: 'El impuesto ya está en uso.' }, expense_category: { @@ -625,6 +641,7 @@ export default { created_message: 'Categoría creada con éxito', deleted_message: 'Categoría de gastos eliminada correctamente', updated_message: 'Categoría de gastos actualizada con éxito', + confirm_delete: 'No podrá recuperar esta categoría de gastos', already_in_use: 'La categoría ya está en uso.' }, preferences: { @@ -742,7 +759,7 @@ export default { numbers_only: 'Solo numeros.', characters_only: 'Solo personajes.', password_incorrect: 'Las contraseñas deben ser idénticas', - password_length: 'La contraseña debe tener 6 caracteres de longitud.', + password_length: 'La contraseña debe tener 5 caracteres de longitud.', qty_must_greater_than_zero: 'La cantidad debe ser mayor que cero.', price_greater_than_zero: 'El precio debe ser mayor que cero.', payment_greater_than_zero: 'El pago debe ser mayor que cero.', diff --git a/resources/assets/js/plugins/fr.js b/resources/assets/js/plugins/fr.js index 577cd5e9..27d9c312 100644 --- a/resources/assets/js/plugins/fr.js +++ b/resources/assets/js/plugins/fr.js @@ -233,6 +233,10 @@ export default { save_estimate: 'Sauvegarder lestimation', confirm_conversion: 'Vous souhaitez convertir cette estimation en facture?', conversion_message: 'Conversion réussie', + confirm_send_estimate: 'Cette estimation sera envoyée par courrier électronique au client.', + confirm_mark_as_sent: 'Cette estimation sera marquée comme envoyé', + confirm_mark_as_accepted: 'Cette estimation sera marquée comme acceptée', + confirm_mark_as_rejected: 'Cette estimation sera marquée comme Rejetée', errors: { required: 'Champ requis' }, @@ -308,6 +312,8 @@ export default { invoice_template: 'Modèle de facture', template: 'Modèle', mark_as_sent: 'Marquer comme envoyé', + invoice_mark_as_sent: 'Cette facture sera marquée comme envoyé', + confirm_send: 'Cette facture sera envoyée par courrier électronique au client.', invoice_date: 'Date de facturation', record_payment: 'Record de paiement', add_new_invoice: 'Ajouter une nouvelle facture', @@ -548,7 +554,17 @@ export default { right: 'Droite', left: 'La gauche', action: 'action', - add_currency: 'Ajouter une devise', + add_currency: 'Ajouter une devise' + }, + mail: { + host: 'Mail Host', + port: 'Port mail', + driver: 'Pilote de courrier', + password: 'Mot de passe mail', + username: "Mail Nom d'utilisateur", + mail_config: 'Configuration du courrier', + encryption: 'Chiffrement du courrier', + mail_config_desc: "Les détails ci-dessous seront utilisés pour mettre à jour l'environnement de messagerie. Aussi, vous pouvez modifier les détails à tout moment après la connexion." }, pdf: { title: 'Paramètre PDF', @@ -614,6 +630,7 @@ export default { created_message: 'La taxe de vente créée avec succès', updated_message: 'La taxe de vente a été mise à jour avec succès', deleted_message: 'La taxe de vente a été supprimée avec succès', + confirm_delete: 'Vous ne pourrez pas récupérer ce type de taxe', already_in_use: 'La taxe est déjà utilisée' }, expense_category: { @@ -626,6 +643,7 @@ export default { created_message: 'Catégorie créée avec succès', deleted_message: 'La catégorie de dépenses a été supprimée avec succès', updated_message: 'Catégorie de dépenses mise à jour avec succès', + confirm_delete: 'Vous ne pourrez pas récupérer cette catégorie de dépenses', already_in_use: 'La catégorie est déjà utilisée' }, preferences: { @@ -744,7 +762,7 @@ export default { numbers_only: 'Chiffres uniquement.', characters_only: 'Caractères seulement.', password_incorrect: 'Les mots de passe doivent être identiques', - password_length: 'Le mot de passe doit comporter 6 caractères.', + password_length: 'Le mot de passe doit comporter 5 caractères.', qty_must_greater_than_zero: 'La quantité doit être supérieure à zéro.', price_greater_than_zero: 'Le prix doit être supérieur à zéro.', payment_greater_than_zero: 'Le paiement doit être supérieur à zéro.', diff --git a/resources/assets/js/router.js b/resources/assets/js/router.js index 5fb1a243..279a620d 100644 --- a/resources/assets/js/router.js +++ b/resources/assets/js/router.js @@ -72,6 +72,7 @@ import UserProfile from './views/settings/UserProfile.vue' import TaxTypes from './views/settings/TaxTypes.vue' import ExpenseCategory from './views/settings/ExpenseCategory.vue' import MailConfig from './views/settings/MailConfig.vue' +import UpdateApp from './views/settings/UpdateApp.vue' import Wizard from './views/wizard/Index.vue' @@ -337,6 +338,11 @@ const routes = [ path: 'notifications', name: 'notifications', component: Notifications + }, + { + path: 'update-app', + name: 'updateapp', + component: UpdateApp } ] } diff --git a/resources/assets/js/views/auth/Login.vue b/resources/assets/js/views/auth/Login.vue index 5e253b38..71f11758 100644 --- a/resources/assets/js/views/auth/Login.vue +++ b/resources/assets/js/views/auth/Login.vue @@ -12,10 +12,15 @@ focus type="email" name="email" + @input="$v.loginData.email.$touch()" />
- {{ $tc('validation.required') }} - {{ $tc('validation.email_incorrect') }} + + {{ $tc('validation.required') }} + + + {{ $tc('validation.email_incorrect') }} +
@@ -25,8 +30,10 @@ :invalid="$v.loginData.password.$error" type="password" name="password" + show-password + @input="$v.loginData.password.$touch()" /> -
+
{{ $tc('validation.required') }} {{ $tc('validation.password_min_length', $v.loginData.password.$params.minLength.min, {count: $v.loginData.password.$params.minLength.min}) }}
@@ -91,7 +98,7 @@ export default { }, password: { required, - minLength: minLength(8) + minLength: minLength(5) } } }, diff --git a/resources/assets/js/views/customers/Create.vue b/resources/assets/js/views/customers/Create.vue index f01bf58f..8b831584 100644 --- a/resources/assets/js/views/customers/Create.vue +++ b/resources/assets/js/views/customers/Create.vue @@ -219,7 +219,7 @@

-
+
{{ $t('customers.copy_billing_address') }} @@ -624,17 +624,20 @@ export default { this.isLoading = true this.formData.currency_id = this.currency.id } - - let response = await this.addCustomer(this.formData) - - if (response.data.success) { - window.toastr['success'](this.$t('customers.created_message')) - this.$router.push('/admin/customers') - this.isLoading = false - return true + try { + let response = await this.addCustomer(this.formData) + if (response.data.success) { + window.toastr['success'](this.$t('customers.created_message')) + this.$router.push('/admin/customers') + this.isLoading = false + return true + } + } catch (err) { + if (err.response.data.errors.email) { + this.isLoading = false + window.toastr['error'](this.$t('validation.email_already_taken')) + } } - - window.toastr['error'](response.data.error) } }, async fetchBillingState () { diff --git a/resources/assets/js/views/customers/Index.vue b/resources/assets/js/views/customers/Index.vue index 4068e5eb..33d5b9e5 100644 --- a/resources/assets/js/views/customers/Index.vue +++ b/resources/assets/js/views/customers/Index.vue @@ -343,7 +343,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('customers.confirm_delete'), - icon: 'error', + icon: '/assets/icon/trash-solid.svg', buttons: true, dangerMode: true }).then(async (willDelete) => { @@ -363,7 +363,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('customers.confirm_delete', 2), - icon: 'error', + icon: '/assets/icon/trash-solid.svg', buttons: true, dangerMode: true }).then(async (willDelete) => { diff --git a/resources/assets/js/views/dashboard/Dashboard.vue b/resources/assets/js/views/dashboard/Dashboard.vue index e3780514..bca6d07b 100644 --- a/resources/assets/js/views/dashboard/Dashboard.vue +++ b/resources/assets/js/views/dashboard/Dashboard.vue @@ -1,5 +1,5 @@