diff --git a/app/Listeners/Updates/v1/Version110.php b/app/Listeners/Updates/v1/Version110.php index 010561ee..96b47e2a 100644 --- a/app/Listeners/Updates/v1/Version110.php +++ b/app/Listeners/Updates/v1/Version110.php @@ -7,6 +7,7 @@ use Illuminate\Queue\InteractsWithQueue; use Crater\Events\UpdateFinished; use Crater\Listeners\Updates\Listener; use Crater\Setting; +use Crater\Currency; class Version110 extends Listener { @@ -34,7 +35,81 @@ class Version110 extends Listener return; } + // Add currencies + $this->addCurrencies(); + // Update Crater app version Setting::setSetting('version', static::VERSION); } + + private function addCurrencies() { + + $currencies = [ + '13' => [ + 'symbol' => 'S$' + ], + '16' => [ + 'symbol' => '₫' + ], + '17' => [ + 'symbol' => 'Fr.' + ], + '21' => [ + 'symbol' => '฿' + ], + '22' => [ + 'symbol' => '₦' + ], + '26' => [ + 'symbol' => 'HK$' + ], + '35' => [ + 'symbol' => 'NAƒ' + ], + '38' => [ + 'symbol' => 'GH₵' + ], + '39' => [ + 'symbol' => 'Лв.' + ], + '42' => [ + 'symbol' => 'RON' + ], + '44' => [ + 'symbol' => 'SِAR' + ], + '46' => [ + 'symbol' => 'Rf' + ], + '47' => [ + 'symbol' => '₡' + ], + '54' => [ + 'symbol' => '‎د.ت' + ], + '55' => [ + 'symbol' => '₽' + ], + '57' => [ + 'symbol' => 'ر.ع.' + ], + '58' => [ + 'symbol' => '₴' + ], + + ]; + + foreach ($currencies as $key => $currency) { + Currency::updateOrCreate(['id' => $key], $currency); + } + + Currency::create([ + 'name' => 'Kuwaiti Dinar', + 'code' => 'KWD', + 'symbol' => 'KWD ', + 'precision' => '3', + 'thousand_separator' => ',', + 'decimal_separator' => '.' + ]); + } } diff --git a/resources/assets/js/store/modules/customer/actions.js b/resources/assets/js/store/modules/customer/actions.js index ef03d1b6..1588cccb 100644 --- a/resources/assets/js/store/modules/customer/actions.js +++ b/resources/assets/js/store/modules/customer/actions.js @@ -36,7 +36,9 @@ export const addCustomer = ({ commit, dispatch, state }, data) => { export const updateCustomer = ({ commit, dispatch, state }, data) => { return new Promise((resolve, reject) => { window.axios.put(`/api/customers/${data.id}`, data).then((response) => { - commit(types.UPDATE_CUSTOMER, response.data) + if(response.data.success){ + commit(types.UPDATE_CUSTOMER, response.data) + } resolve(response) }).catch((err) => { reject(err) diff --git a/routes/web.php b/routes/web.php index 203e963b..3c9b2175 100644 --- a/routes/web.php +++ b/routes/web.php @@ -47,6 +47,8 @@ Route::group(['prefix' => 'reports'], function () { 'uses' => 'ReportController@profitLossReport' ]); + + });