<?php
require_once(__DIR__.'/../includes/sysinit.php');
require(SABLE_WORKING_PATH.'client/client_func.php');
//**********************************************************************************
$_SESSION['listParams']['searchVisible'] = 1;
if (isset($_POST))
{
	$_SESSION['listParams']['searchField'][0]['title'] = 'client_full_name';
	$_SESSION['listParams']['searchField'][0][0] = 'client_name';
	$_SESSION['listParams']['searchField'][0][1] = 'client_surname';
	$_SESSION['listParams']['searchField'][1] = 'client_cell';
	$_SESSION['listParams']['searchField'][2] = 'client_phone';
	$_SESSION['listParams']['searchField'][3] = 'client_email';
}

$_SESSION['listParams']['listSql'] = "select client_id, concat(client_name, ' ', client_surname) as client_full_name, client_cell, 
									  client_phone, client_email
									  from client";

$_SESSION['listParams']['module']					= "client";
$_SESSION['listParams']['page']						= 0;
$_SESSION['listParams']['offset']					= 30; //the number of records to display per page
$_SESSION['listParams']['parentId']					= ""; //
$_SESSION['listParams']['moduleFolder']				= "client";
$_SESSION['listParams']['moduleFolderDesc']			= "Client";
$_SESSION['listParams']['modulePage']				= "index.php";
$_SESSION['listParams']['moduleIdField']			= "client_id";
$_SESSION['listParams']['moduleDescField']			= "client_full_name";
$_SESSION['listParams']['orderField']				= 0;
$_SESSION['listParams']['orderDirection']			= 0;

$_SESSION['listParams']['listHeadings'][0] = "Name";
$_SESSION['listParams']['listHeadings'][1] = "Cell No.";
$_SESSION['listParams']['listHeadings'][2] = "Phone No.";
$_SESSION['listParams']['listHeadings'][3] = "Email";
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_USER){	$_SESSION['listParams']['listHeadings'][4] = "";} //Add
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_CLERK){	$_SESSION['listParams']['listHeadings'][5] = "";} //Edit
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_MANAGER){	$_SESSION['listParams']['listHeadings'][6] = "";} //View Buildings
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_MANAGER){	$_SESSION['listParams']['listHeadings'][7] = "";} //Delete

$_SESSION['listParams']['listHeadingWidth'][0] = "25%";
$_SESSION['listParams']['listHeadingWidth'][1] = "15%";
$_SESSION['listParams']['listHeadingWidth'][2] = "15%";
$_SESSION['listParams']['listHeadingWidth'][3] = "25%";
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_USER){	$_SESSION['listParams']['listHeadingWidth'][4] = "5%";} //View
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_CLERK){	$_SESSION['listParams']['listHeadingWidth'][5] = "5%";} //Edit
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_MANAGER){	$_SESSION['listParams']['listHeadingWidth'][6] = "5%";} //View Buildings
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_MANAGER){	$_SESSION['listParams']['listHeadingWidth'][7] = "5%";} //Delete

$_SESSION['listParams']['listFields'][0]['field']			= "client_full_name";
$_SESSION['listParams']['listFields'][1]['field']			= "client_cell";
$_SESSION['listParams']['listFields'][2]['field']			= "client_phone";
$_SESSION['listParams']['listFields'][3]['field']			= "client_email";
$_SESSION['listParams']['listFields'][3]['emailLink']		= "1";
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_USER) 
{
	$_SESSION['listParams']['listFields'][4]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_VIEW."' title='View --!--'></i>";
	$_SESSION['listParams']['listFields'][4]['onClick'] = " onClick='viewClient(\"--#--\")' ";
}
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_CLERK) 
{
	$_SESSION['listParams']['listFields'][5]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_EDIT."' title='Modify --!--'></i>";
	$_SESSION['listParams']['listFields'][5]['onClick'] = " onClick='editClient(\"--#--\")' ";
}
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_MANAGER) 
{
	$_SESSION['listParams']['listFields'][6]['field'] = "<i class='fa fa-2x fa-paw' title='--!--&acute;s Buildings'></i>";
	$_SESSION['listParams']['listFields'][6]['onClick'] = " onClick='viewBuildings(\"--#--\")' ";
	
	$_SESSION['listParams']['listFields'][7]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_DELETE."' title='Delete --!--'></i>";
	$_SESSION['listParams']['listFields'][7]['onClick'] = " onClick='deleteClient(\"--#--\",\"--!--\")' ";
}
SableGeneralFunctions::callDataList();
?>

