<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
?>

<?php if( $this->form ): ?>

  <?php echo $this->form->render($this) ?>

	<script type="text/javascript">
		en4.core.runonce.add(function() {
			if(document.getElementById('menu_icon_preview-wrapper'))
			document.getElementById('menu_icon_preview-wrapper').style.display = 'none';
		});

		function showReadImage(input,id) {
			var url = input.value; 
			var ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase();
			if (input.files && input.files[0] && (ext == "png" || ext == "jpeg" || ext == "jpg" || ext == 'PNG' || ext == 'JPEG' || ext == 'JPG' || ext == 'webp')){
				var reader = new FileReader();
				reader.onload = function (e) {
					document.getElementById(id+'-wrapper').style.display = 'block';
					scriptJquery('#'+id).attr('src', e.target.result);
				}
				document.getElementById(id+'-wrapper').style.display = 'block';
				reader.readAsDataURL(input.files[0]);
			}
		}
	</script>
<?php elseif( $this->status ): ?>

  <div class="admin_popup_success_msg"><?php echo $this->translate("Your changes have been saved.") ?></div>

  <script type="text/javascript">
    setTimeout(function() {
      parent.window.location.replace( '<?php echo $this->url(array('action' => 'index','module'=>"core",'controller'=>'menus'),'admin_default',true); ?>?name=<?php echo $this->selectedMenu->name; ?>' )
    }, 500);
  </script>

<?php endif; ?>
