From 1d08b3d47eac24ee388bd706a6cc94f735148b4a Mon Sep 17 00:00:00 2001 From: bansarishukla Date: Tue, 12 Nov 2019 17:55:51 +0530 Subject: [PATCH] add sweetalert on actions and update icon --- 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 | 6 + resources/assets/js/plugins/es.js | 6 + resources/assets/js/plugins/fr.js | 6 + .../js/store/modules/estimate/actions.js | 2 +- resources/assets/js/views/customers/Index.vue | 4 +- resources/assets/js/views/estimates/Index.vue | 126 ++++++++++++------ resources/assets/js/views/expenses/Index.vue | 4 +- resources/assets/js/views/invoices/Index.vue | 4 +- 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/settings/ExpenseCategory.vue | 24 +++- .../assets/js/views/settings/TaxTypes.vue | 24 +++- resources/assets/sass/base.scss | 3 + 19 files changed, 222 insertions(+), 71 deletions(-) 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 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 6be999aa..b9ac48f5 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: 'You want to send this Estimate?', + confirm_mark_as_sent: 'You want to mark this estimate as sent?', + confirm_mark_as_accepted: 'You want to mark this estimate as accepted?', + confirm_mark_as_rejected: 'You want to mark this estimate as rejected?', no_matching_estimates: 'There are no matching estimates!', errors: { required: 'Field is required' @@ -614,6 +618,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: { @@ -626,6 +631,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: { diff --git a/resources/assets/js/plugins/es.js b/resources/assets/js/plugins/es.js index 04c67339..eafa7a0e 100644 --- a/resources/assets/js/plugins/es.js +++ b/resources/assets/js/plugins/es.js @@ -233,6 +233,10 @@ export default { save_estimate: 'Guardar estimación', confirm_conversion: '¿Quiere convertir esta estimación en factura?', conversion_message: 'Conversión exitosa', + confirm_send_estimate: '¿Quieres enviar este presupuesto?', + confirm_mark_as_sent: '¿Desea marcar esta estimación como enviada?', + confirm_mark_as_accepted: '¿Quiere marcar esta estimación como aceptada?', + confirm_mark_as_rejected: '¿Desea marcar esta estimación como rechazada?', errors: { required: 'Se requiere campo' }, @@ -614,6 +618,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: { @@ -626,6 +631,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: { diff --git a/resources/assets/js/plugins/fr.js b/resources/assets/js/plugins/fr.js index 597d1c23..c4554e4e 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: 'Vous voulez envoyer cette estimation?', + confirm_mark_as_sent: 'Vous souhaitez marquer cette estimation comme envoyée?', + confirm_mark_as_accepted: 'Vous souhaitez marquer cette estimation comme acceptée?', + confirm_mark_as_rejected: 'Vous souhaitez marquer cette estimation comme rejetée?', errors: { required: 'Champ requis' }, @@ -614,6 +618,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 +631,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: { diff --git a/resources/assets/js/store/modules/estimate/actions.js b/resources/assets/js/store/modules/estimate/actions.js index a69b025d..0e5f0d8e 100644 --- a/resources/assets/js/store/modules/estimate/actions.js +++ b/resources/assets/js/store/modules/estimate/actions.js @@ -130,7 +130,7 @@ export const markAsRejected = ({ commit, dispatch, state }, data) => { export const markAsSent = ({ commit, dispatch, state }, data) => { return new Promise((resolve, reject) => { - window.axios.post(`/api/estimates/sent`, data).then((response) => { + window.axios.post(`/api/estimates/mark-as-sent`, data).then((response) => { // commit(types.UPDATE_INVOICE, response.data) resolve(response) }).catch((err) => { 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/estimates/Index.vue b/resources/assets/js/views/estimates/Index.vue index 3e5f9a63..c52c9fea 100644 --- a/resources/assets/js/views/estimates/Index.vue +++ b/resources/assets/js/views/estimates/Index.vue @@ -249,25 +249,25 @@ {{ $t('estimates.convert_to_invoice') }} - + {{ $t('estimates.mark_as_sent') }} - + {{ $t('estimates.send_estimate') }} - + {{ $t('estimates.mark_as_accepted') }} - + {{ $t('estimates.mark_as_rejected') }} @@ -409,28 +409,48 @@ export default { } }, async onMarkAsAccepted (id) { - const data = { - id: id - } - let response = await this.markAsAccepted(data) - this.refreshTable() - if (response.data) { - this.filters.status = 'ACCEPTED' - this.$refs.table.refresh() - window.toastr['success'](this.$tc('estimates.marked_as_rejected_message')) - } + swal({ + title: this.$t('general.are_you_sure'), + text: this.$t('estimates.confirm_mark_as_accepted'), + icon: '/assets/icon/check-circle-solid.svg', + buttons: true, + dangerMode: true + }).then(async (markedAsRejected) => { + if (markedAsRejected) { + const data = { + id: id + } + let response = await this.markAsAccepted(data) + this.refreshTable() + if (response.data) { + this.filters.status = 'ACCEPTED' + this.$refs.table.refresh() + window.toastr['success'](this.$tc('estimates.marked_as_rejected_message')) + } + } + }) }, async onMarkAsRejected (id) { - const data = { - id: id - } - let response = await this.markAsRejected(data) - this.refreshTable() - if (response.data) { - this.filters.status = 'REJECTED' - this.$refs.table.refresh() - window.toastr['success'](this.$tc('estimates.marked_as_rejected_message')) - } + swal({ + title: this.$t('general.are_you_sure'), + text: this.$t('estimates.confirm_mark_as_rejected'), + icon: '/assets/icon/times-circle-solid.svg', + buttons: true, + dangerMode: true + }).then(async (markedAsRejected) => { + if (markedAsRejected) { + const data = { + id: id + } + let response = await this.markAsRejected(data) + this.refreshTable() + if (response.data) { + this.filters.status = 'REJECTED' + this.$refs.table.refresh() + window.toastr['success'](this.$tc('estimates.marked_as_rejected_message')) + } + } + }) }, setFilters () { this.filtersApplied = true @@ -470,7 +490,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('estimates.confirm_delete', 1), - icon: 'error', + icon: '/assets/icon/trash-solid.svg', buttons: true, dangerMode: true }).then(async (willDelete) => { @@ -491,7 +511,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$t('estimates.confirm_conversion'), - icon: 'error', + icon: '/assets/icon/envelope-solid.svg', buttons: true, dangerMode: true }).then(async (willDelete) => { @@ -510,7 +530,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('estimates.confirm_delete', 2), - icon: 'error', + icon: '/assets/icon/trash-solid.svg', buttons: true, dangerMode: true }).then(async (willDelete) => { @@ -536,24 +556,44 @@ export default { this.refreshTable() }, async onMarkAsSent (id) { - const data = { - id: id - } - let response = await this.markAsSent(data) - this.refreshTable() - if (response.data) { - window.toastr['success'](this.$tc('estimates.mark_as_sent')) - } + swal({ + title: this.$t('general.are_you_sure'), + text: this.$t('estimates.confirm_mark_as_sent'), + icon: '/assets/icon/check-circle-solid.svg', + buttons: true, + dangerMode: true + }).then(async (willDelete) => { + if (willDelete) { + const data = { + id: id + } + let response = await this.markAsSent(data) + this.refreshTable() + if (response.data) { + window.toastr['success'](this.$tc('estimates.mark_as_sent')) + } + } + }) }, async sendEstimate (id) { - const data = { - id: id - } - let response = await this.sendEmail(data) - this.refreshTable() - if (response.data) { - window.toastr['success'](this.$tc('estimates.mark_as_sent')) - } + swal({ + title: this.$t('general.are_you_sure'), + text: this.$t('estimates.confirm_send_estimate'), + icon: '/assets/icon/paper-plane-solid.svg', + buttons: true, + dangerMode: true + }).then(async (sendEstimate) => { + if (sendEstimate) { + const data = { + id: id + } + let response = await this.sendEmail(data) + this.refreshTable() + if (response.data) { + window.toastr['success'](this.$tc('estimates.mark_as_sent')) + } + } + }) } } } diff --git a/resources/assets/js/views/expenses/Index.vue b/resources/assets/js/views/expenses/Index.vue index 3081de27..4ee774d0 100644 --- a/resources/assets/js/views/expenses/Index.vue +++ b/resources/assets/js/views/expenses/Index.vue @@ -358,7 +358,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('expenses.confirm_delete'), - icon: 'error', + icon: '/assets/icon/trash-solid.svg', buttons: true, dangerMode: true }).then(async (willDelete) => { @@ -378,7 +378,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('expenses.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/invoices/Index.vue b/resources/assets/js/views/invoices/Index.vue index 4e1c5218..88197c91 100644 --- a/resources/assets/js/views/invoices/Index.vue +++ b/resources/assets/js/views/invoices/Index.vue @@ -476,7 +476,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('invoices.confirm_delete'), - icon: 'error', + icon: '/assets/icon/trash-solid.svg', buttons: true, dangerMode: true }).then(async (willDelete) => { @@ -506,7 +506,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('invoices.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/items/Index.vue b/resources/assets/js/views/items/Index.vue index e44b5a11..c2370607 100644 --- a/resources/assets/js/views/items/Index.vue +++ b/resources/assets/js/views/items/Index.vue @@ -362,7 +362,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('items.confirm_delete'), - icon: 'error', + icon: '/assets/icon/trash-solid.svg', buttons: true, dangerMode: true }).then(async (willDelete) => { @@ -388,7 +388,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('items.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/payments/Create.vue b/resources/assets/js/views/payments/Create.vue index 2ce64c9e..4d61b776 100644 --- a/resources/assets/js/views/payments/Create.vue +++ b/resources/assets/js/views/payments/Create.vue @@ -101,7 +101,6 @@
{{ $t('validation.required') }} - {{ $t('validation.numbers_only') }} {{ $t('validation.payment_greater_than_zero') }} {{ $t('validation.payment_greater_than_due_amount') }}
@@ -156,7 +155,7 @@ import { mapActions, mapGetters } from 'vuex' import MultiSelect from 'vue-multiselect' import { validationMixin } from 'vuelidate' import moment from 'moment' -const { required, numeric, between, maxLength } = require('vuelidate/lib/validators') +const { required, between, maxLength } = require('vuelidate/lib/validators') export default { components: { MultiSelect }, @@ -201,7 +200,6 @@ export default { }, amount: { required, - numeric, between: between(1, this.maxPayableAmount + 1) }, notes: { diff --git a/resources/assets/js/views/payments/Index.vue b/resources/assets/js/views/payments/Index.vue index 29aca136..ae51a1ef 100644 --- a/resources/assets/js/views/payments/Index.vue +++ b/resources/assets/js/views/payments/Index.vue @@ -368,7 +368,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('payments.confirm_delete'), - icon: 'error', + icon: '/assets/icon/trash-solid.svg', buttons: true, dangerMode: true }).then(async (willDelete) => { @@ -388,7 +388,7 @@ export default { swal({ title: this.$t('general.are_you_sure'), text: this.$tc('payments.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/settings/ExpenseCategory.vue b/resources/assets/js/views/settings/ExpenseCategory.vue index 7347095d..e4b9496f 100644 --- a/resources/assets/js/views/settings/ExpenseCategory.vue +++ b/resources/assets/js/views/settings/ExpenseCategory.vue @@ -101,13 +101,23 @@ export default { 'deleteCategory' ]), async removeExpenseCategory (id, index) { - let response = await this.deleteCategory(id) - if (response.data.success) { - window.toastr['success'](this.$tc('settings.expense_category.deleted_message')) - this.id = null - this.$refs.table.refresh() - return true - } window.toastr['success'](this.$t('settings.expense_category.already_in_use')) + swal({ + title: this.$t('general.are_you_sure'), + text: this.$t('settings.expense_category.confirm_delete'), + icon: '/assets/icon/trash-solid.svg', + buttons: true, + dangerMode: true + }).then(async (willDelete) => { + if (willDelete) { + let response = await this.deleteCategory(id) + if (response.data.success) { + window.toastr['success'](this.$tc('settings.expense_category.deleted_message')) + this.id = null + this.$refs.table.refresh() + return true + } window.toastr['success'](this.$t('settings.expense_category.already_in_use')) + } + }) }, openCategoryModal () { this.openModal({ diff --git a/resources/assets/js/views/settings/TaxTypes.vue b/resources/assets/js/views/settings/TaxTypes.vue index a98e32ad..db441856 100644 --- a/resources/assets/js/views/settings/TaxTypes.vue +++ b/resources/assets/js/views/settings/TaxTypes.vue @@ -159,13 +159,23 @@ export default { } }, async removeTax (id, index) { - let response = await this.deleteTaxType(id) - if (response.data.success) { - window.toastr['success'](this.$t('settings.tax_types.deleted_message')) - this.id = null - this.$refs.table.refresh() - return true - }window.toastr['success'](this.$t('settings.tax_types.already_in_use')) + swal({ + title: this.$t('general.are_you_sure'), + text: this.$t('settings.tax_types.confirm_delete'), + icon: '/assets/icon/trash-solid.svg', + buttons: true, + dangerMode: true + }).then(async (willDelete) => { + if (willDelete) { + let response = await this.deleteTaxType(id) + if (response.data.success) { + window.toastr['success'](this.$t('settings.tax_types.deleted_message')) + this.id = null + this.$refs.table.refresh() + return true + }window.toastr['success'](this.$t('settings.tax_types.already_in_use')) + } + }) }, openTaxModal () { this.openModal({ diff --git a/resources/assets/sass/base.scss b/resources/assets/sass/base.scss index dd3012c1..32da2c98 100644 --- a/resources/assets/sass/base.scss +++ b/resources/assets/sass/base.scss @@ -111,3 +111,6 @@ code, .code { justify-content: center; align-items: center; } +.swal-icon--custom { + height: 50px !important; +}