SelectContactCard add text fields..
This commit is contained in:
parent
918c5af23e
commit
3b3c0c60a5
@ -20,18 +20,42 @@ class SelectContactCard extends Component
|
|||||||
|
|
||||||
public $create_route;
|
public $create_route;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $textAddContact;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $textCreateNewContact;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $textEditContact;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $textContactInfo;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $textChooseDifferentContact;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new component instance.
|
* Create a new component instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct($type, $contact = false, $contacts = [], $search_route = '', $create_route = '')
|
public function __construct(
|
||||||
|
$type, $contact = false, $contacts = [], $search_route = '', $create_route = '',
|
||||||
|
string $textAddContact = '', string $textCreateNewContact = '', string $textEditContact = '', string $textContactInfo = '', string $textChooseDifferentContact = ''
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->contact = $contact;
|
$this->contact = $contact;
|
||||||
$this->contacts = $contacts;
|
$this->contacts = $contacts;
|
||||||
$this->search_route = $search_route;
|
$this->search_route = $search_route;
|
||||||
$this->create_route = $create_route;
|
$this->create_route = $create_route;
|
||||||
|
|
||||||
|
$this->textAddContact = $this->getTextAddContact($type, $textAddContact);
|
||||||
|
$this->textCreateNewContact = $this->getTextCreateNewContact($type, $textCreateNewContact);
|
||||||
|
$this->textEditContact = $this->getTextEditContact($type, $textEditContact);
|
||||||
|
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
|
||||||
|
$this->textChooseDifferentContact = $this->getTextChooseDifferentContact($type, $textChooseDifferentContact);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,4 +96,104 @@ class SelectContactCard extends Component
|
|||||||
|
|
||||||
return view('components.select-contact-card');
|
return view('components.select-contact-card');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getTextAddContact($type, $textAddContact)
|
||||||
|
{
|
||||||
|
if (!empty($textAddContact)) {
|
||||||
|
return $textAddContact;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case 'bill':
|
||||||
|
case 'expense':
|
||||||
|
case 'purchase':
|
||||||
|
$textAddContact = 'vendor';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$textAddContact = 'customer';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $textAddContact;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getTextCreateNewContact($type, $textCreateNewContact)
|
||||||
|
{
|
||||||
|
if (!empty($textCreateNewContact)) {
|
||||||
|
return $textCreateNewContact;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case 'bill':
|
||||||
|
case 'expense':
|
||||||
|
case 'purchase':
|
||||||
|
$textCreateNewContact = 'vendor';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$textCreateNewContact = 'customer';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $textCreateNewContact;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getTextEditContact($type, $textEditContact)
|
||||||
|
{
|
||||||
|
if (!empty($textEditContact)) {
|
||||||
|
return $textEditContact;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case 'bill':
|
||||||
|
case 'expense':
|
||||||
|
case 'purchase':
|
||||||
|
$textEditContact = 'vendor';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$textEditContact = 'customer';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $textEditContact;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getTextContactInfo($type, $textContactInfo)
|
||||||
|
{
|
||||||
|
if (!empty($textContactInfo)) {
|
||||||
|
return $textContactInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case 'bill':
|
||||||
|
case 'expense':
|
||||||
|
case 'purchase':
|
||||||
|
$textContactInfo = 'vendor';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$textContactInfo = 'customer';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $textContactInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getTextChooseDifferentContact($type, $textChooseDifferentContact)
|
||||||
|
{
|
||||||
|
if (!empty($textChooseDifferentContact)) {
|
||||||
|
return $textChooseDifferentContact;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case 'bill':
|
||||||
|
case 'expense':
|
||||||
|
case 'purchase':
|
||||||
|
$textChooseDifferentContact = 'vendor';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$textChooseDifferentContact = 'customer';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $textChooseDifferentContact;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<div class="document-contact-without-contact-box">
|
<div class="document-contact-without-contact-box">
|
||||||
<button type="button" class="btn-aka-link aka-btn--fluid document-contact-without-contact-box-btn"
|
<button type="button" class="btn-aka-link aka-btn--fluid document-contact-without-contact-box-btn"
|
||||||
@click="onContactList">
|
@click="onContactList">
|
||||||
<i class="far fa-user fa-2x"></i> Add a customer
|
<i class="far fa-user fa-2x"></i> {{ addContactText }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
<div class="aka-select__footer" tabindex="0" @click="onContactCreate">
|
<div class="aka-select__footer" tabindex="0" @click="onContactCreate">
|
||||||
<span>
|
<span>
|
||||||
<i class="fas fa-plus"></i> Create a new customer
|
<i class="fas fa-plus"></i> {{ createNewContactText }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
<div v-else class="invoice-customer__with-customer__bill-to">
|
<div v-else class="invoice-customer__with-customer__bill-to">
|
||||||
<div>
|
<div>
|
||||||
<span class="aka-text aka-text--block-label">Bill to</span>
|
<span class="aka-text aka-text--block-label">{{ contactInfoText }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
@ -85,12 +85,12 @@
|
|||||||
{{ contact.address }}
|
{{ contact.address }}
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr v-if="contact.tax_number">
|
||||||
<th class="p-0">
|
<th class="p-0">
|
||||||
general.tax_number: {{ contact.tax_number }}
|
{{ taxNumberText }}: {{ contact.tax_number }}
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr v-if="contact.phone">
|
||||||
<th class="p-0">
|
<th class="p-0">
|
||||||
{{ contact.phone }}
|
{{ contact.phone }}
|
||||||
</th>
|
</th>
|
||||||
@ -104,7 +104,8 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button" class="btn btn-link" @click="onContactEdit">Edit Test Customer</button> • <button type="button" class="btn btn-link" @click="onContactList">Choose a different customer</button>
|
<button type="button" class="btn btn-link" @click="onContactEdit">{{ editContactText.replace(':contact_name', contact.name) }}</button> •
|
||||||
|
<button type="button" class="btn btn-link" @click="onContactList">{{ chooseDiffentContactText }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -198,6 +199,36 @@ export default {
|
|||||||
},
|
},
|
||||||
description: "Selectbox Add New Item Feature"
|
description: "Selectbox Add New Item Feature"
|
||||||
},
|
},
|
||||||
|
addContactText: {
|
||||||
|
type: String,
|
||||||
|
default: 'Add a customer',
|
||||||
|
description: ""
|
||||||
|
},
|
||||||
|
createNewContactText: {
|
||||||
|
type: String,
|
||||||
|
default: 'Create a new customer',
|
||||||
|
description: ""
|
||||||
|
},
|
||||||
|
editContactText: {
|
||||||
|
type: String,
|
||||||
|
default: 'Edit :contact_name Customer',
|
||||||
|
description: ""
|
||||||
|
},
|
||||||
|
contactInfoText: {
|
||||||
|
type: String,
|
||||||
|
default: 'Bill to',
|
||||||
|
description: ""
|
||||||
|
},
|
||||||
|
taxNumberText: {
|
||||||
|
type: String,
|
||||||
|
default: 'Tax number',
|
||||||
|
description: ""
|
||||||
|
},
|
||||||
|
chooseDiffentContactText: {
|
||||||
|
type: String,
|
||||||
|
default: 'Choose a different customer',
|
||||||
|
description: ""
|
||||||
|
},
|
||||||
noDataText: {
|
noDataText: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'No Data',
|
default: 'No Data',
|
||||||
|
@ -6,7 +6,12 @@
|
|||||||
create-route="{{ $create_route }}"
|
create-route="{{ $create_route }}"
|
||||||
:contacts="{{ json_encode($contacts) }}"
|
:contacts="{{ json_encode($contacts) }}"
|
||||||
:selected="{{ json_encode($contact) }}"
|
:selected="{{ json_encode($contact) }}"
|
||||||
|
add-contact-text="{{ $textAddContact }}"
|
||||||
|
create-new-contact-text="{{ $textCreateNewContact }}"
|
||||||
|
editContactText="{{ $textEditContact }}"
|
||||||
|
contact-info-text="{{ $textContactInfo }}"
|
||||||
|
tax-number-text="{{ trans('general.tax_number') }}"
|
||||||
|
choose-different-contact-text="{{ $textChooseDifferentContact }}"
|
||||||
:add-new="{{ json_encode([
|
:add-new="{{ json_encode([
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'text' => trans('general.add_new'),
|
'text' => trans('general.add_new'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user