{extends "../window.tpl"}

{block size}
   width = 1150;
   height = 700;
{/block}

{block css append}
   <style>
      .cke_contents > iframe {
         width: 100% !important;
      }
   </style>
{/block}

{block tabs}
   {windowTab id='flapProduct'}
   {if $body.data.id && findModule("pricelists")}
      {windowTab id='flapPricelists'}
   {/if}
   {windowTab id='flapTexts'}
   {if $body.data.id && findModule("products_variations")}
      {windowTab id='flapVariations' label="{'flapVariations'|translate} {if $body.variationCount > 0} ({$body.variationCount}){/if}"}
   {/if}
   {if $body.data.id}
      {windowTab id='flapCategorization'}
   {/if}
   {if $body.data.id && findModule("products_parameters")}
      {windowTab id='flapParameters'}
   {/if}
   {if $body.data.id && ($module.TEMPLATES || $module.PRODUCT_SETS || findModule('links') || findModule("attachments") || $module.ORDER_DISCOUNT)}
      {windowTab id='flapFillIn'}
   {/if}
   {if $body.data.id && findModule("photos")}
      {windowTab id='flapPhotos'}
   {/if}
   {if findModule("seo")}
      {windowTab id='flapSeo' label='flapSeo'|translate:'seo'}
   {/if}
   {if false && $body.acn == "edit" && findModule("products_comments") && {find_right name="products_comments"}}
      {windowTab id='flapComments'}
   {/if}
{/block}

{block tabsContent}
   <div id="flapProduct" class="tab-pane fade boxStatic">
      {include "window/products.product.tpl"}
   </div>

   {if {find_module name="pricelists"}}
   <div id="flapPricelists" class="tab-pane fade boxFlex box iframe-box">
      <iframe class='on-demand boxFlex' src="" data-src="launch.php?s=products.pricelists.php&amp;ID={$body.data.id}"></iframe>
   </div>
   {/if}


   <div id="flapTexts" class="tab-pane fade boxFlex">
      {include "window/products.texts.tpl"}
   </div>


   {if {find_module name="products_variations"}}
      <div id="flapVariations" class="tab-pane fade boxFlex box iframe-box">
         {if $body.acn == "edit"}
            <iframe class='on-demand boxFlex' src="" data-src="launch.php?s=products.variations.php&amp;ID={$body.data.id}"></iframe>
         {else}
            <div class="row">
               <div class="col-md-12">
                  <div class="alert alert-info alert-dismissable"> {'variationsNewProductNote'|translate} </div>
               </div>
            </div>
         {/if}
      </div>
   {/if}

   <div id="flapCategorization" class="tab-pane fade boxFlex box iframe-box">
       {if $body.acn == "edit"}
          <iframe class='on-demand boxFlex' src="" data-src="launch.php?s=products.sections.php&amp;type=products&amp;ID={$body.data.id}"></iframe>
       {/if}
      <script>
         // proverit collections jestli to funguje
         {if $body.selected != NULL && ($body.products_related || $body.collections.own)}
         addTabClass('flapCategorization', 'success');
         {elseif $body.selected == NULL}
         addTabClass('flapCategorization', 'error');
         {/if}
      </script>
   </div>

   {if {find_module name="products_parameters"}}
      <div id="flapParameters" class="tab-pane fade boxFlex box iframe-box">
         {if $body.acn == "edit"}
            <iframe class='on-demand boxFlex' src="" data-src="launch.php?s=products.parameters.php&amp;ID={$body.data.id}"></iframe>
         {else}
            <div class="row">
               <div class="col-md-12">
                  <div class="alert alert-info alert-dismissable"> {'parametersNewProductNote'|translate} </div>
               </div>
            </div>
         {/if}
      </div>
   {/if}

   <div id="flapFillIn" class="tab-pane fade boxStatic">
      {include "window/products.others.tpl"}
   </div>

   {if {find_module name="photos"}}
      <div id="flapPhotos" class="tab-pane fade boxFlex box iframe-box">
         {if $body.acn == "edit"}
            <iframe class='on-demand boxFlex' src="" data-src="launch.php?s=products.photos.php&amp;ID={$body.data.id}"></iframe>
         {else}
            <div class="row">
               <div class="col-md-12">
                  <div class="alert alert-info alert-dismissable">{'saveToAddImg'|translate:'base'}</div>
               </div>
            </div>
         {/if}
      </div>
   {/if}

   {if {find_module name="seo"}}
      <div id="flapSeo" class="tab-pane fade boxFlex box">
         {include "window/products.seo.tpl"}
      </div>
   {/if}


   {if $body.acn == "edit" && {find_module name="products_comments"} && {find_right name="products_comments"}}
      <div id="flapComments" class="tab-pane fade boxFlex box">
         <iframe class='on-demand boxFlex' src="" data-src="launch.php?s=comments.php&amp;ID={$body.data.id}"></iframe>
      </div>
   {/if}

   <script>
      {if $body.missingParameters.count === 0 and $body.missingParameters.required == true}
      addTabClass('flapParameters', 'success');
      {elseif $body.missingParameters.count > 0 and $body.missingParameters.required == true}
      addTabClass('flapParameters', 'error');
      {/if}
   </script>

{/block}
