Files
kupshop/admin/templates/window.tpl
2025-08-02 16:30:27 +02:00

414 lines
18 KiB
Smarty

{extends "frame.tpl"}
{block "css-entry" append}
{encore_entry_link_tags entry='window' build='admin'}
{/block}
{block "js-entry" append}
{encore_entry_script_tags entry='window' build='admin'}
{/block}
{block sentry}
{include "utils/sentry.tpl"}
{/block}
{block "js" append}
<script src="/admin/static/js/wpj.actions.modal.js"></script>
{/block}
{block title}
{$name = $body.data[$view->getNameField()]}
{if $name}
{$name} |
{/if}
{if $body.acn == "edit"}
{'titleEdit'|translate}
{elseif $body.acn =="add"}
{'titleAdd'|translate}
{else}
{$body.acn|translate}
{/if}
{/block}
{block body}
{$smarty.block.parent}
<div data-wpj-modal-mount></div>
{/block}
{block name=windowContent}
<form name="editform" id="editform" method="post" action="launch.php?s={$type}.php&amp;acn={$body.acn}&amp;ID={$body.data.id}"
enctype="multipart/form-data"
class="{block 'form-class'}form-horizontal{/block}" {block 'form-no-validate'}novalidate{/block}>
{* novalidate umoznuje pridavat na input atribut required. Nepotrebujeme ho kvuli validaci ale kvuli css.
validace nefunguje, protoze je obsah skryty v tabech. *}
{if $body.duplicate}
<input type="hidden" name="Duplicate" value="1">
{/if}
{if $smarty.get.autoclose}
<input type="hidden" name="autoclose" value="{$smarty.get.autoclose}">
{/if}
<div class="row static alert-inforow" style="display:none">
<div class="alert autoclose alert-dismissable fade in" id="data-alert-type">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<span class="glyphicon" id="data-alert-icon"></span>
<strong id="data-alert-text"> </strong>
</div>
</div>
{if !empty($ErrStr) || $OkStr}
{if $ErrStr == 'saved'|translate:'status' || $OkStr}
<script>
showInfoMessage('{if !empty($ErrStr)}{$ErrStr nofilter}{elseif !empty($OkStr)}{$OkStr}{/if}', 'success');
</script>
{else}
<script>
alert({$ErrStr|json_encode nofilter});
</script>
{/if}
{/if}
<div class="container-fluid box">
<input type="hidden" name="flap" id="inptHiddenFlap" value="{$header.flap}"/>
{if $header.refresh}
<input type="hidden" name="refresh" id="inptHiddenRefresh" value="{$header.refresh}"/>
{/if}
{block windowButtons}
<div class="window-btns">
{block buttons}
<div class="row">
{block buttonsLeft}
<div class="col-md-4">
{$showOnWeb = $view->getShowOnWeb()}
{if $showOnWeb}
<a href="{if $showOnWeb.url}{$showOnWeb.url}{else}/{'redir'|translate_shop:'SEO_URL'}/?type={$showOnWeb.type}&id={$showOnWeb.id}{/if}"
class="btn btn-primary"
title="{'show'|translate:'button'}" target="_blank">
<span class="glyphicon glyphicon-search"></span>
</a>
{else}
<button type="button" class="btn" title="Zobrazit na webu" disabled="disabled">
<span class="glyphicon glyphicon-search"></span>
</button>
{/if}
<div class="btn-group">
<button type="button" onClick="moveToNext(true);" data-goto="prev" class="btn">
<span class="glyphicon glyphicon-chevron-left"></span> {'prev'|translate:'button'}</button>
<button type="button" onClick="moveToNext(false);" data-goto="next" class="btn">{'next'|translate:'button'}
<span class="glyphicon glyphicon-chevron-right"></span>
</button>
</div>
</div>
{/block}
{block buttonsRight}
{$has_actions = ($actionsLocator && $actionsLocator->isVisible($type))}
{$has_default_button = $body.acn != 'add' and ($view->hasRights('duplicate') or $view->hasRights('delete') or ($tabs and (count($tabs) > 1)))}
{if $view->hasRights('save')}
<div class="col-md-2{if !$has_default_button && !$has_actions} col-md-offset-4{/if}">
<button type="submit" name="Submit" class="btn btn-primary btn-block"
value="{'windowSave'|translate:'button'}">{'windowSave'|translate:'button'}</button>
</div>
{/if}
<div class="col-md-2">
<input type="button" class="btn btn-primary btn-block" onClick="closeWindow();"
value="{'windowCancel'|translate:'button'}"/>
</div>
{block buttonsFreeSpace}
<div class="col-md-2"></div>
{/block}
{block actionButtons}{if ($has_actions || $has_default_button) && $body.acn!='add'}
<div class="col-md-2 pull-right d-flex justify-end">
<div class="dropup dropup-actions flex-grow">
<button class="btn btn-block dropdown-toggle" type="button" id="adminActionsDropdownTrigger"
data-toggle="dropdown">
Akce
</button>
<ul class="dropdown-menu" aria-labelledby="adminActionsDropdownTrigger" id="adminActionsDropdown">
{function printActionButton}
{$actionService->setDialogData($body.data)}
{if $actionService->isVisible()}
<li>
{assign var="hotkey" value=$actionService->getHotKeys()}
<a {if $actionService->getHotKeys()} title="" data-hotkey="{$hotkey['modifier']}{$hotkey['key']}" data-original-title="{$hotkey['modifier']}{$hotkey['key']}{/if}" {if $actionService->hasDialog()}
href="#" data-action="{$actionService|get_class}"
{else}
href="launch.php?s={$type}.php&acn=executeAction&ID={$body.data.id}&action={$actionService|get_class|escape:'url'}"
{/if}
{$actionService->getDialogHrefAttributes() nofilter}
{if $actionService->getLaunchHandler()}
onclick="{$actionService->getLaunchHandler()};"
{/if}
>
{if $actionService->getIcon()}<span class="{$actionService->getIcon()} {$actionService->getColor()}"></span>{/if}
<span{if $actionService->getColorText()} class="{$actionService->getColorText()}"{/if}>{$actionService->getName()}</span>
</a>
</li>
{/if}
{/function}
{$last_priority = null}
{foreach $actionsLocator->getActions($type) as $actionService}
{if $actionService->getPriority() == $actionService::PRIORITY_DUPLICATE}
{$duplicateAction = $actionService}
{continue}
{/if}
{if $actionService->getPriority() == $actionService::PRIORITY_DELETE}
{$deleteAction = $actionService}
{continue}
{/if}
{if $actionService->getPriority() != $last_priority && $actionService@index !== 0}
<li role="separator" class="divider"></li>
{/if}
{printActionButton actionService=$actionService}
{$last_priority = $actionService->getPriority()}
{/foreach}
{block actionMenuButtons}{/block}
{if $has_default_button}
{if $actionsLocator->isVisible($type) && !is_null($last_priority)}
<li role="separator" class="divider"></li>
{/if}
<li style="display: none;">
<a href="" onclick="return wpj.windowUtils.setDefaultTab('{$type}')" id="setDefaultTab">
<span class="glyphicon fc icons_pin"></span>
Nastavit jako výchozí záložku
</a>
</li>
{if $view->hasRights('delete')}
{if $deleteAction}
{printActionButton actionService=$deleteAction}
{else}
<li>
<a href="launch.php?s={$type}.php&amp;acn=erase&amp;ID={$body.data.id}" id="buttonDelete"
class="confirm" title="{'windowDelete'|translate:'button'}">
<span class="glyphicon glyphicon-trash"></span>
{'windowDelete'|translate:'button'}
</a>
</li>
{/if}
{/if}
{if $view->hasRights('duplicate')}
{if $duplicateAction}
{printActionButton actionService=$duplicateAction}
{else}
<li>
<a onclick="window.location='launch.php?s={$type}.php&amp;acn=add&amp;Duplicate=1&amp;ID={$body.data.id}'">
<span class="glyphicon glyphicon-duplicate"></span>
{'windowDuplicate'|translate:'button'}
</a>
</li>
{/if}
{/if}
{/if}
</ul>
</div>
<button class="btn m-l-1 w-max btn-block d-flex justify-center align-center btn-info" type="button" title="Nápověda" data-beacon>
<img src="/admin/static/images/icons_question-circle.svg" width="15" alt="Nápověda">
</button>
</div>
{/if}
{/block}
{/block}
</div>
{/block}
</div>
{/block}
{block content}
<div class="panel box">
<ul id="windowTables" class="nav nav-tabs nav-justified">
{block tabs}
{/block}
{foreach $tabs as $windowTab}
{windowTab id=$windowTab->getTitle() label=$windowTab->getLabel() wpjadmin=$windowTab->isOnlyForWpjAdmin()}
{/foreach}
</ul>
<div class="tab-content boxFlex box">
{block tabsContent}
{/block}
{foreach $tabs as $windowTab}
{insertWindowTab windowTab=$windowTab}
{/foreach}
</div>
</div>
{/block}
</div>
</form>
<script>
$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) {
$("#inptHiddenFlap").val($(this).data('tab'));
$onDemands = $($(this).attr("href")).find(".on-demand");
$.each($onDemands, function() {
var $this = $(this),
data = $this.data("src");
if (data) {
$this.attr("src", data);
$this.data('src', '');
}
})
});
// zmena velikosti okna
if (top.window.location == this.window.location) {
/*
NASTAVENI SPRAVNE VELIKOSTI OKNA, ABY SE NEMUSELO SCROLLOVAT
*/
if (!window.history || window.history.length <= 1 {if $header.force_resize} || true {/if}) {
var width = 1190;
var height = 780;
{block size}
{/block}
resizePopup(window, width, height);
}
}
</script>
{literal}
<script>
!function(e, t, n) {
function a() {
var e = t.getElementsByTagName("script")[0], n = t.createElement("script");
n.type = "text/javascript", n.async = !0, n.src = "https://beacon-v2.helpscout.net", e.parentNode.insertBefore(n, e)
}
if (e.Beacon = n = function(t, n, a) {
e.Beacon.readyQueue.push({method: t, options: n, data: a})
}, n.readyQueue = [], "complete" === t.readyState) return a();
e.attachEvent ? e.attachEvent("onload", a) : e.addEventListener("load", a, !1)
}(window, document, window.Beacon || function() {
});
</script>
<script>
window.Beacon('init', 'e8d8d426-0404-43e8-b43c-bd14c673ba3a');
window.Beacon('identify', {/literal}{helpscout_beacon_identity}{literal});
</script>
<script>
$('[data-beacon]').on('click', function() {
Beacon('open');
return false;
});
</script>
{/literal}
{/block}
<script>
{block onready}
{if $body.acn=='erased'}
refreshOpener(window.opener.top.mainFrame);
closeWindow();
{elseif $body.acn=='erased2'}
refreshOpener(window.opener);
closeWindow();
{elseif $body.acn=='erased3'}
window.opener.top.location = '/{$cfg.Path.admin}';
closeWindow();
{/if}
{$smarty.block.parent}
{$flapNo = $header.flap|default:$smarty.get.flap|default:1}
$.fx.off = true;
if ($.isNumeric('{$flapNo}')) {
$("#windowTables").find("a").eq({$flapNo}-1).trigger('click.bs.tab.data-api');
} else {
$("#windowTables").find("[data-tab={$flapNo}]").trigger('click.bs.tab.data-api');
}
$.fx.off = false;
{if $header.flap_next}
$("#inptHiddenFlap").val({$header.flap_next});
{/if}
$("[data-delete]").click(function(e) {
var selector = $(this).data("delete");
var $row = $(this).closest(selector);
$row.slideUp();
var $delete = $row.find("input[data-delete-check]");
if ($delete.length)
$delete.prop("checked", true);
else
$row.find("input").val("");
});
// Handle tab keyboard navigation
$(document).on('keydown', null, 'ctrl+1', function(e) {
var data = e.data;
{block hotkeys}
var hotKey = (data.modif + data.character).toUpperCase();
var $hotkey = $('[data-hotkey="' + hotKey + '"]');
if ($hotkey.length) {
$hotkey.click();
return false;
}
if (data.modif == "ctrl+") {
if ("0" < data.character && data.character < "9")
switchTab(data.character - 1);
else if (data.character == "\r")
$('input[name=Submit]').click();
else if (data.special == "right")
moveToNext(false);
else if (data.special == "left")
moveToNext(true);
else
return true;
return false;
}
{/block}
});
checkUnsavedChanges();
// Enable/disable prev/next fields
var $prevnext = getWindowStorage('itemPrevNextTmp');
if ($prevnext) {
setWindowStorage('itemPrevNext', $prevnext);
setWindowStorage('itemPrevNextTmp', null);
}
$prevnext = getWindowStorage('itemPrevNext');
if ($prevnext == undefined || $prevnext[1] == null)
$('[data-goto="next"]').prop("disabled", "disabled");
if ($prevnext == undefined || $prevnext[0] == null)
$('[data-goto="prev"]').prop("disabled", "disabled");
// Focus name field
{if $view and $view->getNameField()}
$.dataField('{$view->getNameField()}').focus();
{/if}
$("[name='Submit']").click(function(event) {
event.preventDefault();
checkFormSaved(event.target);
});
$('#adminActionsDropdown [data-action]').click(function(e) {
openActionConfig($(this), $(this).data('action'), '{$type}', '{$body.data.id}');
});
wpj.windowUtils.initDefaultTab('{$type}');
{/block}
</script>
{block name=body_class}class="window"{/block}