last from 01 2019
This commit is contained in:
parent
f9fcaac838
commit
ed80b25b85
19 changed files with 626 additions and 341 deletions
|
|
@ -65,6 +65,7 @@ class BookingDraftItem extends Model
|
|||
protected $fillable = [
|
||||
'booking_id',
|
||||
'travel_program_id',
|
||||
'fewo_lodging_id',
|
||||
'travel_class_id',
|
||||
'draft_item_id',
|
||||
'draft_type_id',
|
||||
|
|
@ -78,6 +79,7 @@ class BookingDraftItem extends Model
|
|||
'adult',
|
||||
'price_children',
|
||||
'children',
|
||||
'price',
|
||||
'pos',
|
||||
'in_pdf',
|
||||
'comfort',
|
||||
|
|
@ -104,6 +106,10 @@ class BookingDraftItem extends Model
|
|||
return $this->belongsTo('App\Models\DraftType', 'draft_type_id');
|
||||
}
|
||||
|
||||
public function _format_number($value){
|
||||
return preg_replace("/[^0-9,]/", "", $value);
|
||||
}
|
||||
|
||||
public function getStartDateAttribute(){
|
||||
return isset($this->attributes['start_date']) ? Carbon::parse($this->attributes['start_date'])->format("d.m.Y") : '';
|
||||
}
|
||||
|
|
@ -127,4 +133,21 @@ class BookingDraftItem extends Model
|
|||
}
|
||||
}
|
||||
|
||||
public function setPriceAttribute($value)
|
||||
{
|
||||
$value = $this->_format_number($value);
|
||||
$this->attributes['price'] = floatval(str_replace(',', '.', $value));
|
||||
}
|
||||
|
||||
public function getPriceAttribute()
|
||||
{
|
||||
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
|
||||
return number_format(($this->attributes['price']), 2, ',', '.');
|
||||
}
|
||||
|
||||
public function getPriceRaw()
|
||||
{
|
||||
return isset($this->attributes['price']) ? $this->attributes['price'] : 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,5 +106,22 @@ class DraftItem extends Model
|
|||
return isset($this->attributes['price_children']) ? $this->attributes['price_children'] : 0;
|
||||
}
|
||||
|
||||
public function setPriceAttribute($value)
|
||||
{
|
||||
$value = $this->_format_number($value);
|
||||
$this->attributes['price'] = floatval(str_replace(',', '.', $value));
|
||||
}
|
||||
|
||||
public function getPriceAttribute()
|
||||
{
|
||||
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
|
||||
return number_format(($this->attributes['price']), 2, ',', '.');
|
||||
}
|
||||
|
||||
public function getPriceRaw()
|
||||
{
|
||||
return isset($this->attributes['price']) ? $this->attributes['price'] : 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class DraftType extends Model
|
|||
protected $table = 'draft_types';
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'active',
|
||||
'name', 'active', 'color',
|
||||
];
|
||||
|
||||
public function draft_items()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue