diff --git a/app/Http/Modules/User/ContractModule.php b/app/Http/Modules/User/ContractModule.php
index 3e76541..50d5865 100644
--- a/app/Http/Modules/User/ContractModule.php
+++ b/app/Http/Modules/User/ContractModule.php
@@ -178,9 +178,6 @@ class ContractModule extends BaseController
$contract->complete_day_range = $complete_day_range ?? $contract->complete_day_range;
$contract->update();
-
-
-
// log
ContractModule::makeLog($contract->id, 'user (' . Auth::guard('user-api')->user()->id . ') updated');
diff --git a/app/Http/Modules/User/ContractTemplateObligationContractTemplateDependencyModule.php b/app/Http/Modules/User/ContractTemplateObligationContractTemplateDependencyModule.php
index e0cd583..e69d5b4 100644
--- a/app/Http/Modules/User/ContractTemplateObligationContractTemplateDependencyModule.php
+++ b/app/Http/Modules/User/ContractTemplateObligationContractTemplateDependencyModule.php
@@ -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'] ?? [])
],
];
}
diff --git a/app/Http/Modules/User/ContractTemplateObligationDependencyModule.php b/app/Http/Modules/User/ContractTemplateObligationDependencyModule.php
index f7ab1f5..ce89f84 100644
--- a/app/Http/Modules/User/ContractTemplateObligationDependencyModule.php
+++ b/app/Http/Modules/User/ContractTemplateObligationDependencyModule.php
@@ -32,7 +32,9 @@ class ContractTemplateObligationDependencyModule extends BaseController
public static function list(Request $request)
{
General::storeCachePerviousQuery($request->query(), 'contract_template_obligation_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);
@@ -40,7 +42,12 @@ class ContractTemplateObligationDependencyModule extends BaseController
$query = ContractTemplateObligationDependency::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 . '%');
}
@@ -53,6 +60,7 @@ class ContractTemplateObligationDependencyModule extends BaseController
$query->orderBy('id', 'desc');
$params = [
+ 'contract_template_obligation_id' => $contract_template_obligation_hash_id,
'name' => $name,
'status' => $status,
'page' => $page
@@ -154,12 +162,12 @@ class ContractTemplateObligationDependencyModule extends BaseController
'required',
new UnderCheck('contract_template_obligation'),
new ExistCheck('contract_template_obligation'),
- new ContractTemplateObligationDependencyCheck($data['depend_contract_template_obligation_id'] ?? [])
],
'depend_contract_template_obligation_id' => [
'required',
new UnderCheck('contract_template_obligation'),
- new ExistCheck('contract_template_obligation')
+ new ExistCheck('contract_template_obligation'),
+ new ContractTemplateObligationDependencyCheck($data['contract_template_obligation_id'] ?? [])
],
];
}
diff --git a/app/Http/Modules/User/ContractTemplateObligationModule.php b/app/Http/Modules/User/ContractTemplateObligationModule.php
index cafbbba..7cd1d6e 100644
--- a/app/Http/Modules/User/ContractTemplateObligationModule.php
+++ b/app/Http/Modules/User/ContractTemplateObligationModule.php
@@ -31,6 +31,7 @@ class ContractTemplateObligationModule extends BaseController
{
General::storeCachePerviousQuery($request->query(), 'contract_template_obligation_query');
+ $not_hash_id = $not_id = $request->get('not_id', []);
$contract_template_hash_id = $contract_template_id = $request->get('contract_template_id', []);
$name = $request->get('name', null);
@@ -40,6 +41,11 @@ class ContractTemplateObligationModule extends BaseController
$query = ContractTemplateObligation::query();
+ if (!empty($not_id)) {
+ $not_id = Hasher::decodeArray('contract_template_obligations', $not_id);
+ $query->whereNotIn('id', $not_id);
+ }
+
if (!empty($contract_template_id)) {
$contract_template_id = Hasher::decodeArray('contract_templates', $contract_template_id);
$query->whereIn('contract_template_id', $contract_template_id);
diff --git a/app/Http/Rules/User/ContractTemplateObligationDependencyCheck.php b/app/Http/Rules/User/ContractTemplateObligationDependencyCheck.php
index 0a9df79..80a0552 100644
--- a/app/Http/Rules/User/ContractTemplateObligationDependencyCheck.php
+++ b/app/Http/Rules/User/ContractTemplateObligationDependencyCheck.php
@@ -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;
diff --git a/database/seeders/PlumberService/PlumberServiceContractTemplateObligationContractDependenciesTableSeeder.php b/database/seeders/PlumberService/PlumberServiceContractTemplateObligationContractDependenciesTableSeeder.php
index 8167217..4b6c173 100644
--- a/database/seeders/PlumberService/PlumberServiceContractTemplateObligationContractDependenciesTableSeeder.php
+++ b/database/seeders/PlumberService/PlumberServiceContractTemplateObligationContractDependenciesTableSeeder.php
@@ -18,7 +18,7 @@ class PlumberServiceContractTemplateObligationContractDependenciesTableSeeder ex
DB::table('contract_template_obligation_contract_template_dependencies')->insert([
[
'id' => 201,
- 'user_id' => 4,
+ 'user_id' => 3,
'contract_template_obligation_id' => 202, // plumber hero company rescue princess peach
'depend_contract_template_id' => 202, // Plumber Mario Service
'status' => 1,
diff --git a/database/seeders/PlumberService/PlumberServiceEntitiesTableSeeder.php b/database/seeders/PlumberService/PlumberServiceEntitiesTableSeeder.php
index 147e119..ebd5e91 100644
--- a/database/seeders/PlumberService/PlumberServiceEntitiesTableSeeder.php
+++ b/database/seeders/PlumberService/PlumberServiceEntitiesTableSeeder.php
@@ -18,7 +18,7 @@ class PlumberServiceEntitiesTableSeeder extends Seeder
DB::table('entities')->insert([
[
'id' => 201,
- 'user_id' => 4,
+ 'user_id' => 3,
'name' => 'Mushroom Kingdom',
'status' => 1,
'created_at' => date('Y-m-d H:i:s'),
@@ -26,7 +26,7 @@ class PlumberServiceEntitiesTableSeeder extends Seeder
],
[
'id' => 202,
- 'user_id' => 4,
+ 'user_id' => 3,
'name' => 'Mario',
'status' => 1,
'created_at' => date('Y-m-d H:i:s'),
@@ -34,7 +34,7 @@ class PlumberServiceEntitiesTableSeeder extends Seeder
],
[
'id' => 203,
- 'user_id' => 4,
+ 'user_id' => 3,
'name' => 'Plumber Hero Company',
'status' => 1,
'created_at' => date('Y-m-d H:i:s'),
diff --git a/database/seeders/PlumberService/PlumberServiveContractTemplateObligationsTableSeeder.php b/database/seeders/PlumberService/PlumberServiveContractTemplateObligationsTableSeeder.php
index 5abd3e6..7f0acd5 100644
--- a/database/seeders/PlumberService/PlumberServiveContractTemplateObligationsTableSeeder.php
+++ b/database/seeders/PlumberService/PlumberServiveContractTemplateObligationsTableSeeder.php
@@ -49,7 +49,7 @@ class PlumberServiceContractTemplateObligationsTableSeeder extends Seeder
'id' => 202,
'user_id' => 3,
'contract_template_id' => 201,
- 'name' => 'plumber hero rescue princess peach',
+ 'name' => 'plumber company hero rescue princess peach',
'sequence' => 2.0,
'reference' => null,
'content' => null,
diff --git a/resources/js/user/langs/en.js b/resources/js/user/langs/en.js
index a9d0f9c..e5b19d3 100644
--- a/resources/js/user/langs/en.js
+++ b/resources/js/user/langs/en.js
@@ -6,7 +6,7 @@ const En = {
'password': 'password',
'complete_day_range': 'complete day range',
'sequence': 'sequence',
-
+ 'depend_contract_template_id': 'depend contract template',
// Error
'incorrect_account_or_password': 'Incorrect account or password',
@@ -22,10 +22,12 @@ const En = {
'the_content_must_be_at_least_10_characters': 'The %(att)s must be at least 10 characters',
'the_content_must_be_less_than_100': 'The %(att)s must be less than 100',
'status_error': 'status not allow update',
+ 'obligation_depend_error': 'contract template obligation dependency error',
// toasted
'have_been_successfully_created': '%(value[0].att)s ( %(value[1].att)s ) have been successfully created',
'have_been_successfully_updated': '%(value[0].att)s ( %(value[1].att)s ) have been successfully updated',
+ 'have_been_successfully_deleted': '%(value[0].att)s ( %(value[1].att)s ) have been successfully deleted',
'have_been_successfully_imported': '%(value[0].att)s have been successfully imported',
'error_mass_import': '%(value[0].att)s excel file have error when import',
};
diff --git a/resources/js/user/pages/contract-template-obligation-contract-template-denpendencies/DeleteModal.vue b/resources/js/user/pages/contract-template-obligation-contract-template-denpendencies/DeleteModal.vue
new file mode 100644
index 0000000..530721b
--- /dev/null
+++ b/resources/js/user/pages/contract-template-obligation-contract-template-denpendencies/DeleteModal.vue
@@ -0,0 +1,69 @@
+
+
+
+
+ Contract Template Obligation Contract Template Dependency Delete
+
+ Are you sure want to delete?
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/user/pages/contract-template-obligation-contract-template-denpendencies/FormModal.vue b/resources/js/user/pages/contract-template-obligation-contract-template-denpendencies/FormModal.vue
new file mode 100644
index 0000000..0eb195d
--- /dev/null
+++ b/resources/js/user/pages/contract-template-obligation-contract-template-denpendencies/FormModal.vue
@@ -0,0 +1,98 @@
+
+
+
+
+ Contract Template Obligation Dependency Contract Template Create
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/user/pages/contract-template-obligation-contract-template-denpendencies/TableModal.vue b/resources/js/user/pages/contract-template-obligation-contract-template-denpendencies/TableModal.vue
new file mode 100644
index 0000000..b8e64f6
--- /dev/null
+++ b/resources/js/user/pages/contract-template-obligation-contract-template-denpendencies/TableModal.vue
@@ -0,0 +1,193 @@
+
+
+
+
+ Contract Template Obligation Conntract Template Dependency List
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Contract Obligation Template
+ Depend On Contract Template
+ Status
+ Created
+ Actions
+
+
+
+
+ {{ $index + 1 }}
+
+ {{ contract.contract_template_obligation_list[0].name }}
+
+
+ {{ contract.depend_contract_template_list[0].name }}
+
+
+ {{ contract.status[0].name }}
+
+
+ {{ contract.created_at }}
+
+
+
+
+
+
+
+
+
+
+ Empty
+
+
+
+
+
+
+
+
+ Total: {{ contract_template_obligation_contract_template_dependency_list.total }}
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/user/pages/contract-template-obligation-denpendencies/DeleteModal.vue b/resources/js/user/pages/contract-template-obligation-denpendencies/DeleteModal.vue
new file mode 100644
index 0000000..b1e4c99
--- /dev/null
+++ b/resources/js/user/pages/contract-template-obligation-denpendencies/DeleteModal.vue
@@ -0,0 +1,69 @@
+
+
+
+
+ Contract Template Obligation Dependency Delete
+
+ Are you sure want to delete?
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/user/pages/contract-template-obligation-denpendencies/FormModal.vue b/resources/js/user/pages/contract-template-obligation-denpendencies/FormModal.vue
new file mode 100644
index 0000000..e4d8d3a
--- /dev/null
+++ b/resources/js/user/pages/contract-template-obligation-denpendencies/FormModal.vue
@@ -0,0 +1,100 @@
+
+
+
+
+ Contract Template Obligation Dependency Create
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/user/pages/contract-template-obligation-denpendencies/TableModal.vue b/resources/js/user/pages/contract-template-obligation-denpendencies/TableModal.vue
new file mode 100644
index 0000000..1b03df1
--- /dev/null
+++ b/resources/js/user/pages/contract-template-obligation-denpendencies/TableModal.vue
@@ -0,0 +1,193 @@
+
+
+
+
+ Contract Template Obligation Dependency List
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Contract Obligation Template
+ Depend On Contract Obligation Template
+ Status
+ Created
+ Actions
+
+
+
+
+ {{ $index + 1 }}
+
+ {{ contract.contract_template_obligation_list[0].name }}
+
+
+ {{ contract.depend_contract_template_obligation_list[0].name }}
+
+
+ {{ contract.status[0].name }}
+
+
+ {{ contract.created_at }}
+
+
+
+
+
+
+
+
+
+
+ Empty
+
+
+
+
+
+
+
+
+ Total: {{ contract_template_obligation_dependency_list.total }}
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/user/pages/contract-template-obligations/FormTable.vue b/resources/js/user/pages/contract-template-obligations/FormTable.vue
new file mode 100644
index 0000000..74d3333
--- /dev/null
+++ b/resources/js/user/pages/contract-template-obligations/FormTable.vue
@@ -0,0 +1,61 @@
+
+
+
Contract Template
+
+
+
+ #
+ Details
+ Contract Template
+ Sequence
+ Status
+ Created
+
+
+
+
+ {{ $index + 1 }}
+
+ Name : {{ contract.name }}
+ Complete Day Range : {{ contract.complete_day_range }}
+ Must Complete : {{ contract.must_complete }}
+ Must Accept : {{ contract.must_accept }}
+
+
+ {{ contract.contract_template_list[0].name }}
+
+ {{ contract.sequence }}
+
+ {{ contract.status[0].name }}
+
+
+ {{ contract.created_at }}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/user/pages/contract-template-obligations/TableModal.vue b/resources/js/user/pages/contract-template-obligations/TableModal.vue
index b47fe6a..60ca74f 100644
--- a/resources/js/user/pages/contract-template-obligations/TableModal.vue
+++ b/resources/js/user/pages/contract-template-obligations/TableModal.vue
@@ -57,6 +57,24 @@
{{ contract.created_at }}
+
+
+
+
+
+
+
+