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

<?php include APPLICATION_PATH .  '/application/modules/Browserpush/views/scripts/dismiss_message.tpl';
?>
<div class="clear">
  <div class='settings'>
    <?php echo $this->form->render($this); ?>
  </div>
</div>
<div class="waiting_msg_box" style="display:none;">
	<div class="waiting_msg_box_cont">
    <?php echo $this->translate("Please wait.. It might take some time to activate plugin."); ?>
    <i></i>
  </div>
</div>
<?php if(!Engine_Api::_()->getApi('settings', 'core')->getSetting('browserpush.pluginactivated',0)) { ?>
	<script type="application/javascript">
  	scriptJquery('.global_form').submit(function(e){
			scriptJquery('.waiting_msg_box').show();
		});
  </script>
<?php } ?>

<?php $notificationpush = Engine_Api::_()->getApi('settings', 'core')->getSetting('browserpush.notificationpush', 1);?>

<script type="text/javascript">
 
  en4.core.runonce.add(function() {
    showHide('<?php echo $notificationpush;?>');
    //showHideOptions('<?php //echo Engine_Api::_()->getApi('settings', 'core')->getSetting('browserpush.type',0) ;?>');
  });
  
  function showHide(value) {
    if(value == 1) {
      document.getElementById('browserpush_type-wrapper').style.display = 'flex';
      document.getElementById('browserpush_title-wrapper').style.display = 'flex';
      document.getElementById('browserpush_descr-wrapper').style.display = 'flex';
      document.getElementById('browserpush_logo-wrapper').style.display = 'flex';
      document.getElementById('browserpush_days-wrapper').style.display = 'flex';
      document.getElementById('browserpush_height-wrapper').style.display = 'flex';
      document.getElementById('browserpush_width-wrapper').style.display = 'flex';
      document.getElementById('browserpush_percontainer-wrapper').style.display = 'flex';
      showHideOptions('<?php echo Engine_Api::_()->getApi('settings', 'core')->getSetting('browserpush.type',0) ;?>');
      showperHide('<?php echo Engine_Api::_()->getApi('settings', 'core')->getSetting('browserpush.percontainer',1) ;?>');
    } else {
      document.getElementById('browserpush_type-wrapper').style.display = 'none';
      document.getElementById('browserpush_title-wrapper').style.display = 'none';
      document.getElementById('browserpush_descr-wrapper').style.display = 'none';
      document.getElementById('browserpush_logo-wrapper').style.display = 'none';
      document.getElementById('browserpush_days-wrapper').style.display = 'none';
      document.getElementById('browserpush_height-wrapper').style.display = 'none';
      document.getElementById('browserpush_width-wrapper').style.display = 'none';
      document.getElementById('browserpush_percontainer-wrapper').style.display = 'none';
      showHideOptions(0);
      showperHide(0);
    }
  }
  
  function showperHide(value) {
    if(value == 1) {
      document.getElementById('browserpush_textpercontai-wrapper').style.display = 'flex';
    } else {
      document.getElementById('browserpush_textpercontai-wrapper').style.display = 'none';
    }
  }
  
  function showHideOptions(value) {
    if(value == 1) {
      //document.getElementById('browserpush_type-wrapper').style.display = 'flex';
      document.getElementById('browserpush_title-wrapper').style.display = 'flex';
      document.getElementById('browserpush_descr-wrapper').style.display = 'flex';
      document.getElementById('browserpush_logo-wrapper').style.display = 'flex';
      document.getElementById('browserpush_days-wrapper').style.display = 'flex';
      document.getElementById('browserpush_height-wrapper').style.display = 'none';
      document.getElementById('browserpush_width-wrapper').style.display = 'none';
    } else if(value == 2) {
      //document.getElementById('browserpush_type-wrapper').style.display = 'flex';
      document.getElementById('browserpush_title-wrapper').style.display = 'flex';
      document.getElementById('browserpush_descr-wrapper').style.display = 'flex';
      document.getElementById('browserpush_logo-wrapper').style.display = 'flex';
      document.getElementById('browserpush_days-wrapper').style.display = 'flex';
      document.getElementById('browserpush_height-wrapper').style.display = 'none';
      document.getElementById('browserpush_width-wrapper').style.display = 'none';
    } else if(value == 3) {
      //document.getElementById('browserpush_type-wrapper').style.display = 'flex';
      document.getElementById('browserpush_title-wrapper').style.display = 'flex';
      document.getElementById('browserpush_descr-wrapper').style.display = 'flex';
      document.getElementById('browserpush_logo-wrapper').style.display = 'flex';
      document.getElementById('browserpush_days-wrapper').style.display = 'flex';
      document.getElementById('browserpush_height-wrapper').style.display = 'flex';
      document.getElementById('browserpush_width-wrapper').style.display = 'flex';
    } 
    
    else {
      //document.getElementById('browserpush_type-wrapper').style.display = 'none';
      document.getElementById('browserpush_title-wrapper').style.display = 'none';
      document.getElementById('browserpush_descr-wrapper').style.display = 'none';
      document.getElementById('browserpush_logo-wrapper').style.display = 'none';
      document.getElementById('browserpush_days-wrapper').style.display = 'none';
      document.getElementById('browserpush_height-wrapper').style.display = 'none';
      document.getElementById('browserpush_width-wrapper').style.display = 'none';
    }
  }
</script>
