93 lines
1.7 KiB
PHP
93 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Carbon\Carbon;
|
|
|
|
class WorkflowDocumentProcess extends Model
|
|
{
|
|
/**
|
|
* The table associated with the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'workflow_document_process';
|
|
|
|
protected $fillable = [
|
|
'parent_id',
|
|
'workflow_document_id',
|
|
'user_id',
|
|
'user_name',
|
|
'user_email',
|
|
'user_role',
|
|
'user_department',
|
|
'assign_by',
|
|
'assigner_name',
|
|
'assigner_email',
|
|
'assigner_role',
|
|
'assigner_department',
|
|
'assign_date',
|
|
'start_date',
|
|
'end_date',
|
|
'comment',
|
|
'status',
|
|
'is_approved',
|
|
'user_type',
|
|
'supporter_action',
|
|
];
|
|
|
|
public function getProcessDate()
|
|
{
|
|
return ($this->assign_date != null) ? Carbon::parse($this->assign_date)->format('d-m-Y H:i') : Carbon::parse($this->created_at)->format('d-m-Y H:i');
|
|
}
|
|
|
|
public function getProcessUserType()
|
|
{
|
|
if($this->user_type == 'S')
|
|
return 'Completed';
|
|
elseif($this->status=='P')
|
|
return 'Pending';
|
|
|
|
return 'Completed';
|
|
}
|
|
|
|
public function getProcessAction()
|
|
{
|
|
if($this->user_type == 'S')
|
|
return ($this->supporter_action == 'A') ? 'Approved' : 'Not Approved';
|
|
|
|
$result = '';
|
|
switch ($this->status) {
|
|
case 'D':
|
|
$result = 'Delegate';
|
|
break;
|
|
case 'W':
|
|
$result = 'Working';
|
|
break;
|
|
case 'CA':
|
|
$result = 'Cancel';
|
|
break;
|
|
case 'CO':
|
|
$result = 'Completed';
|
|
break;
|
|
case 'R':
|
|
$result = 'Returned';
|
|
break;
|
|
case 'SA':
|
|
$result = 'Send For approval';
|
|
break;
|
|
case 'A':
|
|
$result = 'Approved';
|
|
break;
|
|
case 'RE':
|
|
$result = 'Rejected';
|
|
break;
|
|
default:
|
|
$result='';
|
|
break;
|
|
}
|
|
return $result;
|
|
}
|
|
}
|