<?php
/**
 * The create view file of customer module of ZDOO.
 *
 * @copyright   Copyright 2009-2018 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     ZPL (http://zpl.pub/page/zplv12.html)
 * @author      Tingting Dai <daitingting@xirangit.com>
 * @package     customer
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
<?php include '../../common/view/editor.html.php';?>
<div class='panel'>
  <div class='panel-heading'>
    <strong><?php echo $lang->customer->create;?></strong>
  </div>
  <div class='panel-body'>
    <form method='post' id='customerForm' class='no-margin-t'>
      <fieldset class='no-margin-b'>
        <table class='table table-form'>
          <tr>
            <th class='w-80px'></th>
            <td class='w-300px'></td>
            <th class='w-100px'></th>
            <td class='w-300px'></td>
            <td></td>
          </tr>
          <tr>
            <th><?php echo $lang->customer->name;?></th>
            <td colspan='3'>
              <div class='input-group'>
                <?php echo html::input('name', '', "class='form-control'");?>
                <span class='input-group-addon universal'>
                  <label class='checkbox-inline'><input type='checkbox' id='public' name='public' value='1'> <?php echo $lang->customer->public;?></label>
                </span>
              </div>
            </td>
            <td></td>
          </tr>
          <tr class='universal'>
            <th><?php echo $lang->customer->sourceType;?></th>
            <td><?php echo html::select('sourceType', $lang->customer->sourceTypeList, '', "class='form-control chosen'");?></td>
            <th><?php echo $lang->customer->sourceNote;?></th>
            <td><?php echo html::input('sourceNote', '', "class='form-control'");?></td>
            <td></td>
          </tr>
          <tr class='universal'>
            <th><?php echo $lang->customer->source;?></th>
            <td><?php echo html::select('source', $lang->customer->sourceList, '', "class='form-control chosen'");?></td>
            <th><?php echo $lang->customer->CSM;?></th>
            <td><?php echo html::select('CSM', $users, '', "class='form-control chosen'");?></td>
            <td></td>
          </tr>
        </table>
      </fieldset>
      <fieldset class='universal no-margin-b'>
        <legend class='text-muted'><?php echo $lang->customer->contactInfo;?></legend>
        <table class='table table-form'>
          <tr>
            <th class='w-80px'><?php echo $lang->customer->contact;?></th>
            <td class='w-300px'>
              <div class='input-group'>
                <?php echo html::input('contact', '', "class='form-control'");?>
                <?php echo html::select('contactID', array('') + $contacts, '', "class='form-control chosen' style='display:none' data-no_results_text='" . $lang->searchMore . "'");?>
                <div class='input-group-addon'>
                  <label class='checkbox-inline'><input type='checkbox' id='selectContact' name='selectContact' value='1'> <?php echo $lang->customer->selectContact;?></label>
                </div>
              </div>
            </td>
            <th class='w-100px'><?php echo $lang->contact->gender;?></th>
            <td class='w-300px'><?php unset($lang->genderList['u']); echo html::radio('gender', $lang->genderList, '');?></td>
            <td></td>
          </tr>
          <tr class='contactInfo'>
            <th><?php echo $lang->customer->position;?></th>
            <td id='titleTD'>
              <?php echo html::input('title', '', "class='title-input form-control'");?>
            </td>
            <th><?php echo $lang->customer->email;?></th>
            <td><?php echo html::input('email', '', "class='form-control'");?></td>
            <td></td>
          </tr>
          <tr class='contactInfo'>
            <th><?php echo $lang->customer->mobile;?></th>
            <td><?php echo html::input('mobile', '', "class='form-control'");?></td>
            <th><?php echo $lang->customer->weixin;?></th>
            <td><?php echo html::input('weixin', '', "class='form-control'");?></td>
            <td></td>
          </tr>
          <tr class='contactInfo'>
            <th><?php echo $lang->customer->phone;?></th>
            <td><?php echo html::input('phone', '', "class='form-control'");?></td>
            <th><?php echo $lang->customer->qq;?></th>
            <td><?php echo html::input('qq', '', "class='form-control'");?></td>
            <td></td>
          </tr>
        </table>
      </fieldset>
      <fieldset class='no-margin-b'>
        <legend class='text-muted'><?php echo $lang->customer->customerInfo;?></legend>
        <table class='table table-form'>
          <tr class='universal'>
            <th class='w-80px'><?php echo $lang->customer->status;?></th>
            <td class='w-300px'><?php echo html::select("status", $lang->customer->statusList, '', "class='form-control chosen'");?></td>
            <th class='w-100px'><?php echo $lang->customer->level;?></th>
            <td class='w-300px'><?php echo html::select('level', $levelList, 0, "class='form-control chosen'");?></td>
            <td></td>
          </tr>
          <tr>
            <th class='w-80px'><?php echo $lang->customer->type;?></th>
            <td class='w-300px'><?php echo html::select('type', $lang->customer->typeList, '', "class='form-control chosen'");?></td>
            <th class='w-100px'><?php echo $lang->customer->industry;?></th>
            <td class='w-300px'><?php echo html::select('industry', $industryList, '', "class='form-control chosen'");?></td>
            <td></td>
          </tr>
          <tr>
            <th><?php echo $lang->customer->size;?></th>
            <td><?php echo html::select('size', $sizeList, '', "class='form-control chosen'");?></td>
            <th><?php echo $lang->customer->area;?></th>
            <td><?php echo html::select('area', $areaList, '', "class='form-control chosen'");?></td>
            <td></td>
          </tr>
          <tr class='singleApp'>
            <th><?php echo $lang->customer->weibo;?></th>
            <td><?php echo html::input('weibo', 'http://weibo.com/', "class='form-control'");?></td>
            <th><?php echo $lang->customer->weixin;?></th>
            <td><?php echo html::input('customerWeixin', '', "class='form-control'");?></td>
            <td></td>
          </tr>
          <tr class='singleApp'>
            <th><?php echo $lang->customer->site;?></th>
            <td colspan='3'><?php echo html::input('site', 'http://', "class='form-control'");?></td>
            <td></td>
          </tr>
          <tr class='universal'>
            <?php $this->app->loadLang('address', 'crm');?>
            <th><?php echo $lang->customer->address;?></th>
            <td colspan='3'>
              <div class='input-group'>
                <?php echo html::input('address[title]', '', "id='addresstitle' class='form-control' placeholder='{$lang->address->title}'")?>
                <span class="input-group-addon fix-padding"></span>
                <?php echo html::select('address[area]', $areaList, '', "id='addressarea' class='form-control chosen' data-placeholder='{$lang->address->area}'")?>
                <span class="input-group-addon fix-padding"></span>
                <?php echo html::input('address[location]', '', "id='addresslocation' class='form-control' placeholder='{$lang->address->location}'")?>
              </div>
            </td>
            <td></td>
          </tr>
          <tr class='universal'>
            <th><?php echo $lang->customer->intension;?></th>
            <td colspan='3'><?php echo html::textarea('intension', '', "rows='2' class='form-control'");?></td>
            <td></td>
          </tr>
          <?php $this->printExtendFields('', 'table', 'columns=3');?>
          <tr>
            <th></th>
            <td colspan='3' class='form-actions'>
              <?php echo html::submitButton() . html::backButton();?>
              <div id='duplicateError' class='hide'></div>
            </td>
            <td></td>
          </tr>
        </table>
      </fieldset>
    </form>
  </div>
</div>
<div class='errorMessage hide'>
  <div class='alert alert-danger alert-dismissable'>
    <button aria-hidden='true' data-dismiss='alert' class='close' type='button'>×</button>
    <button type='button' class='btn btn-default' id='continueSubmit'><?php echo $lang->continueSave;?></button>
  </div>
</div>
<script>
<?php helper::import('../js/searchcontact.js');?>
</script>
<?php include $app->getAppRoot() . 'common/view/footer.html.php';?>
