routes refactoring

This commit is contained in:
Peter Papp
2021-05-13 17:50:42 +02:00
parent 3af8bff13b
commit b4e6561134
16 changed files with 573 additions and 608 deletions

View File

@@ -16,14 +16,14 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.client_logo') }} ({{ $t('global.optional') }}):</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="logo" v-slot="{ errors }">
<ImageInput @input="$updateImage('/oasis/invoices/profile', 'logo', profile.logo)" :image="$getImage(profile.logo)" v-model="profile.logo" :error="errors[0]" />
<ImageInput @input="$updateImage('/invoices/profile', 'logo', profile.logo)" :image="$getImage(profile.logo)" v-model="profile.logo" :error="errors[0]" />
</ValidationProvider>
</div>
<div class="block-wrapper">
<label>{{ $t('in.form.company_name') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="company" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'company', profile.company)" v-model="profile.company" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'company', profile.company)" v-model="profile.company" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -35,7 +35,7 @@
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="registration_notes" rules="required" v-slot="{ errors }">
<textarea
rows="2"
@input="$updateText('/oasis/invoices/profile', 'registration_notes', profile.registration_notes)"
@input="$updateText('/invoices/profile', 'registration_notes', profile.registration_notes)"
v-model="profile.registration_notes"
placeholder=""
:class="{'is-error': errors[0]}"
@@ -55,7 +55,7 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.ico') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="ico" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'ico', profile.ico)" v-model="profile.ico" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'ico', profile.ico)" v-model="profile.ico" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -64,7 +64,7 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.dic') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="dic" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'dic', profile.dic)" v-model="profile.dic" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'dic', profile.dic)" v-model="profile.dic" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -73,7 +73,7 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.ic_dph') }} ({{ $t('global.optional') }}):</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="ic_dph" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'ic_dph', profile.ic_dph)" v-model="profile.ic_dph" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'ic_dph', profile.ic_dph)" v-model="profile.ic_dph" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -87,7 +87,7 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.client_address') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="address" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'address', profile.address)" v-model="profile.address" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'address', profile.address)" v-model="profile.address" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -97,7 +97,7 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.client_city') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="city" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'city', profile.city)" v-model="profile.city" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'city', profile.city)" v-model="profile.city" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -106,7 +106,7 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.client_postal_code') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="postal_code" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'postal_code', profile.postal_code)" v-model="profile.postal_code" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'postal_code', profile.postal_code)" v-model="profile.postal_code" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -116,7 +116,7 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.client_country') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="country" rules="required" v-slot="{ errors }">
<SelectInput @input="$updateText('/oasis/invoices/profile', 'country', profile.country)" v-model="profile.country" :default="profile.country" :options="countries" placeholder="" :isError="errors[0]"/>
<SelectInput @input="$updateText('/invoices/profile', 'country', profile.country)" v-model="profile.country" :default="profile.country" :options="countries" placeholder="" :isError="errors[0]"/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
@@ -129,7 +129,7 @@
<div class="block-wrapper">
<label>{{ $t('in.form.bank_name') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="bank" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'bank', profile.bank)" v-model="profile.bank" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'bank', profile.bank)" v-model="profile.bank" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -138,7 +138,7 @@
<div class="block-wrapper">
<label>{{ $t('in.form.iban') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="iban" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'iban', profile.iban)" v-model="profile.iban" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'iban', profile.iban)" v-model="profile.iban" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -147,7 +147,7 @@
<div class="block-wrapper">
<label>{{ $t('in.form.swift_code') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="swift" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'swift', profile.swift)" v-model="profile.swift" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'swift', profile.swift)" v-model="profile.swift" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -161,7 +161,7 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.client_phone') }} ({{ $t('global.optional') }}):</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="phone" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'phone', profile.phone)" v-model="profile.phone" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'phone', profile.phone)" v-model="profile.phone" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -170,7 +170,7 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.client_email') }} ({{ $t('global.optional') }}):</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="email" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'email', profile.email)" v-model="profile.email" placeholder="" type="email"
<input @input="$updateText('/invoices/profile', 'email', profile.email)" v-model="profile.email" placeholder="" type="email"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -179,7 +179,7 @@
<div class="block-wrapper">
<label>{{ $t('in.form.author_name') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="author" rules="required" v-slot="{ errors }">
<input @input="$updateText('/oasis/invoices/profile', 'author', profile.author)" v-model="profile.author" placeholder="" type="text"
<input @input="$updateText('/invoices/profile', 'author', profile.author)" v-model="profile.author" placeholder="" type="text"
:class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -188,7 +188,7 @@
<div class="block-wrapper">
<label>{{ $t('in.form.stamp') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="stamp" v-slot="{ errors }">
<ImageInput @input="$updateImage('/oasis/invoices/profile', 'stamp', profile.stamp)" :image="$getImage(profile.stamp)" v-model="profile.stamp" :error="errors[0]" />
<ImageInput @input="$updateImage('/invoices/profile', 'stamp', profile.stamp)" :image="$getImage(profile.stamp)" v-model="profile.stamp" :error="errors[0]" />
</ValidationProvider>
</div>
</div>
@@ -265,7 +265,7 @@
},
methods: {},
created() {
axios.get('/api/oasis/invoices/profile')
axios.get('/api/invoices/profile')
.then(response => {
this.profile = response.data.data.attributes
})

View File

@@ -260,7 +260,7 @@
// Send request to get user token
axios
.post('/api/oasis/invoices/profile', formData, {
.post('/api/invoices/profile', formData, {
headers: {
'Content-Type': 'multipart/form-data',
}

View File

@@ -74,7 +74,7 @@
},
methods: {
fetchUser() {
axios.get(`/api/oasis/clients/${this.$route.params.id}`)
axios.get(`/api/clients/${this.$route.params.id}`)
.then(response => {
this.client = response.data
})
@@ -111,6 +111,7 @@
border-radius: 12px;
z-index: 1;
position: relative;
object-fit: contain;
&.blurred {
@include blurred-image;

View File

@@ -5,13 +5,13 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.client_logo') }} ({{ $t('global.optional') }}):</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="avatar" v-slot="{ errors }">
<ImageInput @input="$updateImage(`/oasis/clients/${client.id}`, 'avatar', client.avatar)" v-model="client.avatar" :image="client.avatar" :error="errors[0]" />
<ImageInput @input="$updateImage(`/clients/${client.id}`, 'avatar', client.avatar)" v-model="client.avatar" :image="client.avatar" :error="errors[0]" />
</ValidationProvider>
</div>
<div class="block-wrapper">
<label>{{ $t('in_editor.company_name') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="name" rules="required" v-slot="{ errors }">
<input @input="$updateText(`/oasis/clients/${client.id}`, 'name', client.name)" v-model="client.name" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<input @input="$updateText(`/clients/${client.id}`, 'name', client.name)" v-model="client.name" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
@@ -21,21 +21,21 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.ico') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="ico" rules="required" v-slot="{ errors }">
<input @input="$updateText(`/oasis/clients/${client.id}`, 'ico', client.ico)" v-model="client.ico" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<input @input="$updateText(`/clients/${client.id}`, 'ico', client.ico)" v-model="client.ico" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="block-wrapper">
<label>{{ $t('in_editor.dic') }} ({{ $t('global.optional') }}):</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="dic" v-slot="{ errors }">
<input @input="$updateText(`/oasis/clients/${client.id}`, 'dic', client.dic)" v-model="client.dic" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<input @input="$updateText(`/clients/${client.id}`, 'dic', client.dic)" v-model="client.dic" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="block-wrapper">
<label>{{ $t('in_editor.ic_dph') }} ({{ $t('global.optional') }}):</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="ic_dph" v-slot="{ errors }">
<input @input="$updateText(`/oasis/clients/${client.id}`, 'ic_dph', client.ic_dph)" v-model="client.ic_dph" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<input @input="$updateText(`/clients/${client.id}`, 'ic_dph', client.ic_dph)" v-model="client.ic_dph" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
@@ -45,28 +45,28 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.client_address') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="address" rules="required" v-slot="{ errors }">
<input @input="$updateText(`/oasis/clients/${client.id}`, 'address', client.address)" v-model="client.address" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<input @input="$updateText(`/clients/${client.id}`, 'address', client.address)" v-model="client.address" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="block-wrapper">
<label>{{ $t('in_editor.client_city') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="city" rules="required" v-slot="{ errors }">
<input @input="$updateText(`/oasis/clients/${client.id}`, 'city', client.city)" v-model="client.city" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<input @input="$updateText(`/clients/${client.id}`, 'city', client.city)" v-model="client.city" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="block-wrapper">
<label>{{ $t('in_editor.client_postal_code') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="postal_code" rules="required" v-slot="{ errors }">
<input @input="$updateText(`/oasis/clients/${client.id}`, 'postal_code', client.postal_code)" v-model="client.postal_code" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<input @input="$updateText(`/clients/${client.id}`, 'postal_code', client.postal_code)" v-model="client.postal_code" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="block-wrapper">
<label>{{ $t('in_editor.client_country') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="country" rules="required" v-slot="{ errors }">
<SelectInput @input="$updateText(`/oasis/clients/${client.id}`, 'country', client.country)" v-model="client.country" :default="client.country" :options="countries" placeholder="" :isError="errors[0]" />
<SelectInput @input="$updateText(`/clients/${client.id}`, 'country', client.country)" v-model="client.country" :default="client.country" :options="countries" placeholder="" :isError="errors[0]" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
@@ -76,14 +76,14 @@
<div class="block-wrapper">
<label>{{ $t('in_editor.client_phone') }} ({{ $t('global.optional') }}):</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="phone_number" v-slot="{ errors }">
<input @input="$updateText(`/oasis/clients/${client.id}`, 'phone_number', client.phone_number)" v-model="client.phone_number" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<input @input="$updateText(`/clients/${client.id}`, 'phone_number', client.phone_number)" v-model="client.phone_number" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="block-wrapper">
<label>{{ $t('in_editor.client_email') }} ({{ $t('global.optional') }}):</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="email" v-slot="{ errors }">
<input @input="$updateText(`/oasis/clients/${client.id}`, 'email', client.email)" v-model="client.email" placeholder="" type="email" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<input @input="$updateText(`/clients/${client.id}`, 'email', client.email)" v-model="client.email" placeholder="" type="email" :class="{'is-error': errors[0]}" class="focus-border-theme" />
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>

View File

@@ -3,7 +3,7 @@
<PageTabGroup>
<DatatableWrapper
@init="isLoading = false"
:api="`/api/oasis/clients/${$route.params.id}/invoices`"
:api="`/api/clients/${$route.params.id}/invoices`"
:paginator="false"
:columns="columns"
class="table"

View File

@@ -150,7 +150,7 @@
events.$on('action:confirmed', data => {
if (data.operation === 'delete-invoice') {
axios.delete(`/api/oasis/invoices/${data.id}`)
axios.delete(`/api/invoices/${data.id}`)
.then(() => this.goTo(this.currentFolder.location))
.catch(() => this.$isSomethingWrong())
}
@@ -159,7 +159,7 @@
events.$on('action:confirmed', data => {
if (data.operation === 'delete-client') {
axios.delete(`/api/oasis/clients/${data.id}`)
axios.delete(`/api/clients/${data.id}`)
.then(() => this.goTo(this.currentFolder.location))
.catch(() => this.$isSomethingWrong())
}

View File

@@ -615,7 +615,7 @@
// Send request to get user token
axios
.post('/api/oasis/invoices', formData, {
.post('/api/invoices', formData, {
headers: {
'Content-Type': 'multipart/form-data',
}
@@ -690,7 +690,7 @@
mounted() {
this.invoice.invoice_type = this.$route.query.type
axios.get('/api/oasis/invoices/editor')
axios.get('/api/invoices/editor')
.then(response => {
this.isVatPayer = response.data.isVatPayer
this.clients = response.data.clients

View File

@@ -509,7 +509,7 @@
// Send request to get user token
axios
.post(`/api/oasis/invoices/${this.$route.params.id}`, formData)
.post(`/api/invoices/${this.$route.params.id}`, formData)
.then(() => {
events.$emit('toaster', {
@@ -560,12 +560,12 @@
}
},
mounted() {
axios.get('/api/oasis/invoices/editor')
axios.get('/api/invoices/editor')
.then(response => {
this.isVatPayer = response.data.isVatPayer
})
axios.get(`/api/oasis/invoices/${this.$route.params.id}`)
axios.get(`/api/invoices/${this.$route.params.id}`)
.then(response => {
this.invoice.invoice_number = response.data.data.attributes.invoice_number
this.invoice.variable_number = response.data.data.attributes.variable_number

View File

@@ -349,7 +349,7 @@ export default {
}
.image {
object-fit: cover;
object-fit: contain;
user-select: none;
max-width: 100%;
border-radius: 5px;

View File

@@ -86,7 +86,7 @@ export default {
// Send request to get share link
axios
.post(`/api/oasis/invoices/${this.pickedItem.id}/share`,
.post(`/api/invoices/${this.pickedItem.id}/share`,
this.shareOptions
)
.then(() => {

View File

@@ -20,7 +20,7 @@ const actions = {
})
axios
.get('/api/oasis/invoices/regular' + getters.invoiceSorting.URI)
.get('/api/invoices/regular' + getters.invoiceSorting.URI)
.then(response => {
commit('LOADING_STATE', {loading: false, data: response.data})
})
@@ -41,7 +41,7 @@ const actions = {
})
axios
.get('/api/oasis/invoices/advance' + getters.invoiceSorting.URI)
.get('/api/invoices/advance' + getters.invoiceSorting.URI)
.then(response => {
commit('LOADING_STATE', {loading: false, data: response.data})
})
@@ -62,7 +62,7 @@ const actions = {
})
axios
.get('/api/oasis/clients' + getters.invoiceSorting.URI)
.get('/api/clients' + getters.invoiceSorting.URI)
.then(response => {
commit('LOADING_STATE', {loading: false, data: response.data})
})
@@ -78,7 +78,7 @@ const actions = {
commit('CHANGE_SEARCHING_STATE', true)
axios
.get('/api/oasis/invoices/search', {
.get('/api/invoices/search', {
params: {
query: query,
type: getters.currentFolder.location,
@@ -94,7 +94,7 @@ const actions = {
commit('CHANGE_SEARCHING_STATE', true)
axios
.get('/api/oasis/clients/search', {
.get('/api/clients/search', {
params: {query: query}
})
.then(response => {