<?php
 namespace VnChocola\Model;
 use TCMS\Model;
 use TCMS\FieldModel;
 use FIELD_DATA_TYPE;
 class ReservesModel extends Model {
 public $tableName = 'Reserves';
 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 = false;
 $field->displayName = lang('reserve_model.code');
 }
);
 $this->addField('nameCustomer', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 $field->displayName = lang('reserve_model.name_customer');
 }
);
 $this->addField('plate', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->displayName = lang('reserve_model.plate');
 }
);
 $this->addField('search_plate', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->displayName = lang('reserve_model.plate');
 }
);
 $this->addField('staffID', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 $field->setDataSource('StaffsModel', 'name');
 $field->displayName = lang('staff_model.name');
 }
);
 $this->addField('CVDV', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 $field->setDataSource('StaffsModel', 'name');
 $field->displayName = lang('staff_model.CVDV');
 }
);
 $this->addField('branchID', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 }
);
 $this->addField('fromDate', FIELD_DATA_TYPE::DATE, function(FieldModel $field) {
 $field->required = true;
 $field->format = lang('time.dateFormat');
 $field->autoFormat = true;
 $field->extension = 'datetime-picker';
 $field->displayName = lang('reserve_model.fromDate');
 }
);
 $this->addField('fromTime', FIELD_DATA_TYPE::TIME, function(FieldModel $field) {
 $field->required = true;
 $field->format = 'H:i';
 $field->extension = 'datetime-picker';
 $field->displayName = lang('reserve_model.fromTime');
 }
);
 $this->addField('toTime', FIELD_DATA_TYPE::TIME, function(FieldModel $field) {
 $field->required = true;
 $field->format = 'H:i';
 $field->extension = 'datetime-picker';
 $field->displayName = lang('reserve_model.toTime');
 }
);
 $this->addField('purposeID', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 $field->setDataSource('PurposesModel', 'title');
 $field->displayName = lang('purpose_model.name');
 }
);
 $this->addField('carcompartmentID', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = false;
 $field->setDataSource('CarCompartmentIDsModel', 'title');
 $field->displayName = lang('CarCompartment_model.name');
 }
);
 $this->addField('confirm', FIELD_DATA_TYPE::BOOLEAN, function(FieldModel $field) {
 $field->required = true;
 $field->defaultValue = 0;
 }
);
 $this->addField('status', FIELD_DATA_TYPE::INTEGER, function(FieldModel $field) {
 $field->required = true;
 $field->defaultValue = 0;
 $field->displayName = lang('staff_model.status');
 }
);
 $this->addField('note', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->displayName = lang('reserve_model.note');
 }
);
 }
 }
