403Webshell
Server IP : 172.67.201.108  /  Your IP : 216.73.217.123
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/hotel-prod/public_html/mod/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/hotel-prod/public_html/mod/event_form.php
<?php include('_mod_security.php'); ?>
<?php
form_prep('events', 'basic_info');
if ($_POST['ajax_event_submitted'] == '1') :
	$config = HTMLPurifier_Config::createDefault();
	$purifier = new HTMLPurifier($config);
	$_POST['autoresponder_text'] = $purifier->purify($_POST['autoresponder_text']);
	form_reload_check();
	/*
	if (isset($_POST['active_tab'])) :
		$active_tab = $_POST['active_tab'];
	else :
		$active_tab = 'basic_info';
	endif;
	*/
	$ar_err = array();
	if (empty($_POST['event_name'])) :
		$ar_err['event_name'] = 'Event name is required!';
		$err_flag = true;
		$err_tab = 'basic_info';
	endif;
	if (empty($_POST['event_date'])) :
		$ar_err['event_date'] = 'Date is required!';
		$err_flag = true;
		$err_tab = 'basic_info';
	endif;
	if (empty($_POST['event_time'])) :
		$ar_err['event_time'] = 'Time is required!';
		$err_flag = true;
		$err_tab = 'basic_info';
	endif;
	if (!strtotime($_POST['event_date'] . ' ' . $_POST['event_time'])) :
		$ar_err['event_date_time'] = 'Event date/time is invalid!';
		$err_flag = true;
		$err_tab = 'basic_info';
	endif;
	if (!$err_flag) :
		if ($_POST['xsubmit'] == 'Copy') :
			$action = 'Add New';
			$_POST['event_name'] .= ' - Copy';
		endif;
		/* ***************** store photos **************** */
		if (isset($_FILES['online_rsvp_artwork']) && !empty($_FILES['online_rsvp_artwork']['tmp_name'])) :
			$check = getimagesize($_FILES['online_rsvp_artwork']['tmp_name']);
			if ($check !== false) :
				$target_dir = APP_ROOT_DIR . "/rsvp_artwork/";
				$ext = strtolower(pathinfo($_FILES['online_rsvp_artwork']['name'], PATHINFO_EXTENSION));
				if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'gif') :
					$file_id = bin2hex(openssl_random_pseudo_bytes(12)) . '.' . $ext;
					$source = $_FILES['online_rsvp_artwork']['tmp_name'];
					$dest = $target_dir . basename($file_id);
					//echo ' === source: '.$source.' === dest: '.$dest.' === ';
					if (move_uploaded_file($source, $dest)) :
						$_POST['online_rsvp_artwork'] = $file_id;
					else :
						die('Error uploading file ');
					endif;
				endif;
			endif;
		endif;
		/* ************************************************ */
		$set = "event_name = " . $db->quote(trim($_POST['event_name'])) . ", " .
			"event_date_time = " . nzdatetime($_POST['event_date'] . ' ' . $_POST['event_time']) . ", " .
			"invitation_1_date = " . nzdate($_POST['invitation_1_date']) . ", " .
			"invitation_2_date = " . nzdate($_POST['invitation_2_date']) . ", " .
			"invitation_3_date = " . nzdate($_POST['invitation_3_date']) . ", " .
			"invitation_4_date = " . nzdate($_POST['invitation_4_date']) . ", " .
			"invitation_5_date = " . nzdate($_POST['invitation_5_date']) . ", " .
			"reminder_email_sent = " . nzdate($_POST['reminder_email_sent']) . ", " .
			"photographer_1 = " . $db->quote(trim($_POST['photographer_1'])) . ", " .
			"photographer_2 = " . $db->quote(trim($_POST['photographer_2'])) . ", " .
			"photographer_3 = " . $db->quote(trim($_POST['photographer_3'])) . ", " .
			"photographer_4 = " . $db->quote(trim($_POST['photographer_4'])) . ", " .
			"marketing_company = " . $db->quote(trim($_POST['marketing_company'])) . ", " .
			"bus_memo = " . $db->quote(trim($_POST['bus_memo'])) . ", " .
			"bus = " . nz(trim($_POST['bus']), '0') . ", " .
			"posters = " . nz(trim($_POST['posters']), '0') . ", " .
			"event_venue_1 = " . $db->quote(trim($_POST['event_venue_1'])) . ", " .
			"event_type_1 = " . nz(trim($_POST['event_type_1']), '0') . ", " .
			"capacity_1 = " . nz(trim($_POST['capacity_1']), '0') . ", " .
			"sales_rep_id_1 = " . nz(trim($_POST['sales_rep_id_1']), '0') . ", " .
			"venue_1_address = " . $db->quote(trim($_POST['venue_1_address'])) . ", " .
			"venue_1_cross_streets = " . $db->quote(trim($_POST['venue_1_cross_streets'])) . ", " .
			"venue_1_contact_1 = " . $db->quote(trim($_POST['venue_1_contact_1'])) . ", " .
			"venue_1_contact_2 = " . $db->quote(trim($_POST['venue_1_contact_2'])) . ", " .
			"venue_1_contact_3 = " . $db->quote(trim($_POST['venue_1_contact_3'])) . ", " .
			"venue_1_phone_1 = " . $db->quote(trim($_POST['venue_1_phone_1'])) . ", " .
			"venue_1_phone_2 = " . $db->quote(trim($_POST['venue_1_phone_2'])) . ", " .
			"venue_1_phone_3 = " . $db->quote(trim($_POST['venue_1_phone_3'])) . ", " .
			"venue_1_email_1 = " . $db->quote(trim($_POST['venue_1_email_1'])) . ", " .
			"venue_1_email_2 = " . $db->quote(trim($_POST['venue_1_email_2'])) . ", " .
			"venue_1_email_3 = " . $db->quote(trim($_POST['venue_1_email_3'])) . ", " .
			"venue_1_event_review = " . $db->quote(trim($_POST['venue_1_event_review'])) . ", " .
			"event_venue_2 = " . $db->quote(trim($_POST['event_venue_2'])) . ", " .
			"event_type_2 = " . nz(trim($_POST['event_type_2']), '0') . ", " .
			"capacity_2 = " . nz(trim($_POST['capacity_2']), '0') . ", " .
			"sales_rep_id_2 = " . nz(trim($_POST['sales_rep_id_2']), '0') . ", " .
			"venue_2_address = " . $db->quote(trim($_POST['venue_2_address'])) . ", " .
			"venue_2_cross_streets = " . $db->quote(trim($_POST['venue_2_cross_streets'])) . ", " .
			"venue_2_contact_1 = " . $db->quote(trim($_POST['venue_2_contact_1'])) . ", " .
			"venue_2_contact_2 = " . $db->quote(trim($_POST['venue_2_contact_2'])) . ", " .
			"venue_2_contact_3 = " . $db->quote(trim($_POST['venue_2_contact_3'])) . ", " .
			"venue_2_phone_1 = " . $db->quote(trim($_POST['venue_2_phone_1'])) . ", " .
			"venue_2_phone_2 = " . $db->quote(trim($_POST['venue_2_phone_2'])) . ", " .
			"venue_2_phone_3 = " . $db->quote(trim($_POST['venue_2_phone_3'])) . ", " .
			"venue_2_email_1 = " . $db->quote(trim($_POST['venue_2_email_1'])) . ", " .
			"venue_2_email_2 = " . $db->quote(trim($_POST['venue_2_email_2'])) . ", " .
			"venue_2_email_3 = " . $db->quote(trim($_POST['venue_2_email_3'])) . ", " .
			"online_rsvp_enabled = " . nz(trim($_POST['online_rsvp_enabled']), '0') . ", " .
			"online_rsvp_expires = " . nzdate($_POST['online_rsvp_expires']) . ", " .
			"online_rsvp_artwork = " . $db->quote(trim($_POST['online_rsvp_artwork'])) . ", " .
			"online_rsvp_allow_guest = " . nz(trim($_POST['online_rsvp_allow_guest']), '0') . ", " .
			"online_rsvp_allow_guest_name = " . nz(trim($_POST['online_rsvp_allow_guest_name']), '0') . ", " .
			"online_rsvp_allow_corrections = " . nz(trim($_POST['online_rsvp_allow_corrections']), '0') . ", " .
			"online_rsvp_allow_association_guests = " . nz(trim($_POST['online_rsvp_allow_association_guests']), '0') . ", " .
			"online_rsvp_allow_association_guests_new = " . nz(trim($_POST['online_rsvp_allow_association_guests_new']), '0') . ", " .
			"online_rsvp_require_cell_phone = " . nz(trim($_POST['online_rsvp_require_cell_phone']), '0') . ", " .
			"online_rsvp_enforce_capacity_limit = " . nz(trim($_POST['online_rsvp_enforce_capacity_limit']), '0') . ", " .
			"online_rsvp_capacity_limit_waitlist = " . nz(trim($_POST['online_rsvp_capacity_limit_waitlist']), '0') . ", " .
			"online_rsvp_unauthorized_text = " . $db->quote(trim($_POST['online_rsvp_unauthorized_text'])) . ", " .
			"online_rsvp_invalid_unauthorized_text = " . $db->quote(trim($_POST['online_rsvp_invalid_unauthorized_text'])) . ", " .
			"master_event = " . nz(trim($_POST['master_event']), '0') . ", " .
			"master_event_id = " . nz(trim($_POST['master_event_id']), '0') . ", " .
			"autoresponder_send = " . nz(trim($_POST['autoresponder_send']), '0') . ", " .
			"autoresponder_subject = " . $db->quote(trim($_POST['autoresponder_subject'])) . ", " .
			"autoresponder_bcc = " . $db->quote(trim($_POST['autoresponder_bcc'])) . ", " .
			"autoresponder_text = " . $db->quote(trim($_POST['autoresponder_text'])) . ", " .
			"cg_rewards_applied = " . nz(trim($_POST['cg_rewards_applied']), '0') . ", " .
			//"batch_email_subject = " . $db->quote(trim($_POST['batch_email_subject'])) . ", " .
			//"batch_email_bcc = " . $db->quote(trim($_POST['batch_email_bcc'])) . ", " .
			//"batch_email_text = " . $db->quote(trim($_POST['batch_email_text'])) . ", " .
			//"batch_email_calendar_link = " . nz(trim($_POST['batch_email_calendar_link']), '0') . ", " .
			"comments = " . $db->quote(trim($_POST['comments'])) . ", " .
			sql_set_update();
		if ($action == 'Edit') :
			$sql = "UPDATE events set " . $set .
				"WHERE event_id = " . nz(trim($_REQUEST['id']), '0') . " ";
			$db->query($sql) or die('Database Error!');
			//echo '==='.$sql.'===';
			post_set_update();
		else :
			if ($action == 'Add New') :
				$sql = "INSERT INTO events SET " .
					sql_set_create() .
					$set;
				//echo '==='.$sql.'===';
				$db->query($sql) or die('Database Error!');
				$_REQUEST['id'] = last_id();
				$_POST['event_id'] = $_REQUEST['id'];
				post_set_create_update();
			endif;
		endif;
		$form_message = "Saved sucessfully!";
		form_uid_reset();
		if ($_POST['xsubmit'] == 'Save & Close' || $_POST['xsubmit'] == 'Copy') :
			echo "<SCRIPT>";
			//echo "window.location.href = 'index.php?IX=".$_REQUEST['ref']."'";
			echo "appstack_pop()";
			echo "</SCRIPT>";
		endif;
		if ($_POST['xsubmit'] == 'Save & New') :
			echo "<SCRIPT>";
			echo "window.location.href = 'index.php?IX=event_form&ref=" . urlencode($_REQUEST['ref']) . "'";
			echo "</SCRIPT>";
		endif;
	else :
		$active_tab = $err_tab;
		$form_message = "Errors found!";
	endif;
else :
	if ($action == 'Edit') :
		$sql = "SELECT * FROM events WHERE event_id = " . nz(trim($_REQUEST['id']), '0') . " ";
		$result = $db->query($sql) or die('Database Error!');
		if ($result->rowCount() > 0) :
			$row = $result->fetch(PDO::FETCH_OBJ);
			$_POST['event_id'] = $row->event_id;
			$_POST['event_name'] = $row->event_name;
			$_POST['event_date'] = nzdate_display($row->event_date_time);
			$_POST['event_time'] = nztime_display($row->event_date_time);
			$_POST['invitation_1_date'] = nzdate_display($row->invitation_1_date);
			$_POST['invitation_2_date'] = nzdate_display($row->invitation_2_date);
			$_POST['invitation_3_date'] = nzdate_display($row->invitation_3_date);
			$_POST['invitation_4_date'] = nzdate_display($row->invitation_4_date);
			$_POST['invitation_5_date'] = nzdate_display($row->invitation_5_date);
			$_POST['reminder_email_sent'] = nzdate_display($row->reminder_email_sent);
			$_POST['photographer_1'] = $row->photographer_1;
			$_POST['photographer_2'] = $row->photographer_2;
			$_POST['photographer_3'] = $row->photographer_3;
			$_POST['photographer_4'] = $row->photographer_4;
			$_POST['marketing_company'] = $row->marketing_company;
			$_POST['bus'] = $row->bus;
			$_POST['bus_memo'] = $row->bus_memo;
			$_POST['posters'] = $row->posters;
			$_POST['event_venue_1'] = $row->event_venue_1;
			$_POST['event_type_1'] = $row->event_type_1;
			$_POST['capacity_1'] = $row->capacity_1;
			$_POST['sales_rep_id_1'] = $row->sales_rep_id_1;
			$_POST['venue_1_address'] = $row->venue_1_address;
			$_POST['venue_1_cross_streets'] = $row->venue_1_cross_streets;
			$_POST['venue_1_contact_1'] = $row->venue_1_contact_1;
			$_POST['venue_1_contact_2'] = $row->venue_1_contact_2;
			$_POST['venue_1_contact_3'] = $row->venue_1_contact_3;
			$_POST['venue_1_phone_1'] = $row->venue_1_phone_1;
			$_POST['venue_1_phone_2'] = $row->venue_1_phone_2;
			$_POST['venue_1_phone_3'] = $row->venue_1_phone_3;
			$_POST['venue_1_email_1'] = $row->venue_1_email_1;
			$_POST['venue_1_email_2'] = $row->venue_1_email_2;
			$_POST['venue_1_email_3'] = $row->venue_1_email_3;
			$_POST['venue_1_event_review'] = $row->venue_1_event_review;
			$_POST['event_venue_2'] = $row->event_venue_2;
			$_POST['event_type_2'] = $row->event_type_2;
			$_POST['capacity_2'] = $row->capacity_2;
			$_POST['sales_rep_id_2'] = $row->sales_rep_id_2;
			$_POST['venue_2_address'] = $row->venue_2_address;
			$_POST['venue_2_cross_streets'] = $row->venue_2_cross_streets;
			$_POST['venue_2_contact_1'] = $row->venue_2_contact_1;
			$_POST['venue_2_contact_2'] = $row->venue_2_contact_2;
			$_POST['venue_2_contact_3'] = $row->venue_2_contact_3;
			$_POST['venue_2_phone_1'] = $row->venue_2_phone_1;
			$_POST['venue_2_phone_2'] = $row->venue_2_phone_2;
			$_POST['venue_2_phone_3'] = $row->venue_2_phone_3;
			$_POST['venue_2_email_1'] = $row->venue_2_email_1;
			$_POST['venue_2_email_2'] = $row->venue_2_email_2;
			$_POST['venue_2_email_3'] = $row->venue_2_email_3;
			$_POST['online_rsvp_enabled'] = $row->online_rsvp_enabled;
			$_POST['online_rsvp_expires'] = nzdate_display($row->online_rsvp_expires);
			$_POST['online_rsvp_allow_guest'] = $row->online_rsvp_allow_guest;
			$_POST['online_rsvp_allow_guest_name'] = $row->online_rsvp_allow_guest_name;
			$_POST['online_rsvp_allow_corrections'] = $row->online_rsvp_allow_corrections;
			$_POST['online_rsvp_allow_association_guests'] = $row->online_rsvp_allow_association_guests;
			$_POST['online_rsvp_allow_association_guests_new'] = $row->online_rsvp_allow_association_guests_new;
			$_POST['online_rsvp_require_cell_phone'] = $row->online_rsvp_require_cell_phone;
			$_POST['online_rsvp_enforce_capacity_limit'] = $row->online_rsvp_enforce_capacity_limit;
			$_POST['online_rsvp_capacity_limit_waitlist'] = $row->online_rsvp_capacity_limit_waitlist;
			$_POST['online_rsvp_unauthorized_text'] = $row->online_rsvp_unauthorized_text;
			$_POST['online_rsvp_invalid_unauthorized_text'] = $row->online_rsvp_invalid_unauthorized_text;
			$_POST['online_rsvp_artwork'] = $row->online_rsvp_artwork;
			$_POST['master_event'] = $row->master_event;
			$_POST['master_event_id'] = $row->master_event_id;
			$_POST['autoresponder_send'] = $row->autoresponder_send;
			$_POST['autoresponder_subject'] = $row->autoresponder_subject;
			$_POST['autoresponder_bcc'] = $row->autoresponder_bcc;
			$_POST['autoresponder_text'] = $row->autoresponder_text;
			//$_POST['batch_email_subject'] = $row->batch_email_subject;
			//$_POST['batch_email_bcc'] = $row->batch_email_bcc;
			//$_POST['batch_email_text'] = $row->batch_email_text;
			//$_POST['batch_email_calendar_link'] = $row->batch_email_calendar_link;
			$_POST['comments'] = $row->comments;
			$_POST['cg_rewards_applied'] = $row->cg_rewards_applied;
			post_set_load_create_update();
		else :
			echo form_fatal_error('Invalid Operation!');
			return;
		endif;
	else :
	endif;
endif;

?>

<script>
	var active_page = '<?php echo $_REQUEST['IX']; ?>';
	var active_tab = '';

	event_concierge_update = function(eid, cid, field, obj) {
		//alert($(obj).val());
		//alert($(obj).attr('type'));
		var value = $(obj).val();
		if ($(obj).attr('type').toLowerCase() == 'checkbox') {
			if (obj.checked) {
				value = 1;
			} else {
				value = 0;
			}
		}
		switch (field) {
			case 'rsvp_1':
				if (value == 1) {
					$("#ec_conf_1_" + cid).prop('disabled', false);
					$("#ec_conf_1_" + cid).prop('checked', false);
					$("#ec_cancel_1_" + cid).prop('disabled', false);
					$("#ec_cancel_1_" + cid).prop('checked', false);
					$("#ec_attended_1_" + cid).prop('disabled', false);
					$("#ec_attended_1_" + cid).prop('checked', true);
					$("#ec_wait_1_" + cid).prop('checked', false);
					$("#ec_nbr_of_guests_" + cid).prop('disabled', false);
					if ($("#ec_nbr_of_guests_" + cid).val() == '') {
						$("#ec_nbr_of_guests_" + cid).val('1');
					}
					if ($("#ec_nbr_of_guests_" + cid).val() > '1') {
						$("#ec_guest_name_" + cid).prop('disabled', false);
					}
				} else {
					$("#ec_conf_1_" + cid).prop('disabled', true);
					$("#ec_conf_1_" + cid).prop('checked', false);
					$("#ec_cancel_1_" + cid).prop('disabled', true);
					$("#ec_cancel_1_" + cid).prop('checked', false);
					$("#ec_attended_1_" + cid).prop('disabled', true);
					$("#ec_attended_1_" + cid).prop('checked', false);
					if (!$("#ec_wait_1_" + cid).prop('checked') && !$("#ec_rsvp_2_" + cid).prop('checked') && !$("#ec_wait_2_" + cid).prop('checked')) {
						$("#ec_nbr_of_guests_" + cid).prop('disabled', true);
						$("#ec_nbr_of_guests_" + cid).val('');
						$("#ec_guest_name_" + cid).prop('disabled', true);
						$("#ec_guest_name_" + cid).val('');
					}
				}
				break;
			case 'wait_1':
				if (value == 1) {
					$("#ec_rsvp_1_" + cid).prop('checked', false);
					$("#ec_conf_1_" + cid).prop('disabled', true);
					$("#ec_conf_1_" + cid).prop('checked', false);
					$("#ec_cancel_1_" + cid).prop('disabled', true);
					$("#ec_cancel_1_" + cid).prop('checked', false);
					$("#ec_attended_1_" + cid).prop('disabled', true);
					$("#ec_attended_1_" + cid).prop('checked', false);
					$("#ec_nbr_of_guests_" + cid).prop('disabled', false);
					if ($("#ec_nbr_of_guests_" + cid).val() == '') {
						$("#ec_nbr_of_guests_" + cid).val('1');
					}
					if ($("#ec_nbr_of_guests_" + cid).val() > '1') {
						$("#ec_guest_name_" + cid).prop('disabled', false);
					}
				} else {
					if (!$("#ec_wait_2_" + cid).prop('checked') && !$("#ec_rsvp_2_" + cid).prop('checked') && !$("#ec_rsvp_1_" + cid).prop('checked')) {
						$("#ec_nbr_of_guests_" + cid).prop('disabled', true);
						$("#ec_nbr_of_guests_" + cid).val('');
						$("#ec_guest_name_" + cid).prop('disabled', true);
						$("#ec_guest_name_" + cid).val('');
					}
				}
				break;
			case 'cancel_1':
				if (value == 1) {
					$("#ec_rsvp_1_" + cid).prop('disabled', true);
					$("#ec_rsvp_1_" + cid).prop('checked', false);
					$("#ec_conf_1_" + cid).prop('disabled', true);
					$("#ec_conf_1_" + cid).prop('checked', false);
					$("#ec_attended_1_" + cid).prop('disabled', true);
					$("#ec_attended_1_" + cid).prop('checked', false);
					if (!$("#ec_wait_2_" + cid).prop('checked') && !$("#ec_rsvp_2_" + cid).prop('checked') && !$("#ec_rsvp_2_" + cid).prop('checked')) {
						$("#ec_nbr_of_guests_" + cid).prop('disabled', true);
						$("#ec_nbr_of_guests_" + cid).val('');
						$("#ec_guest_name_" + cid).prop('disabled', true);
						$("#ec_guest_name_" + cid).val('');
					}
				} else {
					$("#ec_rsvp_1_" + cid).prop('disabled', false);
				}
				break;
			case 'rsvp_2':
				if (value == 1) {
					$("#ec_conf_2_" + cid).prop('disabled', false);
					$("#ec_conf_2_" + cid).prop('checked', false);
					$("#ec_cancel_2_" + cid).prop('disabled', false);
					$("#ec_cancel_2_" + cid).prop('checked', false);
					$("#ec_attended_2_" + cid).prop('disabled', false);
					$("#ec_attended_2_" + cid).prop('checked', true);
					$("#ec_wait_2_" + cid).prop('checked', false);
					$("#ec_nbr_of_guests_" + cid).prop('disabled', false);
					if ($("#ec_nbr_of_guests_" + cid).val() == '') {
						$("#ec_nbr_of_guests_" + cid).val('1');
					}
					if ($("#ec_nbr_of_guests_" + cid).val() > '1') {
						$("#ec_guest_name_" + cid).prop('disabled', false);
					}
				} else {
					$("#ec_conf_2_" + cid).prop('disabled', true);
					$("#ec_conf_2_" + cid).prop('checked', false);
					$("#ec_cancel_2_" + cid).prop('disabled', true);
					$("#ec_cancel_2_" + cid).prop('checked', false);
					$("#ec_attended_2_" + cid).prop('disabled', true);
					$("#ec_attended_2_" + cid).prop('checked', false);
					if (!$("#ec_wait_2_" + cid).prop('checked') && !$("#ec_rsvp_1_" + cid).prop('checked') && !$("#ec_wait_1_" + cid).prop('checked')) {
						$("#ec_nbr_of_guests_" + cid).prop('disabled', true);
						$("#ec_nbr_of_guests_" + cid).val('');
						$("#ec_guest_name_" + cid).prop('disabled', true);
						$("#ec_guest_name_" + cid).val('');
					}
				}
				break;
			case 'wait_2':
				if (value == 1) {
					$("#ec_rsvp_2_" + cid).prop('checked', false);
					$("#ec_conf_2_" + cid).prop('disabled', true);
					$("#ec_conf_2_" + cid).prop('checked', false);
					$("#ec_cancel_2_" + cid).prop('disabled', true);
					$("#ec_cancel_2_" + cid).prop('checked', false);
					$("#ec_attended_2_" + cid).prop('disabled', true);
					$("#ec_attended_2_" + cid).prop('checked', false);
					$("#ec_nbr_of_guests_" + cid).prop('disabled', false);
					if ($("#ec_nbr_of_guests_" + cid).val() == '') {
						$("#ec_nbr_of_guests_" + cid).val('1');
					}
					if ($("#ec_nbr_of_guests_" + cid).val() > '1') {
						$("#ec_guest_name_" + cid).prop('disabled', false);
					}
				} else {
					if (!$("#ec_wait_1_" + cid).prop('checked') && !$("#ec_rsvp_1_" + cid).prop('checked') && !$("#ec_rsvp_2_" + cid).prop('checked')) {
						$("#ec_nbr_of_guests_" + cid).prop('disabled', true);
						$("#ec_nbr_of_guests_" + cid).val('');
						$("#ec_guest_name_" + cid).prop('disabled', true);
						$("#ec_guest_name_" + cid).val('');
					}
				}
				break;
			case 'cancel_2':
				if (value == 1) {
					$("#ec_rsvp_2_" + cid).prop('disabled', true);
					$("#ec_rsvp_2_" + cid).prop('checked', false);
					$("#ec_conf_2_" + cid).prop('disabled', true);
					$("#ec_conf_2_" + cid).prop('checked', false);
					$("#ec_attended_2_" + cid).prop('disabled', true);
					$("#ec_attended_2_" + cid).prop('checked', false);
					if (!$("#ec_wait_1_" + cid).prop('checked') && !$("#ec_rsvp_1_" + cid).prop('checked') && !$("#ec_rsvp_1_" + cid).prop('checked')) {
						$("#ec_nbr_of_guests_" + cid).prop('disabled', true);
						$("#ec_nbr_of_guests_" + cid).val('');
						$("#ec_guest_name_" + cid).prop('disabled', true);
						$("#ec_guest_name_" + cid).val('');
					}
				} else {
					$("#ec_rsvp_2_" + cid).prop('disabled', false);
				}
				break;
			case 'nbr_of_guests':
				if ($("#ec_nbr_of_guests_" + cid).val() > '1') {
					$("#ec_guest_name_" + cid).prop('disabled', false);
				} else {
					$("#ec_guest_name_" + cid).prop('disabled', true);
					$("#ec_guest_name_" + cid).val('');
				}
				break;
		}
		$('#ajax_update_concierges').load('ajax.php?call=event_ajax&function=concierge' +
			'&cid=' + cid +
			'&eid=' + eid +
			'&rsvp_1=' + val_checkbox($('#ec_rsvp_1_' + cid + ':checked').val()) +
			'&conf_1=' + val_checkbox($('#ec_conf_1_' + cid + ':checked').val()) +
			'&cancel_1=' + val_checkbox($('#ec_cancel_1_' + cid + ':checked').val()) +
			'&attended_1=' + val_checkbox($('#ec_attended_1_' + cid + ':checked').val()) +
			'&wait_1=' + val_checkbox($('#ec_wait_1_' + cid + ':checked').val()) +
			'&rsvp_2=' + val_checkbox($('#ec_rsvp_2_' + cid + ':checked').val()) +
			'&conf_2=' + val_checkbox($('#ec_conf_2_' + cid + ':checked').val()) +
			'&cancel_2=' + val_checkbox($('#ec_cancel_2_' + cid + ':checked').val()) +
			'&attended_2=' + val_checkbox($('#ec_attended_2_' + cid + ':checked').val()) +
			'&wait_2=' + val_checkbox($('#ec_wait_2_' + cid + ':checked').val()) +
			'&nbr_of_guests=' + $('#ec_nbr_of_guests_' + cid).val() +
			'&guest_name=' + encodeURI($('#ec_guest_name_' + cid).val()),
			function() {
				if ($('#ajax_update_concierges').html().toLowerCase == 'error') {
					alert('Error!');
				} else {
					$('#db_grid_concierges_extra_data').text($('#ajax_update_concierges').text());
				}
			});
	}

	event_guest_update = function(eid, gid, field, obj) {
		//alert($(obj).val());
		//alert($(obj).attr('type'));
		var value = $(obj).val();
		if ($(obj).attr('type').toLowerCase() == 'checkbox') {
			if (obj.checked) {
				value = 1;
			} else {
				value = 0;
			}
		}
		switch (field) {
			case 'rsvp_1':
				if (value == 1) {
					$("#eg_conf_1_" + gid).prop('disabled', false);
					$("#eg_conf_1_" + gid).prop('checked', false);
					$("#eg_cancel_1_" + gid).prop('disabled', false);
					$("#eg_cancel_1_" + gid).prop('checked', false);
					$("#eg_attended_1_" + gid).prop('disabled', false);
					$("#eg_attended_1_" + gid).prop('checked', true);
					$("#eg_wait_1_" + gid).prop('checked', false);
					$("#eg_nbr_of_guests_" + gid).prop('disabled', false);
					if ($("#eg_nbr_of_guests_" + gid).val() == '') {
						$("#eg_nbr_of_guests_" + gid).val('1');
					}
					if ($("#eg_nbr_of_guests_" + gid).val() > '1') {
						$("#eg_guest_name_" + gid).prop('disabled', false);
					}
					$("#eg_invitor_" + gid).prop('disabled', false);
				} else {
					$("#eg_conf_1_" + gid).prop('disabled', true);
					$("#eg_conf_1_" + gid).prop('checked', false);
					$("#eg_cancel_1_" + gid).prop('disabled', true);
					$("#eg_cancel_1_" + gid).prop('checked', false);
					$("#eg_attended_1_" + gid).prop('disabled', true);
					$("#eg_attended_1_" + gid).prop('checked', false);
					if (!$("#eg_wait_1_" + gid).prop('checked') && !$("#eg_rsvp_2_" + gid).prop('checked') && !$("#eg_wait_2_" + gid).prop('checked')) {
						$("#eg_nbr_of_guests_" + gid).prop('disabled', true);
						$("#eg_nbr_of_guests_" + gid).val('');
						$("#eg_guest_name_" + gid).prop('disabled', true);
						$("#eg_guest_name_" + gid).val('');
						$("#eg_invitor_" + gid).prop('disabled', true);
						$("#eg_invitor_" + gid).val('');
					}
				}
				break;
			case 'wait_1':
				if (value == 1) {
					$("#eg_rsvp_1_" + gid).prop('checked', false);
					$("#eg_conf_1_" + gid).prop('disabled', true);
					$("#eg_conf_1_" + gid).prop('checked', false);
					$("#eg_cancel_1_" + gid).prop('disabled', true);
					$("#eg_cancel_1_" + gid).prop('checked', false);
					$("#eg_attended_1_" + gid).prop('disabled', true);
					$("#eg_attended_1_" + gid).prop('checked', false);
					$("#eg_nbr_of_guests_" + gid).prop('disabled', false);
					if ($("#eg_nbr_of_guests_" + gid).val() == '') {
						$("#eg_nbr_of_guests_" + gid).val('1');
					}
					if ($("#eg_nbr_of_guests_" + gid).val() > '1') {
						$("#eg_guest_name_" + gid).prop('disabled', false);
					}
					$("#eg_invitor_" + gid).prop('disabled', false);
				} else {
					if (!$("#eg_wait_2_" + gid).prop('checked') && !$("#eg_rsvp_2_" + gid).prop('checked') && !$("#eg_rsvp_1_" + gid).prop('checked')) {
						$("#eg_nbr_of_guests_" + gid).prop('disabled', true);
						$("#eg_nbr_of_guests_" + gid).val('');
						$("#eg_guest_name_" + gid).prop('disabled', true);
						$("#eg_guest_name_" + gid).val('');
						$("#eg_invitor_" + gid).prop('disabled', true);
						$("#eg_invitor_" + gid).val('');
					}
				}
				break;
			case 'cancel_1':
				if (value == 1) {
					$("#eg_rsvp_1_" + gid).prop('disabled', true);
					$("#eg_rsvp_1_" + gid).prop('checked', false);
					$("#eg_conf_1_" + gid).prop('disabled', true);
					$("#eg_conf_1_" + gid).prop('checked', false);
					$("#eg_attended_1_" + gid).prop('disabled', true);
					$("#eg_attended_1_" + gid).prop('checked', false);
					if (!$("#eg_wait_2_" + gid).prop('checked') && !$("#eg_rsvp_2_" + gid).prop('checked') && !$("#eg_rsvp_2_" + gid).prop('checked')) {
						$("#eg_nbr_of_guests_" + gid).prop('disabled', true);
						$("#eg_nbr_of_guests_" + gid).val('');
						$("#eg_guest_name_" + gid).prop('disabled', true);
						$("#eg_guest_name_" + gid).val('');
						$("#eg_invitor_" + gid).prop('disabled', true);
						$("#eg_invitor_" + gid).val('');
					}
				} else {
					$("#eg_rsvp_1_" + gid).prop('disabled', false);
				}
				break;
			case 'rsvp_2':
				if (value == 1) {
					$("#eg_conf_2_" + gid).prop('disabled', false);
					$("#eg_conf_2_" + gid).prop('checked', false);
					$("#eg_cancel_2_" + gid).prop('disabled', false);
					$("#eg_cancel_2_" + gid).prop('checked', false);
					$("#eg_attended_2_" + gid).prop('disabled', false);
					$("#eg_attended_2_" + gid).prop('checked', true);
					$("#eg_wait_2_" + gid).prop('checked', false);
					$("#eg_nbr_of_guests_" + gid).prop('disabled', false);
					if ($("#eg_nbr_of_guests_" + gid).val() == '') {
						$("#eg_nbr_of_guests_" + gid).val('1');
					}
					if ($("#eg_nbr_of_guests_" + gid).val() > '1') {
						$("#eg_guest_name_" + gid).prop('disabled', false);
					}
					$("#eg_invitor_" + gid).prop('disabled', false);
				} else {
					$("#eg_conf_2_" + gid).prop('disabled', true);
					$("#eg_conf_2_" + gid).prop('checked', false);
					$("#eg_cancel_2_" + gid).prop('disabled', true);
					$("#eg_cancel_2_" + gid).prop('checked', false);
					$("#eg_attended_2_" + gid).prop('disabled', true);
					$("#eg_attended_2_" + gid).prop('checked', false);
					if (!$("#eg_wait_2_" + gid).prop('checked') && !$("#eg_rsvp_1_" + gid).prop('checked') && !$("#eg_wait_1_" + gid).prop('checked')) {
						$("#eg_nbr_of_guests_" + gid).prop('disabled', true);
						$("#eg_nbr_of_guests_" + gid).val('');
						$("#eg_guest_name_" + gid).prop('disabled', true);
						$("#eg_guest_name_" + gid).val('');
						$("#eg_invitor_" + gid).prop('disabled', true);
						$("#eg_invitor_" + gid).val('');
					}
				}
				break;
			case 'wait_2':
				if (value == 1) {
					$("#eg_rsvp_2_" + gid).prop('checked', false);
					$("#eg_conf_2_" + gid).prop('disabled', true);
					$("#eg_conf_2_" + gid).prop('checked', false);
					$("#eg_cancel_2_" + gid).prop('disabled', true);
					$("#eg_cancel_2_" + gid).prop('checked', false);
					$("#eg_attended_2_" + gid).prop('disabled', true);
					$("#eg_attended_2_" + gid).prop('checked', false);
					$("#eg_nbr_of_guests_" + gid).prop('disabled', false);
					if ($("#eg_nbr_of_guests_" + gid).val() == '') {
						$("#eg_nbr_of_guests_" + gid).val('1');
					}
					if ($("#eg_nbr_of_guests_" + gid).val() > '1') {
						$("#eg_guest_name_" + gid).prop('disabled', false);
					}
					$("#eg_invitor_" + gid).prop('disabled', false);
				} else {
					if (!$("#eg_wait_1_" + gid).prop('checked') && !$("#eg_rsvp_1_" + gid).prop('checked') && !$("#eg_rsvp_2_" + gid).prop('checked')) {
						$("#eg_nbr_of_guests_" + gid).prop('disabled', true);
						$("#eg_nbr_of_guests_" + gid).val('');
						$("#eg_guest_name_" + gid).prop('disabled', true);
						$("#eg_guest_name_" + gid).val('');
						$("#eg_invitor_" + gid).prop('disabled', true);
						$("#eg_invitor_" + gid).val('');
					}
				}
				break;
			case 'cancel_2':
				if (value == 1) {
					$("#eg_rsvp_2_" + gid).prop('disabled', true);
					$("#eg_rsvp_2_" + gid).prop('checked', false);
					$("#eg_conf_2_" + gid).prop('disabled', true);
					$("#eg_conf_2_" + gid).prop('checked', false);
					$("#eg_attended_2_" + gid).prop('disabled', true);
					$("#eg_attended_2_" + gid).prop('checked', false);
					if (!$("#eg_wait_1_" + gid).prop('checked') && !$("#eg_rsvp_1_" + gid).prop('checked') && !$("#eg_rsvp_1_" + gid).prop('checked')) {
						$("#eg_nbr_of_guests_" + gid).prop('disabled', true);
						$("#eg_nbr_of_guests_" + gid).val('');
						$("#eg_guest_name_" + gid).prop('disabled', true);
						$("#eg_guest_name_" + gid).val('');
						$("#eg_invitor_" + gid).prop('disabled', true);
						$("#eg_invitor_" + gid).val('');
					}
				} else {
					$("#eg_rsvp_2_" + gid).prop('disabled', false);
				}
				break;
			case 'nbr_of_guests':
				if ($("#eg_nbr_of_guests_" + gid).val() > '1') {
					$("#eg_guest_name_" + gid).prop('disabled', false);
				} else {
					$("#eg_guest_name_" + gid).prop('disabled', true);
					$("#eg_guest_name_" + gid).val('');
				}
				break;
		}
		$('#ajax_update_guests').load('ajax.php?call=event_ajax&function=guest' +
			'&gid=' + gid +
			'&eid=' + eid +
			'&rsvp_1=' + val_checkbox($('#eg_rsvp_1_' + gid + ':checked').val()) +
			'&conf_1=' + val_checkbox($('#eg_conf_1_' + gid + ':checked').val()) +
			'&cancel_1=' + val_checkbox($('#eg_cancel_1_' + gid + ':checked').val()) +
			'&attended_1=' + val_checkbox($('#eg_attended_1_' + gid + ':checked').val()) +
			'&wait_1=' + val_checkbox($('#eg_wait_1_' + gid + ':checked').val()) +
			'&rsvp_2=' + val_checkbox($('#eg_rsvp_2_' + gid + ':checked').val()) +
			'&conf_2=' + val_checkbox($('#eg_conf_2_' + gid + ':checked').val()) +
			'&cancel_2=' + val_checkbox($('#eg_cancel_2_' + gid + ':checked').val()) +
			'&attended_2=' + val_checkbox($('#eg_attended_2_' + gid + ':checked').val()) +
			'&wait_2=' + val_checkbox($('#eg_wait_2_' + gid + ':checked').val()) +
			'&nbr_of_guests=' + $('#eg_nbr_of_guests_' + gid).val() +
			'&guest_name=' + encodeURI($('#eg_guest_name_' + gid).val()) +
			'&invitor=' + encodeURIComponent($('#eg_invitor_' + gid).val()),
			function() {
				if ($('#ajax_update_guests').html().toLowerCase == 'error') {
					alert('Error!');
				} else {
					$('#db_grid_guests_extra_data').text($('#ajax_update_guests').text());
				}
			});
	}

	requery_totals = function(venue, event_id) {
		$.ajax({
			url: "ajax.php?call=event_stats&venue=" + venue + '&event_id=' + event_id,
			cache: false,
			dataType: "json",
			headers: {
				"Accept": "application/json"
			},
			success: function(json) {
				$('#nbr_rsvp_' + venue).val(json.nbr_rsvp);
				$('#nbr_cancelirmed_' + venue).val(json.nbr_cancelirmed);
				$('#nbr_attended_' + venue).val(json.nbr_attended);
				$('#nbr_waitlisted_' + venue).val(json.nbr_waitlisted);
			},
			error: function(request, status, error) {
				alert(status + ", " + error);
			}
		})
	}

	requery_total_nbr_guests_concierges = function() {
		var guest_sum = 0;
		var field_val;
		/*
		$('input[id^="ec_nbr_of_guests_"]').each(function () {
							field_val = parseInt($(this).val());
							if (!isNaN(field_val))
								guest_sum = guest_sum + field_val;
							//alert($(this).val()); 
						});
		*/
		var oTable = dTable['db_grid_concierges'].column(14, {
			order: 'current',
			search: 'applied',
			page: 'all'
		}).data();
		var oCells = dTable['db_grid_concierges'].column(14, {
			order: 'current',
			search: 'applied',
			page: 'all'
		}).nodes().to$();
		$(oCells).each(function() {
			field_val = parseInt($(this).find('input[id^="ec_nbr_of_guests_"]').val());
			if (!isNaN(field_val)) {
				guest_sum = guest_sum + field_val;
			}
		});
		//alert(guest_sum);
		//console.debug(oCells);
		/*
		for (var property in oTable) {
			if (oTable.hasOwnProperty(property)) {
				console.debug(property + ': ' + oTable[property]);
			}
		}		
		*/

	}

	online_rsvp_toggle = function() {
		if ($('#online_rsvp_expires').val() == '') {
			if ($('#online_rsvp_enabled').prop('checked')) {
				$('#online_rsvp_expires').val($('#event_date').val());
			}
		}
	}

	master_event_toggle = function() {
		if ($('#master_event').prop('checked')) {
			$('#master_event_id').prop('readonly', true);
			$('#master_event_id').prop('disabled', true);
			$('#master_event_id').addClass('readonly');
			$('#master_event_id').prop('selectedIndex', 0);
		} else {
			$('#master_event_id').prop('readonly', false);
			$('#master_event_id').prop('disabled', false);
			$('#master_event_id').removeClass('readonly');
		}
	}

	allow_guest_toggle = function() {
		if ($('#online_rsvp_allow_guest').prop('checked')) {
			$('#online_rsvp_allow_guest_name').prop('readonly', false);
			$('#online_rsvp_allow_guest_name').prop('disabled', false);
		} else {
			$('#online_rsvp_allow_guest_name').prop('readonly', true);
			$('#online_rsvp_allow_guest_name').prop('disabled', true);
			$('#online_rsvp_allow_guest_name').prop('checked', false);
		}
	}

	allow_association_guest_toggle = function() {
		if ($('#online_rsvp_allow_association_guests').prop('checked')) {
			$('#online_rsvp_allow_association_guests_new').prop('readonly', false);
			$('#online_rsvp_allow_association_guests_new').prop('disabled', false);
		} else {
			$('#online_rsvp_allow_association_guests_new').prop('readonly', true);
			$('#online_rsvp_allow_association_guests_new').prop('disabled', true);
			$('#online_rsvp_allow_association_guests_new').prop('checked', false);
		}
	}

	update_header = function() {
		if ($("#event_name").val() > "") {
			$("#header_repeater").text(" - " + $("#event_name").val());
		}
	}

	function show_details(id) {
		hide_details();
		$('#' + id).show();
	}

	function hide_details() {
		$('div.grid_popup').hide();
	}

	var online_rsvp_link_orig;
	var online_rsvp_link_mailchimp_orig;
	var online_rsvp_link_constant_contact_orig;
	var online_rsvp_link_hubspot_orig;
	var online_rsvp_link_web_orig;

	function association_change() {
		var a_id = $('#association_id').val();
		if (a_id) {
			var a_text = $('#association_id option:selected').text().trim();
			//alert('**' + a_text + '**');
			$('#online_rsvp_link').val(online_rsvp_link_orig.replace('?event=', '?assoc=' + a_text + '&event='));
			$('#online_rsvp_link_mailchimp').val(online_rsvp_link_mailchimp_orig.replace('?event=', '?assoc=' + a_text + '&event='));
			$('#online_rsvp_link_constant_contact').val(online_rsvp_link_constant_contact_orig.replace('?event=', '?assoc=' + a_text + '&event='));
			$('#online_rsvp_link_hubspot').val(online_rsvp_link_hubspot_orig.replace('?event=', '?assoc=' + a_text + '&event='));
			$('#online_rsvp_link_web').val(online_rsvp_link_web_orig.replace('?event=', '?assoc=' + a_text + '&event='));
		} else {
			$('#online_rsvp_link').val(online_rsvp_link_orig);
			$('#online_rsvp_link_mailchimp').val(online_rsvp_link_mailchimp_orig);
			$('#online_rsvp_link_constant_contact').val(online_rsvp_link_constant_contact_orig);
			$('#online_rsvp_link_hubspot').val(online_rsvp_link_hubspot_orig);
			$('#online_rsvp_link_web').val(online_rsvp_link_web_orig);
		}
	}

	function autoresponder_toggle() {
		if ($('#autoresponder_send').prop('checked')) {
			$('#autoresponder_subject').prop('readonly', false);
			$('#autoresponder_bcc').prop('readonly', false);
			$('#autoresponder_text').prop('readonly', false).removeClass('readonly');
			$('#autoresponder_text').parent().children('.trumbowyg-editor').attr('contenteditable', true);
			/*
			$('#master_event_id').prop('disabled', true);
			$('#master_event_id').addClass('readonly');
			$('#master_event_id').prop('selectedIndex',0);
			*/
		} else {
			$('#autoresponder_subject').prop('readonly', true);
			$('#autoresponder_bcc').prop('readonly', true);
			$('#autoresponder_text').prop('readonly', true).addClass('readonly');
			$('#autoresponder_text').parent().children('.trumbowyg-editor').attr('contenteditable', false);
			/*
			$('#master_event_id').prop('readonly', false);
			$('#master_event_id').prop('disabled', false);
			$('#master_event_id').removeClass('readonly');
			*/
		}
	}

	function apply_cg_rewards(event_id) {
		if (confirm("CG Rewards may be applied more than once to an event but cannot be undone.\nAre you sure you would like to proceed?")) {
			$.ajax({
				url: 'ajax.php?call=event_ajax&function=apply_cg_rewards&event_id=' + event_id,
				cache: false,
				dataType: "json",
				headers: {
					"Accept": "application/json"
				},
				success: function(json) {
					if (json.status == 'success') {
						$('#cg_rewards_applied').val('1');
						alert('Successfully applied CG Rewards to this event.');
					} else {
						alert('Error! Please check logs.');
					}
				},
				error: function(request, status, error) {
					alert(status + ", " + error);
				}
			});
		}
	}

	function toggle_capacity_limit() {
		if ($('#online_rsvp_enforce_capacity_limit').prop('checked')) {
			$('#online_rsvp_capacity_limit_waitlist').prop('readonly', false);
			$('#online_rsvp_capacity_limit_waitlist').prop('disabled', false);
		} else {
			$('#online_rsvp_capacity_limit_waitlist').prop('readonly', true);
			$('#online_rsvp_capacity_limit_waitlist').prop('disabled', true);
			$('#online_rsvp_capacity_limit_waitlist').prop('checked', false);
		}
	}

	$(document).ready(function() {
		switch_tab('<?php echo $active_tab; ?>');
		update_header();
		requery_totals('1', <?php echo nz($_REQUEST['id'], '0'); ?>);
		requery_totals('2', <?php echo nz($_REQUEST['id'], '0'); ?>);
		editor = $('#autoresponder_text').trumbowyg({
			removeformatPasted: true,
			btns: ['fontfamily'],
			btns: [
				['viewHTML'],
				['undo', 'redo'], // Only supported in Blink browsers
				['formatting'],
				['strong', 'em', 'del'],
				['superscript', 'subscript'],
				['link'],
				['insertImage'],
				['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
				['unorderedList', 'orderedList'],
				['horizontalRule'],
				['removeformat'],
				['fullscreen'],
				['fontfamily'],
			],
		});
		master_event_toggle();
		allow_guest_toggle();
		allow_association_guest_toggle();
		autoresponder_toggle();
		toggle_capacity_limit();
		$(':input:not(.search, .no_dirty, .no_dirty input)').change(function() {
			sheet_dirty = true;
		});
		$('.report_header').click(function() {
			$('.report_criteria').not($(this).next('.report_criteria')).slideUp(300);
			$(this).next('.report_criteria').slideToggle(300);
		});
		online_rsvp_link_orig = $('#online_rsvp_link').val();
		online_rsvp_link_mailchimp_orig = $('#online_rsvp_link_mailchimp').val();
		online_rsvp_link_constant_contact_orig = $('#online_rsvp_link_constant_contact').val();
		online_rsvp_link_hubspot_orig = $('#online_rsvp_link_hubspot').val();
		online_rsvp_link_web_orig = $('#online_rsvp_link_web').val();
	});
</script>

<h1>Event - <?php echo $action; ?><span id="header_repeater"></span></h1>
<?php echo form_message($form_message); ?>

<form name="frm_event" id="frm_event" method="post" enctype="multipart/form-data" action="">
	<input name="ajax_event_submitted" type="hidden" value="1" />
	<input name="id" type="hidden" value="<?php echo $_REQUEST['id']; ?>" />
	<input name="active_tab" id="active_tab" type="hidden" value="basic_info" />
	<input name="cg_rewards_applied" id="cg_rewards_applied" type="hidden" value="<?php echo $_POST['cg_rewards_applied']; ?>" />
	<?php 
		form_button_strip('top', [
			'save_as' => ['show' => true, 'caption' => 'Copy', 'js' => "sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();"],
		]); 
		form_tab_strip_start();
		form_tab_header('basic_info', 'Basic Info', 'admin,eventmgr');
		form_tab_header('venue_1', 'Venue 1', 'admin,eventmgr');
		form_tab_header('venue_2', 'Venue 2', 'admin,eventmgr');
		if (!empty($_REQUEST['id'])) :
			form_tab_header('concierges', 'Concierges', 'admin,eventmgr,eventview');
			form_tab_header('guests', 'Guests', 'admin,eventmgr');
			form_tab_header('reports', 'Reports', 'admin,eventmgr');
			form_tab_header('online', 'Online RSVP Form', 'admin,eventmgr');
			form_tab_header('surveys', 'Surveys', 'admin,eventmgr');
		endif;
		form_tab_strip_end();
		//******************************************************************************************
		if (form_tab_start('basic_info', 'Basic Info')) :

			form_column_start();
			form_field('event_id', 'text', 10, 0, false, false, true, '', '', 'event_id', 'Event ID');
			form_field('event_name', 'text', 50, 0, true, false, false, '', '', 'event_name', 'Event Name', array(), '', 'update_header();');
			echo '<div style="width:45%; min-width:130px; display:inline-block;">';
			form_field('event_date', 'text', 20, 0, true, false, true, '', 'date-pick dp-applied required', 'event_date', 'Event Date');
			echo '</div>';
			echo '<div style="width:45%; min-width:130px; display:inline-block;">';
			form_field('event_time', 'text', 8, 0, true, false, false, 'width:100%; min-width:120px;', '', 'event_time', 'Event Time');
			echo '</div>';
			form_field('invitation_1_date', 'text', 20, 0, false, false, true, '', 'date-pick dp-applied', 'invitation_1_date', 'Invitation 1 Date');
			form_field('invitation_2_date', 'text', 20, 0, false, false, true, '', 'date-pick dp-applied', 'invitation_2_date', 'Invitation 2 Date');
			form_field('invitation_3_date', 'text', 20, 0, false, false, true, '', 'date-pick dp-applied', 'invitation_3_date', 'Invitation 3 Date');
			form_field('invitation_4_date', 'text', 20, 0, false, false, true, '', 'date-pick dp-applied', 'invitation_4_date', 'Invitation 4 Date');
			form_field('invitation_5_date', 'text', 20, 0, false, false, true, '', 'date-pick dp-applied', 'invitation_5_date', 'Invitation 5 Date');
			form_field('reminder_email_sent', 'text', 20, 0, false, false, true, '', 'date-pick dp-applied', 'reminder_email_sent', 'Reminder Email Sent');
			form_column_end();

			form_column_start();
			form_field('photographer_1', 'text', 50, 0, false, false, false, '', '', 'photographer_1', 'Photogrpher 1');
			form_field('photographer_2', 'text', 50, 0, false, false, false, '', '', 'photographer_2', 'Photogrpher 2');
			form_field('photographer_3', 'text', 50, 0, false, false, false, '', '', 'photographer_3', 'Photogrpher 3');
			form_field('photographer_4', 'text', 50, 0, false, false, false, '', '', 'photographer_4', 'Photogrpher 4');
			form_field('marketing_company', 'text', 75, 0, false, false, false, '', '', 'marketing_company', 'Marketing Company');
			form_field('bus_memo', 'text', 150, 0, false, false, false, '', '', 'bus_memo', 'Bus Memo');
			form_field('bus', 'checkbox', 50, 0, false, false, false, '', '', 'bus', 'Bus');
			form_field('posters', 'checkbox', 50, 0, false, false, false, '', '', 'posters', 'Posters');
			form_column_end();

			form_column_start();
			form_field('comments', 'textarea', 70, 9, false, false, false, '', '', 'comments', 'Comments');
			form_column_end();

			form_tab_end();
		else :
			echo '<input name="event_name" id="event_name" type="hidden" value="' . $_POST['event_name'] . '">';
		endif;

		//******************************************************************************************
		if (form_tab_start('venue_1', 'Venue 1')) :

			form_column_start();
			form_field('event_venue_1', 'text', 75, 0, false, false, false, '', '', 'event_venue_1', 'Event Venue 1');
			$sql = "SELECT event_type_id, event_type FROM event_types ORDER BY event_type ";
			$result = $db->query($sql) or die('Database Error!');
			$ar_event_types = $result->fetchAll(PDO::FETCH_KEY_PAIR);
			form_field('event_type_1', 'select', 50, 0, false, false, false, '', '', 'event_type_1', 'Event Type 1', $ar_event_types);
			form_field('capacity_1', 'text', 6, 0, false, false, false, '', '', 'capacity_1', 'Capacity 1');
			form_field('nbr_rsvp_1', 'text', 6, 0, false, false, true, '', '', 'nbr_rsvp_1', '# RSVP 1');
			form_field('nbr_cancelirmed_1', 'text', 6, 0, false, false, true, '', '', 'nbr_cancelirmed_1', '# Cancelled  1');
			form_field('nbr_attended_1', 'text', 6, 0, false, false, true, '', '', 'nbr_attended_1', '# Attended  1');
			form_field('nbr_waitlisted_1', 'text', 6, 0, false, false, true, '', '', 'nbr_waitlisted_1', '# Wait Listed 1');
			$sql = "SELECT sales_rep_id, sales_rep_name FROM sales_reps ORDER BY sales_rep_name ";
			$result = $db->query($sql) or die('Database Error!');
			$ar_sales_reps = $result->fetchAll(PDO::FETCH_KEY_PAIR);
			form_field('sales_rep_id_1', 'select', 50, 0, false, false, false, '', '', 'sales_rep_id_1', 'Sales Rep ID 1', $ar_sales_reps);
			form_field('venue_1_event_review', 'text', 250, 0, false, false, false, '', '', 'venue_1_event_review', 'Venue 1 Event Review');
			form_column_end();

			form_column_start();
			form_field('venue_1_address', 'text', 75, 0, false, false, false, '', '', 'venue_1_address', 'Venue 1 Address');
			form_field('venue_1_cross_streets', 'text', 50, 0, false, false, false, '', '', 'venue_1_cross_streets', 'Venue 1 Cross Streets');
			form_field('venue_1_contact_1', 'text', 50, 0, false, false, false, '', '', 'venue_1_contact_1', 'Venue 1 Contact 1');
			form_field('venue_1_contact_2', 'text', 50, 0, false, false, false, '', '', 'venue_1_contact_2', 'Venue 1 Contact 2');
			form_field('venue_1_contact_3', 'text', 50, 0, false, false, false, '', '', 'venue_1_contact_3', 'Venue 1 Contact 3');
			form_field('venue_1_phone_1', 'text', 50, 0, false, false, false, '', '', 'venue_1_phone_1', 'Venue 1 Phone 1');
			form_field('venue_1_phone_2', 'text', 50, 0, false, false, false, '', '', 'venue_1_phone_2', 'Venue 1 Phone 2');
			form_field('venue_1_phone_3', 'text', 50, 0, false, false, false, '', '', 'venue_1_phone_3', 'Venue 1 Phone 3');
			form_field('venue_1_email_1', 'text', 50, 0, false, false, false, '', '', 'venue_1_email_1', 'Venue 1 Email 1');
			form_field('venue_1_email_2', 'text', 50, 0, false, false, false, '', '', 'venue_1_email_2', 'Venue 1 Email 2');
			form_field('venue_1_email_3', 'text', 50, 0, false, false, false, '', '', 'venue_1_email_3', 'Venue 1 Email 3');
			form_column_end();

			form_tab_end();
		endif;
		//******************************************************************************************
		if (form_tab_start('venue_2', 'Venue 2')) :

			form_column_start();
			form_field('event_venue_2', 'text', 75, 0, false, false, false, '', '', 'event_venue_2', 'Event Venue 2');
			$sql = "SELECT event_type_id, event_type FROM event_types ORDER BY event_type ";
			$result = $db->query($sql) or die('Database Error!');
			$ar_event_types = $result->fetchAll(PDO::FETCH_KEY_PAIR);
			form_field('event_type_2', 'select', 50, 0, false, false, false, '', '', 'event_type_2', 'Event Type 2', $ar_event_types);
			form_field('capacity_2', 'text', 6, 0, false, false, false, '', '', 'capacity_2', 'Capacity 2');
			form_field('nbr_rsvp_2', 'text', 6, 0, false, false, true, '', '', 'nbr_rsvp_2', '# RSVP 2');
			form_field('nbr_cancelirmed_2', 'text', 6, 0, false, false, true, '', '', 'nbr_cancelirmed_2', '# Cancelled  2');
			form_field('nbr_attended_2', 'text', 6, 0, false, false, true, '', '', 'nbr_attended_2', '# Attended  2');
			form_field('nbr_waitlisted_2', 'text', 6, 0, false, false, true, '', '', 'nbr_waitlisted_2', '# Wait Listed 2');
			$sql = "SELECT sales_rep_id, sales_rep_name FROM sales_reps ORDER BY sales_rep_name ";
			$result = $db->query($sql) or die('Database Error!');
			$ar_sales_reps = $result->fetchAll(PDO::FETCH_KEY_PAIR);
			form_field('sales_rep_id_2', 'select', 50, 0, false, false, false, '', '', 'sales_rep_id_2', 'Sales Rep ID 2', $ar_sales_reps);
			form_column_end();

			form_column_start();
			form_field('venue_2_address', 'text', 75, 0, false, false, false, '', '', 'venue_2_address', 'Venue 2 Address');
			form_field('venue_2_cross_streets', 'text', 50, 0, false, false, false, '', '', 'venue_2_cross_streets', 'Venue 2 Cross Streets');
			form_field('venue_2_contact_1', 'text', 50, 0, false, false, false, '', '', 'venue_2_contact_1', 'Venue 2 Contact 1');
			form_field('venue_2_contact_2', 'text', 50, 0, false, false, false, '', '', 'venue_2_contact_2', 'Venue 2 Contact 2');
			form_field('venue_2_contact_3', 'text', 50, 0, false, false, false, '', '', 'venue_2_contact_3', 'Venue 2 Contact 3');
			form_field('venue_2_phone_1', 'text', 50, 0, false, false, false, '', '', 'venue_2_phone_1', 'Venue 2 Phone 1');
			form_field('venue_2_phone_2', 'text', 50, 0, false, false, false, '', '', 'venue_2_phone_2', 'Venue 2 Phone 2');
			form_field('venue_2_phone_3', 'text', 50, 0, false, false, false, '', '', 'venue_2_phone_3', 'Venue 2 Phone 3');
			form_field('venue_2_email_1', 'text', 50, 0, false, false, false, '', '', 'venue_2_email_1', 'Venue 2 Email 1');
			form_field('venue_2_email_2', 'text', 50, 0, false, false, false, '', '', 'venue_2_email_2', 'Venue 2 Email 2');
			form_field('venue_2_email_3', 'text', 50, 0, false, false, false, '', '', 'venue_2_email_3', 'Venue 2 Email 3');
			form_column_end();

		form_tab_end();
		endif;
		//******************************************************************************************
		if (form_tab_start('concierges', 'Concierges')) :
			echo '<div id="ajax_update_concierges" style="width:1px; height:1px; display:none;"></div>';
			$ix_form = 'concierge_form';
			$ar_extra_buttons = [];
			if (nzdatetime($_POST['event_date'] . ' ' . $_POST['event_time'], '9999', false) < date('Y-m-d H:i:s')) :
				if (role_match($ar_pagecontrol[$_GET['IX']]['update_roles'], get_roles())) :
					$ar_extra_buttons = [
						['id' => 'btn_apply_cg_rewards', 'title' => 'Apply CG Rewards', 'action' => 'apply_cg_rewards('.nz($_REQUEST['id'], '0').');', 'style' => 'width: 120px;'],
					];
				endif;
			endif;
			db_navigator_bar(array('table_id' => 'db_grid_concierges', 'form' => $ix_form, 'print_section' => 'db_grid_concierges', 'call' => 'event_concierges_ajax', 'sort_col' => '5', 'sort_order' => '0', 'subtab' => 'true', 'parm1' => " " . nz($_REQUEST['id'], '0') . " ", 'func' => 'grid', 'filter_cols' => '0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0', 'extra_buttons' => $ar_extra_buttons));

			form_tab_end();
		endif;
		//******************************************************************************************
		if (form_tab_start('guests', 'Guests')) :
			echo '<div id="ajax_update_guests" style="width:1px; height:1px; display:none;"></div>';
			$ix_form = 'guest_form';
			db_navigator_bar(array('table_id' => 'db_grid_guests', 'form' => $ix_form, 'print_section' => 'db_grid_guests', 'call' => 'event_guests_ajax', 'sort_col' => '4', 'sort_order' => '0', 'subtab' => 'true', 'parm1' => " " . nz($_REQUEST['id'], '0') . " ", 'func' => 'grid', 'filter_cols' => '0,0,0,0,1,0,0,0,0,0,0,0,0,0,0'));

			form_tab_end();
		endif;
		//******************************************************************************************
		if (form_tab_start('reports', 'Reports')) :
			?>
			<div class="report_section">
				<div class="report_header">
					Name Labels - 5160
				</div>
				<div class="report_criteria">
					Venue: &emsp; <input class="no_dirty" type="radio" name="rpt_option_name_labels" value="1" checked="checked" /> 1 &emsp; <input class="no_dirty" type="radio" name="rpt_option_name_labels" value="2" /> 2
					<br />
					<input type="button" value="PDF" onclick="window.open('report.php?rpt=name_labels_5160&type=label&fmt=pdf&eid=<?php echo $_REQUEST['id']; ?>&venue=' + $('input[name=rpt_option_name_labels]:checked').val(), '_blank');" />
					<input type="button" value="RTF" onclick="window.open('report.php?rpt=name_labels_5160&type=label&fmt=word&eid=<?php echo $_REQUEST['id']; ?>&venue=' + $('input[name=rpt_option_name_labels]:checked').val(), '_blank');" />
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					Name Tags - 74549 Version 1
				</div>
				<div class="report_criteria">
					<input class="no_dirty" type="radio" name="rpt_option_name_tags_1" value="c" checked="checked" /> Concierges &emsp; <input class="no_dirty" type="radio" name="rpt_option_name_tags_1" value="g" /> Guests &emsp; <input class="no_dirty" type="radio" name="rpt_option_name_tags_1" value="b" /> Both
					<br />
					<input type="button" value="PDF" onclick="window.open('report.php?rpt=name_tags_74549v1&type=label&fmt=pdf&eid=<?php echo $_REQUEST['id']; ?>&guest_type=' + $('input[name=rpt_option_name_tags_1]:checked').val(), '_blank');" />
					<input type="button" value="RTF" onclick="window.open('report.php?rpt=name_tags_74549v1&type=label&fmt=word&eid=<?php echo $_REQUEST['id']; ?>&guest_type=' + $('input[name=rpt_option_name_tags_1]:checked').val(), '_blank');" />
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					Name Tags - 74549 Version 2
				</div>
				<div class="report_criteria">
					<input class="no_dirty" type="radio" name="rpt_option_name_tags_2" value="c" checked="checked" /> Concierges &emsp; <input class="no_dirty" type="radio" name="rpt_option_name_tags_2" value="g" /> Guests &emsp; <input class="no_dirty" type="radio" name="rpt_option_name_tags_2" value="b" /> Both
					<br />
					<input type="button" value="PDF" onclick="window.open('report.php?rpt=name_tags_74549v2&type=label&fmt=pdf&eid=<?php echo $_REQUEST['id']; ?>&guest_type=' + $('input[name=rpt_option_name_tags_2]:checked').val(), '_blank');" />
					<input type="button" value="RTF" onclick="window.open('report.php?rpt=name_tags_74549v2&type=label&fmt=word&eid=<?php echo $_REQUEST['id']; ?>&guest_type=' + $('input[name=rpt_option_name_tags_2]:checked').val(), '_blank');" />
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					Concierge Resistration List
				</div>
				<div class="report_criteria">
					Venue: &emsp; <input class="no_dirty" type="radio" name="rpt_option_concierge_registration" value="1" checked="checked" /> 1 &emsp; <input class="no_dirty" type="radio" name="rpt_option_concierge_registration" value="2" /> 2
					<br />
					<input type="button" value="PDF" onclick="window.open('report.php?rpt=concierge_registration_list&type=report&fmt=pdf&eid=<?php echo $_REQUEST['id']; ?>&venue=' + $('input[name=rpt_option_concierge_registration]:checked').val(), '_blank');" />
					<input type="button" value="Excel" onclick="window.open('report.php?rpt=concierge_registration_list&type=report&fmt=excel&eid=<?php echo $_REQUEST['id']; ?>&venue=' + $('input[name=rpt_option_concierge_registration]:checked').val(), '_blank');" />
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					Guest Resistration List
				</div>
				<div class="report_criteria">
					Venue: &emsp; <input class="no_dirty" type="radio" name="rpt_option_guest_registration" value="1" checked="checked" /> 1 &emsp; <input class="no_dirty" type="radio" name="rpt_option_guest_registration" value="2" /> 2
					<br />
					<input type="button" value="PDF" onclick="window.open('report.php?rpt=guest_registration_list&type=report&fmt=pdf&eid=<?php echo $_REQUEST['id']; ?>&venue=' + $('input[name=rpt_option_guest_registration]:checked').val(), '_blank');" />
					<input type="button" value="Excel" onclick="window.open('report.php?rpt=guest_registration_list&type=report&fmt=excel&eid=<?php echo $_REQUEST['id']; ?>&venue=' + $('input[name=rpt_option_guest_registration]:checked').val(), '_blank');" />
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					Combined Resistration List
				</div>
				<div class="report_criteria">
					Venue: &emsp; <input class="no_dirty" type="radio" name="rpt_option_combined_registration" value="1" checked="checked" /> 1 &emsp; <input class="no_dirty" type="radio" name="rpt_option_combined_registration" value="2" /> 2
					<br />
					<input type="button" value="PDF" onclick="window.open('report.php?rpt=combined_registration_list&type=report&fmt=pdf&eid=<?php echo $_REQUEST['id']; ?>&venue=' + $('input[name=rpt_option_combined_registration]:checked').val(), '_blank');" />
					<input type="button" value="Excel" onclick="window.open('report.php?rpt=combined_registration_list&type=report&fmt=excel&eid=<?php echo $_REQUEST['id']; ?>&venue=' + $('input[name=rpt_option_combined_registration]:checked').val(), '_blank');" />
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					Concierge Wrap Up Report
				</div>
				<div class="report_criteria">
					<input type="button" value="PDF" onclick="window.open('report.php?rpt=concierge_wrap_up&type=report&fmt=pdf&eid=<?php echo $_REQUEST['id']; ?>', '_blank');" />
					<input type="button" value="Excel" onclick="window.open('report.php?rpt=concierge_wrap_up&type=report&fmt=excel&eid=<?php echo $_REQUEST['id']; ?>', '_blank');" />
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					Concierge Wrap Up - Wait List
				</div>
				<div class="report_criteria">
					<input type="button" value="PDF" onclick="window.open('report.php?rpt=concierge_wrap_up_wait&type=report&fmt=pdf&eid=<?php echo $_REQUEST['id']; ?>', '_blank');" />
					<input type="button" value="Excel" onclick="window.open('report.php?rpt=concierge_wrap_up_wait&type=report&fmt=excel&eid=<?php echo $_REQUEST['id']; ?>', '_blank');" />
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					Guest Wrap Up Report
				</div>
				<div class="report_criteria">
					<input type="button" value="PDF" onclick="window.open('report.php?rpt=guest_wrap_up&type=report&fmt=pdf&eid=<?php echo $_REQUEST['id']; ?>', '_blank');" />
					<input type="button" value="Excel" onclick="window.open('report.php?rpt=guest_wrap_up&type=report&fmt=excel&eid=<?php echo $_REQUEST['id']; ?>', '_blank');" />
				</div>
			</div>
			<?php if ($_POST['master_event'] == 1) : ?>
				<div class="report_section">
					<div class="report_header">
						Master Event Concierge Wrap Up Report
					</div>
					<div class="report_criteria">
						<input type="button" value="PDF" onclick="window.open('report.php?rpt=concierge_wrap_up_master&type=report&fmt=pdf&eid=<?php echo $_REQUEST['id']; ?>', '_blank');" />
						<input type="button" value="Excel" onclick="window.open('report.php?rpt=concierge_wrap_up_master&type=report&fmt=excel&eid=<?php echo $_REQUEST['id']; ?>', '_blank');" />
					</div>
				</div>
				<div class="report_section">
					<div class="report_header">
						Master Event Guest Wrap Up Report
					</div>
					<div class="report_criteria">
						<input type="button" value="PDF" onclick="window.open('report.php?rpt=guest_wrap_up_master&type=report&fmt=pdf&eid=<?php echo $_REQUEST['id']; ?>', '_blank');" />
						<input type="button" value="Excel" onclick="window.open('report.php?rpt=guest_wrap_up_master&type=report&fmt=excel&eid=<?php echo $_REQUEST['id']; ?>', '_blank');" />
					</div>
				</div>
			<?php endif; ?>
			<div class="report_section">
				<div class="report_header">
					Batch Email
				</div>
				<div class="report_criteria">
					<a href="index.php?IX=batch_email&type=event&event_id=<?php echo $_REQUEST['id']; ?>">Click here to go to batch email generator</a>
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					Survey Responses Report
				</div>
				<div class="report_criteria oo_report">
					<div class="input_column">
						<?php
							$sql = "SELECT DISTINCT id, description FROM surveys WHERE event_id = " . nz($_REQUEST['id'], '0') . " ORDER BY create_date DESC ";
							$result = $db->query($sql) or die('Database Error!');
							$ar_surveys = $result->fetchAll(PDO::FETCH_KEY_PAIR);
							form_field(['fname'=>'srp_survey_id', 'ftype'=>'select', 'fsize'=>25, 'frequired'=>false, 'fclass'=>'no_dirty', 'fdbname'=>'', 'flabel'=>'Survey', 'ar_group'=>$ar_surveys, 'form_id'=>'frm_report_srp']);
						?>
					</div>
					<?php report_output_format('frm_report_srp'); ?>
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					Survey Responses Crosstab Report
				</div>
				<div class="report_criteria oo_report">
					<div class="input_column">
						<?php
							form_field(['fname'=>'src_survey_id', 'ftype'=>'select', 'fsize'=>25, 'frequired'=>false, 'fclass'=>'no_dirty', 'fdbname'=>'', 'flabel'=>'Survey', 'ar_group'=>$ar_surveys, 'form_id'=>'frm_report_src']);
						?>
					</div>
					<?php report_output_format('frm_report_src'); ?>
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					No Shows Report
				</div>
				<div class="report_criteria oo_report">
					<div class="input_column">
						<?php
							form_field(['fname'=>'ens_guest_type', 'ftype'=>'radiogroup', 'fsize'=>25, 'frequired'=>false, 'fclass'=>'no_dirty', 'fdbname'=>'', 'flabel'=>'Guest Type', 'ar_group'=>['Concierges', 'Guests'], 'form_id'=>'frm_report_ens']);
							form_field(['fname'=>'ens_venue', 'ftype'=>'radiogroup', 'fsize'=>25, 'frequired'=>false, 'fclass'=>'no_dirty', 'fdbname'=>'', 'flabel'=>'Venue', 'ar_group'=>['Venue 1', 'Venue 2'], 'form_id'=>'frm_report_ens']);
						?>
					</div>
					<?php report_output_format('frm_report_ens'); ?>
				</div>
			</div>
			<div class="report_section">
				<div class="report_header">
					Cancellation Report
				</div>
				<div class="report_criteria oo_report">
					<div class="input_column">
						<?php
							form_field(['fname'=>'ecn_guest_type', 'ftype'=>'radiogroup', 'fsize'=>25, 'frequired'=>false, 'fclass'=>'no_dirty', 'fdbname'=>'', 'flabel'=>'Guest Type', 'ar_group'=>['Concierges', 'Guests'], 'form_id'=>'frm_report_ecn']);
							form_field(['fname'=>'ecn_venue', 'ftype'=>'radiogroup', 'fsize'=>25, 'frequired'=>false, 'fclass'=>'no_dirty', 'fdbname'=>'', 'flabel'=>'Venue', 'ar_group'=>['Venue 1', 'Venue 2'], 'form_id'=>'frm_report_ecn']);
						?>
					</div>
					<?php report_output_format('frm_report_ecn'); ?>
				</div>
			</div>
			<?php

			form_tab_end();
		endif;
		//******************************************************************************************
		if (form_tab_start('online', 'Online RSVP Form')) :

			form_column_start();
			form_field('online_rsvp_enabled', 'checkbox', 50, 0, false, false, false, '', '', 'online_rsvp_enabled', 'Enabled');
			echo '<div style="width:130px; min-width:130px; display:inline-block;">';
			form_field('online_rsvp_expires', 'text', 20, 0, false, false, true, '', 'date-pick dp-applied', 'online_rsvp_expires', 'Expires');
			echo '</div>';
			form_field('online_rsvp_allow_guest', 'checkbox', 50, 0, false, false, false, '', '', 'online_rsvp_allow_guest', 'Allow Guest', null, 'allow_guest_toggle()');
			form_field('online_rsvp_allow_guest_name', 'checkbox', 50, 0, false, false, false, '', '', 'online_rsvp_allow_guest_name', 'Allow Guest Name Entry');
			form_field('online_rsvp_allow_corrections', 'checkbox', 50, 0, false, false, false, '', '', 'online_rsvp_allow_corrections', 'Allow Corrections');
			form_field('online_rsvp_allow_association_guests', 'checkbox', 50, 0, false, false, false, '', '', 'online_rsvp_allow_association_guests', 'Allow Association Guests', null, 'allow_association_guest_toggle()');
			form_field('online_rsvp_allow_association_guests_new', 'checkbox', 50, 0, false, false, false, '', '', 'online_rsvp_allow_association_guests_new', 'Allow New Association Guests');
			form_field('online_rsvp_require_cell_phone', 'checkbox', 50, 0, false, false, false, '', '', 'online_rsvp_require_cell_phone', 'Require cell phone entry if none found');
			form_field('online_rsvp_enforce_capacity_limit', 'checkbox', 50, 0, false, false, false, '', '', 'online_rsvp_enforce_capacity_limit', 'Enforce capacity limit (applies to Venue 1 only)', [], 'toggle_capacity_limit()');
			form_field('online_rsvp_capacity_limit_waitlist', 'checkbox', 50, 0, false, false, false, '', '', 'online_rsvp_capacity_limit_waitlist', 'Allow RSVP to waitlist when limit reached');
			form_field('master_event', 'checkbox', 50, 0, false, false, false, '', '', 'master_event', 'Master Event', array(), 'master_event_toggle();');
			$sql = "SELECT event_id, CONCAT(event_date_time, ' - ', event_name) FROM events WHERE master_event = TRUE AND event_id <> " . nz($_REQUEST['id'], '0') . " ORDER BY event_date_time DESC ";
			$result = $db->query($sql) or die('Database Error!');
			$ar_master_events = $result->fetchAll(PDO::FETCH_KEY_PAIR);
			form_field('master_event_id', 'select', 50, 0, false, false, false, '', '', 'master_event_id', 'Linked Master Event', $ar_master_events);
			form_field('online_rsvp_unauthorized_text', 'textarea', 120, 9, false, false, false, '', '', 'online_rsvp_unauthorized_text', 'Alternate Not Authorized Text');
			form_field('online_rsvp_invalid_unauthorized_text', 'textarea', 120, 9, false, false, false, '', '', 'online_rsvp_invalid_unauthorized_text', 'Invalid Event Not Authorized Text');
			form_field('autoresponder_send', 'checkbox', 50, 0, false, false, false, '', '', 'autoresponder_send', 'Enable Auto-Responder', [], 'autoresponder_toggle();');
			form_field('autoresponder_subject', 'text', 150, 0, false, false, false, '', '', 'autoresponder_subject', 'Auto-Responder Subject');
			form_field('autoresponder_bcc', 'text', 150, 0, false, false, false, '', '', 'autoresponder_bcc', 'Auto-Responder BCC (comma separated)');
			form_field('autoresponder_text', 'textarea', 120, 9, false, false, false, '', '', 'autoresponder_text', 'Auto-Responder Text');
			echo '<h3>Embedded Links</h3>';
			$sql = "SELECT association_id, name FROM associations ORDER BY name ";
			$result = $db->query($sql) or die('Database Error!');
			$ar_associations = $result->fetchAll(PDO::FETCH_KEY_PAIR);
			form_field('association_id', 'select', 50, 0, false, false, false, '', 'no_dirty', 'association_id', 'Guest Association', $ar_associations, 'association_change()');
			$_POST['online_rsvp_link'] = APP_BASE_SECURE . 'rsvp.php?event=' . $_POST['event_id'] * APP_PRIME_NUMBER . '&email=[email]';
			form_field('online_rsvp_link', 'text', 150, 0, false, false, true, '', '', 'online_rsvp_link', 'Link for embedding in iContact');
			$_POST['online_rsvp_link_mailchimp'] = APP_BASE_SECURE . 'rsvp.php?event=' . $_POST['event_id'] * APP_PRIME_NUMBER . '&email=*|EMAIL|*';
			form_field('online_rsvp_link_mailchimp', 'text', 150, 0, false, false, true, '', '', 'online_rsvp_link_mailchimp', 'Link for embedding in MailChimp');
			$_POST['online_rsvp_link_constant_contact'] = APP_BASE_SECURE . 'rsvp.php?event=' . $_POST['event_id'] * APP_PRIME_NUMBER . '&email=[[EmailAddress]]';
			form_field('online_rsvp_link_constant_contact', 'text', 150, 0, false, false, true, '', '', 'online_rsvp_link_constant_contact', 'Link for embedding in Constant Contact');
			$_POST['online_rsvp_link_hubspot'] = APP_BASE_SECURE . 'rsvp.php?event=' . $_POST['event_id'] * APP_PRIME_NUMBER . '&email={{ personalization_token(\'contact.email\', \'Customer\') }}';
			form_field('online_rsvp_link_hubspot', 'textarea', 150, 0, false, true, true, '', '', 'online_rsvp_link_hubspot', 'Link for embedding in Hubspot');
			$_POST['online_rsvp_link_web'] = APP_BASE_SECURE . 'rsvp.php?event=' . $_POST['event_id'] * APP_PRIME_NUMBER;
			form_field('online_rsvp_link_web', 'text', 150, 0, false, false, true, '', '', 'online_rsvp_link_web', 'Link for embedding in a Web Page');
			form_column_end();

			form_column_start();
		?>
			<div class="input_field" style="padding-right:20px;">
				<label for="photo_label">Artwork</label>
				<label id="photo_label" class="photo_label" for="filename">
					Click/Touch here to upload or snap a photo<br />
					<input name="online_rsvp_artwork" id="online_rsvp_artwork" type="file" maxlength="120" accept="image/*" capture="camera" />
				</label>
				<input name="online_rsvp_artwork" type="hidden" maxlength="120" value="<?php echo $_POST['online_rsvp_artwork']; ?>" />
				<?php show_form_error($ar_err['online_rsvp_artwork']); ?>
			</div>
		<?php
			if (!empty($_POST['online_rsvp_artwork'])) :
		?>
				<br />
				<div style="width:100%; max-width:280px; text-align:center; margin-left:auto; margin-right:auto; margin-top:10px;">
					<img src="rsvp_artwork/<?php echo $_POST['online_rsvp_artwork']; ?>" style="max-width:100%;" align="top" />
				</div>
		<?php
			endif;
			form_column_end();

			form_tab_end();
		endif;
		//******************************************************************************************
		if (form_tab_start('surveys', 'Surveys')) :
			$ix_form = 'survey_form&event_id='.trim(nz($_REQUEST['id'], '0'));
			db_navigator_bar(['table_id' => 'db_grid_surveys', 'form' => $ix_form, 'print_section' => 'db_grid_surveys', 'call' => 'event_surveys_ajax', 'sort_col' => '3', 'sort_order' => '1', 'parm1' => " AND s.event_id = " . nz($_REQUEST['id'], '0') . " ", 'func' => 'grid']);

			form_tab_end();
		endif;
		
		form_button_strip('bottom', [
			'save_as' => ['show' => true, 'caption' => 'Copy', 'js' => "sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();"],
		]); 
	?>
</form>
<form name="frm_report_srp" id="frm_report_srp" method="post" action="report.php?rpt=survey_responses&type=oo_report" target="_blank">
</form>
<form name="frm_report_src" id="frm_report_src" method="post" action="report.php?rpt=survey_responses_crosstab&type=oo_report" target="_blank">
</form>
<form name="frm_report_ens" id="frm_report_ens" method="post" action="report.php?rpt=event_no_shows&type=oo_report&eid=<?php echo $_REQUEST['id']; ?>" target="_blank">
</form>
<form name="frm_report_ecn" id="frm_report_ecn" method="post" action="report.php?rpt=event_cancellations&type=oo_report&eid=<?php echo $_REQUEST['id']; ?>" target="_blank">
</form>
<script src="trumbowyg/dist/trumbowyg.min.js?ver=<?php echo filemtime(__DIR__.'/../trumbowyg/dist/trumbowyg.min.js') ?>"></script>
<script src="trumbowyg/dist/plugins/fontfamily/trumbowyg.fontfamily.min.js?ver=<?php echo filemtime(__DIR__.'/../trumbowyg/dist/plugins/fontfamily/trumbowyg.fontfamily.min.js') ?>"></script>

Youez - 2016 - github.com/yon3zu
LinuXploit