Dropzone form post edited
This commit is contained in:
parent
7adb8c9663
commit
93ba76e978
@ -16,7 +16,7 @@ class Settings extends Controller
|
|||||||
{
|
{
|
||||||
use DateTime, Uploads;
|
use DateTime, Uploads;
|
||||||
|
|
||||||
public $skip_keys = ['company_id', '_method', '_token', '_prefix'];
|
public $skip_keys = ['company_id', '_method', '_token', '_prefix', 'uploaded_logo'];
|
||||||
|
|
||||||
public $file_keys = ['company.logo', 'invoice.logo'];
|
public $file_keys = ['company.logo', 'invoice.logo'];
|
||||||
|
|
||||||
@ -113,10 +113,6 @@ class Settings extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($real_key == 'default.locale') {
|
if ($real_key == 'default.locale') {
|
||||||
if (!in_array($value, config('language.allowed'))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
user()->setAttribute('locale', $value)->save();
|
user()->setAttribute('locale', $value)->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,10 +156,10 @@ class Settings extends Controller
|
|||||||
Installer::updateEnv(['MAIL_FROM_NAME' => '"' . $value . '"']);
|
Installer::updateEnv(['MAIL_FROM_NAME' => '"' . $value . '"']);
|
||||||
break;
|
break;
|
||||||
case 'company.email':
|
case 'company.email':
|
||||||
Installer::updateEnv(['MAIL_FROM_ADDRESS' => '"' . $value . '"']);
|
Installer::updateEnv(['MAIL_FROM_ADDRESS' => $value]);
|
||||||
break;
|
break;
|
||||||
case 'default.locale':
|
case 'default.locale':
|
||||||
Installer::updateEnv(['APP_LOCALE' => '"' . $value . '"']);
|
Installer::updateEnv(['APP_LOCALE' => $value]);
|
||||||
break;
|
break;
|
||||||
case 'schedule.time':
|
case 'schedule.time':
|
||||||
Installer::updateEnv(['APP_SCHEDULE_TIME' => '"' . $value . '"']);
|
Installer::updateEnv(['APP_SCHEDULE_TIME' => '"' . $value . '"']);
|
||||||
|
@ -50,7 +50,7 @@ class Companies extends Controller
|
|||||||
|
|
||||||
$fields = $request->all();
|
$fields = $request->all();
|
||||||
|
|
||||||
$skip_keys = ['company_id', '_method', '_token'];
|
$skip_keys = ['company_id', '_method', '_token', 'uploaded_logo'];
|
||||||
$file_keys = ['company.logo'];
|
$file_keys = ['company.logo'];
|
||||||
|
|
||||||
foreach ($fields as $key => $value) {
|
foreach ($fields as $key => $value) {
|
||||||
@ -70,13 +70,13 @@ class Companies extends Controller
|
|||||||
$real_key = 'company.' . $key;
|
$real_key = 'company.' . $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process file uploads
|
// Process file uploads
|
||||||
if (in_array($real_key, $file_keys)) {
|
if (in_array($real_key, $file_keys)) {
|
||||||
// Upload attachment
|
// Upload attachment
|
||||||
if ($request->file($key)) {
|
if ($request->file($key)) {
|
||||||
$media = $this->getMedia($request->file($key), 'settings');
|
$media = $this->getMedia($request->file($key), 'settings');
|
||||||
|
|
||||||
$company->attachMedia($media, Str::snake($key));
|
$company->attachMedia($media, Str::snake($real_key));
|
||||||
|
|
||||||
$value = $media->id;
|
$value = $media->id;
|
||||||
}
|
}
|
||||||
|
@ -70,12 +70,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<base-input :label="translations.company.logo">
|
<base-input :label="translations.company.logo">
|
||||||
<akaunting-dropzone-file-upload
|
<akaunting-dropzone-file-upload
|
||||||
ref="dropzoneWizard"
|
ref="dropzoneWizard"
|
||||||
preview-classes="single"
|
preview-classes="single"
|
||||||
:attachments="logo"
|
:attachments="logo"
|
||||||
>
|
>
|
||||||
</akaunting-dropzone-file-upload>
|
</akaunting-dropzone-file-upload>
|
||||||
</base-input>
|
</base-input>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -127,52 +127,44 @@ export default {
|
|||||||
return {
|
return {
|
||||||
active: 0,
|
active: 0,
|
||||||
logo: [],
|
logo: [],
|
||||||
real_date: ''
|
real_date: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
let company_data = this.company;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.company != undefined) {
|
this.dataWatch(company_data);
|
||||||
let logo_arr = [
|
|
||||||
{
|
|
||||||
id: this.company.logo.id,
|
|
||||||
name:this.company.logo.filename + "." + this.company.logo.extension,
|
|
||||||
path: this.company.logo.path,
|
|
||||||
type: this.company.logo.mime_type,
|
|
||||||
size: this.company.logo.size,
|
|
||||||
downloadPath: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
this.logo.push(logo_arr);
|
|
||||||
this.real_date = this.company.financial_start;
|
|
||||||
}
|
|
||||||
}, 500);
|
}, 500);
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
company: function (company) {
|
company: function (company) {
|
||||||
let logo_arr = [
|
this.dataWatch(company);
|
||||||
{
|
|
||||||
id: company.logo.id,
|
|
||||||
name: company.logo.filename + "." + company.logo.extension,
|
|
||||||
path: company.logo.path,
|
|
||||||
type: company.logo.mime_type,
|
|
||||||
size: company.logo.size,
|
|
||||||
downloadPath: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
this.logo.push(logo_arr);
|
|
||||||
|
|
||||||
this.real_date = company.financial_start;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
dataWatch(company) {
|
||||||
|
if(Object.keys(company).length) {
|
||||||
|
let logo_arr = [
|
||||||
|
{
|
||||||
|
id: company.logo.id,
|
||||||
|
name: company.logo.filename + "." + company.logo.extension,
|
||||||
|
path: company.logo.path,
|
||||||
|
type: company.logo.mime_type,
|
||||||
|
size: company.logo.size,
|
||||||
|
downloadPath: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
this.logo.push(logo_arr);
|
||||||
|
this.real_date = company.financial_start;
|
||||||
|
}
|
||||||
|
},
|
||||||
next() {
|
next() {
|
||||||
if (this.active++ > 2);
|
if (this.active++ > 2);
|
||||||
this.$router.push("/wizard/currencies");
|
this.$router.push("/wizard/currencies");
|
||||||
},
|
},
|
||||||
|
|
||||||
onEditSave() {
|
onEditSave() {
|
||||||
this.onEditEvent("PATCH", url + "/wizard/company", "logo", "", "");
|
this.onEditEvent("PATCH", url + "/wizard/companies", "logo", "", "");
|
||||||
this.$router.push("/wizard/currencies");
|
this.$router.push("/wizard/currencies");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -12,7 +12,7 @@ Route::group(['as' => 'wizard.'], function () {
|
|||||||
Route::get('data', 'Wizard\Data@index')->name('data.index');
|
Route::get('data', 'Wizard\Data@index')->name('data.index');
|
||||||
|
|
||||||
Route::get('companies', 'Wizard\Companies@edit')->name('companies.edit');
|
Route::get('companies', 'Wizard\Companies@edit')->name('companies.edit');
|
||||||
Route::patch('companies', 'Wizard\Companies@update')->name('companies.update');
|
Route::patch('companies', 'Wizard\Companies@update')->middleware('dropzone')->name('companies.update');
|
||||||
|
|
||||||
Route::get('currencies/{currency}/enable', 'Settings\Currencies@enable')->name('currencies.enable');
|
Route::get('currencies/{currency}/enable', 'Settings\Currencies@enable')->name('currencies.enable');
|
||||||
Route::get('currencies/{currency}/disable', 'Settings\Currencies@disable')->name('currencies.disable');
|
Route::get('currencies/{currency}/disable', 'Settings\Currencies@disable')->name('currencies.disable');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user