{extends "../window.tpl"}

{block size}
    width = 1110;
{/block}

{block tabs}
    {windowTab id='flap1' label="{'flapGlobal'|translate}"}
    {if $body.data.id}
        {windowTab id='flap5' label="{'flapRanges'|translate}"}

        {if findModule('producers')}
            {windowTab id='flap4' label="{'flapProducer'|translate}"}
        {/if}
        {if findModule('products_sections')}
            {windowTab id='flap2' label="{'flapSection'|translate}"}
        {/if}
        {if findModule('products')}
            {windowTab id='flap3' label="{'flapProduct'|translate}"}
        {/if}
    {/if}
{/block}

{block tabsContent}
    <div id="flap1" class="tab-pane fade active in boxStatic box">
        <h1 class="h4 main-panel-title">{'infoHeading'|translate}</h1>
        {block inputs}
        <div class="form-group">
            <div class="col-md-2"><label>{'name'|translate}</label></div>
            <div class="col-md-5">
                <input type="text" class="form-control input-sm" name="data[name]" value="{$body.data.name}">
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-2"><label>{'description'|translate}</label></div>
            <div class="col-md-5">
                <input type="text" class="form-control input-sm" name="data[descr]" value="{$body.data.descr}">
            </div>
        </div>
        <div class="row">
            <div class="col-md-2">
                <label>{'discountForAll'|translate}</label>
                <a data-original-title="{'discountForAllTooltip'|translate}" class="help-tip" data-toggle="tooltip">
                    <i class="bi bi-question-circle"></i>
                </a>
            </div>
            <div class="col-md-2">
                <input type="text" class="form-control input-sm" name="data[discount]"
                       value="{$body.data.discount|default:0}" onKeyPress="checkInputData('float');">
                <span class="help-block">{'discountWithoutVat'|translate}</span>
            </div>
            <div class="col-md-2">
                <label>{'discountForDiscounted'|translate}</label>
                <a data-original-title="{'discountForDiscountedTooltip'|translate}" class="help-tip"
                   data-toggle="tooltip" title="">
                    <i class="bi bi-question-circle"></i>
                </a>
            </div>
            <div class="col-md-2">
                <input type="text" class="form-control input-sm" name="data[discount_discount]"
                       value="{$body.data.discount_discount}" onKeyPress="checkInputData('float');">
            </div>
            <div class="col-md-1">
                <select name="data[unit]" class="selecter">
                    <option value="perc" {"perc"|selected:$body.data.unit} >%</option>
                    <option value="price" {"price"|selected:$body.data.unit}>{$dbcfg.currency}</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-2">
                <label>{'discountAdd'|translate}</label>
                <a data-original-title="{'discountAddTooltip'|translate}"
                   class="help-tip" data-toggle="tooltip" title=""><i class="bi bi-question-circle"></i></a>
            </div>
            <div class="col-md-2">
                {print_toggle name='combine'}
            </div>
        </div>
        {/block}
    </div>

    <div id="flap5" class="tab-pane fade boxFlex">
        {include 'window/priceLevels.ranges.tpl'}
    </div>

    {if {find_module name="producers"}}
        <div id="flap4" class="tab-pane fade boxFlex">
            {include 'window/priceLevels.producers.tpl'}
        </div>
    {/if}

    {if {find_module name="products_sections"}}
        <div id="flap2" class="tab-pane fade boxFlex">
            {include 'window/priceLevels.sections.tpl'}
        </div>
    {/if}

    {if {find_module name="products"}}
        <div id="flap3" class="tab-pane fade boxFlex">
            {include 'window/priceLevels.products.tpl'}
        </div>
    {/if}


{/block}
