first init
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
# SUTERA 3.0 – Guide
|
||||
|
||||
Welcome to **SUTERA 3.0**, the streamlined training deployment setup using **Docker**, **Laravel**, and **Vite**.
|
||||
|
||||
---
|
||||
|
||||
## 🔐 Login Credentials
|
||||
|
||||
> Use the following to log into the system:
|
||||
|
||||
- **Email**: `isml.msrn11@gmail.com`
|
||||
- **Password**: `TOPAZTHEGOAT`
|
||||
|
||||
---
|
||||
|
||||
## Formula Used:
|
||||
1. KEUPAYAAN (%) = (PEGANGAN/PERJAWATAN) * 100
|
||||
2. SIAPSIAGA or KESIAGAAN (%) = (BDG/perjawatan) * 100
|
||||
3. SERVISIBILITI (%) = (BDG/pegangan) * 100
|
||||
|
||||
## Laravel command to clear
|
||||
```bash
|
||||
sail artisan config:clear
|
||||
sail artisan cache:clear
|
||||
sail artisan permission:cache-reset
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 🎯 Addtional Notes to consider
|
||||
- Make sure `/var/www/public/build` exists inside your PHP-FPM container (handled by Dockerfile).
|
||||
- Assets are built via Vite in the **Node.js stage** and injected into the Laravel `public/` directory.
|
||||
- Use `entrypoint.sh` for Laravel setup like `php artisan migrate` or `storage:link` if needed.
|
||||
- 'DEVELOPER' roles can bypassed all permissions by default and cannot be deleted even through database
|
||||
- Use delete in controller not directly in routes because no authorization and validation
|
||||
- Use Gate for non-model-specific permissions. general-purpose or simple logic,
|
||||
- Use policy when need structured authorization for CRUD operations. anything tied to a model/resource
|
||||
- Servisibility always higher than siapsiaga
|
||||
- Solution — put specific routes first before resource routes
|
||||
- to use soft delete, make id and deleted_at as unique
|
||||
- to make new module, run:
|
||||
```bash
|
||||
sail artisan module:make Example
|
||||
```
|
||||
- There are two User model files
|
||||
|
||||
## PKJ Default Varian (DO NOT DELETE) or update. If require update, be sure to update the export name for each PKJ report:
|
||||
- BANTUAN MOBILITI
|
||||
- BEKALAN AIR
|
||||
- EOD/IED/PEMUSNAHAN
|
||||
- JURUUKUR
|
||||
- KENDERAAN JENIS A
|
||||
- KENDERAAN JENIS B
|
||||
- OPTRONIK DAN PERALATAN LATIHAN
|
||||
- PELURU DAN BAHAN LETUPAN
|
||||
- PEMUSNAHAN
|
||||
- PERALATAN KETUKANGAN
|
||||
- PERALATAN KOMUNIKASI PERTAHANAN
|
||||
- PERALATAN PD&P
|
||||
- PERALATAN PERAIRAN
|
||||
- PERALATAN PNBK
|
||||
- SENJATA PERTAHANAN
|
||||
|
||||
|
||||
```sql
|
||||
--- KJC TO UPDATE PEGANGAN IN PERJAWATAN TABLE; CHECK WILL BE UPDATED FIRST
|
||||
SELECT
|
||||
ae.id,
|
||||
ae.entitlement,
|
||||
ae.holding AS current_holding,
|
||||
(
|
||||
SELECT COUNT(*)
|
||||
FROM kjc_asset_holdings ah
|
||||
WHERE ah.kjc_category_id = ae.kjc_category_id
|
||||
AND ah.kjc_category_id = ae.kjc_category_id
|
||||
AND ah.unit_id = ae.unit_id
|
||||
AND ah.deleted_at IS NULL
|
||||
) AS actual_holding_count
|
||||
FROM kjc_asset_entitlements ae
|
||||
WHERE ae.deleted_at IS NULL;
|
||||
|
||||
--- EXECUTE IT
|
||||
UPDATE kjc_asset_entitlements ae
|
||||
SET ae.holding = (
|
||||
SELECT COUNT(*)
|
||||
FROM kjc_asset_holdings ah
|
||||
WHERE ah.kjc_category_id = ae.kjc_category_id
|
||||
AND ah.kjc_category_id = ae.kjc_category_id
|
||||
AND ah.unit_id = ae.unit_id
|
||||
AND ah.deleted_at IS NULL
|
||||
)
|
||||
WHERE ae.deleted_at IS NULL;
|
||||
```
|
||||
|
||||
## Run specific laravel migration:
|
||||
- If it is fresh, then run:
|
||||
```bash
|
||||
sail artisan migrate --path=database/migrations/2025_07_30_044653_create_historical_pkj_perjawatan_table.php
|
||||
```
|
||||
|
||||
- If not, rollback first:
|
||||
```bash
|
||||
sail artisan migrate:rollback --step=1
|
||||
|
||||
sail artisan migrate --path=database/migrations/2025_07_30_044708_create_historical_pkj_pegangan_status_table.php
|
||||
```
|
||||
|
||||
## To remove data in postgres and restart numbering
|
||||
```bash
|
||||
TRUNCATE TABLE kjc_spare_parts RESTART IDENTITY;
|
||||
```
|
||||
|
||||
## Reset query numbering
|
||||
```sql
|
||||
SELECT pg_get_serial_sequence('"permissions"', 'id') AS seq_name;
|
||||
SELECT last_value FROM public.permissions_id_seq;
|
||||
SELECT setval('public.permissions_id_seq', COALESCE((SELECT MAX(id) FROM permissions), 0) + 1, false);
|
||||
```
|
||||
|
||||
## Run capture data command
|
||||
```bash
|
||||
# kjc
|
||||
sail artisan kjc:historical:trigger
|
||||
|
||||
# pkj
|
||||
sail artisan pkj:historical:trigger
|
||||
```
|
||||
|
||||
## Auto-generate weekly KJC report (Jabatan Arah RAJD) - Scheduled to run every Monday at 3:00 AM.
|
||||
```bash
|
||||
# Manual trigger
|
||||
sail artisan kjc:auto-generate-weekly-report "Jabatan Arah RAJD"
|
||||
|
||||
# Force regenerate even if reports exist
|
||||
sail artisan kjc:auto-generate-weekly-report "Jabatan Arah RAJD" --force
|
||||
```
|
||||
|
||||
# Git
|
||||
## DO NOT RUN THIS BECAUSE IT WILL REMOVE ALL THE UNTAGGED FILES IN LOCAL
|
||||
```bash
|
||||
git reset --hard development # moves the current branch (e.g., main) to point exactly where development
|
||||
```
|
||||
Reference in New Issue
Block a user