mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 04:13:58 +00:00
contract obligation contract dependency generate
This commit is contained in:
@@ -124,11 +124,12 @@ class ContractModule extends BaseController
|
|||||||
$contract_obligation = ContractObligationModule::generate($request);
|
$contract_obligation = ContractObligationModule::generate($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate contract dependency
|
|
||||||
|
// generate contract obligation dependency
|
||||||
foreach ($contract_template_obligation_list as $key => $row) {
|
foreach ($contract_template_obligation_list as $key => $row) {
|
||||||
$contract_template_obligation_dependency = $row->contract_template_obligation_dependency()
|
$contract_template_obligation_dependency = $row->contract_template_obligation_dependency()
|
||||||
->where('status', config('constants.contract_template_obligation_dependency.status.active'))
|
->where('status', config('constants.contract_template_obligation_dependency.status.active'))
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
if (!empty($contract_template_obligation_dependency[0])) {
|
if (!empty($contract_template_obligation_dependency[0])) {
|
||||||
$contract_obligation = ContractObligation::
|
$contract_obligation = ContractObligation::
|
||||||
@@ -149,10 +150,25 @@ class ContractModule extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generate contract obligation contract dependency
|
||||||
|
foreach ($contract_template_obligation_list as $key => $row) {
|
||||||
|
$contract_template_obligation_contract_dependency = $row->contract_template_obligation_contract_template_dependency()
|
||||||
|
->where('status', config('constants.contract_template_obligation_dependency.status.active'))
|
||||||
|
->get();
|
||||||
|
|
||||||
|
if (!empty($contract_template_obligation_contract_dependency[0])) {
|
||||||
|
|
||||||
|
$request->request->add([
|
||||||
|
'contract_template_id' => [$contract_template_obligation_contract_dependency[0]->depend_contract_template_hash_id],
|
||||||
|
]);
|
||||||
|
$depend_contract = ContractModule::generate($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// log
|
// log
|
||||||
ContractModule::makeLog($contract->id, 'user (' . Auth::guard('user-api')->user()->id . ') created');
|
ContractModule::makeLog($contract->id, 'user (' . Auth::guard('user-api')->user()->id . ') created');
|
||||||
|
|
||||||
// DB::commit();
|
DB::commit();
|
||||||
|
|
||||||
$query_string = General::getCachePerviousQuery('contract_query');
|
$query_string = General::getCachePerviousQuery('contract_query');
|
||||||
$data = General::returnData($contract, $query_string);
|
$data = General::returnData($contract, $query_string);
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ class ContractTemplateObligation extends Model
|
|||||||
'hash_id',
|
'hash_id',
|
||||||
'contract_template_list',
|
'contract_template_list',
|
||||||
'contract_template_obligation_dependency_list',
|
'contract_template_obligation_dependency_list',
|
||||||
'depend_contract_template_obligation_dependency_list'
|
'depend_contract_template_obligation_dependency_list',
|
||||||
|
'contract_template_obligation_contract_template_dependency_list'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function contract_template()
|
public function contract_template()
|
||||||
@@ -33,6 +34,11 @@ class ContractTemplateObligation extends Model
|
|||||||
return $this->hasMany('App\Models\ContractTemplateObligationDependency', 'depend_contract_template_obligation_id');
|
return $this->hasMany('App\Models\ContractTemplateObligationDependency', 'depend_contract_template_obligation_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function contract_template_obligation_contract_template_dependency()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\ContractTemplateObligationContractTemplateDependency', 'contract_template_obligation_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function getHashIdAttribute()
|
public function getHashIdAttribute()
|
||||||
{
|
{
|
||||||
return Hasher::encode('contract_template_obligations', $this->id);
|
return Hasher::encode('contract_template_obligations', $this->id);
|
||||||
@@ -46,17 +52,24 @@ class ContractTemplateObligation extends Model
|
|||||||
public function getContractTemplateObligationDependencyListAttribute()
|
public function getContractTemplateObligationDependencyListAttribute()
|
||||||
{
|
{
|
||||||
return $this->contract_template_obligation_dependency()
|
return $this->contract_template_obligation_dependency()
|
||||||
->where('status', config('constants.contract_template_obligation.status.active'))
|
->where('status', config('constants.contract_template_obligation_dependency.status.active'))
|
||||||
->get()->makeHidden(['contract_template_obligation_list', 'depend_contract_template_obligation_list']);
|
->get()->makeHidden(['contract_template_obligation_list', 'depend_contract_template_obligation_list']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDependContractTemplateObligationDependencyListAttribute()
|
public function getDependContractTemplateObligationDependencyListAttribute()
|
||||||
{
|
{
|
||||||
return $this->depend_contract_template_obligation_dependency()
|
return $this->depend_contract_template_obligation_dependency()
|
||||||
->where('status', config('constants.contract_template_obligation.status.active'))
|
->where('status', config('constants.contract_template_obligation_dependency.status.active'))
|
||||||
->get()->makeHidden(['contract_template_obligation_list', 'depend_contract_template_obligation_list']);
|
->get()->makeHidden(['contract_template_obligation_list', 'depend_contract_template_obligation_list']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getContractTemplateObligationContractTemplateDependencyListAttribute()
|
||||||
|
{
|
||||||
|
return $this->contract_template_obligation_dependency()
|
||||||
|
->where('status', config('constants.contract_template_obligation_contract_template_dependency.status.active'))
|
||||||
|
->get()->makeHidden(['contract_template_obligation_list']);
|
||||||
|
}
|
||||||
|
|
||||||
public function getUpdatedAtAttribute($date)
|
public function getUpdatedAtAttribute($date)
|
||||||
{
|
{
|
||||||
return $date ? Carbon::parse($date)->timezone('Asia/Kuala_Lumpur')->format('Y-m-d') : '';
|
return $date ? Carbon::parse($date)->timezone('Asia/Kuala_Lumpur')->format('Y-m-d') : '';
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th style="width: 25%">Details</th>
|
<th style="width: 25%">Details</th>
|
||||||
|
<th>Obligation Template</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Created</th>
|
<th>Created</th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
@@ -48,6 +49,14 @@
|
|||||||
<div><b>Name</b>: {{ contract.name }}</div>
|
<div><b>Name</b>: {{ contract.name }}</div>
|
||||||
<div><b>Complete Day Range</b>: {{ contract.complete_day_range }}</div>
|
<div><b>Complete Day Range</b>: {{ contract.complete_day_range }}</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<div v-if="contract.contract_obligation_list" v-for="(obligation, $index) in contract.contract_obligation_list" :key="$index">
|
||||||
|
<div>-{{ obligation.name }} <small>({{ obligation.sequence }})</small></div>
|
||||||
|
</div>
|
||||||
|
<div v-if="!contract.contract_obligation_list[0]">
|
||||||
|
-
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span :class="'badge badge-' + contract.status[0].color">{{ contract.status[0].name }}</span>
|
<span :class="'badge badge-' + contract.status[0].color">{{ contract.status[0].name }}</span>
|
||||||
</td>
|
</td>
|
||||||
@@ -107,7 +116,7 @@
|
|||||||
status: General.returnAray(General.getURLParam('status[]')),
|
status: General.returnAray(General.getURLParam('status[]')),
|
||||||
page: General.getURLParam('page')
|
page: General.getURLParam('page')
|
||||||
}),
|
}),
|
||||||
colspan: 7,
|
colspan: 6,
|
||||||
filter_status: false,
|
filter_status: false,
|
||||||
loading: true,
|
loading: true,
|
||||||
contract_list: [],
|
contract_list: [],
|
||||||
|
|||||||
Reference in New Issue
Block a user