Back to PhocacartRenderAdminjs class

Method renderAjaxDoRequestWizardAfterChange

public static
renderAjaxDoRequestWizardAfterChange
(mixed $url, mixed $value = 'phClickBtn')

Method renderAjaxDoRequestWizardAfterChange - Source code

/* When the modal window will be focused, check again the statuses of all the items
 */
public static function renderAjaxDoRequestWizardAfterChange($url, $value = 'phClickBtn')
{
    $s = array();
    $s[] = 'jQuery(document).ready(function() {';
    $s[] = '   phDoRequestWizard(\'' . $url . '\');';
    $s[] = '   jQuery(window).on("blur focus", function(e) {';
    $s[] = '      var prevType = jQuery(this).data("prevType");';
    $s[] = ' ';
    $s[] = '	  if (prevType != e.type) {';
    $s[] = '	     switch (e.type) {';
    $s[] = '		   case "blur":';
    $s[] = '		   break;';
    $s[] = '		   case "focus":';
    $s[] = '              phDoRequestWizard(\'' . $url . '\');';
    $s[] = '		   break;';
    $s[] = '	     }';
    $s[] = '      }';
    $s[] = ' ';
    $s[] = '   jQuery(this).data("prevType", e.type);';
    $s[] = '   })';
    $s[] = '})';
    Factory::getDocument()->addScriptDeclaration(implode("\n", $s));
}