-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add script on webpack.mix.js to compile page js
- Use mix() when loading js helpers - Set try catch handling at getFiles() function on webpack.mix.js - Create js helpers for page - Composer install spatie/laravel-enum - Create periodicity enum class - Create achievement repository class - Create form request on laporan pencapain new !check in - Change deprecated document.ready() of jquery function
- Loading branch information
Showing
17 changed files
with
520 additions
and
194 deletions.
There are no files selected for viewing
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,27 @@ | ||
<?php | ||
|
||
namespace App\Enum; | ||
|
||
use Spatie\Enum\Laravel\Enum; | ||
|
||
/** | ||
* @method static self yearly() | ||
* @method static self monthly() | ||
* @method static self weekly() | ||
* @method static self daily() | ||
*/ | ||
class Periodicity extends Enum | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected static function labels(): array | ||
{ | ||
return [ | ||
'yearly' => trans('Yearly'), | ||
'monthly' => trans('Monthly'), | ||
'weekly' => trans('Weekly'), | ||
'daily' => trans('Daily'), | ||
]; | ||
} | ||
} |
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
48 changes: 48 additions & 0 deletions
48
app/Http/Requests/Achievement/LaporanPencapaianNewCinChartRequest.php
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,48 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests\Achievement; | ||
|
||
use App\Enum\Periodicity; | ||
use App\Infrastructure\Foundation\Http\FormRequest; | ||
use Spatie\Enum\Laravel\Http\Requests\TransformsEnums; | ||
use Spatie\Enum\Laravel\Rules\EnumRule; | ||
|
||
/** | ||
* @property \App\Enum\Periodicity $periodicity | ||
*/ | ||
class LaporanPencapaianNewCinChartRequest extends FormRequest | ||
{ | ||
use TransformsEnums; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function authorize() | ||
{ | ||
return !is_null($this->user()); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
'start_date' => ['required', 'date_format:Y-m-d H:i:s'], | ||
'end_date' => ['required', 'date_format:Y-m-d H:i:s'], | ||
'periodicity' => ['sometimes', 'nullable', new EnumRule(Periodicity::class)], | ||
]; | ||
} | ||
|
||
/** | ||
* List of transformed enum from request. | ||
* | ||
* @return array | ||
*/ | ||
public function enums(): array | ||
{ | ||
return [ | ||
'periodicity' => Periodicity::class, | ||
]; | ||
} | ||
} |
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,47 @@ | ||
<?php | ||
|
||
namespace App\Repositories; | ||
|
||
use App\Enum\Periodicity; | ||
use App\Models\Branch; | ||
use Illuminate\Support\Carbon; | ||
|
||
class AchievementRepository | ||
{ | ||
/** | ||
* Return chart data of laporan pencapaian new cin. | ||
* | ||
* @param \Illuminate\Support\Carbon $startDate | ||
* @param \Illuminate\Support\Carbon $endDate | ||
* @param \App\Enum\Periodicity $periodicity | ||
* @return array | ||
*/ | ||
public function chartLaporanPencapaianNewCin(Carbon $startDate, Carbon $endDate, Periodicity $periodicity): array | ||
{ | ||
$branches = Branch::all(); | ||
|
||
return [ | ||
'labels' => $branches->pluck('name'), | ||
'datasets' => [ | ||
[ | ||
'label' => trans('Number of New CiN'), | ||
'data' => $branches->map(fn (Branch $branch) => rand(1, 100)), | ||
'backgroundColor' => 'rgba(254,86,83,.7)', | ||
'borderColor' => 'rgba(254,86,83,.7)', | ||
'borderWidth' => 2.5, | ||
'pointBackgroundColor' => '#ffffff', | ||
'pointRadius' => 4, | ||
], | ||
[ | ||
'label' => trans(':periodicity target', ['periodicity' => $periodicity->label]), | ||
'data' => $branches->map(fn (Branch $branch) => rand(1, 100)), | ||
'backgroundColor' => 'rgba(63,82,227,.8)', | ||
'borderColor' => 'transparent', | ||
'borderWidth' => 0, | ||
'pointBackgroundColor' => '#999999', | ||
'pointRadius' => 4, | ||
], | ||
], | ||
]; | ||
} | ||
} |
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
Oops, something went wrong.