<?php echo $header; ?><?php echo $column_left; ?>
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="submit" form="form-service" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button>
        <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
      <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>
  </div>
  <div class="container-fluid">
    <?php if ($error_warning) { ?>
    <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    <?php } ?>
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3>
      </div>
      <div class="panel-body">
        <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-service" class="form-horizontal">
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-status"><?php echo $entry_status; ?></label>
            <div class="col-sm-10">
              <select name="status" id="input-status" class="form-control">
                <?php if ($status) { ?>
                <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
                <option value="0"><?php echo $text_disabled; ?></option>
                <?php } else { ?>
                <option value="1"><?php echo $text_enabled; ?></option>
                <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
                <?php } ?>
              </select>
            </div>
          </div>
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input-name"><?php echo $entry_name; ?></label>
            <div class="col-sm-10">
              <input type="text" name="name" value="<?php echo $name; ?>" placeholder="<?php echo $entry_name; ?>" id="input-name" class="form-control" />
              <?php if ($error_name) { ?>
              <div class="text-danger"><?php echo $error_name; ?></div>
              <?php } ?>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-blog"><?php echo $entry_blog; ?></label>
            <div class="col-sm-10">
              <input type="text" name="blog" value="<?php echo $blog; ?>" placeholder="<?php echo $entry_blog; ?>" id="input-blog" class="form-control" />
            </div>
          </div>
		  <div class="form-group">
            <label class="col-sm-2 control-label" for="input-main"><?php echo $entry_main; ?></label>
            <div class="col-sm-10">
              <select name="main" id="input-main" class="form-control">
				<?php if ($main == 'container') { ?>
                <option value="container" selected="selected"><?php echo $text_mainc; ?></option>
				<?php } else { ?>
                <option value="container"><?php echo $text_mainc; ?></option>
				<?php } ?>
				<?php if ($main == 'fullwidth') { ?>
                <option value="fullwidth" selected="selected"><?php echo $text_mainfw; ?></option>
				<?php } else { ?>
				<option value="fullwidth"><?php echo $text_mainfw; ?></option>
                <?php } ?>
              </select>
            </div>
          </div>
		  <div class="form-group">
            <label class="col-sm-2 control-label" for="input-npositions"><?php echo $entry_npositions; ?></label>
            <div class="col-sm-10">
              <select name="npositions" id="input-npositions" class="form-control">
				<?php if ($npositions == 'u-header u-header--sticky-top u-header--toggle-section u-header--change-appearance') { ?>
                <option value="u-header u-header--sticky-top u-header--toggle-section u-header--change-appearance" selected="selected">固定在头部</option>
				<?php } else { ?>
                <option value="u-header u-header--sticky-top u-header--toggle-section u-header--change-appearance">固定在头部</option>
				<?php } ?>
				<?php if ($npositions == 'u-header u-header--sticky-top u-header--toggle-section u-header--show-hide') { ?>
                <option value="u-header u-header--sticky-top u-header--toggle-section u-header--show-hide" selected="selected">下拉隐藏</option>
				<?php } else { ?>
				<option value="u-header u-header--sticky-top u-header--toggle-section u-header--show-hide">下拉隐藏</option>
                <?php } ?>
				<?php if ($npositions == 'u-header u-header--sticky-bottom u-header--change-appearance') { ?>
                <option value="u-header u-header--sticky-bottom u-header--change-appearance" selected="selected">固定在底部</option>
				<?php } else { ?>
				<option value="u-header u-header--sticky-bottom u-header--change-appearance">固定在底部</option>
                <?php } ?>
				<?php if ($npositions == 'u-header u-header--static u-header--floating g-mt-40--lg') { ?>
                <option value="u-header u-header--static u-header--floating g-mt-40--lg" selected="selected">浮动导航</option>
				<?php } else { ?>
				<option value="u-header u-header--static u-header--floating g-mt-40--lg">浮动导航</option>
                <?php } ?>
				<?php if ($npositions == 'u-header u-header--static u-header--show-hide u-header--change-appearance') { ?>
                <option value="u-header u-header--static u-header--show-hide u-header--change-appearance" selected="selected">分割头部</option>
				<?php } else { ?>
				<option value="u-header u-header--static u-header--show-hide u-header--change-appearance">分割头部</option>
                <?php } ?>
				<?php if ($npositions == 'u-header u-header--static u-header--change-appearance') { ?>
                <option value="u-header u-header--static u-header--change-appearance" selected="selected">固定分割头部</option>
				<?php } else { ?>
				<option value="u-header u-header--static u-header--change-appearance">固定分割头部</option>
                <?php } ?>
				<?php if ($npositions == 'u-header u-header--abs-top u-header--show-hide u-header--change-appearance') { ?>
                <option value="u-header u-header--abs-top u-header--show-hide u-header--change-appearance" selected="selected">绝对位置在头部</option>
				<?php } else { ?>
				<option value="u-header u-header--abs-top u-header--show-hide u-header--change-appearance">绝对位置在头部</option>
                <?php } ?>
				<?php if ($npositions == 'u-header u-header--abs-bottom u-header--change-appearance') { ?>
                <option value="u-header u-header--abs-bottom u-header--change-appearance" selected="selected">绝对位置在底部</option>
				<?php } else { ?>
				<option value="u-header u-header--abs-bottom u-header--change-appearance">绝对位置在底部</option>
                <?php } ?>
				<?php if ($npositions == 'u-header u-header--abs-top-2nd-screen u-header--change-appearance') { ?>
                <option value="u-header u-header--abs-top-2nd-screen u-header--change-appearance" selected="selected">绝对位置在第二屏</option>
				<?php } else { ?>
				<option value="u-header u-header--abs-top-2nd-screen u-header--change-appearance">绝对位置在第二屏</option>
                <?php } ?>
              </select>
            </div>
          </div>
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input-navp"><span data-toggle="tooltip" title="<?php echo $help_navp; ?>"><?php echo $entry_navp; ?></span></label>
            <div class="col-sm-10">
              <input type="text" name="navp" value="<?php echo $navp; ?>" placeholder="<?php echo $entry_navp; ?>" id="input-navp" class="form-control" />
              <?php if ($error_navp) { ?>
              <div class="text-danger"><?php echo $error_navp; ?></div>
              <?php } ?>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-image"><?php echo $entry_image; ?></label>
            <div class="col-sm-10">
              <a href="" id="thumb-image" data-toggle="image" class="img-thumbnail"><img src="<?php echo $thumb; ?>" alt="" title="" data-placeholder="<?php echo $placeholder; ?>" /></a>
              <input type="hidden" name="image" value="<?php echo $image; ?>" id="input-image" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-width"><?php echo $entry_width; ?></label>
            <div class="col-sm-10">
              <input type="text" name="width" value="<?php echo $width; ?>" placeholder="<?php echo $entry_width; ?>" id="input-width" class="form-control" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-height"><?php echo $entry_height; ?></label>
            <div class="col-sm-10">
              <input type="text" name="height" value="<?php echo $height; ?>" placeholder="<?php echo $entry_height; ?>" id="input-height" class="form-control" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-bgcolortitle"><?php echo $entry_bgcolortitle; ?></label>
            <div class="col-sm-10">
			<div class="row">
            <div class="col-sm-3">
			<div id="cp2" class="input-group colorpicker-component colorpicker-element">
              <input type="text" name="bgcolor" value="<?php echo $bgcolor; ?>"  placeholder="<?php echo $entry_bgcolor; ?>" id="input-bgcolor" class="color form-control"  />
             <span class="input-group-addon"><i></i></span>
			 </div>
			  </div>
            <div class="col-sm-3">
			<div id="cp3" class="input-group colorpicker-component colorpicker-element">
              <input type="text" name="titlecss" value="<?php echo $titlecss; ?>"  placeholder="<?php echo $entry_titlejbcss; ?>" id="input-titlecss" class="color form-control"  />
              <span class="input-group-addon"><i></i></span>
			  </div>
			  </div>
            <div class="col-sm-3">
              <input type="text" name="navpadding" value="<?php echo $navpadding; ?>"  placeholder="<?php echo $entry_navpadding; ?>" id="input-navpadding" class="form-control"  />
              </div>
              </div>
            </div>
          </div> 
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-bgback"><?php echo $entry_bgback; ?></label>
            <div class="col-sm-10">
			<div class="row">
            <div class="col-sm-3">
			<div id="cp4" class="input-group colorpicker-component colorpicker-element">
              <input type="text" name="bgcolorbk" value="<?php echo $bgcolorbk; ?>"  placeholder="<?php echo $entry_bgcolorbk; ?>" id="input-bgcolorbk" class="color form-control"  />
             <span class="input-group-addon"><i></i></span>
			 </div>
			  </div>
            <div class="col-sm-3">
			<div id="cp5" class="input-group colorpicker-component colorpicker-element">
              <input type="text" name="titlecssbk" value="<?php echo $titlecssbk; ?>"  placeholder="<?php echo $entry_titlecssbk; ?>" id="input-titlecssbk" class="color form-control"  />
              <span class="input-group-addon"><i></i></span>
			  </div>
			  </div>
            <div class="col-sm-3">
              <input type="text" name="navpbk" value="<?php echo $navpbk; ?>"  placeholder="<?php echo $entry_navpbk; ?>" id="input-navpbk" class="form-control"  />
              </div>
            <div class="col-sm-3">
              <input type="text" name="navtx" value="<?php echo $navtx; ?>"  placeholder="<?php echo $entry_navtx; ?>" id="input-navtx" class="form-control"  />
              </div>
              </div>
            </div>
          </div> 		  
          <table id="images" class="table table-striped table-bordered table-hover">
            <thead>
              <tr>
                <td class="text-left"><?php echo $entry_title; ?></td>
                <td class="text-left"><span data-toggle="tooltip" title="<?php echo $help_link; ?>"><?php echo $entry_link; ?></span></td>
                <td class="text-right"><?php echo $entry_sort_order; ?></td>
                <td></td>
              </tr>
            </thead>
            <tbody>
              <?php $service_row = 0; ?>
              <?php foreach ($services as $service) { ?>
              <tr id="service-row<?php echo $service_row; ?>">
                <td class="text-left"><?php foreach ($languages as $language) { ?>
                    <input type="text" name="service[<?php echo $service_row; ?>][title][<?php echo $language['language_id']; ?>]" value="<?php echo isset($service['title'][$language['language_id']]) ? $service['title'][$language['language_id']] : ''; ?>" placeholder="<?php echo $entry_title; ?>" class="form-control" />
                  <?php if (isset($error_service[$service_row][$language['language_id']])) { ?>
                  <div class="text-danger"><?php echo $error_service[$service_row][$language['language_id']]; ?></div>
                  <?php } ?>
                  <?php } ?></td>
                 
                <td class="text-left"><input type="text" name="service[<?php echo $service_row; ?>][link]" value="<?php echo $service['link']; ?>" placeholder="<?php echo $entry_link; ?>" class="form-control" /></td>

                <td class="text-right" style="width: 10%;"><input type="text" name="service[<?php echo $service_row; ?>][sort_order]" value="<?php echo $service['sort_order']; ?>" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td>
                <td class="text-left"><button type="button" onclick="$('#service-row<?php echo $service_row; ?>, .tooltip').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>
              </tr>
              <?php $service_row++; ?>
              <?php } ?>
            </tbody>
            <tfoot>
              <tr>
                <td colspan="3"></td>
                <td class="text-left"><button type="button" onclick="addService();" data-toggle="tooltip" title="<?php echo $button_add; ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td>
              </tr>
            </tfoot>
          </table>
        </form>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
var service_row = <?php echo $service_row; ?>;

function addService() {
  html  = '<tr id="service-row' + service_row + '">';
  html += '  <td class="text-left">';
  <?php foreach ($languages as $language) { ?>
  html += '      <input type="text" name="service[' + service_row + '][title][<?php echo $language['language_id']; ?>]" value="" placeholder="<?php echo $entry_title; ?>" class="form-control" />';
  <?php } ?>
  html += '  </td>';
    
  html += '  <td class="text-left"><input type="text" name="service[' + service_row + '][link]" value="" placeholder="<?php echo $entry_link; ?>" class="form-control" /></td>';

  html += '  <td class="text-right" style="width: 10%;"><input type="text" name="service[' + service_row + '][sort_order]" value="" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td>';
  html += '  <td class="text-left"><button type="button" onclick="$(\'#service-row' + service_row  + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>';
  html += '</tr>';

  $('#images tbody').append(html);

  service_row++;
}
//--></script>
	<script type="text/javascript">
		$(function () {
		    $('#cp2, #cp4').colorpicker({
		      format: "rgba"
		    });
		    $('#cp3, #cp5').colorpicker();
		  });
	</script>
 <link href="view/javascript/colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet">
 <script src="view/javascript/colorpicker/js/bootstrap-colorpicker.min.js"></script>

<?php echo $footer; ?>
</div>