<?php
$must_login             = true ;
$require_path           = '../../../' ;
$require_sub            = '../../' ;
require( $require_sub.'header.php' ) ;

if ( $boolean_login ){
    $status             = '200' ;

    $staffs             = [] ;
    $all_tier           = getAllTier( $array['lang'] ) ;

    // select all staff
    $select             = $mysqli->query( "SELECT a.staff_id, a.staff_idno, a.staff_name, a.staff_shortname, a.staff_tier FROM staff a
                                           WHERE a.deleted_at IS NULL AND a.branch_id = '".$array['branch_id']."' AND ( a.staff_date_resigned >= '".date("Y-m-d",time())."' OR a.staff_date_resigned = '0000-00-00' OR a.staff_date_resigned IS NULL ) AND a.staff_settings LIKE '%\"ismanager\":\"yes\"%'" ) ;

    if ( $select->num_rows > 0 ){
        while ( $row        = $select->fetch_assoc() ){
            $get_staff_tier = $all_tier[$row['staff_tier']] ;

            $staffs[]  = [
                'id'    => $row['staff_id'],
                'title' => dataFilter( $row['staff_shortname'] ) . ' ('.$row['staff_idno'].' / '.strtoupper( $get_staff_tier['title'] ).')',
                'name'  => dataFilter( $row['staff_name'] ),
                'tier'  => $get_staff_tier['level']
            ] ;
        }
    }

    $data               = [
        'staffs'        => $staffs
    ] ;
}

require( $require_sub.'footer.php' ) ;
?>