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

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

    $query             = "SELECT a.category_id, a.category_mode, a.created_at, b.title FROM redeem_category a
                          LEFT JOIN redeem_category_translation b ON ( a.category_id = b.category_id )
                          WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."' AND ( ( a.receiver_type IN ( '0' ) ) OR ( a.receiver_type IN ( '1', '2' ) AND a.staff_id LIKE '%/".$staff_info['staff_id']."/%' ) ) AND a.status = 'active' AND ( a.category_type = 'all' OR ( a.category_type = 'date' AND a.date_start <= '".TODAYDAY."' AND a.date_end >= '".TODAYDAY."' ) )" ;
    $mysqli_query      = $mysqli->query( $query . " ORDER BY a.sortable ASC" ) ;

    if ( $mysqli_query->num_rows > 0 ){

        $status        = '200' ;

        $list          = [] ;
        while ( $row   = $mysqli_query->fetch_assoc() ){
            $row['id']      = dataFilter( $row['category_id'] ) ;
            $row['title']   = dataFilter( $row['title'] ) ;
            $list[]         = $row ;
        }

        $data['list']  = $list ;

    }
}

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