<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
?>
<?php echo $this->partial('_admin_breadcrumb.tpl', 'core', array('parentMenu' => "core_admin_main_settings", "parentMenuItemName" => "core_admin_main_emailsettings", 'lastMenuItemName' => 'Email All Members')); ?>

<h2 class="page_heading"><?php echo $this->translate('Email Settings') ?></h2>
<div class='tabs'>
	<?php echo $this->navigation()->menu()->setContainer($this->navigation)->render(); ?>
</div>
<?php if ($this->form): ?>
	<div class="settings">
		<?php echo $this->form->render($this) ?>
	</div>
	<script>
		function choosemember(value) {
			if (value == 1) {
				document.getElementById('member_levels-wrapper').style.display = 'none';
				if (document.getElementById('profile_types-wrapper'))
					document.getElementById('profile_types-wrapper').style.display = 'none';
				document.getElementById('external_emails-wrapper').style.display = 'none';
				document.getElementById('member_name-wrapper').style.display = 'flex';
				if (document.getElementById('networks-wrapper'))
					document.getElementById('networks-wrapper').style.display = 'none';
			} else if (value == 4) {
				document.getElementById('external_emails-wrapper').style.display = 'none';
				document.getElementById('member_name-wrapper').style.display = 'none';
				if (document.getElementById('profile_types-wrapper'))
					document.getElementById('profile_types-wrapper').style.display = 'flex';
				if (document.getElementById('member_levels-wrapper'))
					document.getElementById('member_levels-wrapper').style.display = 'flex';
				if (document.getElementById('networks-wrapper'))
					document.getElementById('networks-wrapper').style.display = 'flex';

			} else if (value == 5) {
				document.getElementById('member_levels-wrapper').style.display = 'none';

				if (document.getElementById('profile_types-wrapper'))
					document.getElementById('profile_types-wrapper').style.display = 'none';
				document.getElementById('external_emails-wrapper').style.display = 'flex';
				document.getElementById('member_name-wrapper').style.display = 'none';
				if (document.getElementById('networks-wrapper'))
					document.getElementById('networks-wrapper').style.display = 'none';
			}
		}

		en4.core.runonce.add(function() {
			AutocompleterRequestJSON('member_name', "<?php echo $this->url(array('module' => 'user', 'controller' => 'index', 'action' => 'getusers'), 'default', true) ?>", function(selecteditem) {
				document.getElementById('user_id').value = selecteditem.id;
			});
			choosemember(4);
		});
	</script>
<?php else: ?>
	<div class="tip">
		<?php echo $this->translate("Your email has been queued for sending."); ?>
	</div>
<?php endif; ?>