Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitpanjwani committed Mar 6, 2022
2 parents fadef0e + 7ba120d commit e31f947
Show file tree
Hide file tree
Showing 41 changed files with 232 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Crater\Http\Requests\UpdateSettingsRequest;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Illuminate\Support\Arr;

class UpdateCompanySettingsController extends Controller
{
Expand All @@ -20,16 +21,17 @@ public function __invoke(UpdateSettingsRequest $request)
$company = Company::find($request->header('company'));
$this->authorize('manage company', $company);

$companyCurrency = CompanySetting::getSetting('currency', $request->header('company'));
$data = $request->settings;

if (array_key_exists('currency', $data)) {
if ($companyCurrency !== $data['currency'] && $company->hasTransactions()) {
return response()->json([
'success' => false,
'message' => 'Cannot update company currency after transactions are created.'
]);
}
if (
Arr::exists($data, 'currency') &&
(CompanySetting::getSetting('currency', $company->id) !== $data['currency']) &&
$company->hasTransactions()
) {
return response()->json([
'success' => false,
'message' => 'Cannot update company currency after transactions are created.'
]);
}

CompanySetting::setSettings($data, $request->header('company'));
Expand Down
4 changes: 2 additions & 2 deletions app/Models/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ public static function createItems($invoice, $invoiceItems)
if (array_key_exists('taxes', $invoiceItem) && $invoiceItem['taxes']) {
foreach ($invoiceItem['taxes'] as $tax) {
$tax['company_id'] = $invoice->company_id;
$tax['exchnage_rate'] = $invoice->exchange_rate;
$tax['exchange_rate'] = $invoice->exchange_rate;
$tax['base_amount'] = $tax['amount'] * $exchange_rate;
$tax['currency_id'] = $invoice->currency_id;

Expand All @@ -524,7 +524,7 @@ public static function createTaxes($invoice, $taxes)

foreach ($taxes as $tax) {
$tax['company_id'] = $invoice->company_id;
$tax['exchnage_rate'] = $invoice->exchange_rate;
$tax['exchange_rate'] = $invoice->exchange_rate;
$tax['base_amount'] = $tax['amount'] * $exchange_rate;
$tax['currency_id'] = $invoice->currency_id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
label="name"
value-prop="id"
:placeholder="$t('settings.disk.select_disk')"
track-by="id"
track-by="name"
object
/>
</BaseInputGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
label="key"
:searchable="true"
:invalid="v$.currentExchangeRate.driver.$error"
track-by="key"
@update:modelValue="resetCurrency"
@input="v$.currentExchangeRate.driver.$touch()"
/>
Expand All @@ -60,6 +61,7 @@
:options="serverOptions"
:invalid="v$.currencyConverter.type.$error"
label="value"
track-by="value"
@update:modelValue="resetCurrency"
/>
</BaseInputGroup>
Expand Down Expand Up @@ -104,8 +106,8 @@
:invalid="v$.currentExchangeRate.currencies.$error"
label="code"
track-by="code"
open-direction="top"
@input="v$.currentExchangeRate.currencies.$touch()"
openDirection="top"
/>
</BaseInputGroup>
<!-- For Currency Converter -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
:can-clear="false"
:placeholder="$t('items.select_a_unit')"
searchable
track-by="id"
track-by="name"
/>
</BaseInputGroup>

Expand All @@ -61,13 +61,14 @@
<BaseMultiselect
v-model="taxes"
:options="getTaxTypes"
label="name"
mode="tags"
label="tax_name"
value-prop="id"
class="w-full"
:can-deselect="false"
:can-clear="false"
searchable
track-by="id"
track-by="tax_name"
object
/>
</BaseInputGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
searchable
label="name"
:can-deselect="false"
track-by="name"
@update:modelValue="onChangeDriver(data)"
/>
</BaseInputGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
value-prop="code"
:placeholder="$tc('settings.preferences.select_language')"
class="w-full"
track-by="code"
track-by="name"
:searchable="true"
:invalid="v$.currentPreferences.language.$error"
/>
Expand Down Expand Up @@ -95,7 +95,7 @@
label="key"
value-prop="value"
:placeholder="$tc('settings.preferences.select_time_zone')"
track-by="value"
track-by="key"
:searchable="true"
:invalid="v$.currentPreferences.time_zone.$error"
/>
Expand Down
2 changes: 1 addition & 1 deletion resources/scripts/admin/views/settings/AccountSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
:options="globalStore.config.languages"
label="name"
value-prop="code"
track-by="code"
track-by="name"
open-direction="top"
/>
</BaseInputGroup>
Expand Down
2 changes: 1 addition & 1 deletion resources/scripts/admin/views/settings/BackupSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
v-model="filters.selected_disk"
:content-loading="isFetchingInitialData"
:options="getDisksOptions"
track-by="id"
track-by="name"
:placeholder="$t('settings.disk.select_disk')"
label="name"
:searchable="true"
Expand Down
4 changes: 2 additions & 2 deletions resources/scripts/admin/views/settings/PreferencesSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
label="name"
value-prop="code"
class="w-full"
track-by="code"
track-by="name"
:searchable="true"
:invalid="v$.language.$error"
/>
Expand Down Expand Up @@ -79,7 +79,7 @@
:options="globalStore.dateFormats"
label="display_date"
value-prop="carbon_format_value"
track-by="carbon_format_value"
track-by="display_date"
searchable
:invalid="v$.carbon_date_format.$error"
class="w-full"
Expand Down
1 change: 1 addition & 0 deletions resources/scripts/admin/views/users/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
searchable
:can-deselect="false"
class="w-full"
track-by="name"
/>
</BaseInputGroup>

Expand Down
2 changes: 1 addition & 1 deletion resources/scripts/components/base/BaseItemSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
v-model="itemSelect"
:content-loading="contentLoading"
value-prop="id"
track-by="id"
track-by="name"
:invalid="invalid"
preserve-search
:initial-search="itemData.name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
? notification.message
: success
? 'Successful'
: 'Somthing went wrong'
: 'Something went wrong'
}}
</p>
</div>
Expand Down
1 change: 1 addition & 0 deletions resources/scripts/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",
Expand Down
1 change: 1 addition & 0 deletions resources/scripts/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@
"cloned_successfully": "Opakující se faktura úspěšně naklonována",
"clone_invoice": "Naklonovat opakující se fakturu",
"confirm_clone": "Tato opakující se faktura bude naklonována do nové opakující se faktury",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Název položky",
"description": "Popis",
Expand Down
1 change: 1 addition & 0 deletions resources/scripts/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@
"cloned_successfully": "Serienrechnung erfolgreich kopiert",
"clone_invoice": "Serienrechnung kopieren",
"confirm_clone": "Diese Serienrechnung wird in eine neue Serienrechnung kopiert",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Titel des Artikels",
"description": "Beschreibung",
Expand Down
1 change: 1 addition & 0 deletions resources/scripts/locales/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@
"cloned_successfully": "Επαναλαμβανόμενο τιμολόγιο κλωνοποιήθηκε επιτυχής",
"clone_invoice": "Δημιουργία Επαναλαμβανόμενου Τιμολογίου",
"confirm_clone": "Αυτό το επαναλαμβανόμενο τιμολόγιο θα κλωνοποιηθεί σε ένα νέο επαναλαμβανόμενο τιμολόγιο",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Τίτλος Προϊόντος",
"description": "Περιγραφή",
Expand Down
1 change: 1 addition & 0 deletions resources/scripts/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@
"cloned_successfully": "Factura recurrente clonada con éxito",
"clone_invoice": "Clonar factura recurrente",
"confirm_clone": "Esta factura recurrente será clonada en una nueva factura recurrente",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Título del artículo",
"description": "Descripción",
Expand Down
1 change: 1 addition & 0 deletions resources/scripts/locales/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",
Expand Down
Loading

0 comments on commit e31f947

Please sign in to comment.