<?php if(!defined('PARENT')) { exit; } ?>

    <div class="row">
      <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <ul class="nav nav-tabs">
          <li class="active"><a href="#one" data-toggle="tab"><i class="fa fa-pencil fa-fw"></i> <span class="hidden-xs"><?php echo $msw_adm_aff_add; ?></span></a></li>
          <li><a href="#two" data-toggle="tab"><i class="fa fa-user fa-fw"></i> <span class="hidden-xs"><?php echo $msw_adm_aff_add2; ?></span></a></li>
          <li><a href="#three" data-toggle="tab"><i class="fa fa-money fa-fw"></i> <span class="hidden-xs"><?php echo $msw_adm_aff_add10; ?></span></a></li>
          <li><a href="#four" data-toggle="tab"><i class="fa fa-file-text-o fa-fw"></i> <span class="hidden-xs"><?php echo $msw_adm_aff_add11; ?></span></a></li>
        </ul>
      </div>
    </div>

    <form method="post" action="#">
    <div class="row formarea">
      <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <div class="tab-content">
          <div class="tab-pane active in" id="one">
            <div class="panel panel-default">
              <div class="panel-body">
                <div class="form-group">
                  <label><?php echo $msw_adm_aff_add3; ?></label>
                  <input type="text" class="form-control" name="fm[fname]" value="<?php echo (isset($ED->fname) ? mswSH($ED->fname) : ''); ?>">
                </div>
                <div class="form-group">
                  <label><?php echo $msw_adm_aff_add4; ?></label>
                  <input type="text" class="form-control" name="fm[lname]" value="<?php echo (isset($ED->lname) ? mswSH($ED->lname) : ''); ?>">
                </div>
                <div class="form-group">
                  <label><?php echo $msw_adm_aff_add5; ?></label>
                  <input type="text" class="form-control" name="fm[email]" value="<?php echo (isset($ED->email) ? mswSH($ED->email) : ''); ?>">
                </div>
                <div class="form-group">
                  <label><?php echo $msw_adm_aff_add6; ?> <span class="passGenReveal">&nbsp;</span></label>
                  <div class="form-group input-group">
                    <span class="input-group-addon"><a href="#" onclick="mswPassGen();return false"><i class="fa fa-key fa-fw"></i></a></span>
                    <input type="password" class="form-control" name="fm[pass]" value="" onkeyup="mswPassClr()">
                  </div>
                </div>
                <div class="form-group">
                  <label><?php echo $msw_adm_aff_add7; ?></label>
                  <div class="radio">
                    <label><input type="radio" name="fm[en]" value="yes"<?php echo (isset($ED->en) && $ED->en == 'yes' ? ' checked="checked"' : (!isset($ED->en) ? ' checked="checked"' : '')); ?>> <?php echo $msw_common; ?></label>
                  </div>
                  <div class="radio">
                   <label><input type="radio" name="fm[en]" value="no"<?php echo (isset($ED->en) && $ED->en == 'no' ? ' checked="checked"' : ''); ?>> <?php echo $msw_common2; ?></label>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="tab-pane fade" id="two">
            <div class="panel panel-default">
              <div class="panel-body">
                <div class="form-group">
                  <label><?php echo $msw_adm_aff_add13; ?></label>
                  <div class="form-group input-group" style="margin-bottom:5px">
                    <span class="input-group-addon"><i class="fa fa-calendar fa-fw"></i></span>
                    <input type="text" class="form-control mswdatepicker" name="fm[ts]" value="<?php echo (isset($ED->ts) ? $DT->converter($ED->ts) : $DT->converter($DT->ts())); ?>">
                  </div>
                </div>
              	<div class="form-group">
                  <label><?php echo $msw_adm_aff_add8; ?></label>
                  <input type="text" class="form-control" name="fm[code]" value="<?php echo (isset($ED->code) ? mswSH($ED->code) : ''); ?>">
                </div>
                <div class="form-group">
                  <label><?php echo $msw_adm_aff_add9; ?></label>
                  <input type="text" class="form-control" name="fm[commtier]" value="<?php echo (isset($ED->commtier) ? mswSH($ED->commtier) : ''); ?>">
                </div>
                <div class="form-group">
                  <label><?php echo $msw_adm_aff_add12; ?></label>
                  <input type="text" class="form-control" name="fm[ip]" value="<?php echo (isset($ED->ip) ? mswSH($ED->ip) : ''); ?>">
                </div>
              </div>
            </div>
          </div>
          <div class="tab-pane fade" id="three">
            <div class="panel panel-default">
              <div class="panel-body">
                <textarea class="form-control" name="fm[payinfo]"><?php echo (isset($ED->payinfo) ? mswSH($ED->payinfo) : ''); ?></textarea>
              </div>
            </div>
          </div>
          <div class="tab-pane fade" id="four">
            <div class="panel panel-default">
              <div class="panel-body">
                <textarea class="form-control" name="fm[notes]"><?php echo (isset($ED->notes) ? mswSH($ED->notes) : ''); ?></textarea>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="act-button">
      <button type="button" class="btn btn-success" onclick="mswAction('<?php echo $cmd . (isset($ED->id) ? '-edit' : ''); ?>')"><i class="fa fa-<?php echo (isset($ED->id) ? 'check' : 'plus'); ?> fa-fw"></i> <span class="hidden-xs"><?php echo (isset($ED->id) ? $msw_common5 : $msw_adm_aff_add14); ?></span></button>
      <?php
      if (isset($ED->id)) {
      ?>
      <input type="hidden" name="fm[id]" value="<?php echo $ED->id; ?>">
      <input type="hidden" name="fm[opass]" value="<?php echo mswSH($ED->pass); ?>">
      <input type="hidden" name="fm[rdr]" value="<?php echo (isset($_GET['rdr']) ? mswSH($_GET['rdr']) : 'no'); ?>">
      <button type="button" class="btn btn-default left_20" onclick="mswWin('<?php echo (isset($_GET['rdr']) ? mswSH($_GET['rdr']) : 'aff-manage'); ?>')"><i class="fa fa-arrow-left fa-fw"></i> <span class="hidden-xs"><?php echo $msw_common6; ?></span></button>
      <?php
      }
      ?>
    </div>
    </form>