contract template obligation contract template dependency UI

This commit is contained in:
glovetleong
2021-07-18 17:29:45 +08:00
parent fca442fb7c
commit 175b99d6dc
20 changed files with 914 additions and 29 deletions
@@ -17,11 +17,11 @@ class ContractTemplateObligationDependencyCheck implements Rule
* @return void
*/
private $depend_template_contract_obligation_id;
private $contract_template_obligation_id;
public function __construct($depend_template_contract_obligation_id = '')
public function __construct($contract_template_obligation_id = '')
{
$this->depend_template_contract_obligation_id = $depend_template_contract_obligation_id;
$this->contract_template_obligation_id = $contract_template_obligation_id;
}
/**
@@ -36,16 +36,17 @@ class ContractTemplateObligationDependencyCheck implements Rule
$this->attribute = $attribute;
$value = is_array($value) ? $value : [$value];
if ($value[0] != $this->depend_template_contract_obligation_id[0]) {
$contract_template_obligation_id = Hasher::decode('contract_template_obligations', $value[0]);
if ($value[0] != $this->contract_template_obligation_id[0]) {
$contract_template_obligation_id = Hasher::decode('contract_template_obligations', $this->contract_template_obligation_id[0]);
$contract_template_obligation = ContractTemplateObligation::find($contract_template_obligation_id);
$depend_contract_template_obligation_id = Hasher::decode('contract_template_obligations', $this->depend_template_contract_obligation_id[0]);
$depend_contract_template_obligation_id = Hasher::decode('contract_template_obligations', $value[0]);
$depend_contract_template_obligation = ContractTemplateObligation::find($depend_contract_template_obligation_id);
$contract_template_obligation_dependency_structure = $contract_template_obligation->getContractTemplateObligationDependencyStructure([$contract_template_obligation->hash_id]);
$contract_template_obligation_dependency_structure = $depend_contract_template_obligation->getContractTemplateObligationDependencyStructure([$depend_contract_template_obligation->hash_id]);
if (in_array($depend_contract_template_obligation->hash_id, $contract_template_obligation_dependency_structure)) {
// return false;
if (in_array($contract_template_obligation->hash_id, $contract_template_obligation_dependency_structure)) {
return false;
}
return true;