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
@@ -11,7 +11,7 @@ use App\Http\Modules\User\ContractTemplateObligationModule;
use App\Http\Rules\User\UnderCheck;
use App\Http\Rules\User\ExistCheck;
use App\Http\Rules\User\ContractTemplateObligationDependencyCheck;
use App\Http\Rules\User\ContractTemplateObligationContractTemplateDependencyCheck;
use App\Http\Helpers\General;
use App\Http\Helpers\Hasher;
@@ -33,7 +33,9 @@ class ContractTemplateObligationContractTemplateDependencyModule extends BaseCon
public static function list(Request $request)
{
General::storeCachePerviousQuery($request->query(), 'contract_template_obligation_contract_template_dependency_query');
$contract_template_obligation_hash_id = $contract_template_obligation_id = $request->get('contract_template_obligation_id', []);
$name = $request->get('name', null);
$status = $request->get('status', []);
$page = $request->get('page', null);
@@ -41,7 +43,12 @@ class ContractTemplateObligationContractTemplateDependencyModule extends BaseCon
$query = ContractTemplateObligationContractTemplateDependency::query();
if (strlen($name) > 0) {
if (!empty($contract_template_obligation_id)) {
$contract_template_obligation_id = Hasher::decodeArray('contract_template_obligations', $contract_template_obligation_id);
$query->whereIn('contract_template_obligation_id', $contract_template_obligation_id);
}
if (strlen($name) > 0) {
$query->where('name', 'like', '%' . $name . '%');
}
@@ -54,6 +61,7 @@ class ContractTemplateObligationContractTemplateDependencyModule extends BaseCon
$query->orderBy('id', 'desc');
$params = [
'contract_template_obligation_id' => $contract_template_obligation_hash_id,
'name' => $name,
'status' => $status,
'page' => $page
@@ -155,12 +163,12 @@ class ContractTemplateObligationContractTemplateDependencyModule extends BaseCon
'required',
new UnderCheck('contract_template_obligation'),
new ExistCheck('contract_template_obligation'),
// new ContractTemplateObligationDependencyCheck($data['depend_contract_template_obligation_id'] ?? [])
],
'depend_contract_template_id' => [
'required',
new UnderCheck('contract_template'),
new ExistCheck('contract_template')
new ExistCheck('contract_template'),
// new ContractTemplateObligationContractTemplateDependencyCheck($data['contract_template_obligation_id'] ?? [])
],
];
}