no message

This commit is contained in:
StudioTem committed 2023-12-12 15:24:10 +01:00
1 parent bb6528e5d1
commit 52fafc6aa9
4 files changed
+61 -2

No files matched your search

+5 -2
View File
@@ -13,8 +13,9 @@ class Vacation extends Api {
public $end_date;
public $type;
public $name;
public $approved;
public function __construct($intranet_id, $ldap_username, $start_date, $end_date, $type, $halfday) {
public function __construct($intranet_id, $ldap_username, $start_date, $end_date, $type, $halfday, $approved) {
$startend = $this->getStartEndDate($start_date, $end_date, $halfday, $ldap_username);
$this->intranet_id = $intranet_id;
@@ -23,13 +24,14 @@ class Vacation extends Api {
$this->end_date = (isset($startend['end'])) ? $startend['end'] : null;
$this->type = $type;
$this->name = $this->getVacationName($type);
$this->approved = $approved;
}
public static function fromDate($date) {
$vacations = self::getVacations($date);
return collect(array_map(function($vacation) {
return new Vacation( $vacation['id'], $vacation['user']['ldap_username'], $vacation['start_date'], $vacation['end_date'], $vacation['vacation_type']['name'], $vacation['halfday_position']);
return new Vacation( $vacation['id'], $vacation['user']['ldap_username'], $vacation['start_date'], $vacation['end_date'], $vacation['vacation_type']['name'], $vacation['halfday_position'], $vacation['approved']);
}, $vacations))->reject(function($vacation) {
return $vacation->user_id === null;
});
@@ -43,6 +45,7 @@ class Vacation extends Api {
'end' => date('Y-m-d H:i:s', strtotime($this->end_date)),
'type' => $this->type,
'name' => $this->name,
'approved' => $this->approved,
];
}