Initial invoice rendering
This commit is contained in:
@@ -36,13 +36,52 @@ class Account extends Model
|
||||
return $this->belongsTo(\App\User::class);
|
||||
}
|
||||
|
||||
public function getActiveDisplayAttribute($value)
|
||||
{
|
||||
return sprintf('<span class="btn-sm btn-block btn-%s text-center">%s</span>',$this->active ? 'primary' : 'danger',$this->active ? 'Active' : 'Inactive');
|
||||
}
|
||||
|
||||
public function getCompanyAttribute($value)
|
||||
{
|
||||
return $value ? $value : $this->user->SurFirstName;
|
||||
}
|
||||
|
||||
public function getActiveDisplayAttribute($value)
|
||||
public function getAccountIdAttribute()
|
||||
{
|
||||
return sprintf('<span class="btn-sm btn-block btn-%s text-center">%s</span>',$this->active ? 'primary' : 'danger',$this->active ? 'Active' : 'Inactive');
|
||||
return sprintf('%02s-%04s',$this->site_id,$this->id);
|
||||
}
|
||||
|
||||
public function getAccountIdUrlAttribute()
|
||||
{
|
||||
return sprintf('<a href="/r/account/view/%s">%s</a>',$this->id,$this->account_id);
|
||||
}
|
||||
|
||||
private function _address()
|
||||
{
|
||||
$return = [];
|
||||
|
||||
if ($this->address1)
|
||||
array_push($return,$this->address1);
|
||||
if ($this->address2)
|
||||
array_push($return,$this->address2);
|
||||
if ($this->city)
|
||||
array_push($return,sprintf('%s %s %s',$this->city.(($this->state OR $this->zip) ? ',' : ''),$this->state,$this->zip));
|
||||
|
||||
if (! $return)
|
||||
$return = ['No Address'];
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function address($type='plain')
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case 'html' : return join('<br>',$this->_address());
|
||||
case 'newline': return join("\m",$this->_address());
|
||||
|
||||
default:
|
||||
return join("\n",$this->_address());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user