File upload development for form patch
This commit is contained in:
parent
99d8ea337e
commit
d9ba4c47d9
21
resources/assets/js/mixins/spa-global.js
vendored
21
resources/assets/js/mixins/spa-global.js
vendored
@ -98,20 +98,6 @@ export default {
|
||||
[key]: val,
|
||||
});
|
||||
}
|
||||
|
||||
if(this.$refs.dropzoneWizard) {
|
||||
if(this.$refs.dropzoneWizard.dropzone.files.length) {
|
||||
file = this.$refs.dropzoneWizard.dropzone.files[0];
|
||||
} else {
|
||||
file = this.$refs.dropzoneWizard.files[0];
|
||||
}
|
||||
}
|
||||
|
||||
if(plus_data == 'logo') {
|
||||
Object.assign(data, {
|
||||
['logo']: file
|
||||
});
|
||||
}
|
||||
|
||||
if(plus_data == 'type') {
|
||||
Object.assign(data, {
|
||||
@ -210,17 +196,16 @@ export default {
|
||||
for (let [key, val] of formData.entries()) {
|
||||
Object.assign(data_name, {
|
||||
[key]: val,
|
||||
['logo']: this.$refs.dropzoneWizard.files[1],
|
||||
['logo']: this.$refs.dropzoneWizard.files[1] ? this.$refs.dropzoneWizard.files[1] : this.$refs.dropzoneWizard.files[0],
|
||||
['_prefix']: 'company',
|
||||
['_token']: window.Laravel.csrfToken,
|
||||
['_method']: 'PATCH',
|
||||
['_method']: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
formData.appendRecursive(data_name);
|
||||
|
||||
window.axios({
|
||||
method: 'PATCH',
|
||||
method: 'POST',
|
||||
url: url + "/wizard/companies",
|
||||
data: formData,
|
||||
headers: {
|
||||
|
@ -12,7 +12,7 @@
|
||||
<el-step :title="translations.finish.title"></el-step>
|
||||
</el-steps>
|
||||
</div>
|
||||
<form id="company-name" ref="form" class="w-100" method="PATCH">
|
||||
<form ref="form" class="w-100">
|
||||
<div class="card-body">
|
||||
<div class="row mb-4">
|
||||
<div class="col-12 mb-4">
|
||||
@ -170,10 +170,4 @@ export default {
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
form {
|
||||
flex-flow: row wrap;
|
||||
}
|
||||
</style>
|
||||
</script>
|
@ -57,7 +57,7 @@
|
||||
<base-button type="white" native-type="submit" @click="prev()"
|
||||
>{{ translations.finish.previous }}</base-button
|
||||
>
|
||||
<base-button type="success" native-type="submit" @click="finish()"
|
||||
<base-button type="success" native-type="submit" v-if="button_show" @click="finish()"
|
||||
>{{ translations.finish.go_to_dashboard }}</base-button
|
||||
>
|
||||
</div>
|
||||
@ -79,9 +79,12 @@ export default {
|
||||
},
|
||||
created() {
|
||||
window.axios({
|
||||
method: 'GET',
|
||||
url
|
||||
method: 'PATCH',
|
||||
url: url + '/wizard/finish'
|
||||
}).then(response => {
|
||||
if(response.status == "200") {
|
||||
this.button_show = true;
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
|
||||
@ -99,11 +102,12 @@ export default {
|
||||
return {
|
||||
active: 3,
|
||||
route_url: url,
|
||||
button_show: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
finish() {
|
||||
window.location.href = "";
|
||||
window.location.href = url;
|
||||
},
|
||||
prev() {
|
||||
if (this.active-- > 2);
|
||||
|
@ -12,7 +12,7 @@ Route::group(['as' => 'wizard.'], function () {
|
||||
Route::get('data', 'Wizard\Data@index')->name('data.index');
|
||||
|
||||
Route::get('companies', 'Wizard\Companies@edit')->name('companies.edit');
|
||||
Route::patch('companies', 'Wizard\Companies@update')->middleware('dropzone')->name('companies.update');
|
||||
Route::post('companies', 'Wizard\Companies@update')->middleware('dropzone')->name('companies.update');
|
||||
|
||||
Route::get('currencies/{currency}/enable', 'Settings\Currencies@enable')->name('currencies.enable');
|
||||
Route::get('currencies/{currency}/disable', 'Settings\Currencies@disable')->name('currencies.disable');
|
||||
|
Loading…
x
Reference in New Issue
Block a user