SelectContactCard add text fields..
This commit is contained in:
@ -20,18 +20,42 @@ class SelectContactCard extends Component
|
||||
|
||||
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.
|
||||
*
|
||||
* @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->contact = $contact;
|
||||
$this->contacts = $contacts;
|
||||
$this->search_route = $search_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');
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user