<?php
 namespace VnChocola\Model;
 use TCMS\Model;
 use TCMS\FieldModel;
 use FIELD_DATA_TYPE;
 class CustomersModel extends Model {
 public $tableName = 'Customers';
 public $timestamp = true;
 public function registerField() {
 $this->addField('id', FIELD_DATA_TYPE::STRING);
 $this->addField('code', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 }
);
 $this->addField('name', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 }
);
 $this->addField('email', FIELD_DATA_TYPE::STRING);
 $this->addField('tel', FIELD_DATA_TYPE::STRING);
 $this->addField('phone', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 }
);
 $this->addField('fax', FIELD_DATA_TYPE::STRING);
 $this->addField('sex', FIELD_DATA_TYPE::INTEGER, function(FieldModel $field) {
 $field->required = true;
 $field->defaultValue = 1;
 }
);
 $this->addField('birthday', FIELD_DATA_TYPE::DATE, function(FieldModel $field) {
 $field->format = lang('time.dateFormat');
 $field->autoFormat = true;
 }
);
 $this->addField('notify', FIELD_DATA_TYPE::BOOLEAN);
 $this->addField('cityID', FIELD_DATA_TYPE::STRING);
 $this->addField('districtID', FIELD_DATA_TYPE::STRING);
 $this->addField('address', FIELD_DATA_TYPE::STRING);
 $this->addField('interests', FIELD_DATA_TYPE::STRING);
 $this->addField('note', FIELD_DATA_TYPE::STRING);
 $this->addField('company', FIELD_DATA_TYPE::STRING);
 $this->addField('companyCityID', FIELD_DATA_TYPE::STRING);
 $this->addField('companyDistrictID', FIELD_DATA_TYPE::STRING);
 $this->addField('companyAddress', FIELD_DATA_TYPE::STRING);
 $this->addField('companyPhone', FIELD_DATA_TYPE::STRING);
 $this->addField('companyFax', FIELD_DATA_TYPE::STRING);
 $this->addField('companyemail', FIELD_DATA_TYPE::STRING);
 $this->addField('companyTypeID', FIELD_DATA_TYPE::STRING);
 $this->addField('department', FIELD_DATA_TYPE::STRING);
 $this->addField('position', FIELD_DATA_TYPE::STRING);
 $this->addField('personContact',FIELD_DATA_TYPE::STRING);
 $this->addField('personContactPhone',FIELD_DATA_TYPE::STRING);
 $this->addField('staffID', FIELD_DATA_TYPE::STRING, function(FieldModel $field){
 $field->require = true;
 }
);
 $this->addField('branchID', FIELD_DATA_TYPE::STRING, function(FieldModel $field){
 $field->require = true;
 }
);
 $this->addField('insurranceId', FIELD_DATA_TYPE::STRING);
 $this->addField('loanCarId', FIELD_DATA_TYPE::STRING);
 }
 }
