mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 04:13:58 +00:00
clone contract UI
This commit is contained in:
Vendored
+2
@@ -6,6 +6,7 @@ const En = {
|
||||
'password': 'password',
|
||||
'complete_day_range': 'complete day range',
|
||||
'sequence': 'sequence',
|
||||
'contract_template_id': 'contract template',
|
||||
'depend_contract_template_id': 'depend contract template',
|
||||
|
||||
// Error
|
||||
@@ -23,6 +24,7 @@ const En = {
|
||||
'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',
|
||||
'under_error': 'This %(att)s not belong to this user',
|
||||
|
||||
// toasted
|
||||
'have_been_successfully_created': '%(value[0].att)s ( %(value[1].att)s ) have been successfully created',
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
<breadcrumb
|
||||
:menu_item_list="menu_item_list"
|
||||
></breadcrumb>
|
||||
<admin-form
|
||||
<contract-form
|
||||
:mode="'create'"
|
||||
></admin-form>
|
||||
></contract-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import PageTitle from "../../components/titles/PageTitle";
|
||||
import Breadcrumb from "../../layouts/parts/Breadcrumb";
|
||||
import AdminForm from "./Form";
|
||||
import ContractForm from "./Form";
|
||||
|
||||
export default {
|
||||
metaInfo() {
|
||||
@@ -29,11 +29,11 @@
|
||||
components: {
|
||||
PageTitle,
|
||||
Breadcrumb,
|
||||
AdminForm
|
||||
ContractForm
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
heading: 'Create Admin',
|
||||
heading: 'Create Contract',
|
||||
icon: 'fa fa-plus',
|
||||
menu_item_list: [
|
||||
{
|
||||
@@ -42,14 +42,14 @@
|
||||
path: '/'
|
||||
},
|
||||
{
|
||||
title: 'Admin List',
|
||||
title: 'Contract List',
|
||||
active: false,
|
||||
path: '/admin/list'
|
||||
path: '/contract/list'
|
||||
},
|
||||
{
|
||||
title: 'Create Admin',
|
||||
title: 'Create Contract',
|
||||
active: true,
|
||||
path: '/admin/create'
|
||||
path: '/contract/create'
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<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>
|
||||
</div>
|
||||
<div v-if="this_admin.data || mode == 'create'">
|
||||
<div v-if="this_contract.data || mode == 'create'">
|
||||
<form-wizard
|
||||
@on-complete="onComplete"
|
||||
title=""
|
||||
@@ -18,64 +18,18 @@
|
||||
ref="valid_one"
|
||||
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
|
||||
v-if="mode != 'profile'"
|
||||
:input_name="'role_id'"
|
||||
:input_name="'contract_template_id'"
|
||||
:form="form"
|
||||
:exist_data="exist_admin_role"
|
||||
:placeholder="''"
|
||||
:label="'Role*'"
|
||||
:endpoint="'admin-role/list'"
|
||||
:label="'Clone Contract Template*'"
|
||||
:endpoint="'contract-template/list'"
|
||||
:search_field="'name'"
|
||||
:limit_tag="1"
|
||||
:return_key="'hash_id'"
|
||||
></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>
|
||||
</form-wizard>
|
||||
</div>
|
||||
@@ -83,87 +37,61 @@
|
||||
</template>
|
||||
|
||||
<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 ImageInput from '../../components/inputs/ImageInput';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
mode: String
|
||||
},
|
||||
components: {
|
||||
TextInput,
|
||||
TextReadOnlyInput,
|
||||
PasswordInput,
|
||||
SelectOptionAutoCompleteInput,
|
||||
SwitchInput,
|
||||
ImageInput
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: new Form({
|
||||
img: [],
|
||||
name: '',
|
||||
email: '',
|
||||
password: '',
|
||||
password_confirmation: '',
|
||||
role_id: [],
|
||||
status: 1
|
||||
contract_template_id: [],
|
||||
}),
|
||||
this_admin: [],
|
||||
exist_img: [],
|
||||
exist_admin_role: []
|
||||
this_contract: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
validOne() {
|
||||
let vm = this;
|
||||
let ref_inputs = ['img', 'name', 'email', 'password', 'password_confirmation', 'role_id', 'status'];
|
||||
let url = vm.mode == 'create' ? 'admin/valid-check' : 'admin/valid-check/' + vm.this_admin.data.hash_id;
|
||||
let ref_inputs = ['contract_template_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);
|
||||
},
|
||||
onComplete() {
|
||||
let vm = this;
|
||||
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)
|
||||
.then(data => {
|
||||
if (vm.mode != 'profile') {
|
||||
let pervious_query = data.pervious_query ? '?' + data.pervious_query : '';
|
||||
vm.$router.push('/admin/list' + pervious_query);
|
||||
}
|
||||
let pervious_query = data.pervious_query ? '?' + data.pervious_query : '';
|
||||
vm.$router.push('/contract/list' + pervious_query);
|
||||
|
||||
if (vm.mode == 'create') {
|
||||
General.toastedMessage('create', 'Admin', data.data.name);
|
||||
General.toastedMessage('create', 'Contract', data.data.hash_id);
|
||||
}
|
||||
else {
|
||||
General.toastedMessage('edit', 'Admin', data.data.name);
|
||||
General.toastedMessage('edit', 'Contract', data.data.hash_id);
|
||||
}
|
||||
});
|
||||
},
|
||||
loadThisAdmin() {
|
||||
loadThisContract() {
|
||||
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({});
|
||||
General.getCall(url, form).then(data => {
|
||||
vm.this_admin = 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);
|
||||
vm.this_contract = data;
|
||||
});
|
||||
}
|
||||
},
|
||||
created() {
|
||||
let vm = this;
|
||||
if (vm.mode == 'edit' || vm.mode == 'profile') {
|
||||
vm.loadThisAdmin();
|
||||
if (vm.mode == 'edit') {
|
||||
vm.loadThisContract();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<th>#</th>
|
||||
<th style="width: 25%">Details</th>
|
||||
<th>Obligation Template</th>
|
||||
<th>Contract Entity</th>
|
||||
<th>Status</th>
|
||||
<th>Created</th>
|
||||
<th>Actions</th>
|
||||
@@ -51,12 +52,24 @@
|
||||
</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>
|
||||
-{{ 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 v-if="!contract.contract_obligation_list[0]">
|
||||
-
|
||||
</div>
|
||||
</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>
|
||||
<span :class="'badge badge-' + contract.status[0].color">{{ contract.status[0].name }}</span>
|
||||
</td>
|
||||
@@ -116,7 +129,7 @@
|
||||
status: General.returnAray(General.getURLParam('status[]')),
|
||||
page: General.getURLParam('page')
|
||||
}),
|
||||
colspan: 6,
|
||||
colspan: 7,
|
||||
filter_status: false,
|
||||
loading: true,
|
||||
contract_list: [],
|
||||
|
||||
Vendored
+3
@@ -156,6 +156,9 @@ class Form {
|
||||
else if(code[i] == 'OBLIGATION_DEPEND_ERROR') {
|
||||
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 {
|
||||
return_message.push(code[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user