Select Contact Card dynamic language text

This commit is contained in:
Cüneyt Şentürk 2020-12-29 11:54:36 +03:00
parent 50b6385ed4
commit 8eb020211f
6 changed files with 87 additions and 33 deletions

View File

@ -368,10 +368,16 @@ abstract class DocumentForm extends Component
case 'bill':
case 'expense':
case 'purchase':
$textAddContact = 'vendor';
$textAddContact = [
'general.form.add',
'general.vendors'
];
break;
default:
$textAddContact = 'customer';
$textAddContact = [
'general.form.add',
'general.customers'
];
break;
}
@ -388,10 +394,16 @@ abstract class DocumentForm extends Component
case 'bill':
case 'expense':
case 'purchase':
$textCreateNewContact = 'vendor';
$textCreateNewContact = [
'general.form.add_new',
'general.vendors'
];
break;
default:
$textCreateNewContact = 'customer';
$textCreateNewContact = [
'general.form.add_new',
'general.customers'
];
break;
}
@ -408,10 +420,16 @@ abstract class DocumentForm extends Component
case 'bill':
case 'expense':
case 'purchase':
$textEditContact = 'vendor';
$textEditContact = [
'general.form.contact_edit',
'general.vendors'
];
break;
default:
$textEditContact = 'customer';
$textEditContact = [
'general.form.contact_edit',
'general.customers'
];
break;
}
@ -428,10 +446,10 @@ abstract class DocumentForm extends Component
case 'bill':
case 'expense':
case 'purchase':
$textContactInfo = 'vendor';
$textContactInfo = 'bills.bill_from';
break;
default:
$textContactInfo = 'customer';
$textContactInfo = 'invoices.bill_to';
break;
}
@ -448,10 +466,16 @@ abstract class DocumentForm extends Component
case 'bill':
case 'expense':
case 'purchase':
$textChooseDifferentContact = 'vendor';
$textChooseDifferentContact = [
'general.form.choose_different',
'general.vendors'
];
break;
default:
$textChooseDifferentContact = 'customer';
$textChooseDifferentContact = [
'general.form.choose_different',
'general.customers'
];
break;
}

View File

@ -42,7 +42,7 @@ class SelectContactCard extends Component
*/
public function __construct(
$type, $contact = false, $contacts = [], $search_route = '', $create_route = '',
string $textAddContact = '', string $textCreateNewContact = '', string $textEditContact = '', string $textContactInfo = '', string $textChooseDifferentContact = ''
$textAddContact = '', $textCreateNewContact = '', $textEditContact = '', $textContactInfo = '', $textChooseDifferentContact = ''
)
{
$this->type = $type;
@ -107,10 +107,16 @@ class SelectContactCard extends Component
case 'bill':
case 'expense':
case 'purchase':
$textAddContact = 'vendor';
$textAddContact = [
'general.form.add',
'general.vendors'
];
break;
default:
$textAddContact = 'customer';
$textAddContact = [
'general.form.add',
'general.customers'
];
break;
}
@ -127,10 +133,16 @@ class SelectContactCard extends Component
case 'bill':
case 'expense':
case 'purchase':
$textCreateNewContact = 'vendor';
$textCreateNewContact = [
'general.form.add_new',
'general.vendors'
];
break;
default:
$textCreateNewContact = 'customer';
$textCreateNewContact = [
'general.form.add_new',
'general.customers'
];
break;
}
@ -147,10 +159,16 @@ class SelectContactCard extends Component
case 'bill':
case 'expense':
case 'purchase':
$textEditContact = 'vendor';
$textEditContact = [
'general.form.contact_edit',
'general.vendors'
];
break;
default:
$textEditContact = 'customer';
$textEditContact = [
'general.form.contact_edit',
'general.customers'
];
break;
}
@ -167,10 +185,10 @@ class SelectContactCard extends Component
case 'bill':
case 'expense':
case 'purchase':
$textContactInfo = 'vendor';
$textContactInfo = 'bills.bill_from';
break;
default:
$textContactInfo = 'customer';
$textContactInfo = 'invoices.bill_to';
break;
}
@ -187,10 +205,16 @@ class SelectContactCard extends Component
case 'bill':
case 'expense':
case 'purchase':
$textChooseDifferentContact = 'vendor';
$textChooseDifferentContact = [
'general.form.choose_different',
'general.vendors'
];
break;
default:
$textChooseDifferentContact = 'customer';
$textChooseDifferentContact = [
'general.form.choose_different',
'general.customers'
];
break;
}

View File

@ -105,7 +105,7 @@
</div>
<button type="button" class="btn btn-link" @click="onContactEdit">{{ editContactText.replace(':contact_name', contact.name) }}</button>&nbsp;&nbsp;
<button type="button" class="btn btn-link" @click="onContactList">{{ chooseDiffentContactText }}</button>
<button type="button" class="btn btn-link" @click="onContactList">{{ chooseDifferentContactText }}</button>
</div>
</div>
@ -224,7 +224,7 @@ export default {
default: 'Tax number',
description: ""
},
chooseDiffentContactText: {
chooseDifferentContactText: {
type: String,
default: 'Choose a different customer',
description: ""

View File

@ -185,7 +185,13 @@ return [
'field' => '- Select :field -',
'file' => 'Select File',
],
'add' => 'Add a :field',
'add_an' => 'Add an :field',
'add_new' => 'Add New :field',
'edit' => 'Edit :field',
'contact_edit' => 'Edit :contact_name :field',
'choose' => 'Choose :field',
'choose_different' => 'Choose a different :field',
'no_file_selected' => 'No file selected...',
],

View File

@ -8,11 +8,11 @@
:contacts="$contacts"
:search_route="$contactSearchRoute"
:create_route="$contactCreateRoute"
text-add-contact="{{ $textAddContact }}"
text-create-new-contact="{{ $textCreateNewContact }}"
text-edit-contact="{{ $textEditContact }}"
text-contact-info="{{ $textContactInfo }}"
text-choose-different-contact="{{ $textChooseDifferentContact }}"
:text-add-contact="$textAddContact"
:text-create-new-contact="$textCreateNewContact"
:text-edit-contact="$textEditContact"
:text-contact-info="$textContactInfo"
:text-choose-different-contact="$textChooseDifferentContact"
/>
</div>
@endif

View File

@ -6,12 +6,12 @@
create-route="{{ $create_route }}"
:contacts="{{ json_encode($contacts) }}"
:selected="{{ json_encode($contact) }}"
add-contact-text="{{ $textAddContact }}"
create-new-contact-text="{{ $textCreateNewContact }}"
edit-contact-text="{{ $textEditContact }}"
contact-info-text="{{ $textContactInfo }}"
add-contact-text="{{ is_array($textAddContact) ? trans($textAddContact[0], ['field' => trans_choice($textAddContact[1], 1)]) : trans($textAddContact) }}"
create-new-contact-text="{{ is_array($textCreateNewContact) ? trans($textCreateNewContact[0], ['field' => trans_choice($textCreateNewContact[1], 1)]) : trans($textCreateNewContact) }}"
edit-contact-text="{{ is_array($textEditContact) ? trans($textEditContact[0], ['field' => trans_choice($textEditContact[1], 1)]) : trans($textEditContact) }}"
contact-info-text="{{ is_array($textContactInfo) ? trans($textContactInfo[0], ['field' => trans_choice($textContactInfo[1], 1)]) : trans($textContactInfo) }}"
tax-number-text="{{ trans('general.tax_number') }}"
choose-different-contact-text="{{ $textChooseDifferentContact }}"
choose-different-contact-text="{{ is_array($textChooseDifferentContact) ? trans($textChooseDifferentContact[0], ['field' => trans_choice($textChooseDifferentContact[1], 1)]) : trans($textChooseDifferentContact) }}"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),