mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-09-01 18:53:58 +00:00
clone contract UI
This commit is contained in:
@@ -45,4 +45,11 @@ class ContractController extends BaseController
|
|||||||
$contract = ContractModule::delete($request, $hash_id);
|
$contract = ContractModule::delete($request, $hash_id);
|
||||||
return $contract;
|
return $contract;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function validCheck(Request $request, $hash_id = '')
|
||||||
|
{
|
||||||
|
$method = empty($hash_id) ? 'POST' :'PUT';
|
||||||
|
$valid = ContractModule::validCheck($request, $hash_id, $method);
|
||||||
|
return $valid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,6 +230,14 @@ class ContractModule extends BaseController
|
|||||||
return response()->json($data);
|
return response()->json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function validCheck(Request $request, $hash_id = '', $method = 'POST')
|
||||||
|
{
|
||||||
|
$id = $hash_id ? Hasher::decode('contracts', $hash_id) : '';
|
||||||
|
$validation = ContractModule::validation($request, $id, $method);
|
||||||
|
if (!$validation->status) {
|
||||||
|
return response()->json($validation, 422);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static function validation(Request $request, $id = '', $method = 'POST')
|
private static function validation(Request $request, $id = '', $method = 'POST')
|
||||||
{
|
{
|
||||||
|
|||||||
+11
-1
@@ -11,7 +11,7 @@ class Contract extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'contracts';
|
protected $table = 'contracts';
|
||||||
|
|
||||||
protected $appends = ['hash_id', 'contract_obligation_list'];
|
protected $appends = ['hash_id', 'contract_obligation_list', 'contract_entity_list'];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
'id', 'in_time_contract_template',
|
'id', 'in_time_contract_template',
|
||||||
@@ -22,6 +22,11 @@ class Contract extends Model
|
|||||||
return $this->hasMany('App\Models\ContractObligation', 'contract_id');
|
return $this->hasMany('App\Models\ContractObligation', 'contract_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function contract_entity()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\ContractEntity', 'contract_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function getHashIdAttribute()
|
public function getHashIdAttribute()
|
||||||
{
|
{
|
||||||
return Hasher::encode('contracts', $this->id);
|
return Hasher::encode('contracts', $this->id);
|
||||||
@@ -32,6 +37,11 @@ class Contract extends Model
|
|||||||
return $this->contract_obligation()->get()->makeHidden(['contract_list']);
|
return $this->contract_obligation()->get()->makeHidden(['contract_list']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getContractEntityListAttribute()
|
||||||
|
{
|
||||||
|
return $this->contract_entity()->get()->makeHidden(['contract_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') : '';
|
||||||
|
|||||||
@@ -2,10 +2,49 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use App\Http\Helpers\Hasher;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
class ContractEntity extends Model
|
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',
|
'hash_id',
|
||||||
'contract_list',
|
'contract_list',
|
||||||
'contract_obligation_dependency_list',
|
'contract_obligation_dependency_list',
|
||||||
'depend_contract_obligation_dependency_list'
|
'depend_contract_obligation_dependency_list',
|
||||||
|
'contract_entity_list'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
@@ -37,6 +38,11 @@ class ContractObligation extends Model
|
|||||||
return $this->hasMany('App\Models\ContractObligationDependency', 'depend_contract_obligation_id');
|
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()
|
public function getHashIdAttribute()
|
||||||
{
|
{
|
||||||
return Hasher::encode('contract_obligations', $this->id);
|
return Hasher::encode('contract_obligations', $this->id);
|
||||||
@@ -61,6 +67,11 @@ class ContractObligation extends Model
|
|||||||
->get()->makeHidden(['contract_obligation_list', 'depend_contract_obligation_list']);
|
->get()->makeHidden(['contract_obligation_list', 'depend_contract_obligation_list']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getContractEntityListAttribute()
|
||||||
|
{
|
||||||
|
return $this->contract_entity()->get()->makeHidden(['contract_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') : '';
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ class PlumberServiceContractEntitiesTableSeeder extends Seeder
|
|||||||
'id' => 202,
|
'id' => 202,
|
||||||
'user_id' => 3,
|
'user_id' => 3,
|
||||||
'contract_id' => 201,
|
'contract_id' => 201,
|
||||||
'entity_id' => 203,
|
'entity_id' => 202,
|
||||||
'entity_signature_id' => 203,
|
'entity_signature_id' => 202,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'created_at' => date('Y-m-d H:i:s'),
|
'created_at' => date('Y-m-d H:i:s'),
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class PlumberServiceContractObligationsTableSeeder extends Seeder
|
|||||||
'contract_template_obligation_id' => 201,
|
'contract_template_obligation_id' => 201,
|
||||||
'contract_entity_id' => 201,
|
'contract_entity_id' => 201,
|
||||||
'name' => 'mushroom kingdom request service from plumber hero company to rescue princess peach',
|
'name' => 'mushroom kingdom request service from plumber hero company to rescue princess peach',
|
||||||
|
'sequence' => 1.0,
|
||||||
'reference' => null,
|
'reference' => null,
|
||||||
'content' => null,
|
'content' => null,
|
||||||
'must_complete' => 1,
|
'must_complete' => 1,
|
||||||
@@ -59,6 +60,7 @@ class PlumberServiceContractObligationsTableSeeder extends Seeder
|
|||||||
'contract_template_obligation_id' => 202,
|
'contract_template_obligation_id' => 202,
|
||||||
'contract_entity_id' => 203,
|
'contract_entity_id' => 203,
|
||||||
'name' => 'plumber hero company rescue princess peach',
|
'name' => 'plumber hero company rescue princess peach',
|
||||||
|
'sequence' => 2.0,
|
||||||
'reference' => null,
|
'reference' => null,
|
||||||
'content' => null,
|
'content' => null,
|
||||||
'must_complete' => 1,
|
'must_complete' => 1,
|
||||||
@@ -82,6 +84,7 @@ class PlumberServiceContractObligationsTableSeeder extends Seeder
|
|||||||
'contract_template_obligation_id' => 203,
|
'contract_template_obligation_id' => 203,
|
||||||
'contract_entity_id' => 203,
|
'contract_entity_id' => 203,
|
||||||
'name' => 'plumber hero company get reward',
|
'name' => 'plumber hero company get reward',
|
||||||
|
'sequence' => 3.0,
|
||||||
'reference' => null,
|
'reference' => null,
|
||||||
'content' => null,
|
'content' => null,
|
||||||
'must_complete' => 1,
|
'must_complete' => 1,
|
||||||
@@ -105,6 +108,7 @@ class PlumberServiceContractObligationsTableSeeder extends Seeder
|
|||||||
'contract_template_obligation_id' => 204,
|
'contract_template_obligation_id' => 204,
|
||||||
'contract_entity_id' => 203,
|
'contract_entity_id' => 203,
|
||||||
'name' => 'plumber hero company request plumber rescue mission service',
|
'name' => 'plumber hero company request plumber rescue mission service',
|
||||||
|
'sequence' => 1.0,
|
||||||
'reference' => null,
|
'reference' => null,
|
||||||
'content' => null,
|
'content' => null,
|
||||||
'must_complete' => 1,
|
'must_complete' => 1,
|
||||||
@@ -128,6 +132,7 @@ class PlumberServiceContractObligationsTableSeeder extends Seeder
|
|||||||
'contract_template_obligation_id' => 205,
|
'contract_template_obligation_id' => 205,
|
||||||
'contract_entity_id' => 202,
|
'contract_entity_id' => 202,
|
||||||
'name' => 'plumber hero accept rescue mission',
|
'name' => 'plumber hero accept rescue mission',
|
||||||
|
'sequence' => 2.0,
|
||||||
'reference' => null,
|
'reference' => null,
|
||||||
'content' => null,
|
'content' => null,
|
||||||
'must_complete' => 1,
|
'must_complete' => 1,
|
||||||
@@ -151,6 +156,7 @@ class PlumberServiceContractObligationsTableSeeder extends Seeder
|
|||||||
'contract_template_obligation_id' => 206,
|
'contract_template_obligation_id' => 206,
|
||||||
'contract_entity_id' => 202,
|
'contract_entity_id' => 202,
|
||||||
'name' => 'plumber hero complete castle level',
|
'name' => 'plumber hero complete castle level',
|
||||||
|
'sequence' => 3.0,
|
||||||
'reference' => null,
|
'reference' => null,
|
||||||
'content' => null,
|
'content' => null,
|
||||||
'must_complete' => 1,
|
'must_complete' => 1,
|
||||||
@@ -174,6 +180,7 @@ class PlumberServiceContractObligationsTableSeeder extends Seeder
|
|||||||
'contract_template_obligation_id' => 207,
|
'contract_template_obligation_id' => 207,
|
||||||
'contract_entity_id' => 202,
|
'contract_entity_id' => 202,
|
||||||
'name' => 'plumber hero defeat bowser',
|
'name' => 'plumber hero defeat bowser',
|
||||||
|
'sequence' => 4.0,
|
||||||
'reference' => null,
|
'reference' => null,
|
||||||
'content' => null,
|
'content' => null,
|
||||||
'must_complete' => 1,
|
'must_complete' => 1,
|
||||||
@@ -197,6 +204,7 @@ class PlumberServiceContractObligationsTableSeeder extends Seeder
|
|||||||
'contract_template_obligation_id' => 208,
|
'contract_template_obligation_id' => 208,
|
||||||
'contract_entity_id' => 202,
|
'contract_entity_id' => 202,
|
||||||
'name' => 'plumber hero rescue princess peach',
|
'name' => 'plumber hero rescue princess peach',
|
||||||
|
'sequence' => 5.0,
|
||||||
'reference' => null,
|
'reference' => null,
|
||||||
'content' => null,
|
'content' => null,
|
||||||
'must_complete' => 1,
|
'must_complete' => 1,
|
||||||
@@ -220,6 +228,7 @@ class PlumberServiceContractObligationsTableSeeder extends Seeder
|
|||||||
'contract_template_obligation_id' => 209,
|
'contract_template_obligation_id' => 209,
|
||||||
'contract_entity_id' => 202,
|
'contract_entity_id' => 202,
|
||||||
'name' => 'plumber hero get reward',
|
'name' => 'plumber hero get reward',
|
||||||
|
'sequence' => 6.0,
|
||||||
'reference' => null,
|
'reference' => null,
|
||||||
'content' => null,
|
'content' => null,
|
||||||
'must_complete' => 1,
|
'must_complete' => 1,
|
||||||
|
|||||||
Vendored
+2
@@ -6,6 +6,7 @@ const En = {
|
|||||||
'password': 'password',
|
'password': 'password',
|
||||||
'complete_day_range': 'complete day range',
|
'complete_day_range': 'complete day range',
|
||||||
'sequence': 'sequence',
|
'sequence': 'sequence',
|
||||||
|
'contract_template_id': 'contract template',
|
||||||
'depend_contract_template_id': 'depend contract template',
|
'depend_contract_template_id': 'depend contract template',
|
||||||
|
|
||||||
// Error
|
// Error
|
||||||
@@ -23,6 +24,7 @@ const En = {
|
|||||||
'the_content_must_be_less_than_100': 'The %(att)s must be less than 100',
|
'the_content_must_be_less_than_100': 'The %(att)s must be less than 100',
|
||||||
'status_error': 'status not allow update',
|
'status_error': 'status not allow update',
|
||||||
'obligation_depend_error': 'contract template obligation dependency error',
|
'obligation_depend_error': 'contract template obligation dependency error',
|
||||||
|
'under_error': 'This %(att)s not belong to this user',
|
||||||
|
|
||||||
// toasted
|
// toasted
|
||||||
'have_been_successfully_created': '%(value[0].att)s ( %(value[1].att)s ) have been successfully created',
|
'have_been_successfully_created': '%(value[0].att)s ( %(value[1].att)s ) have been successfully created',
|
||||||
|
|||||||
@@ -8,15 +8,15 @@
|
|||||||
<breadcrumb
|
<breadcrumb
|
||||||
:menu_item_list="menu_item_list"
|
:menu_item_list="menu_item_list"
|
||||||
></breadcrumb>
|
></breadcrumb>
|
||||||
<admin-form
|
<contract-form
|
||||||
:mode="'create'"
|
:mode="'create'"
|
||||||
></admin-form>
|
></contract-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import PageTitle from "../../components/titles/PageTitle";
|
import PageTitle from "../../components/titles/PageTitle";
|
||||||
import Breadcrumb from "../../layouts/parts/Breadcrumb";
|
import Breadcrumb from "../../layouts/parts/Breadcrumb";
|
||||||
import AdminForm from "./Form";
|
import ContractForm from "./Form";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metaInfo() {
|
metaInfo() {
|
||||||
@@ -29,11 +29,11 @@
|
|||||||
components: {
|
components: {
|
||||||
PageTitle,
|
PageTitle,
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
AdminForm
|
ContractForm
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
heading: 'Create Admin',
|
heading: 'Create Contract',
|
||||||
icon: 'fa fa-plus',
|
icon: 'fa fa-plus',
|
||||||
menu_item_list: [
|
menu_item_list: [
|
||||||
{
|
{
|
||||||
@@ -42,14 +42,14 @@
|
|||||||
path: '/'
|
path: '/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Admin List',
|
title: 'Contract List',
|
||||||
active: false,
|
active: false,
|
||||||
path: '/admin/list'
|
path: '/contract/list'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Create Admin',
|
title: 'Create Contract',
|
||||||
active: true,
|
active: true,
|
||||||
path: '/admin/create'
|
path: '/contract/create'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<b-card class="main-card mb-3">
|
<b-card class="main-card mb-3">
|
||||||
<div v-if="!this_admin.data && mode == 'edit'" class="text-center">
|
<div v-if="!this_contract.data && mode == 'edit'" class="text-center">
|
||||||
<vue-element-loading :active="true" spinner="line-scale" color="var(--primary)"></vue-element-loading>
|
<vue-element-loading :active="true" spinner="line-scale" color="var(--primary)"></vue-element-loading>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="this_admin.data || mode == 'create'">
|
<div v-if="this_contract.data || mode == 'create'">
|
||||||
<form-wizard
|
<form-wizard
|
||||||
@on-complete="onComplete"
|
@on-complete="onComplete"
|
||||||
title=""
|
title=""
|
||||||
@@ -18,64 +18,18 @@
|
|||||||
ref="valid_one"
|
ref="valid_one"
|
||||||
icon="fa fa-info-circle"
|
icon="fa fa-info-circle"
|
||||||
>
|
>
|
||||||
<!-- ///////////////////////////////////////////////////// -->
|
|
||||||
<image-input
|
|
||||||
:input_name="'img'"
|
|
||||||
:form="form"
|
|
||||||
:label="'Profile Img'"
|
|
||||||
:exist_img="exist_img"
|
|
||||||
></image-input>
|
|
||||||
<!-- ///////////////////////////////////////////////////// -->
|
|
||||||
<text-input
|
|
||||||
:input_name="'name'"
|
|
||||||
:form="form"
|
|
||||||
:label="'Name*'"
|
|
||||||
></text-input>
|
|
||||||
<!-- ///////////////////////////////////////////////////// -->
|
|
||||||
<text-input
|
|
||||||
:input_name="'email'"
|
|
||||||
:form="form"
|
|
||||||
:label="'Email*'"
|
|
||||||
></text-input>
|
|
||||||
<!-- ///////////////////////////////////////////////////// -->
|
|
||||||
<password-input
|
|
||||||
:input_name="'password'"
|
|
||||||
:form="form"
|
|
||||||
:label="'Password*'"
|
|
||||||
></password-input>
|
|
||||||
<!-- ///////////////////////////////////////////////////// -->
|
|
||||||
<password-input
|
|
||||||
:input_name="'password_confirmation'"
|
|
||||||
:form="form"
|
|
||||||
:label="'Confirm Password*'"
|
|
||||||
></password-input>
|
|
||||||
<!-- ///////////////////////////////////////////////////// -->
|
<!-- ///////////////////////////////////////////////////// -->
|
||||||
<select-option-auto-complete-input
|
<select-option-auto-complete-input
|
||||||
v-if="mode != 'profile'"
|
:input_name="'contract_template_id'"
|
||||||
:input_name="'role_id'"
|
|
||||||
:form="form"
|
:form="form"
|
||||||
:exist_data="exist_admin_role"
|
|
||||||
:placeholder="''"
|
:placeholder="''"
|
||||||
:label="'Role*'"
|
:label="'Clone Contract Template*'"
|
||||||
:endpoint="'admin-role/list'"
|
:endpoint="'contract-template/list'"
|
||||||
:search_field="'name'"
|
:search_field="'name'"
|
||||||
:limit_tag="1"
|
:limit_tag="1"
|
||||||
:return_key="'hash_id'"
|
:return_key="'hash_id'"
|
||||||
></select-option-auto-complete-input>
|
></select-option-auto-complete-input>
|
||||||
<!-- ///////////////////////////////////////////////////// -->
|
<!-- ///////////////////////////////////////////////////// -->
|
||||||
<text-read-only-input
|
|
||||||
v-if="mode == 'profile'"
|
|
||||||
:value="this_admin.data.role_list[0].name"
|
|
||||||
:label="'Role'"
|
|
||||||
>
|
|
||||||
</text-read-only-input>
|
|
||||||
<!-- ///////////////////////////////////////////////////// -->
|
|
||||||
<switch-input
|
|
||||||
:input_name="'status'"
|
|
||||||
:form="form"
|
|
||||||
:label="'Status'"
|
|
||||||
></switch-input>
|
|
||||||
<!-- ///////////////////////////////////////////////////// -->
|
|
||||||
</tab-content>
|
</tab-content>
|
||||||
</form-wizard>
|
</form-wizard>
|
||||||
</div>
|
</div>
|
||||||
@@ -83,87 +37,61 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TextInput from '../../components/inputs/TextInput';
|
|
||||||
import TextReadOnlyInput from '../../components/inputs/TextReadOnlyInput';
|
|
||||||
import PasswordInput from '../../components/inputs/PasswordInput';
|
|
||||||
import SwitchInput from '../../components/inputs/SwitchInput';
|
|
||||||
import SelectOptionAutoCompleteInput from '../../components/inputs/SelectOptionAutoCompleteInput';
|
import SelectOptionAutoCompleteInput from '../../components/inputs/SelectOptionAutoCompleteInput';
|
||||||
import ImageInput from '../../components/inputs/ImageInput';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
mode: String
|
mode: String
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
TextInput,
|
|
||||||
TextReadOnlyInput,
|
|
||||||
PasswordInput,
|
|
||||||
SelectOptionAutoCompleteInput,
|
SelectOptionAutoCompleteInput,
|
||||||
SwitchInput,
|
|
||||||
ImageInput
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: new Form({
|
form: new Form({
|
||||||
img: [],
|
contract_template_id: [],
|
||||||
name: '',
|
|
||||||
email: '',
|
|
||||||
password: '',
|
|
||||||
password_confirmation: '',
|
|
||||||
role_id: [],
|
|
||||||
status: 1
|
|
||||||
}),
|
}),
|
||||||
this_admin: [],
|
this_contract: [],
|
||||||
exist_img: [],
|
|
||||||
exist_admin_role: []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
validOne() {
|
validOne() {
|
||||||
let vm = this;
|
let vm = this;
|
||||||
let ref_inputs = ['img', 'name', 'email', 'password', 'password_confirmation', 'role_id', 'status'];
|
let ref_inputs = ['contract_template_id'];
|
||||||
let url = vm.mode == 'create' ? 'admin/valid-check' : 'admin/valid-check/' + vm.this_admin.data.hash_id;
|
let url = vm.mode == 'create' ? 'contract/valid-check' : 'contract/valid-check/' + vm.this_contract.data.hash_id;
|
||||||
return General.validCheck(url, vm.form, ref_inputs);
|
return General.validCheck(url, vm.form, ref_inputs);
|
||||||
},
|
},
|
||||||
onComplete() {
|
onComplete() {
|
||||||
let vm = this;
|
let vm = this;
|
||||||
let method = vm.mode == 'create' ? 'post' : 'put';
|
let method = vm.mode == 'create' ? 'post' : 'put';
|
||||||
let url = vm.mode == 'create' ? 'admin/store' : 'admin/update/' + vm.this_admin.data.hash_id;
|
let url = vm.mode == 'create' ? 'contract/generate' : 'contract/update/' + vm.this_contract.data.hash_id;
|
||||||
|
|
||||||
return General.onComplete(url, vm.form, method)
|
return General.onComplete(url, vm.form, method)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (vm.mode != 'profile') {
|
let pervious_query = data.pervious_query ? '?' + data.pervious_query : '';
|
||||||
let pervious_query = data.pervious_query ? '?' + data.pervious_query : '';
|
vm.$router.push('/contract/list' + pervious_query);
|
||||||
vm.$router.push('/admin/list' + pervious_query);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vm.mode == 'create') {
|
if (vm.mode == 'create') {
|
||||||
General.toastedMessage('create', 'Admin', data.data.name);
|
General.toastedMessage('create', 'Contract', data.data.hash_id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
General.toastedMessage('edit', 'Admin', data.data.name);
|
General.toastedMessage('edit', 'Contract', data.data.hash_id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
loadThisAdmin() {
|
loadThisContract() {
|
||||||
let vm = this;
|
let vm = this;
|
||||||
let url = vm.mode == 'edit' ? 'admin/show/' + vm.$route.params.hash_id : 'admin/self';
|
let url = 'contract/show/' + vm.$route.params.hash_id;
|
||||||
let form = new Form({});
|
let form = new Form({});
|
||||||
General.getCall(url, form).then(data => {
|
General.getCall(url, form).then(data => {
|
||||||
vm.this_admin = data;
|
vm.this_contract = data;
|
||||||
vm.exist_img = vm.this_admin.data.img;
|
|
||||||
vm.form.name = vm.this_admin.data.name;
|
|
||||||
vm.form.email = vm.this_admin.data.email;
|
|
||||||
vm.form.status = vm.this_admin.data.status;
|
|
||||||
vm.form.role_id = General.getKey(vm.this_admin.data.role_list, 'id');
|
|
||||||
vm.exist_admin_role = General.autoCompleteKeyConvert(vm.this_admin.data.role_list);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
let vm = this;
|
let vm = this;
|
||||||
if (vm.mode == 'edit' || vm.mode == 'profile') {
|
if (vm.mode == 'edit') {
|
||||||
vm.loadThisAdmin();
|
vm.loadThisContract();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th style="width: 25%">Details</th>
|
<th style="width: 25%">Details</th>
|
||||||
<th>Obligation Template</th>
|
<th>Obligation Template</th>
|
||||||
|
<th>Contract Entity</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Created</th>
|
<th>Created</th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
@@ -51,12 +52,24 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div v-if="contract.contract_obligation_list" v-for="(obligation, $index) in contract.contract_obligation_list" :key="$index">
|
<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>
|
||||||
|
-{{ obligation.name }}
|
||||||
|
<small>({{ obligation.sequence }})</small>
|
||||||
|
<small>({{ obligation.contract_entity_list[0] ? obligation.contract_entity_list[0].entity_list[0].name : '-' }})</small>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!contract.contract_obligation_list[0]">
|
<div v-if="!contract.contract_obligation_list[0]">
|
||||||
-
|
-
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<div v-if="contract.contract_entity_list" v-for="(entity, $index) in contract.contract_entity_list" :key="$index">
|
||||||
|
<div>-{{ entity.entity_list[0].name }}</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="!contract.contract_entity_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>
|
||||||
@@ -116,7 +129,7 @@
|
|||||||
status: General.returnAray(General.getURLParam('status[]')),
|
status: General.returnAray(General.getURLParam('status[]')),
|
||||||
page: General.getURLParam('page')
|
page: General.getURLParam('page')
|
||||||
}),
|
}),
|
||||||
colspan: 6,
|
colspan: 7,
|
||||||
filter_status: false,
|
filter_status: false,
|
||||||
loading: true,
|
loading: true,
|
||||||
contract_list: [],
|
contract_list: [],
|
||||||
|
|||||||
Vendored
+3
@@ -156,6 +156,9 @@ class Form {
|
|||||||
else if(code[i] == 'OBLIGATION_DEPEND_ERROR') {
|
else if(code[i] == 'OBLIGATION_DEPEND_ERROR') {
|
||||||
return_message.push(Sprintf(General.lang('obligation_depend_error'), value));
|
return_message.push(Sprintf(General.lang('obligation_depend_error'), value));
|
||||||
}
|
}
|
||||||
|
else if(code[i] == 'UNDER_ERROR') {
|
||||||
|
return_message.push(Sprintf(General.lang('under_error'), value));
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return_message.push(code[i]);
|
return_message.push(code[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -302,6 +302,13 @@ Route::group(['namespace' => 'User', 'prefix' => 'user-backsys/api'], function (
|
|||||||
'middleware' => ['permission:add contract']
|
'middleware' => ['permission:add contract']
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
Route::post('valid-check/{hash_id?}',
|
||||||
|
[
|
||||||
|
'as' => 'api.contract.valid-check',
|
||||||
|
'uses' => 'ContractController@validCheck',
|
||||||
|
'middleware' => ['permission:add contract']
|
||||||
|
]
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// contract generate
|
// contract generate
|
||||||
|
|||||||
Reference in New Issue
Block a user