<?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="alert alert-danger"><i class="fa fa-info-circle"></i> <?php echo $text_qq_open_signup; ?><button type="button" class="close" data-dismiss="alert">&times;</button></div>
          <div class="alert alert-info"><i class="fa fa-info-circle"></i> <?php echo $text_cwkj_wxts; ?></div>  
		  <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 required">
            <label class="col-sm-2 control-label" for="input-sectionid"><span data-toggle="tooltip" title="" data-original-title="仅限数字，且任意模块值为唯一"><?php echo $entry_sectionid; ?></span></label>
            <div class="col-sm-10">
              <input type="text" name="sectionid" value="<?php echo $sectionid; ?>" placeholder="<?php echo $entry_sectionid; ?>" id="input-sectionid" class="form-control" />
              <?php if ($error_sectionid) { ?>
              <div class="text-danger"><?php echo $error_sectionid; ?></div>
              <?php } ?>
			</div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-sectiontab"><span data-toggle="tooltip" title="" data-original-title="适用于单页，和导航模块组合使用，如此处设置为about，导航中需设置为#about"><?php echo $entry_sectiontab; ?></span></label>
            <div class="col-sm-10">
              <input type="text" name="sectiontab" value="<?php echo $sectiontab; ?>" placeholder="<?php echo $entry_sectiontab; ?>" id="input-sectiontab" 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-autoplay"><?php echo $entry_autoplay; ?></label>
            <div class="col-sm-10">
              <select name="autoplay" id="input-autoplay" class="form-control">
                <?php if ($autoplay) { ?>
                <option value="1" selected="selected"><?php echo $text_yes; ?></option>
                <option value="0"><?php echo $text_no; ?></option>
                <?php } else { ?>
                <option value="1"><?php echo $text_yes; ?></option>
                <option value="0" selected="selected"><?php echo $text_no; ?></option>
                <?php } ?>
              </select>
            </div>
          </div>
		  <div class="form-group">
            <label class="col-sm-2 control-label" for="input-fade"><?php echo $entry_fade; ?></label>
            <div class="col-sm-10">
              <select name="fade" id="input-fade" class="form-control">
                <?php if ($fade) { ?>
                <option value="1" selected="selected"><?php echo $text_yes; ?></option>
                <option value="0"><?php echo $text_no; ?></option>
                <?php } else { ?>
                <option value="1"><?php echo $text_yes; ?></option>
                <option value="0" selected="selected"><?php echo $text_no; ?></option>
                <?php } ?>
              </select>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-speed"><?php echo $entry_speed; ?></label>
            <div class="col-sm-10">
              <input type="text" name="speed" value="<?php echo $speed; ?>" placeholder="<?php echo $entry_speed; ?>" id="input-speed" class="form-control" />
            </div>
          </div>  		  
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-column"><span data-toggle="tooltip" title="<?php echo $help_column; ?>"><?php echo $entry_columns; ?></span></label>
            <div class="col-sm-10">
			<div class="row">
			<div class="col-sm-4">
              <input type="text" name="rows" value="<?php echo $rows; ?>"  placeholder="<?php echo $entry_rows; ?>" id="input-rows" class="form-control"  />
			  </div>
			<div class="col-sm-4">
              <input type="text" name="column" value="<?php echo $column; ?>" placeholder="<?php echo $entry_column; ?>" id="input-column" class="form-control" />
			</div>
	            <div class="col-sm-4">
              <input type="text" name="scroll" value="<?php echo $scroll; ?>" placeholder="<?php echo $entry_scroll; ?>" id="input-scroll" class="form-control" />
            </div>
			</div>
			</div>
          </div>  		          
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-mm"><?php echo $entry_mm; ?></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="mtitle" value="<?php echo $mtitle; ?>"  placeholder="<?php echo $entry_mtitle ?>" id="input-mtitle" 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="mdescribe" value="<?php echo $mdescribe; ?>"  placeholder="<?php echo $entry_mdescribe; ?>" id="input-mdescribe" class="color form-control"  />
              <span class="input-group-addon"><i></i></span>
			  </div>
			  </div>
            <div class="col-sm-3">
			<div id="cp4" class="input-group colorpicker-component colorpicker-element">
              <input type="text" name="mbgcolor" value="<?php echo $mbgcolor; ?>"  placeholder="<?php echo $entry_mbgcolor; ?>" id="input-mbgcolor" class="color form-control"  />
              <span class="input-group-addon"><i></i></span>
			  </div>
			  </div>
            <div class="col-sm-3">
              <input type="text" name="boxrnum" value="<?php echo $boxrnum; ?>"  placeholder="<?php echo $entry_boxrnum; ?>" id="input-boxrnum" class="form-control"  />
              <?php if ($error_boxrnum) { ?>
              <div class="text-danger"><?php echo $error_boxrnum; ?></div>
              <?php } ?>
			  </div>
            <div class="col-sm-3">
              <input type="text" name="mpa" value="<?php echo $mpa; ?>"  placeholder="<?php echo $entry_mpa; ?>" id="input-mpa" class="form-control"  />
              </div>
            <div class="col-sm-3">
              <input type="text" name="mborder" value="<?php echo $mborder; ?>"  placeholder="<?php echo $entry_mborder; ?>" id="input-mborder" class="form-control"  />
              </div>
            </div>
			</div>
          </div> 
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-bgcolor"><?php echo $entry_iconstyle; ?></label>
            <div class="col-sm-10">
			<div class="row">
            <div class="col-sm-3">
			<div id="cp6" class="input-group colorpicker-component colorpicker-element">
              <input type="text" name="miconbj" value="<?php echo $miconbj; ?>"  placeholder="<?php echo $entry_miconbj; ?>" id="input-miconbj" class="color form-control"  />
              <span class="input-group-addon"><i></i></span>
			  </div>
			  </div>
            <div class="col-sm-3">
			<div id="cp7" class="input-group colorpicker-component colorpicker-element">
              <input type="text" name="miconcolorc" value="<?php echo $miconcolorc; ?>"  placeholder="<?php echo $entry_miconcolorc; ?>" id="input-miconcolorc" class="color form-control"  />
              <span class="input-group-addon"><i></i></span>
			  </div>
			  </div>
            <div class="col-sm-3">
			<div id="cp7" class="input-group colorpicker-component colorpicker-element">
              <input type="text" name="miconcolor" value="<?php echo $miconcolor; ?>"  placeholder="<?php echo $entry_miconcolor; ?>" id="input-miconcolor" class="color form-control"  />
              <span class="input-group-addon"><i></i></span>
			  </div>
			  </div>
            <div class="col-sm-3">
              <input type="text" name="hoverbj" value="<?php echo $hoverbj; ?>"  placeholder="<?php echo $entry_hoverbj; ?>" id="input-hoverbj" class="form-control"  />
              </div>	
            <div class="col-sm-3">
              <input type="text" name="hovertit" value="<?php echo $hovertit; ?>"  placeholder="<?php echo $entry_hovertit; ?>" id="input-hovertit" class="form-control"  />
              </div>				  
            <div class="col-sm-3">
              <input type="text" name="miconround" value="<?php echo $miconround; ?>"  placeholder="<?php echo $entry_miconround; ?>" id="input-miconround" class="form-control"  />
              </div>
            <div class="col-sm-3">
              <input type="text" name="miconsize" value="<?php echo $miconsize; ?>"  placeholder="<?php echo $entry_miconsize; ?>" id="input-miconsize" class="form-control"  />
              </div>
            <div class="col-sm-3">
              <input type="text" name="miconborder" value="<?php echo $miconborder; ?>"  placeholder="<?php echo $entry_miconborder; ?>" id="input-miconborder" class="form-control"  />
              </div>
            <div class="col-sm-3">
			<div id="cp10" class="input-group colorpicker-component colorpicker-element">
              <input type="text" name="miconbc" value="<?php echo $miconbc; ?>"  placeholder="<?php echo $entry_miconbc; ?>" id="input-miconbc" class="color form-control"  />
              <span class="input-group-addon"><i></i></span>
			  </div>
			  </div>
            <div class="col-sm-3">
              <input type="text" name="miconwidth" value="<?php echo $miconwidth; ?>"  placeholder="<?php echo $entry_miconwidth; ?>" id="input-miconwidth" class="form-control"  />
              </div>
            <div class="col-sm-3">
              <input type="text" name="miconheight" value="<?php echo $miconheight; ?>"  placeholder="<?php echo $entry_miconheight; ?>" id="input-miconheight" class="form-control"  />
              </div>			  
            </div>
			</div>
          </div> 
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-buttonstyle"><?php echo $entry_buttonstyle; ?></label>
            <div class="col-sm-10">
			<div class="row">
            <div class="col-sm-3">
              <input type="text" name="buttonbj" value="<?php echo $buttonbj; ?>"  placeholder="<?php echo $entry_buttonbj; ?>" id="input-buttonbj" class="form-control"  />
              </div>
            <div class="col-sm-3">
              <input type="text" name="buttoncolor" value="<?php echo $buttoncolor; ?>"  placeholder="<?php echo $entry_buttoncolor; ?>" id="input-buttoncolor" class="form-control"  />
              </div>
            <div class="col-sm-3">
              <input type="text" name="buttonhover" value="<?php echo $buttonhover; ?>"  placeholder="<?php echo $entry_buttonhover; ?>" id="input-buttonhover" class="form-control"  />
              </div>
            <div class="col-sm-3">
              <input type="text" name="buttonround" value="<?php echo $buttonround; ?>"  placeholder="<?php echo $entry_buttonround; ?>" id="input-buttonround" class="form-control"  />
              </div>		  
            </div>
			</div>
          </div> 
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-imgmm"><?php echo $entry_imgmm; ?></label>
            <div class="col-sm-10">
			<div class="row">
            <div class="col-sm-3">
              <input type="text" name="imagewidth" value="<?php echo $imagewidth; ?>" placeholder="<?php echo $entry_imagewidth; ?>" id="input-imagewidth" class="form-control" />
			</div>
            <div class="col-sm-3">
              <input type="text" name="imageheight" value="<?php echo $imageheight; ?>" placeholder="<?php echo $entry_imageheight; ?>" id="input-imageheight" 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"><?php echo $entry_text; ?></td>
                <td class="text-left"><?php echo $entry_icon; ?></td>
				<td class="text-left"><span data-toggle="tooltip" title="" data-original-title="left / right"><?php echo $entry_position; ?></span></td>
				<td class="text-left">块背景颜色</td>
                <td class="text-left"><?php echo $entry_buttonname; ?></td>
                <td class="text-left"><?php echo $entry_link; ?></td>
                <td class="text-left"><?php echo $entry_image; ?></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"  style="width: 20%;"><?php foreach ($languages as $language) { ?>
                    <textarea name="service[<?php echo $service_row; ?>][text][<?php echo $language['language_id']; ?>]" rows="2" placeholder="<?php echo $entry_text; ?>" class="form-control" /><?php echo isset($service['text'][$language['language_id']]) ? $service['text'][$language['language_id']] : ''; ?></textarea>
                  <?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"  style="width: 10%;">
                <input type="text" name="service[<?php echo $service_row; ?>][icon]" value="<?php echo $service['icon']; ?>" placeholder="<?php echo $entry_icon; ?>" class="form-control" />
                </td>
                <td class="text-left"  style="width: 10%;">
                <input type="text" name="service[<?php echo $service_row; ?>][position]" value="<?php echo $service['position']; ?>" placeholder="<?php echo $entry_position; ?>" class="form-control" />
                </td>
                <td class="text-left"  style="width: 10%;">
				<div id="cp21" class="input-group colorpicker-component colorpicker-element">
                <input type="text" name="service[<?php echo $service_row; ?>][boxcolor]" value="<?php echo $service['boxcolor']; ?>" placeholder="<?php echo $entry_boxcolor; ?>" class="form-control" />
                <span class="input-group-addon"><i></i></span>
				</div>
				</td>                 
                <td class="text-left"  style="width: 10%;"><?php foreach ($languages as $language) { ?>
                    <input type="text" name="service[<?php echo $service_row; ?>][buttonname][<?php echo $language['language_id']; ?>]" value="<?php echo isset($service['buttonname'][$language['language_id']]) ? $service['buttonname'][$language['language_id']] : ''; ?>" placeholder="<?php echo $entry_buttonname; ?>" 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-left"><a href="" id="thumb-image<?php echo $service_row; ?>" data-toggle="image" class="img-thumbnail"><img src="<?php echo $service['thumb']; ?>" alt="" title="" data-placeholder="<?php echo $placeholder; ?>" /></a>
                  <input type="hidden" name="service[<?php echo $service_row; ?>][image]" value="<?php echo $service['image']; ?>" id="input-image<?php echo $service_row; ?>" /></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="9"></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"  style="width: 20%;">';
  <?php foreach ($languages as $language) { ?>
  html += '      <textarea name="service[' + service_row + '][text][<?php echo $language['language_id']; ?>]" value="" placeholder="<?php echo $entry_text; ?>" class="form-control" />';
  <?php } ?>
  html += '  </td>';

  html += '  <td class="text-left" style="width: 10%;"><input type="text" name="service[' + service_row + '][icon]" value="" placeholder="<?php echo $entry_icon; ?>" class="form-control" /></td>';
  html += '  <td class="text-left" style="width: 10%;"><input type="text" name="service[' + service_row + '][position]" value="" placeholder="<?php echo $entry_position; ?>" class="form-control" /></td>';
   html += '  <td class="text-left" style="width: 10%;"><div id="cp21" class="input-group colorpicker-component colorpicker-element"><input type="text" name="service[' + service_row + '][boxcolor]" value="" placeholder="<?php echo $entry_boxcolor; ?>" class="color form-control" /><span class="input-group-addon"><i></i></span></div></td>';   
  html += '  <td class="text-left"  style="width: 10%;">';
  <?php foreach ($languages as $language) { ?>
  html += '      <input type="text" name="service[' + service_row + '][buttonname][<?php echo $language['language_id']; ?>]" value="" placeholder="<?php echo $entry_buttonname; ?>" 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-left"><a href="" id="thumb-image' + service_row + '" data-toggle="image" class="img-thumbnail"><img src="<?php echo $placeholder; ?>" alt="" title="" data-placeholder="<?php echo $placeholder; ?>" /></a><input type="hidden" name="service[' + service_row + '][image]" value="" id="input-image' + service_row + '" /></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 () {
		    $('#cp5').colorpicker({
		      format: "rgba"
		    });
		    $('#cp2, #cp3, #cp4, #cp6, #cp7, #cp8, #cp9, #cp10, #cp11, #cp12, #cp13, #cp14, #cp15, #cp21').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>