<?php

namespace modules\custom\models;


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

/**
 * This is the model class For table "activities".
 *
 * @property string $id
 * @property string $welder
 * @property string $travelstarttime
 * @property integer $starttime
 * @property integer $finishtime
 * @property string $travelfinishtime
 * @property string $shiftlength
 * @property integer $company
 * @property integer $assistant
 * @property string $contact
 * @property string $contactno
 * @property string $location
 * @property string $createdby
 * @property string $createdon
 * @property string $noofwelds
 * @property string $contactemail
 * @property string $noofshifts
 * @property string $comments
 * @property string $shift
 * @property string $noofteams
 * @property string $jobstatus
 * @property string $billingstatus
 * @property string $details
 * @property string $day
 * @property string $welderemail
 * @property string $manageremail
 * @property integer $jobno
 * @property string $jobtype
 * @property string $weldtype
 * @property integer $prevjobno
 * @property integer $cjobno
 * @property string $postcode
 * @property string $googletime
 * @property string $googledistance
 * @property string $railgrade
 * @property string $railsection
 * @property string $contact2
 * @property string $contactemail2
 * @property string $contactno2
 * @property string $contact3
 * @property string $contactemail3
 * @property string $contactno3
 * @property string $contact4
 * @property string $contactemail4
 * @property string $contactno4
 * @property string $contact5
 * @property string $contactemail5
 * @property string $contactno5
 * @property string $journey
 * @property string $fileenquiry
 * @property string $fileorder
 * @property string $filetef
 * @property string $filedocs
 * @property string $filequotation
 * @property string $updatedby
 * @property integer $created_at
 * @property integer $updated_at
 * @property integer $_id
 * @property integer $created_by2
 * @property integer $updated_by2
 * @property string $files
 * @property string $teftitle
 * @property string $tefdata
 * @property string $ordertitle
 * @property string $orderdata
 * @property string $enquirytitle
 * @property string $enquirydata
 * @property string $quotetitle
 * @property string $quotedata
 * @property string $customerpono
 * @property string $tracktrolley
 * @property integer $weekno
 * @property string $sdate
 * @property string $edate
 * @property string $accesspoint
 * @property string $railwear
 * @property string $railtrack
 * @property string $railclosure
 * @property string $process
 * @property string $fuelgas
 * @property string $portion
 * @property string $mould
 * @property string $wpsno
 * @property string $notes
 * @property string $railsupport
 * @property string $railsupport2
 * @property string $railsupport3
 * @property string $railwear2
 * @property string $railwear3
 * @property string $railtrack2
 * @property string $railtrack3
 * @property string $weld
 * @property string $weld2
 * @property string $weld3
 * @property string $railsection2
 * @property string $railsection3
 * @property string $railgrade2
 * @property string $railgrade3
 * @property string $noofwelds1
 * @property string $noofwelds2
 * @property string $noofwelds3
 * @property string $weldprocess1
 * @property string $weldprocess2
 * @property string $weldprocess3
 * @property string $notes2
 * @property string $notes3
 * @property string $jnotes
 * @property string $fuelgas2
 * @property string $fuelgas3
 * @property string $elr
 * @property integer $totalshiftlengthi
 * @property string $depot
 * @property string $totalshiftlengthw
 * @property string $created_by
 * @property string $updated_by
 * @property integer $deleted
 * @property integer $deleted_at
 * @property string $contact6
 * @property string $contactemail6
 * @property string $contactno6
 * @property string $contact7
 * @property string $contactemail7
 * @property string $contactno7
 * @property string $contact8
 * @property string $contactemail8
 * @property string $contactno8
 * @property string $contact9
 * @property string $contactemail9
 * @property string $contactno9
 * @property string $contact10
 * @property string $contactemail10
 * @property string $contactno10
 */
class Tasksbe extends \common\models\Base {
	
    public $dates = ['created_at', 'updated_at', 'deleted_at', 'starttime', 'finishtime'];
	public $uniqueidentifiers = ['company'];
    public $securefields = [];
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'activities';
    }

    /**
     * @inheritdoc
     */
    public function rules(): array
    {
        return [
            [['id', 'welder', 'travelstarttime', 'travelfinishtime', 'shiftlength', 'contact', 'contactno', 'location', 'createdby', 'noofwelds', 'contactemail', 'noofshifts', 'comments', 'shift', 'noofteams', 'jobstatus', 'billingstatus', 'details', 'day', 'welderemail', 'manageremail', 'jobtype', 'weldtype', 'postcode', 'googletime', 'googledistance', 'railgrade', 'railsection', 'contact2', 'contactemail2', 'contactno2', 'contact3', 'contactemail3', 'contactno3', 'contact4', 'contactemail4', 'contactno4', 'contact5', 'contactemail5', 'contactno5', 'journey', 'fileenquiry', 'fileorder', 'filetef', 'filedocs', 'filequotation', 'updatedby', 'files', 'teftitle', 'tefdata', 'ordertitle', 'orderdata', 'enquirytitle', 'enquirydata', 'quotetitle', 'quotedata', 'customerpono', 'tracktrolley', 'accesspoint', 'railwear', 'railtrack', 'railclosure', 'process', 'fuelgas', 'portion', 'mould', 'wpsno', 'notes', 'railsupport', 'railsupport2', 'railsupport3', 'railwear2', 'railwear3', 'railtrack2', 'railtrack3', 'weld', 'weld2', 'weld3', 'railsection2', 'railsection3', 'railgrade2', 'railgrade3', 'noofwelds1', 'noofwelds2', 'noofwelds3', 'weldprocess1', 'weldprocess2', 'weldprocess3', 'notes2', 'notes3', 'jnotes', 'fuelgas2', 'fuelgas3', 'elr', 'depot', 'totalshiftlengthw', 'created_by', 'updated_by', 'contact6', 'contactemail6', 'contactno6', 'contact7', 'contactemail7', 'contactno7', 'contact8', 'contactemail8', 'contactno8', 'contact9', 'contactemail9', 'contactno9', 'contact10', 'contactemail10', 'contactno10'], 'string'],
            [[ 'company', 'assistant', 'jobno', 'prevjobno', 'cjobno', 'created_at', 'updated_at', '_id', 'created_by2', 'updated_by2', 'weekno', 'totalshiftlengthi', 'deleted', 'deleted_at'], 'integer'],
            [['starttime', 'finishtime','createdon', 'sdate', 'edate'], 'safe'],
            [['id'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels(): array
    {
        return [
            'id' => 'ID',
            'welder' => 'Welder',
            'travelstarttime' => 'Travelstarttime',
            'starttime' => 'Starttime',
            'finishtime' => 'Finishtime',
            'travelfinishtime' => 'Travelfinishtime',
            'shiftlength' => 'Shiftlength',
            'company' => 'Company',
            'assistant' => 'Assistant',
            'contact' => 'Contact',
            'contactno' => 'Contactno',
            'location' => 'Location',
            'createdby' => 'Createdby',
            'createdon' => 'Createdon',
            'noofwelds' => 'Noofwelds',
            'contactemail' => 'Contactemail',
            'noofshifts' => 'Noofshifts',
            'comments' => 'Comments',
            'shift' => 'Shift',
            'noofteams' => 'Noofteams',
            'jobstatus' => 'Jobstatus',
            'billingstatus' => 'Billingstatus',
            'details' => 'Details',
            'day' => 'Day',
            'welderemail' => 'Welderemail',
            'manageremail' => 'Manageremail',
            'jobno' => 'Jobno',
            'jobtype' => 'Jobtype',
            'weldtype' => 'Weldtype',
            'prevjobno' => 'Prevjobno',
            'cjobno' => 'Cjobno',
            'postcode' => 'Postcode',
            'googletime' => 'Googletime',
            'googledistance' => 'Googledistance',
            'railgrade' => 'Railgrade',
            'railsection' => 'Railsection',
            'contact2' => 'Contact2',
            'contactemail2' => 'Contactemail2',
            'contactno2' => 'Contactno2',
            'contact3' => 'Contact3',
            'contactemail3' => 'Contactemail3',
            'contactno3' => 'Contactno3',
            'contact4' => 'Contact4',
            'contactemail4' => 'Contactemail4',
            'contactno4' => 'Contactno4',
            'contact5' => 'Contact5',
            'contactemail5' => 'Contactemail5',
            'contactno5' => 'Contactno5',
            'journey' => 'Journey',
            'fileenquiry' => 'Fileenquiry',
            'fileorder' => 'Fileorder',
            'filetef' => 'Filetef',
            'filedocs' => 'Filedocs',
            'filequotation' => 'Filequotation',
            'updatedby' => 'Updatedby',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            '_id' => 'Id',
            'created_by2' => 'Created By2',
            'updated_by2' => 'Updated By2',
            'files' => 'Files',
            'teftitle' => 'Teftitle',
            'tefdata' => 'Tefdata',
            'ordertitle' => 'Ordertitle',
            'orderdata' => 'Orderdata',
            'enquirytitle' => 'Enquirytitle',
            'enquirydata' => 'Enquirydata',
            'quotetitle' => 'Quotetitle',
            'quotedata' => 'Quotedata',
            'customerpono' => 'Customerpono',
            'tracktrolley' => 'Tracktrolley',
            'weekno' => 'Weekno',
            'sdate' => 'Sdate',
            'edate' => 'Edate',
            'accesspoint' => 'Accesspoint',
            'railwear' => 'Railwear',
            'railtrack' => 'Railtrack',
            'railclosure' => 'Railclosure',
            'process' => 'Process',
            'fuelgas' => 'Fuelgas',
            'portion' => 'Portion',
            'mould' => 'Mould',
            'wpsno' => 'Wpsno',
            'notes' => 'Notes',
            'railsupport' => 'Railsupport',
            'railsupport2' => 'Railsupport2',
            'railsupport3' => 'Railsupport3',
            'railwear2' => 'Railwear2',
            'railwear3' => 'Railwear3',
            'railtrack2' => 'Railtrack2',
            'railtrack3' => 'Railtrack3',
            'weld' => 'Weld',
            'weld2' => 'Weld2',
            'weld3' => 'Weld3',
            'railsection2' => 'Railsection2',
            'railsection3' => 'Railsection3',
            'railgrade2' => 'Railgrade2',
            'railgrade3' => 'Railgrade3',
            'noofwelds1' => 'Noofwelds1',
            'noofwelds2' => 'Noofwelds2',
            'noofwelds3' => 'Noofwelds3',
            'weldprocess1' => 'Weldprocess1',
            'weldprocess2' => 'Weldprocess2',
            'weldprocess3' => 'Weldprocess3',
            'notes2' => 'Notes2',
            'notes3' => 'Notes3',
            'jnotes' => 'Jnotes',
            'fuelgas2' => 'Fuelgas2',
            'fuelgas3' => 'Fuelgas3',
            'elr' => 'Elr',
            'totalshiftlengthi' => 'Totalshiftlengthi',
            'depot' => 'Depot',
            'totalshiftlengthw' => 'Totalshiftlengthw',
            'created_by' => 'Created By',
            'updated_by' => 'Updated By',
            'deleted' => 'Deleted',
            'deleted_at' => 'Deleted At',
            'contact6' => 'Contact6',
            'contactemail6' => 'Contactemail6',
            'contactno6' => 'Contactno6',
            'contact7' => 'Contact7',
            'contactemail7' => 'Contactemail7',
            'contactno7' => 'Contactno7',
            'contact8' => 'Contact8',
            'contactemail8' => 'Contactemail8',
            'contactno8' => 'Contactno8',
            'contact9' => 'Contact9',
            'contactemail9' => 'Contactemail9',
            'contactno9' => 'Contactno9',
            'contact10' => 'Contact10',
            'contactemail10' => 'Contactemail10',
            'contactno10' => 'Contactno10',
        ];
    }
    
    public function getNotesl() {
    	if (Yii::$app->controller->action->id == 'create') {
			$tempid = Yii::$app->session->get('tasktempid');
				return \backend\models\Notesbe::find()->where(['actid' => "$tempid"])->all();
		} else {
			return $this->hasMany(\backend\models\Notesbe::class, ['actid' => 'id']);
			
		}
	}
	
}
