<?php
require_once __DIR__ . '/../init.php';
require_once PROJECT_ROOT . '/backend/controllers/common_function.php';
require_once PROJECT_ROOT . '/backend/controllers/db_select_helper.php';

class KehadiranController
{
    private $conn;
    private $table = "
        kehadiran K
        LEFT JOIN site S ON K.IDSite = S.IDSite
        LEFT JOIN anggota A ON K.IDAnggota = A.IDAnggota
    ";
    private $pk = "IDKehadiran";

    protected $displayedColumn = [
        'K.IDKehadiran',
        'K.IDShiftPegawaiDetail',
        'K.IDSite',
        'S.KodeSite',
        'S.NamaSite',
        'K.IsOOJ',
        'K.IsBackup',
        'K.TanggalKehadiran',
        'K.AbsenCounter',
        'K.IDAnggota',
        'A.KodeAnggota',
        'A.NamaAnggota',
        'K.JamMasukAktual',
        'K.JamKeluarAktual',
        'K.TotalJamKerja',
        'K.CatatanMasuk',
        'K.CatatanPulang',
        'K.GambarMasuk',
        'K.GambarKeluar',
        'K.ModeSimpanMasuk',
        'K.ModeSimpanKeluar',
        'K.RemarksPegawai',
        'K.RemarksAdmin',
        'K.GPS_In',
        'K.GPS_Out',
        'K.GPS_In_Lat',
        'K.GPS_In_Long',
        'K.GPS_Out_Lat',
        'K.GPS_Out_Long',
        'K.CreateBy',
        'K.CreateAt',
        'K.LastUpdateBy',
        'K.LastUpdateAt'
    ];

    public function __construct($conn)
    {
        $this->conn = $conn;
        
    }

    public function select($post)
    {
        return runSelect(
            $this->conn,
            $this->table,
            $this->pk,
            $this->displayedColumn,
            $post
        );
    }

    

}
?>