<?php echo $header; ?>
<?php echo $column_left; ?>

<div id="content" class="isl-module-content">
  <script>var islConfig = <?php echo json_encode($islConfig); ?>;</script>
  <div class="page-header">
    <div class="container-fluid">
      <h1><?php echo $heading_title; ?></h1>

      <ul class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
          <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
        <?php } ?>
      </ul>

      <div class="pull-right">
        <button onclick="$('#form-isl-<?php echo $islConfig['name']; ?>-category').submit();" type="submit" class="save-changes btn btn-primary" data-toggle="tooltip" title="<?php echo $button_save; ?>"><i class="fa fa-save"></i></button>
        <a href="<?php echo $url_module; ?>" class="btn btn-default" data-toggle="tooltip" title="<?php echo $text_cancel; ?>"><i class="fa fa-reply"></i></a>
      </div>
    </div>
  </div>

  <div class="container-fluid">
    <?php if ($error_warning) { ?>
      <div class="alert alert-danger">
        <i class="fa fa-exclamation-circle" style="margin-right:10px"></i><?php echo $error_warning; ?>
      </div>
    <?php } ?>
    <?php if ($success) { ?>
      <div class="alert alert-success autoSlideUp">
        <button type="button" class="close" data-dismiss="alert">&times;</button>
        <i class="fa fa-check-circle" style="margin-right:10px"></i><?php echo $success; ?>
      </div>
      <script>$('.autoSlideUp').delay(5000).fadeOut(600, function(){ $(this).show().css({'visibility':'hidden'}); }).slideUp(600);</script>
    <?php } ?>

    <div class="page-content">
      <div class="panel panel-default">
        <form action="<?php echo $url_form; ?>" method="post" enctype="multipart/form-data" id="form-isl-<?php echo $islConfig['name']; ?>-category" class="form-horizontal">

          <div class="panel-heading">
            <h3 id="_top" class="panel-title"><i class="fa fa-pencil"></i> <?php echo $sub_title; ?></h3>
          </div>

          <div class="panel-body">

            <div class="row">
              <div class="<?php echo !empty($info_form_category_content) ? 'col-md-9' : 'col-xs-12' ?>">

                <ul class="nav nav-tabs lang-tabs" role="tablist">
                  <?php foreach ($languages as $language) { ?>
                    <li>
                      <a href="#lang-<?php echo $language['language_id']; ?>" role="tab" data-toggle="tab">
                        <img src="<?php echo $language['flag_url']; ?>"> <?php echo $language['name']; ?>
                      </a>
                    </li>
                  <?php } ?>
                </ul>
                <div class="tab-content">
                  <?php foreach ($languages as $language) { ?>
                    <div class="tab-pane" id="lang-<?php echo $language['language_id']; ?>">
                      <div class="form-group required">
                        <label class="col-sm-3 control-label"><?php echo $entry_title; ?></label>
                        <div class="col-sm-9">
                          <input name="<?php echo $module_setting; ?>[title][<?php echo $language['language_id']; ?>]" class="form-control" type="text" value="<?php echo !empty($setting['category']['title'][$language['language_id']]) ? $setting['category']['title'][$language['language_id']] : $setting['category']['title'][0]; ?>" >
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label"><?php echo $entry_content; ?></label>
                        <div class="col-sm-9">
                          <?php $content = !empty($setting['category']['content'][$language['language_id']]) ? $setting['category']['content'][$language['language_id']] : $setting['category']['content'][0]; ?>
                          <textarea name="<?php echo $module_setting; ?>[content][<?php echo $language['language_id']; ?>]" data-isl-summernote='300'><?php echo $content; ?></textarea>
                        </div>
                      </div>

                      <div class="form-group">
                        <label class="col-sm-3 control-label"><?php echo $entry_meta_title; ?></label>
                        <div class="col-sm-9">
                          <input name="<?php echo $module_setting; ?>[meta_title][<?php echo $language['language_id']; ?>]" class="form-control" type="text" value="<?php echo !empty($setting['category']['meta_title'][$language['language_id']]) ? $setting['category']['meta_title'][$language['language_id']] : $setting['category']['meta_title'][0]; ?>" >
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label"><?php echo $entry_meta_desc; ?></label>
                        <div class="col-sm-9">
                          <textarea name="<?php echo $module_setting; ?>[meta_description][<?php echo $language['language_id']; ?>]" class="form-control" rows="4"><?php echo !empty($setting['category']['meta_description'][$language['language_id']]) ? $setting['category']['meta_description'][$language['language_id']] : $setting['category']['meta_description'][0]; ?></textarea>
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label"><?php echo $entry_meta_keywords; ?></label>
                        <div class="col-sm-9">
                          <input name="<?php echo $module_setting; ?>[meta_keyword][<?php echo $language['language_id']; ?>]" class="form-control" type="text" value="<?php echo !empty($setting['category']['meta_keyword'][$language['language_id']]) ? $setting['category']['meta_keyword'][$language['language_id']] : $setting['category']['meta_keyword'][0]; ?>" >
                          <div class="isl-help">Comma separated value. Ex: <code>ecommerce, marketing, opencart</code></div>
                        </div>
                      </div>

                    </div>
                  <?php } ?>
                </div> <!-- /.tab-content -->

              </div>

              <?php if (!empty($info_form_category_content)) { ?>
              <div class="col-md-3">
                <div class="panel panel-default panel-info">
                  <div class="panel-heading"><?php echo $text_information; ?></div>
                  <div class="panel-body">
                    <ul class="isl-list">
                      <?php foreach ($info_form_category_content as $info) { ?>
                        <li><?php echo $info ?></li>
                      <?php } ?>
                    </ul>
                  </div>
                </div>
              </div>
              <?php } ?>
            </div>

            <h3 id="_settings" class="isl-legend"><?php echo $text_settings; ?></h3>
            <hr class="isl-hr">

            <div class="row">
              <div class="<?php echo !empty($info_form_category_setting) ? 'col-md-9' : 'col-xs-12' ?>">

                <div class="form-group">
                  <label class="col-sm-3 control-label"><?php echo $entry_url_alias; ?></label>
                  <div class="col-sm-9">
                    <input name="<?php echo $module_setting; ?>[url_alias]" class="form-control" type="text" value="<?php echo $setting['category']['url_alias']; ?>" >
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-3 control-label"><?php echo $entry_parent; ?></label>
                  <div class="col-sm-9">
                    <select name="<?php echo $module_setting; ?>[parent_id]" class="form-control">
                      <option value="0" <?php echo !$setting['category']['parent_id'] ? 'selected="selected"' : ''; ?>><?php echo $text_none; ?></option>
                      <?php foreach ($categories as $category) { ?>
                        <?php if ($setting['category']['category_id'] != $category['category_id']) { ?>
                          <option value="<?php echo $category['category_id']; ?>" <?php echo $setting['category']['parent_id'] == $category['category_id'] ? 'selected="selected"' : ''; ?>><?php echo $category['path']; ?></option>
                        <?php } ?>
                      <?php } ?>
                    </select>
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-3 control-label"><?php echo $entry_image; ?></label>
                  <div class="col-sm-9">
                    <a href="#" id="thumb-category-image" data-toggle="image" class="img-thumbnail">
                      <img src="<?php echo $setting['category']['image_thumb']; ?>" alt="" title="" data-placeholder="<?php echo $no_image; ?>" >
                    </a>
                    <input type="hidden" name="<?php echo $module_setting; ?>[image]" value="<?php echo $setting['category']['image']; ?>" id="input-category-image" >
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-3 control-label"><?php echo $entry_sort_order; ?></label>
                  <div class="col-sm-6 col-md-3">
                    <input type="number" name="<?php echo $module_setting; ?>[sort_order]" value="<?php echo $setting['category']['sort_order']; ?>" min="0" class="form-control isl-w-s isl-inline-block">
                    <i class="fa fa-question-circle text-primary isl-ml-5" data-toggle="tooltip" title="Sort order 0 will be put in last order."></i>
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-3 control-label"><?php echo $entry_status; ?></label>
                  <div class="col-sm-6 col-md-3">
                    <select name="<?php echo $module_setting; ?>[status]" class="form-control">
                      <option value="1" <?php echo $setting['category']['status'] == '1' ? 'selected="selected"' : ''; ?>><?php echo $text_enabled; ?></option>
                      <option value="0" <?php echo $setting['category']['status'] != '1' ? 'selected="selected"' : ''; ?>><?php echo $text_disabled; ?></option>
                    </select>
                  </div>
                </div>

              </div>
              <?php if (!empty($info_form_category_setting)) { ?>
              <div class="col-md-3">
                <div class="panel panel-default panel-info">
                  <div class="panel-heading"><?php echo $text_information; ?></div>
                  <div class="panel-body">
                    <ul class="isl-list">
                      <?php foreach ($info_form_category_setting as $info) { ?>
                        <li><?php echo $info ?></li>
                      <?php } ?>
                    </ul>
                  </div>
                </div>
              </div>
              <?php } ?>
            </div>


          </div> <!-- /.panel-body -->
        </form>
      </div>
    </div> <!-- /.page-content -->

  </div> <!-- /.container-fluid -->
</div>

<?php echo $footer; ?>
