<?php
 namespace VnChocola\Model;
 use TCMS\Model;
 use TCMS\FieldModel;
 use FIELD_DATA_TYPE;
 class StaffsModel extends Model {
 public $tableName = 'Staffs';
 public function registerField() {
 $this->addField('id', FIELD_DATA_TYPE::STRING);
 $this->addField('code', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 $field->displayName = lang('staff_model.code');
 }
);
 $this->addField('name', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 $field->displayName = lang('staff_model.name_display');
 }
);
 $this->addField('account', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->isCustomField = true;
 $field->displayName = lang('staff_model.account');
 $field->showInCreatePage = false;
 $field->showInUpdatePage = false;
 }
);
 $this->addField('phone', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->displayName = lang('staff_model.phone');
 }
);
 $this->addField('email', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->displayName = lang('staff_model.email');
 }
);
 $this->addField('image', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->defaultValue = '/elFinder/files/user.png';
 $field->displayName = lang('staff_model.image');
 $field->extension = 'upload-image';
 }
);
 $this->addField('positionID', FIELD_DATA_TYPE::SELECT, function(FieldModel $field) {
 $field->required = true;
 $field->displayName = lang('position_model.name');
 $field->extension = 'chocola-select';
 $field->extensionOption = [ 'key' => 'storeID' ];
 $field->setDataSource('PositionsModel', 'name', 'id', lang('position_model.choose_default'));
 }
);
 $this->addField('branchID', FIELD_DATA_TYPE::SELECT, function(FieldModel $field) {
 $field->required = true;
 $field->displayName = lang('branch_model.name');
 $field->extension = 'chocola-select';
 $field->extensionOption = [ 'key' => 'storeID' ];
 $field->setDataSource('BranchsModel', 'name', 'id', lang('branch_model.choose_default'));
 }
);
 }
 }
