mirror of
https://github.com/Karaka-Management/oms-HumanResourceManagement.git
synced 2026-02-02 06:08:41 +00:00
continue hr implementation
This commit is contained in:
parent
9bccdfc223
commit
544e61a5d3
|
|
@ -54,21 +54,24 @@
|
|||
"hr_staff_history_unit": {
|
||||
"name": "hr_staff_history_unit",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "organization_unit",
|
||||
"foreignKey": "organization_unit_id"
|
||||
},
|
||||
"hr_staff_history_department": {
|
||||
"name": "hr_staff_history_department",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "organization_department",
|
||||
"foreignKey": "organization_department_id"
|
||||
},
|
||||
"hr_staff_history_position": {
|
||||
"name": "hr_staff_history_position",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "organization_position",
|
||||
"foreignKey": "organization_position_id"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -205,6 +205,20 @@ class Employee implements ArrayableInterface, \JsonSerializable
|
|||
return $this->companyHistory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add company history to employee
|
||||
*
|
||||
* @param mixed $history Company history
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function addHistory($history) : void
|
||||
{
|
||||
$this->companyHistory[] = $history;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get newest company history.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -41,17 +41,53 @@ class EmployeeHistory implements ArrayableInterface, \JsonSerializable
|
|||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
private $employee = null;
|
||||
/**
|
||||
* Employee
|
||||
*
|
||||
* @var int|Employee
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $employee = 0;
|
||||
|
||||
private $unit = 0;
|
||||
/**
|
||||
* Unit
|
||||
*
|
||||
* @var null|int|Unit
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $unit = null;
|
||||
|
||||
private $department = 0;
|
||||
/**
|
||||
* Department
|
||||
*
|
||||
* @var null|int|Department
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $department = null;
|
||||
|
||||
private $position = 0;
|
||||
/**
|
||||
* Position
|
||||
*
|
||||
* @var null|int|Position
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $position = null;
|
||||
|
||||
private $start = null;
|
||||
/**
|
||||
* Start date
|
||||
*
|
||||
* @var \DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private \DateTime $start;
|
||||
|
||||
private $end = null;
|
||||
/**
|
||||
* End date
|
||||
*
|
||||
* @var null|\DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private ?\DateTime $end = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
@ -75,61 +111,159 @@ class EmployeeHistory implements ArrayableInterface, \JsonSerializable
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the employee this history belongs to
|
||||
*
|
||||
* @return int|Employee
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getEmployee()
|
||||
{
|
||||
return $this->employee ?? new NullEmployee();
|
||||
return empty($this->employee) ? new NullEmployee() : $this->employee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the employee
|
||||
*
|
||||
* @param int|Employee $employee Employee
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo maybe only do this in the constructor
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setEmployee($employee) : void
|
||||
{
|
||||
$this->employee = $employee;
|
||||
}
|
||||
|
||||
public function getPosition() : Position
|
||||
/**
|
||||
* Get the position
|
||||
*
|
||||
* @return int|Position
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getPosition()
|
||||
{
|
||||
return $this->position ?? new NullPosition();
|
||||
return empty($this->position) ? new NullPosition() : $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position
|
||||
*
|
||||
* @param int|Position $position Position
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setPosition($position) : void
|
||||
{
|
||||
$this->position = $position;
|
||||
}
|
||||
|
||||
public function getUnit() : Unit
|
||||
/**
|
||||
* Get the unit
|
||||
*
|
||||
* @return int|Unit
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getUnit()
|
||||
{
|
||||
return $this->unit ?? new NullUnit();
|
||||
return empty($this->unit) ? new NullUnit() : $this->unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the unit
|
||||
*
|
||||
* @param int|Unit $unit Unit
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setUnit($unit) : void
|
||||
{
|
||||
$this->unit = $unit;
|
||||
}
|
||||
|
||||
public function getDepartment() : Department
|
||||
/**
|
||||
* Get the department
|
||||
*
|
||||
* @return int|Department
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDepartment()
|
||||
{
|
||||
return $this->department ?? new NullDepartment();
|
||||
return empty($this->department) ? new NullDepartment() : $this->department;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the department
|
||||
*
|
||||
* @param int|Department $department Department
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDepartment($department) : void
|
||||
{
|
||||
$this->department = $department;
|
||||
}
|
||||
|
||||
public function getStart() : ?\DateTime
|
||||
/**
|
||||
* Get start date
|
||||
*
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStart() : \DateTime
|
||||
{
|
||||
return $this->start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set start date
|
||||
*
|
||||
* @param \DateTime $start Start date
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setStart(\DateTime $start) : void
|
||||
{
|
||||
$this->start = $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get end date
|
||||
*
|
||||
* @return null|\DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getEnd() : ?\DateTime
|
||||
{
|
||||
return $this->end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set end date
|
||||
*
|
||||
* @param \DateTime $end End date
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setEnd(\DateTime $end) : void
|
||||
{
|
||||
$this->end = $end;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,10 @@ final class EmployeeHistoryMapper extends DataMapperAbstract
|
|||
'mapper' => PositionMapper::class,
|
||||
'src' => 'hr_staff_history_position',
|
||||
],
|
||||
'employee' => [
|
||||
'mapper' => EmployeeMapper::class,
|
||||
'src' => 'hr_staff_history_staff',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('ID', '0', '0') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Name') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getProfile()->getAccount()->getName1()); ?></a>
|
||||
<td><?= $value->getNewestHistory()->getUnit()->getName(); ?>
|
||||
<td><?= $value->getNewestHistory()->getPosition()->getName(); ?>
|
||||
<td><?= $value->getNewestHistory()->getDepartment()->getName(); ?>
|
||||
<td><?= $this->printHtml($value->getNewestHistory()->getUnit()->getName()); ?>
|
||||
<td><?= $this->printHtml($value->getNewestHistory()->getPosition()->getName()); ?>
|
||||
<td><?= $this->printHtml($value->getNewestHistory()->getDepartment()->getName()); ?>
|
||||
<td><?= !($value->getNewestHistory() instanceof NullEmployeeHistory) ? $this->getHtml('Active') : $this->getHtml('Inactive'); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($c === 0) : ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user