remove unused files and refactor variable names and function names

This commit is contained in:
Mohit Panjwani
2019-11-15 21:02:53 +05:30
parent 9a3e52b658
commit 5d70832f20
43 changed files with 182108 additions and 1664 deletions

View File

@ -1,74 +0,0 @@
<template>
<div class="main-content pdfsetting">
<div class="page-header">
<h3 class="page-title">{{ $t('settings.title') }}</h3>
<ol class="breadcrumb">
<li class="breadcrumb-item"><router-link slot="item-title" to="/admin/dashboard">{{ $t('general.home') }}</router-link></li>
<li class="breadcrumb-item"><router-link slot="item-title" to="#">{{ $t('settings.pdf.title') }}</router-link></li>
</ol>
</div>
<div class="row">
<div class="col-sm-12">
<div class="card">
<div class="card-header">
<div class="caption">
<h6>{{ $t('settings.pdf.title') }}</h6>
</div>
<div class="actions">
<base-button color="theme" size="small" @click="submitData">
{{ $t('general.update') }}
</base-button>
</div>
</div>
<div class="card-body">
<div class="row">
<label class="col-md-2 form-control-label">{{ $t('settings.pdf.footer_text') }} : </label>
<div class="col-md-12">
<input v-model="footerText" type="text" class="form-control">
</div>
</div>
<div class="row pdfsetting__img-row">
<label class="col-md-2 form-control-label">{{ $t('settings.pdf.pdf_layout') }} : </label>
<div class="col-md-12">
<image-radio :current-p-d-f="pdfSet" @selectedPDF="selectedPDF"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import ImageRadio from '../components/ImageRadio.vue'
import { mapActions, mapMutations } from 'vuex'
export default {
components: {
'image-radio': ImageRadio
},
data () {
return this.$store.state.pdf_setting
// return {
// pdfSet: '1',
// footerText: null
// }
},
mounted () {
this.loadData()
},
methods: {
...mapActions('pdf_setting', [
'loadData',
'submitData'
]),
// async submitData () {
// },
...mapMutations('pdf_setting', [
'selectedPDF'
])
}
}
</script>

View File

@ -106,6 +106,7 @@
<script>
import { mapActions, mapGetters } from 'vuex'
export default {
data () {
return {
@ -135,10 +136,11 @@ export default {
]),
async getTaxSetting (val) {
let response = await axios.get('/api/settings/get-setting?key=tax_per_item')
if (response.data) {
response.data.tax_per_item === 'YES' ?
this.formData.tax_per_item = true :
this.formData.tax_per_item = false
if (response.data && response.data.tax_per_item === 'YES') {
this.formData.tax_per_item = true
} else {
this.formData.tax_per_item = false
}
},
async setTax (val) {
@ -158,15 +160,16 @@ export default {
icon: '/assets/icon/trash-solid.svg',
buttons: true,
dangerMode: true
}).then(async (willDelete) => {
if (willDelete) {
}).then(async (value) => {
if (value) {
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['error'](this.$t('settings.tax_types.already_in_use'))
}
window.toastr['error'](this.$t('settings.tax_types.already_in_use'))
}
})
},

View File

@ -8,12 +8,12 @@
</p>
<label class="input-label">Current version</label><br>
<label class="version">1.0.0</label>
<base-button :outline="true" size="large" color="theme" @click="checkUpdate">
<font-awesome-icon :class="{'update': isUpdateAvail}" style="margin-right: 10px;" icon="sync-alt" />
<base-button :outline="true" :disabled="isCheckingforUpdate" size="large" color="theme" @click="checkUpdate" >
<font-awesome-icon :class="{'update': isCheckingforUpdate}" style="margin-right: 10px;" icon="sync-alt" />
{{ $t('settings.update_app.check_update') }}
</base-button>
<hr>
<div v-show="!isUpdating" v-if="isUpdateAvail" class="mt-4 content">
<div v-show="!isUpdating" v-if="isUpdateAvailable" class="mt-4 content">
<h3 class="page-title">{{ $t('settings.update_app.avail_update') }}</h3>
<label class="input-label">{{ $t('settings.update_app.next_version') }}</label><br>
<label class="version">{{ updateData.version }}</label>
@ -41,8 +41,9 @@ export default {
data () {
return {
isShowProgressBar: false,
isUpdateAvail: false,
isUpdateAvailable: false,
isUpdating: false,
isCheckingforUpdate: false,
progress: 10,
interval: null,
description: '',
@ -64,22 +65,24 @@ export default {
this.isUpdating = true
const data = this.updateData
let response = await axios.post('/api/update', data)
console.log(response.data)
this.isUpdating = false
this.isUpdateAvail = false
this.isUpdateAvailable = false
},
async checkUpdate () {
try {
this.isCheckingforUpdate = true
let response = await axios.get('/api/check/update')
console.log(response.data)
this.isCheckingforUpdate = false
if (response.data) {
this.updateData.isMinor = response.data.is_minor
this.updateData.version = response.data.version
this.description = response.data.description
this.isUpdateAvailable = true
}
this.isUpdateAvail = true
} catch (e) {
this.isUpdateAvail = false
this.isUpdateAvailable = false
this.isCheckingforUpdate = false
window.toastr['error']('Something went wrong')
}
}

View File

@ -145,7 +145,7 @@ export default {
name: this.formData.name,
email: this.formData.email
}
if (this.formData.password != null && this.formData.password != undefined && this.formData.password != '') {
if (this.formData.password != null && this.formData.password !== undefined && this.formData.password !== '') {
data = { ...data, password: this.formData.password }
}
let response = await this.editUser(data)

View File

@ -1,126 +0,0 @@
<template>
<div class="main-content">
<div class="page-header">
<h3 class="page-title">{{ $tc('navigation.currency', 2) }}</h3>
<ol class="breadcrumb">
<li class="breadcrumb-item">
<router-link
slot="item-title"
to="/admin/dashboard">
{{ $t('navigation.home') }}
</router-link>
</li>
<li class="breadcrumb-item">
<router-link
slot="item-title"
to="#">
{{ $tc('navigation.currency', 2) }}
</router-link>
</li>
</ol>
</div>
<div class="row">
<div class="col-sm-6">
<div class="card">
<div class="card-header">
<div class="caption">
<h6>{{ $t('settings.currencies.select_currency') }}:</h6>
</div>
</div>
<div class="card-body">
<div class="form-group">
<select
v-model.trim="currencyId"
class="form-control"
@change="selectCurrency()"
>
<option
v-for="(currency, index) in currencies"
:key="index"
:value="currency.id"
>
{{ currency.name }}
</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="card">
<div class="card-header">
<div class="caption">
<h6>{{ $t('settings.currencies.currencies_list') }}</h6>
</div>
<div class="actions">
<router-link slot="item-title" to="currencies/create">
<base-button icon="plus" color="theme" size="small">
{{ $t('navigation.add') }} {{ $t('navigation.new') }}
</base-button>
</router-link>
</div>
</div>
<div class="card-body">
<table-component
ref="table"
:data="currencies"
table-class="table"
sort-by="name"
sort-order="asc"
>
<table-column :label="$t('settings.currencies.name')" show="name" />
<table-column :label="$t('settings.currencies.code')" show="code" />
<table-column :label="$t('settings.currencies.symbol')" show="symbol" />
<table-column :label="$t('settings.currencies.precision')" show="precision" />
<table-column :label="$t('settings.currencies.thousand_separator')" show="thousand_separator" />
<table-column :label="$t('settings.currencies.decimal_separator')" show="decimal_separator" />
<table-column
:sortable="false"
:filterable="false"
:label="$t('settings.currencies.position')"
>
<template slot-scope="row">
<span v-if="row.swap_currency_symbol === 0">{{ $t('settings.currencies.right') }}</span>
<span v-if="row.swap_currency_symbol === 1">{{ $t('settings.currencies.left') }}</span>
</template>
</table-column>
<table-column
:sortable="false"
:filterable="false"
:label="$t('settings.currencies.action')"
>
<template slot-scope="row">
<div class="table__actions">
<router-link slot="item-title" :to="{path: `currencies/${row.id}/edit`}">{{ $t('navigation.edit') }}</router-link>
<div class="table__item--cursor-pointer" @click="removeItems(row.id)">{{ $t('navigation.delete') }}</div>
</div>
</template>
</table-column>
</table-component>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { mapActions } from 'vuex'
export default {
data () {
return this.$store.state.currency
},
mounted () {
this.indexLoadData()
},
methods: {
...mapActions('currency', [
'indexLoadData',
'removeItems',
'selectCurrency'
])
}
}
</script>

View File

@ -1,185 +0,0 @@
<template>
<div class="main-content currencycreate">
<div class="page-header">
<h3 class="page-title">{{ $t('settings.currencies.add_currency') }}</h3>
<ol class="breadcrumb">
<li class="breadcrumb-item"><router-link slot="item-title" to="/admin/dashboard">{{ $t('general.home') }}</router-link></li>
<li class="breadcrumb-item"><router-link slot="item-title" to="/admin/settings/currencies">{{ $tc('settings.currencies.currency',2) }}</router-link></li>
<li class="breadcrumb-item"><a href="#">{{ $t('navigation.add') }}</a></li>
</ol>
<div class="page-actions">
<router-link slot="item-title" to="/admin/settings/currencies">
<base-button icon="backward" color="theme">
{{ $t('navigation.go_back') }}
</base-button>
</router-link>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="card">
<form action="" @submit.prevent="submiteCurrency">
<div class="card-body">
<div class="form-group">
<label class="control-label">{{ $t('settings.currencies.name') }}:</label><span class="required text-danger"> *</span>
<input
:class="{ error: $v.formData.name.$error }"
v-model.trim="formData.name"
type="text"
name="name"
class="form-control"
@input="$v.formData.name.$touch()"
>
<div v-if="$v.formData.name.$error">
<span v-if="!$v.formData.name.required" class="text-danger">{{ $tc('validation.required') }}</span>
</div>
</div>
<div class="form-group">
<label class="control-label">{{ $t('settings.currencies.code') }}:</label><span class="required"> *</span>
<input
:class="{ error: $v.formData.code.$error }"
v-model="formData.code"
type="text"
name="code"
class="form-control"
@input="$v.formData.code.$touch()"
>
<div v-if="$v.formData.code.$error">
<span v-if="!$v.formData.code.required" class="text-danger">{{ $tc('validation.required') }}</span>
</div>
</div>
<div class="form-group">
<label class="control-label">{{ $t('settings.currencies.symbol') }}:</label>
<input
v-model="formData.symbol"
type="text"
name="symbol"
class="form-control"
>
</div>
<div class="form-group">
<label class="control-label">{{ $t('settings.currencies.precision') }}:</label>
<input
v-model="formData.precision"
type="text"
name="precision"
class="form-control"
>
</div>
<div class="form-group">
<label class="control-label">{{ $t('settings.currencies.thousand_separator') }}:</label><span class="required"> *</span>
<input
:class="{ error: $v.formData.thousand_separator.$error }"
v-model="formData.thousand_separator"
type="text"
name="thousand_separator"
class="form-control"
@input="$v.formData.thousand_separator.$touch()"
>
<div v-if="$v.formData.thousand_separator.$error">
<span v-if="!$v.formData.thousand_separator.required" class="text-danger">{{ $tc('validation.required') }}</span>
</div>
</div>
<div class="form-group">
<label class="control-label">{{ $t('settings.currencies.decimal_separator') }}:</label><span class="required"> *</span>
<input
:class="{ error: $v.formData.decimal_separator.$error }"
v-model="formData.decimal_separator"
type="text"
name="decimal_separator"
class="form-control"
@input="$v.formData.decimal_separator.$touch()"
>
<div v-if="$v.formData.decimal_separator.$error">
<span v-if="!$v.formData.decimal_separator.required" class="text-danger">{{ $tc('validation.required') }}</span>
</div>
</div>
<div class="form-group">
<label>{{ $t('settings.currencies.position_of_symbol') }}:</label><span class="required"> *</span>
<select
v-model="formData.swap_currency_symbol"
:class="{ error: $v.formData.swap_currency_symbol.$error }"
class="form-control ls-select2"
name="swap_currency_symbol"
@select="$v.formData.swap_currency_symbol.$touch()"
>
<option value="0">{{ $t('settings.currencies.right') }}</option>
<option value="1">{{ $t('settings.currencies.left') }}</option>
</select>
<div v-if="$v.formData.swap_currency_symbol.$error">
<span v-if="!$v.formData.swap_currency_symbol.required" class="text-danger">{{ $tc('validation.required') }}</span>
</div>
</div>
<base-button color="theme" type="submit">
{{ $t('navigation.add') }}
</base-button>
</div>
</form>
</div>
</div>
</div>
</div>
</template>
<script>
import { mapActions } from 'vuex'
import { validationMixin } from 'vuelidate'
const { required } = require('vuelidate/lib/validators')
export default {
mixins: [validationMixin],
data () {
return this.$store.state.currency
},
computed: {
isEdit () {
if (this.$route.name === 'currencyedit') {
return true
}
return false
}
},
validations: {
formData: {
name: {
required
},
code: {
required
},
thousand_separator: {
required
},
decimal_separator: {
required
},
swap_currency_symbol: {
required
}
}
},
mounted () {
if (!this.isEdit) {
return true
}
this.loadData(this.$route.params.id)
},
methods: {
...mapActions('currency', [
'loadData',
'addCurrency',
'editCurrency'
]),
async submiteCurrency () {
this.$v.formData.$touch()
if (this.$v.$invalid) {
return false
}
if (this.isEdit) {
this.editCurrency(this.$route.params.id)
return true
}
this.addCurrency()
return true
}
}
}
</script>