mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 04:13:58 +00:00
clone contract UI
This commit is contained in:
+11
-1
@@ -11,7 +11,7 @@ class Contract extends Model
|
||||
{
|
||||
protected $table = 'contracts';
|
||||
|
||||
protected $appends = ['hash_id', 'contract_obligation_list'];
|
||||
protected $appends = ['hash_id', 'contract_obligation_list', 'contract_entity_list'];
|
||||
|
||||
protected $hidden = [
|
||||
'id', 'in_time_contract_template',
|
||||
@@ -22,6 +22,11 @@ class Contract extends Model
|
||||
return $this->hasMany('App\Models\ContractObligation', 'contract_id');
|
||||
}
|
||||
|
||||
public function contract_entity()
|
||||
{
|
||||
return $this->hasMany('App\Models\ContractEntity', 'contract_id');
|
||||
}
|
||||
|
||||
public function getHashIdAttribute()
|
||||
{
|
||||
return Hasher::encode('contracts', $this->id);
|
||||
@@ -32,6 +37,11 @@ class Contract extends Model
|
||||
return $this->contract_obligation()->get()->makeHidden(['contract_list']);
|
||||
}
|
||||
|
||||
public function getContractEntityListAttribute()
|
||||
{
|
||||
return $this->contract_entity()->get()->makeHidden(['contract_list']);
|
||||
}
|
||||
|
||||
public function getUpdatedAtAttribute($date)
|
||||
{
|
||||
return $date ? Carbon::parse($date)->timezone('Asia/Kuala_Lumpur')->format('Y-m-d') : '';
|
||||
|
||||
@@ -2,10 +2,49 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use App\Http\Helpers\Hasher;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ContractEntity extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'contract_entities';
|
||||
|
||||
protected $appends = ['hash_id', 'contract_list', 'entity_list'];
|
||||
|
||||
public function contract()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Contract', 'contract_id');
|
||||
}
|
||||
|
||||
public function entity()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Entity', 'entity_id');
|
||||
}
|
||||
|
||||
public function getHashIdAttribute()
|
||||
{
|
||||
return Hasher::encode('contract_entities', $this->id);
|
||||
}
|
||||
|
||||
public function getContractListAttribute()
|
||||
{
|
||||
return $this->contract()->get()->makeHidden(['contract_entity_list']);
|
||||
}
|
||||
|
||||
public function getEntityListAttribute()
|
||||
{
|
||||
return $this->entity()->get()->makeHidden(['entity_signature_list']);
|
||||
}
|
||||
|
||||
public function getUpdatedAtAttribute($date)
|
||||
{
|
||||
return $date ? Carbon::parse($date)->timezone('Asia/Kuala_Lumpur')->format('Y-m-d') : '';
|
||||
}
|
||||
|
||||
public function getCreatedAtAttribute($date)
|
||||
{
|
||||
return $date ? Carbon::parse($date)->timezone('Asia/Kuala_Lumpur')->format('Y-m-d') : '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ class ContractObligation extends Model
|
||||
'hash_id',
|
||||
'contract_list',
|
||||
'contract_obligation_dependency_list',
|
||||
'depend_contract_obligation_dependency_list'
|
||||
'depend_contract_obligation_dependency_list',
|
||||
'contract_entity_list'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
@@ -37,6 +38,11 @@ class ContractObligation extends Model
|
||||
return $this->hasMany('App\Models\ContractObligationDependency', 'depend_contract_obligation_id');
|
||||
}
|
||||
|
||||
public function contract_entity()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ContractEntity', 'contract_entity_id');
|
||||
}
|
||||
|
||||
public function getHashIdAttribute()
|
||||
{
|
||||
return Hasher::encode('contract_obligations', $this->id);
|
||||
@@ -61,6 +67,11 @@ class ContractObligation extends Model
|
||||
->get()->makeHidden(['contract_obligation_list', 'depend_contract_obligation_list']);
|
||||
}
|
||||
|
||||
public function getContractEntityListAttribute()
|
||||
{
|
||||
return $this->contract_entity()->get()->makeHidden(['contract_list']);
|
||||
}
|
||||
|
||||
public function getUpdatedAtAttribute($date)
|
||||
{
|
||||
return $date ? Carbon::parse($date)->timezone('Asia/Kuala_Lumpur')->format('Y-m-d') : '';
|
||||
|
||||
Reference in New Issue
Block a user