{extends "../window.tpl"}

{block tabs}
    {windowTab id='flapProduct' label="Produkt dodavatele"}
{/block}

{block tabsContent}
    <div id="flapProduct" class="tab-pane fade active in boxStatic box">
        <h1 class="h4 main-panel-title">Produkt dodavatele</h1>
        <div class="form-group">
            <div class="col-md-2 control-label"><label>Produkt</label></div>
            {if empty($body.data.id_product)}
                <div class="col-md-4">
                    <input type="text" class="form-control input-sm" id="id_product" name="data[id_product]" size="5" maxlength="100" value="{$body.data.id_product}" style="width: 100%;" tabindex="1" />
                </div>
                <div class="col-md-2 control-label"><label>Varianta</label></div>
                <div class="col-md-3">
                    <select class="selecter" name="data[id_variation]" id="id_variation">
                        <option value="{$body.data.id_variation}" >{$body.data.id_variation}</option>
                    </select>
                </div>
                <script type="text/javascript">
                    $(function(){
                        var $form = $("#flapProduct");
                        initAutocompleteVariation($form.find(":input[name*=id_product]"), $form.find(":input[name*=id_variation]"));
                    });
                </script>
            {else}
                <div class="col-md-4">
                    <p class="input-height"><a href="javascript:nw('product', {$body.data.id_product})">{$body.data.product_title}</a></p>
                </div>
                <div class="col-md-2 control-label"><label>Varianta</label></div>
                <div class="col-md-3">
                    <p class=" input-height">{$body.data.variation_title}</p>
                </div>
                <input type="hidden" name="data[id_product]" value="{$body.data.id_product}" />
                <input type="hidden" name="data[id_variation]" value="{$body.data.id_variation}" />
            {/if}
        </div>
        <div class="form-group">
            <div class="col-md-2 control-label"><label>Dodavatel</label></div>
            <div class="col-md-4">
                {print_select name="data[id_supplier]" var=$body.suppliers selected=$body.data.id_supplier}
            </div>
            <div class="col-md-2 control-label"><label>Kód u dodavatele</label></div>
            <div class="col-md-3">
                <input type="text" class="form-control input-sm" name="data[code]" size="5" maxlength="100" value="{$body.data.code}" style="width: 100%;" />
            </div>

        </div>
        <div class="form-group">
            <div class="col-md-2 control-label"><label>EAN</label></div>
            <div class="col-md-3">
                <input type="text" class="form-control input-sm" name="data[ean]" size="5" maxlength="20" value="{$body.data.ean}"/>
            </div>

        </div>

        <h1 class="h4 main-panel-title">Doplňující informace</h1>
        <div class="form-group">
             <div class="col-md-3 control-label"><label>Skladem u dodavatele</label></div>
            <div class="col-md-2">
                <input type="text" class="form-control input-sm" name="data[in_store]" size="5" maxlength="100" value="{$body.data.in_store}" style="width: 100%;" />
            </div>
            <div class="col-md-3 control-label"><label>{'last_sync'|translate}</label></div>
            <div class="col-md-3">
                <input type="text" class="form-control input-sm" name="data[last_sync]" id="last_sync" size="5" maxlength="100" value="{$body.data.last_sync|format_datetime}" style="width: 100%;" autocomplete="off" />
                {insert_calendar selector='#last_sync' format='datetime'}
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-3 control-label"><label>Poznámka</label></div>
            <div class="col-md-8">
                <textarea class="form-control" name="data[note]">{$body.data.note}</textarea>
            </div>
        </div>
       <h1 class="h4 main-panel-title">Ceny</h1>
       <div class="form-group">
          <div class="col-md-3 control-label"><label>Nákupní cena od prodejce:</label></div>
          <div class="col-md-2">
             <input type="text" class="form-control input-sm" name="" size="5" maxlength="100" value="{$body.data.price_buy}" style="width: 100%;" />
          </div>
       </div>
       <div class="form-group">
          <div class="col-md-3 control-label"><label>Doporučená prodejní cena:</label></div>
          <div class="col-md-2">
             <input type="text" class="form-control input-sm" name="" size="5" maxlength="100" value="{$body.data.price_sell}" style="width: 100%;" />
          </div>
       </div>

        {if findModule('stock_in')}
            <h1 class="h4 main-panel-title">Import</h1>
            <div class="form-group">
                <div class="col-md-2 control-label">
                    <label>{'import_multiplier'|translate}</label>
                </div>
                <div class="col-md-10">
                    <input type="text" class="form-control" name="data[import_multiplier]" maxlength="100" value="{$body.data.import_multiplier}" />
                    <span class="help-block">0 = neimportovat, 1 = importovat normálně, &gt;2 = násobit počet kusů v importu daným číslem</span>
                </div>
            </div>
        {/if}

       <h1 class="h4 main-panel-title">Na cestě</h1>
       <div class="form-group">
          <div class="col-md-3 control-label">
             <label>Počet kusů</label>
          </div>
          <div class="col-md-2">
             <input type="text" class="form-control input-sm" name="data[forecasted_pieces]" size="5" maxlength="100"
                    value="{$body.data.forecasted_pieces}"
                    style="width: 100%;"/>
          </div>
          <div class="col-md-3 control-label">
             <label>Dostupné od</label>
          </div>
          <div class="col-md-3">
             <input type="text" class="form-control input-sm" name="data[forecasted_delivery_date]" id="forecasted_delivery_date" size="5"
                    maxlength="100"
                    value="{$body.data.forecasted_delivery_date|format_datetime}" style="width: 100%;" autocomplete="off"/>
             {insert_calendar selector='#forecasted_delivery_date' format='datetime'}
          </div>
       </div>
    </div>
{/block}
