<?php
require_once(__DIR__.'/../includes/sysinit.php');
require(SABLE_WORKING_PATH.'service/service_func.php');
//**********************************************************************************
$_SESSION['listParams']['searchVisible'] = 1;
if (isset($_POST))
{
	$_SESSION['listParams']['searchField'][0] = 'service_name';
	$_SESSION['listParams']['searchField'][1] = 'service_duration';
	$_SESSION['listParams']['searchField'][2] = 'service_price';
}
$_SESSION['module']['addlink'] = SableSystem::getCallPageLink('/service/add.php');

$_SESSION['listParams']['listSql'] = "select service_id, service_name, service_duration, service_price
									  from service";

$_SESSION['listParams']['module']					= "service";
$_SESSION['listParams']['page']						= 0;
$_SESSION['listParams']['offset']					= 50; //the number of records to display per page
$_SESSION['listParams']['parentId']					= ""; //
$_SESSION['listParams']['moduleFolder']				= "service";
$_SESSION['listParams']['moduleFolderDesc']			= "Service";
$_SESSION['listParams']['modulePage']				= "index.php";
$_SESSION['listParams']['moduleIdField']			= "service_id";
$_SESSION['listParams']['moduleDescField']			= "service_name";
$_SESSION['listParams']['orderField']				= 1;
$_SESSION['listParams']['orderDirection']			= 0;

$_SESSION['listParams']['listHeadings'][0] = "Service Name";
$_SESSION['listParams']['listHeadings'][1] = "Service Duration";
$_SESSION['listParams']['listHeadings'][2] = "Service Price";
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_USER){	$_SESSION['listParams']['listHeadings'][3] = "";} //Add
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_CLERK){	$_SESSION['listParams']['listHeadings'][4] = "";} //Edit
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_CLERK){	$_SESSION['listParams']['listHeadings'][5] = "";} //Copy
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_ADMIN){	$_SESSION['listParams']['listHeadings'][6] = "";} //Delete

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

$_SESSION['listParams']['listFields'][0]['field']			= "service_name";
$_SESSION['listParams']['listFields'][1]['field']			= "service_duration";
$_SESSION['listParams']['listFields'][1]['number']			= "1";
$_SESSION['listParams']['listFields'][1]['sprintf']			= "%01d";
$_SESSION['listParams']['listFields'][2]['field']			= "service_price";
$_SESSION['listParams']['listFields'][2]['currency']		= "1";
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_USER) 
{
	$_SESSION['listParams']['listFields'][3]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_VIEW."' title='View --!--'></i>";
	$_SESSION['listParams']['listFields'][3]['onClick'] = " onClick='viewService(\"--#--\")' ";
}
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_CLERK) 
{
	$_SESSION['listParams']['listFields'][4]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_EDIT."' title='Modify --!--'></i>";
	$_SESSION['listParams']['listFields'][4]['onClick'] = " onClick='editService(\"--#--\")' ";
	$_SESSION['listParams']['listFields'][5]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_COPY."' title='Copy --!--'></i>";
	$_SESSION['listParams']['listFields'][5]['onClick'] = " onClick='copyService(\"--#--\",\"--!--\")' ";	
}
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_ADMIN) 
{
	$_SESSION['listParams']['listFields'][6]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_DELETE."' title='Delete --!--'></i>";
	$_SESSION['listParams']['listFields'][6]['onClick'] = " onClick='deleteService(\"--#--\",\"--!--\")' ";
}
SableGeneralFunctions::callDataList();
