<?php

namespace modules\forms\models;

use Yii;
use yii\behaviors\BlameableBehavior;
use yii\behaviors\TimestampBehavior;

/**
 * This is the model class For table "dt183".
 *
 * @property string $id
 * @property string $actid
 * @property integer $created_at
 * @property integer $created_by
 * @property integer $updated_at
 * @property integer $updated_by
 * @property string $employee
 */
class Dt183 extends \common\models\Base {
    public $printlayout = 'Portrait';
    public $form = 'dt183';
    public $formname = '(DT183)';
    public $formLayout = 'dt183/_form.php';
    public $viewLayout = 'dt183/_view.php';
    public $dates = ['created_at', 'updated_at', 'deleted_at'];
	public $uniqueidentifiers = ['actid'];
    public $securefields = [];
    public $formType = 'Thermic';
    public $createpath = '/forms/dt183/create';
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'dt183';
    }

    /**
     * @inheritdoc
     */
    public function rules(): array
    {
        return [
            [['actid', 'employee'], 'string'],
					//Defaults
			[['deleted'], 'boolean'],
			[['created_at', 'updated_at', 'deleted_at'], 'integer'],
			[['created_by', 'updated_by', 'id'],'safe'],
			//Redundant
			[['created_by2', 'updated_by2'], 'integer'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels(): array
    {
        return [
            'id' => 'ID',
            'actid' => 'Actid',
            'created_at' => 'Created At',
            'created_by' => 'Created By',
            'updated_at' => 'Updated At',
            'updated_by' => 'Updated By',
            'employee' => 'Employee',
        ];
    }	
    public function beforeValidate(){
        $this->padno = $this->padno == null ? User::Padno() : $this->padno;
        return parent::beforeValidate();
    }

    /**
     * @Disabled
     */
    public static function adminFormButtons($buttons, $model){
      $_this = new self();
        /*$buttons[$_this->formType]['items'][] = [
            'label' => $_this->formname,
            'url' => [$_this->createpath, 'actid' => $model->id],
            'linkOptions' =>  ['target'=>'_blank'],
        ];*/
        return $buttons;
    }
}
