-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
176 additions
and
13 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
services: | ||
KejawenLab\Application\SemartHris\Twig\SemartHrisAttendanceTwigExtension: | ||
KejawenLab\Application\SemartHris\Twig\AttendanceExtension: | ||
lazy: true | ||
arguments: | ||
- '@KejawenLab\Application\SemartHris\Repository\EmployeeRepository' | ||
- '@KejawenLab\Application\SemartHris\Repository\ReasonRepository' | ||
- 'KejawenLab\Application\SemartHris\Entity\Attendance' | ||
tags: | ||
- { name: 'twig.extension' } | ||
|
||
KejawenLab\Application\SemartHris\Twig\HolidayExtension: | ||
lazy: true | ||
arguments: | ||
- '@KejawenLab\Application\SemartHris\Repository\HolidayRepository' | ||
tags: | ||
- { name: 'twig.extension' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
- { code: 'SSI', name: 'PT. SEMART SOLUSI INDONESIA', birthDay: 'date:2017-11-27', email: 'admin@kejawenlab.com', taxNumber: '338-00-0912-244' } | ||
- { code: 'SSI', name: 'PT. SEMART SOLUSI INDONESIA', birthDay: 'date:17-11-1977', email: 'admin@kejawenlab.com', taxNumber: '338-00-0912-244' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- { holidayDate: 'year:10-11', name: 'HARI PAHLAWAN' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace KejawenLab\Application\SemartHris\DataFixtures\ORM; | ||
|
||
use KejawenLab\Application\SemartHris\Entity\Holiday; | ||
|
||
/** | ||
* @author Muhamad Surya Iksanudin <surya.iksanudin@kejawenlab.id> | ||
*/ | ||
class HolidayFixtures extends Fixture | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
protected function getFixtureFilePath(): string | ||
{ | ||
return 'holiday.yaml'; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
protected function createNew() | ||
{ | ||
return new Holiday(); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getReferenceKey(): string | ||
{ | ||
return 'holiday'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
namespace KejawenLab\Application\SemartHris\Twig; | ||
|
||
use KejawenLab\Application\SemartHris\Component\Holiday\Model\HolidayInterface; | ||
use KejawenLab\Application\SemartHris\Component\Holiday\Repository\HolidayRepositoryInterface; | ||
|
||
/** | ||
* @author Muhamad Surya Iksanudin <surya.iksanudin@kejawenlab.com> | ||
*/ | ||
class HolidayExtension extends \Twig_Extension | ||
{ | ||
/** | ||
* @var HolidayRepositoryInterface | ||
*/ | ||
private $holidayRepository; | ||
|
||
/** | ||
* @param HolidayRepositoryInterface $repository | ||
*/ | ||
public function __construct(HolidayRepositoryInterface $repository) | ||
{ | ||
$this->holidayRepository = $repository; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getFunctions(): array | ||
{ | ||
return array( | ||
new \Twig_SimpleFunction('semarthris_is_holiday', array($this, 'isHoliday')), | ||
new \Twig_SimpleFunction('semarthris_holiday', array($this, 'getHoliday')), | ||
new \Twig_SimpleFunction('semarthris_is_weekend_holiday', array($this, 'isWeekendHoliday')), | ||
); | ||
} | ||
|
||
/** | ||
* @param \DateTimeInterface $date | ||
* | ||
* @return bool | ||
*/ | ||
public function isHoliday(\DateTimeInterface $date): bool | ||
{ | ||
$holiday = $this->holidayRepository->isWeekendHoliday($date); | ||
if (!$holiday) { | ||
$holiday = $this->holidayRepository->isHoliday($date); | ||
} | ||
|
||
return $holiday; | ||
} | ||
|
||
/** | ||
* @param \DateTimeInterface $date | ||
* | ||
* @return HolidayInterface|null | ||
*/ | ||
public function getHoliday(\DateTimeInterface $date): ? HolidayInterface | ||
{ | ||
return $this->holidayRepository->getHoliday($date); | ||
} | ||
|
||
/** | ||
* @param \DateTimeInterface $date | ||
* | ||
* @return bool | ||
*/ | ||
public function isWeekendHoliday(\DateTimeInterface $date): bool | ||
{ | ||
return $this->holidayRepository->isWeekendHoliday($date); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters