<?php
require_once(__DIR__.'/../includes/sysinit.php');
require(SABLE_WORKING_PATH.'sms_message/sms_message_func.php');
//**********************************************************************************
$_SESSION['listParams']['searchVisible'] = 1;
unset($_SESSION['module']['add']);
if (isset($_POST))
{
	$_SESSION['listParams']['searchField'][0] = 'sms_number';
	
	$_SESSION['listParams']['searchField'][1]['title'] = 'full_name';
	$_SESSION['listParams']['searchField'][1][0] = 'client_name';
	$_SESSION['listParams']['searchField'][1][1] = 'client_surname';	
	
	$_SESSION['listParams']['searchField'][2] = 'sms_timestamp';
	$_SESSION['listParams']['searchField'][3] = 'sms_timestamp';
	$_SESSION['listParams']['searchField'][4] = 'sms_message';
	$_SESSION['listParams']['searchField'][5] = 'sms_sent';
	$_SESSION['listParams']['searchField'][6] = 'sms_reply';
}

$_SESSION['listParams']['listSql'] = "select sms_id, sms_number, sms_message, sms_sent, sms_reply, 
									sms_timestamp,  concat(client_name, ' ', client_surname) as full_name 
									from sms_message 
									inner join client on client.client_id = sms_message.client_id";

$_SESSION['listParams']['module']					= "sms_message";
$_SESSION['listParams']['page']						= 0;
$_SESSION['listParams']['offset']					= 50; //the number of records to display per page
$_SESSION['listParams']['parentId']					= ""; //
$_SESSION['listParams']['moduleFolder']				= "sms_message";
$_SESSION['listParams']['moduleFolderDesc']			= "Sms Message";
$_SESSION['listParams']['modulePage']				= "index.php";
$_SESSION['listParams']['moduleIdField']			= "sms_id";
$_SESSION['listParams']['moduleDescField']			= "sms_number";
$_SESSION['listParams']['orderField']				= 2;
$_SESSION['listParams']['orderDirection']			= 1;

$_SESSION['listParams']['listHeadings'][0] = "Number";
$_SESSION['listParams']['listHeadings'][1] = "Client";
$_SESSION['listParams']['listHeadings'][2] = "Date";
$_SESSION['listParams']['listHeadings'][3] = "Time";
$_SESSION['listParams']['listHeadings'][4] = "Message";
$_SESSION['listParams']['listHeadings'][5] = "Sent?";
$_SESSION['listParams']['listHeadings'][6] = "Response";

$_SESSION['listParams']['listHeadingWidth'][0] = "7%";
$_SESSION['listParams']['listHeadingWidth'][1] = "10%";
$_SESSION['listParams']['listHeadingWidth'][2] = "7%";
$_SESSION['listParams']['listHeadingWidth'][3] = "7%";
$_SESSION['listParams']['listHeadingWidth'][4] = "45%";
$_SESSION['listParams']['listHeadingWidth'][5] = "5%";
$_SESSION['listParams']['listHeadingWidth'][6] = "15%";

$_SESSION['listParams']['listFields'][0]['field']			= "sms_number";
$_SESSION['listParams']['listFields'][0]['phoneLink']		= "1";
$_SESSION['listParams']['listFields'][0]['prefix']			= "+";

$_SESSION['listParams']['listFields'][1]['field']			= "full_name";

$_SESSION['listParams']['listFields'][2]['field']			= "sms_timestamp";
$_SESSION['listParams']['listFields'][2]['date']			= 1;
$_SESSION['listParams']['listFields'][3]['field']			= "sms_timestamp";
$_SESSION['listParams']['listFields'][3]['time']			= 1;

$_SESSION['listParams']['listFields'][4]['field']			= "sms_message";

$_SESSION['listParams']['listFields'][5]['field']			= "sms_sent";
$_SESSION['listParams']['listFields'][5]['yesNo']			= 1;
$_SESSION['listParams']['listFields'][5]['yesNoYes']		= "Yes";
$_SESSION['listParams']['listFields'][5]['yesNoNo']			= "No";

$_SESSION['listParams']['listFields'][6]['field']			= "sms_reply";


SableGeneralFunctions::callDataList();
