<?php
 namespace VnChocola\Model;
 use TCMS\Model;
 use TCMS\FieldModel;
 use FIELD_DATA_TYPE;
 class CallHistorysModel extends Model {
 public $tableName = 'CallHistorys';
 public $timestamp = true;
 public function registerField() {
 $this->addField('id', FIELD_DATA_TYPE::STRING);
 $this->addField('storeID', FIELD_DATA_TYPE::SELECT, function(FieldModel $field) {
 $field->required = true;
 $auth = load_auth();
 $field->defaultValue = $auth->getUser()->storeID;
 }
);
 $this->addField('branchID', FIELD_DATA_TYPE::SELECT, function(FieldModel $field) {
 $field->required = true;
 $auth = load_auth();
 $field->defaultValue = $auth->getUser()->branchID;
 }
);
 $this->addField('staffID', FIELD_DATA_TYPE::SELECT, function(FieldModel $field){
 $field->require = true;
 $auth = load_auth();
 $field->defaultValue = $auth->getUser()->staffId;
 }
);
 $this->addField('customerID', FIELD_DATA_TYPE::SELECT);
 $this->addField('hotCustomerID', FIELD_DATA_TYPE::SELECT);
 $this->addField('phoneCustomer', FIELD_DATA_TYPE::SELECT);
 $this->addField('timeStart', FIELD_DATA_TYPE::DATETIME, function(FieldModel $field) {
 $field->autoFormat = true;
 $field->require = true;
 }
);
 $this->addField('timeCall', FIELD_DATA_TYPE::INTEGER, function(FieldModel $field) {
 $field->require = true;
 }
);
 $this->addField('note', FIELD_DATA_TYPE::STRING, function(FieldModel $field){
 $field->defaultValue = "";
 }
);
 $this->addField('status', FIELD_DATA_TYPE::INTEGER, function(FieldModel $field){
 $field->require = true;
 }
);
 }
 }
