Commit db1fd0e0 authored by hong-IT-99's avatar hong-IT-99
parents 15a56e72 ce23ddd0
......@@ -127,7 +127,7 @@
<div class="row">
<div class="col-auto text-h6 text-weight-regular flex q-ml-md">
{{ $t('managingUnit.titleAdd')
{{ $t('managingUnitAdd.titleAdd')
}}<span style="color: red" class="q-ml-xs">*</span>
</div>
<q-space></q-space>
......@@ -206,6 +206,65 @@
</template>
</q-table>
</div>
<div class="row q-pt-lg">
<div class="col-auto text-h6 text-weight-regular flex q-ml-md">
{{ $t('managingUnitAdd.titleUnitBankAccount')
}}<span style="color: red" class="q-ml-xs">*</span>
</div>
<q-space></q-space>
<div class="col-auto">
<q-btn
color="primary"
no-caps
:label="$t('managingUnitAdd.AddmanagingBankAccount')"
class="q-mr-sm"
@click="openAddBankAccountDialog"
>
</q-btn>
</div>
</div>
<div class="col-12 q-mt-sm">
<q-table
:rows="bankAccountList"
:columns="bankAccountTableColumns"
separator="cell"
:no-data-label="$t('emptyData')"
hide-pagination
>
<template v-slot:body-cell-action="">
<q-td style="padding: 0" class="flex flex-center">
<q-btn flat round color="primary" icon="mdi-delete-outline">
<q-tooltip :offset="[20, 10]">{{
$t('managingUnitAdd.toolTipMessage.deleteBankAccount')
}}</q-tooltip>
</q-btn>
<q-btn
flat
round
color="primary"
icon="mdi-account-edit-outline"
>
<q-tooltip :offset="[20, 10]">{{
$t('managingUnitAdd.toolTipMessage.updateBankAccount')
}}</q-tooltip>
</q-btn>
</q-td>
</template>
<template v-slot:body-cell-isDefault="rowData">
<q-td>
<div align="center">
<q-checkbox
:true-value="1"
:false-value="2"
v-model="rowData.value"
/>
</div>
</q-td>
</template>
</q-table>
</div>
</q-card-section>
<q-card-actions align="right">
......@@ -231,6 +290,7 @@
</q-card>
</q-dialog>
<!-- components DS nghệ sỹ -->
<UnitAddUpdateArtistDialog
v-model:isOpened="addArtistDialogIsOpened"
v-model:artistField="artistField"
......@@ -255,6 +315,32 @@
:fieldOptions="fieldsOptions"
@saveArtistInfo="updateArtistContract"
/>
<!-- components DS tài khoản ngân hàng -->
<UnitAddUpdateBankAccountDialog
v-model:isOpened="addBankAccountDialogIsOpened"
v-model:bank="bank"
v-model:cardCode="cardCode"
v-model:numberCard="numberCard"
v-model:cardType="cardType"
v-model:isDefault="isDefault"
:bankOptions="bankOptions"
:cardTypeOptions="cardTypeOptions"
isUpdate
@saveBankAccountInfo="addNewBankAccount"
/>
<UnitAddUpdateBankAccountDialog
v-model:isOpened="updateBankAccountDialogIsOpened"
v-model:bank="bank"
v-model:cardCode="cardCode"
v-model:numberCard="numberCard"
v-model:cardType="cardType"
v-model:isDefault="isDefault"
:bankOptions="bankOptions"
:cardTypeOptions="cardTypeOptions"
@saveBankAccountInfo="updateNewBankAccount"
/>
</template>
<script lang="ts">
......@@ -268,10 +354,12 @@ import { api, BaseResponseBody } from 'src/boot/axios';
import { FieldType, ArtistInfoType, Contract } from 'src/assets/type';
import { config } from 'src/assets/configurations';
import UnitAddUpdateArtistDialog from '../unit-add-update-artist/index.vue';
import UnitAddUpdateBankAccountDialog from '../unit-add-update-bank-account/index.vue';
import moment from 'moment';
import { Dialog, Notify } from 'quasar';
import { UnitStatus } from 'src/assets/enums';
//contract
const artistTableColumns = [
{
name: 'nameAdd',
......@@ -329,8 +417,66 @@ const artistTableColumns = [
},
];
//bankAccount
const bankAccountTableColumns = [
{
name: 'cardCode',
field: 'cardCode',
required: true,
label: i18n.global.t('managingUnitAdd.tableColumns.cardCode'),
headerStyle: 'text-align: center !important;',
align: 'left',
sortable: false,
},
{
name: 'numberCard',
field: 'numberCard',
required: true,
label: i18n.global.t('managingUnitAdd.tableColumns.numberCard'),
headerStyle: 'text-align: center !important;',
align: 'left',
sortable: false,
},
{
name: 'bank',
field: 'bank',
required: true,
label: i18n.global.t('managingUnitAdd.tableColumns.bank'),
headerStyle: 'text-align: center !important;',
align: 'left',
sortable: false,
},
{
name: 'cardType',
field: 'cardType',
required: true,
label: i18n.global.t('managingUnitAdd.tableColumns.cardType'),
headerStyle: 'text-align: center !important;',
align: 'left',
sortable: false,
},
{
name: 'isDefault',
field: 'isDefault',
required: true,
label: i18n.global.t('managingUnitAdd.tableColumns.isDefault'),
headerStyle: 'text-align: center !important;',
align: 'center',
sortable: false,
},
{
name: 'action',
field: 'action',
required: true,
label: i18n.global.t('managingUnitAdd.tableColumns.action'),
headerStyle: 'text-align: center !important;',
align: 'center',
sortable: false,
},
];
export default defineComponent({
components: { UnitAddUpdateArtistDialog },
components: { UnitAddUpdateArtistDialog, UnitAddUpdateBankAccountDialog },
props: {
isOpened: {
type: Boolean,
......@@ -347,6 +493,7 @@ export default defineComponent({
phoneNumber: { type: String, required: true },
status: { type: Number, required: true },
artistList: { type: Array as PropType<unknown[]>, required: true },
bankAccountList: { type: Array as PropType<unknown[]>, required: true },
},
setup(props, context) {
const addArtistDialogIsOpened = ref(false);
......@@ -364,6 +511,16 @@ export default defineComponent({
{ artist: Contract; index: number } | undefined
> = ref(undefined);
const addBankAccountDialogIsOpened = ref(false);
const updateBankAccountDialogIsOpened = ref(false);
const bank: Ref<number | undefined> = ref(undefined);
const cardType: Ref<number | undefined> = ref(undefined);
const cardCode = ref('');
const numberCard = ref('');
const isDefault: Ref<number> = ref(2);
const bankOptions: Ref<number | undefined> = ref(undefined);
const cardTypeOptions: Ref<number | undefined> = ref(undefined);
const codeRules = [
(val?: string) =>
(val && val.trim().length) ||
......@@ -381,7 +538,7 @@ export default defineComponent({
];
const fieldsRules = [
(val?: number) =>
val !== undefined ||
val !== null ||
i18n.global.t('managingUnit.validateMessages.requireFields'),
];
const phoneNumberRules = [
......@@ -490,6 +647,24 @@ export default defineComponent({
}
};
//tài khoản ngân hàng
const openAddBankAccountDialog = () => {
addBankAccountDialogIsOpened.value = true;
cardCode.value = '';
numberCard.value = '';
bank.value = undefined;
cardType.value = undefined;
};
const addNewBankAccount = () => {
console.log(Object);
};
const updateNewBankAccount = () => {
console.log(Object);
};
//nghệ sỹ
const openAddArtistDialog = () => {
addArtistDialogIsOpened.value = true;
artistField.value = undefined;
......@@ -615,6 +790,19 @@ export default defineComponent({
openUpdateArtistDialog,
UnitStatus,
deleteContract,
bankAccountTableColumns,
addBankAccountDialogIsOpened,
bank,
cardCode,
numberCard,
cardType,
isDefault,
bankOptions,
cardTypeOptions,
addNewBankAccount,
openAddBankAccountDialog,
updateBankAccountDialogIsOpened,
updateNewBankAccount,
};
},
emits: [
......
......@@ -4,7 +4,7 @@
:model-value="isOpened"
@update:model-value="$emit('update:isOpened', $event)"
>
<q-card class="full-width" style="max-width: 50rem" bordered>
<q-card class="full-width" style="max-width: 30rem" bordered>
<q-form
greedy
@submit.prevent="
......@@ -30,7 +30,7 @@
style="max-height: calc(100vh - 10rem)"
>
<div class="row q-col-gutter-sm">
<div class="col-6">
<div class="col-12">
<q-select
:model-value="artistField"
@update:model-value="$emit('update:artistField', $event)"
......@@ -45,6 +45,28 @@
class="q-my-sm"
outlined
></q-select>
<div>
<q-select
:model-value="artistName"
:disable="!artistField"
@update:model-value="$emit('update:artistName', $event)"
:label="
$t('managingUnitAdd.dialogLabel.fieldLabels.artistName')
"
:options="artistOptions"
:rules="artistNameRules"
map-options
option-value="id"
option-label="fullName"
class="q-my-sm"
outlined
clearable
>
</q-select
><q-tooltip v-if="!artistField"
>Vui lòng chọn Lĩnh vực</q-tooltip
>
</div>
<q-input
:model-value="contractTimeFrom"
:label="
......@@ -78,42 +100,6 @@
</q-date>
</q-popup-proxy>
</q-input>
<div>
<span class="text-body1">{{
$t('managingUnitAdd.dialogLabel.fieldLabels.status')
}}</span
><q-toggle
:model-value="artistStatus"
:true-value="1"
:false-value="2"
@update:model-value="$emit('update:artistStatus', $event)"
/>
</div>
</div>
<div class="col-6">
<div>
<q-select
:model-value="artistName"
:disable="!artistField"
@update:model-value="$emit('update:artistName', $event)"
:label="
$t('managingUnitAdd.dialogLabel.fieldLabels.artistName')
"
:options="artistOptions"
:rules="artistNameRules"
map-options
option-value="id"
option-label="fullName"
class="q-my-sm"
outlined
clearable
>
</q-select
><q-tooltip v-if="!artistField"
>Vui lòng chọn Lĩnh vực</q-tooltip
>
</div>
<q-input
:model-value="contractTimeTo"
:label="
......@@ -143,6 +129,17 @@
</q-date>
</q-popup-proxy>
</q-input>
<div>
<span class="text-body1">{{
$t('managingUnitAdd.dialogLabel.fieldLabels.status')
}}</span
><q-toggle
:model-value="artistStatus"
:true-value="1"
:false-value="2"
@update:model-value="$emit('update:artistStatus', $event)"
/>
</div>
</div>
</div>
</q-card-section>
......@@ -194,19 +191,19 @@ export default defineComponent({
setup() {
const artistNameRules = [
(val?: number) =>
val !== undefined ||
val !== null ||
i18n.global.t('managingUnitAdd.validateMessages.requireArtistName'),
];
const artistFieldRules = [
(val?: number) =>
val !== undefined ||
val !== null ||
i18n.global.t('managingUnitAdd.validateMessages.requireArtistField'),
];
const contractTimeFromRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t(
'managingUnitAdd.validateMessages.requireContractTimeFromRules'
'managingUnitAdd.validateMessages.requireContractTimeFrom'
),
];
const contractTimeToRules = [
......
<template>
<q-dialog
persistent
:model-value="isOpened"
@update:model-value="$emit('update:isOpened', $event)"
>
<q-card class="full-width" style="max-width: 30rem" bordered>
<q-form
greedy
@submit.prevent="
$emit('saveBankAccountInfo', {});
$emit('update:isOpened', false);
"
>
<q-card-section class="q-pa-none">
<q-item>
<q-item-section>
<q-item-label class="text-h6 text-weight-regular">{{
isUpdate
? $t('managingUnitAdd.dialogLabel.title.addBankAccount')
: $t('managingUnitAdd.dialogLabel.title.updateBankAccount')
}}</q-item-label>
</q-item-section>
</q-item>
</q-card-section>
<q-separator />
<q-card-section
class="overflow-auto"
style="max-height: calc(100vh - 10rem)"
>
<div class="row q-col-gutter-sm">
<div class="col-12">
<q-select
:model-value="bank"
@update:model-value="$emit('update:bank', $event)"
:label="$t('managingUnitAdd.dialogLabel.fieldLabels.bank')"
:options="bankOptions"
:rules="bankdRules"
map-options
option-value="id"
option-label="name"
class="q-my-sm"
outlined
></q-select>
<q-select
:model-value="cardType"
@update:model-value="$emit('update:cardType', $event)"
:label="$t('managingUnitAdd.dialogLabel.fieldLabels.cardType')"
:options="cardTypeOptions"
:rules="cardTypeRules"
map-options
option-value="id"
option-label="name"
class="q-my-sm"
outlined
></q-select>
<q-input
:model-value="cardCode"
@update:model-value="$emit('update:cardCode', $event)"
:label="$t('managingUnitAdd.dialogLabel.fieldLabels.cardCode')"
type="text"
class="q-my-sm"
outlined
:rules="cardCodeRules"
clearable
></q-input>
<q-input
:model-value="numberCard"
@update:model-value="$emit('update:numberCard', $event)"
:label="
$t('managingUnitAdd.dialogLabel.fieldLabels.numberCard')
"
type="text"
class="q-my-sm"
outlined
:rules="numberCardRules"
clearable
></q-input>
<div class="flex">
<div class="flex flex-center text-body1 q-ml-xs">Mặc định</div>
<q-checkbox
:model-value="isDefault"
:true-value="1"
:false-value="2"
@update:model-value="$emit('update:isDefault', $event)"
/>
</div>
</div>
</div>
</q-card-section>
<q-card-actions align="right">
<div>
<q-btn
color="grey"
no-caps
style="width: 90px"
class="q-mr-sm"
:label="$t('managingUnitAdd.crudActions.cancel')"
@click="$emit('update:isOpened', false)"
/>
<q-btn
type="submit"
color="primary"
no-caps
style="width: 90px"
:label="$t('managingUnitAdd.crudActions.save')"
/>
</div>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { i18n } from 'src/boot/i18n';
export default defineComponent({
props: {
isOpened: {
type: Boolean,
required: true,
},
isUpdate: { type: Boolean, default: false },
bank: { type: Number, required: true },
bankOptions: { type: Array, required: true },
cardType: { type: Number, required: true },
cardTypeOptions: { type: Array, required: true },
cardCode: { type: String, required: true },
numberCard: { type: Number, required: true },
isDefault: { type: Number, required: true },
},
setup() {
const bankdRules = [
(val?: number) =>
val !== null ||
i18n.global.t('managingUnitAdd.validateMessages.requireBank'),
];
const cardTypeRules = [
(val?: number) =>
val !== null ||
i18n.global.t('managingUnitAdd.validateMessages.requireCardType'),
];
const cardCodeRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('managingUnitAdd.validateMessages.requireCardCode'),
];
const numberCardRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('managingUnitAdd.validateMessages.requireNumberCard'),
];
return {
bankdRules,
cardTypeRules,
cardCodeRules,
numberCardRules,
};
},
emits: [
'update:isOpened',
'update:cardCode',
'update:bank',
'update:numberCard',
'update:cardType',
'update:isDefault',
'saveBankAccountInfo',
],
});
</script>
......@@ -22,6 +22,8 @@ export default {
'msg-1': 'Lỗi không xác định',
msg999: 'Lỗi hệ thống',
msg99: 'Lỗi hệ thống',
msg1016: 'Tài khoản hoặc Mật khẩu không đúng',
msg4: 'Tên đơn vị chủ quản đã tồn tại',
},
emptyData: 'Không có dữ liệu',
crudActions: {
......@@ -138,7 +140,6 @@ export default {
// Đơn vị chủ quản
managingUnit: {
titleAdd: 'Danh sách nghệ sỹ',
title: 'Đơn vị chủ quản',
tableColumns: {
code: 'Mã đơn vị',
......@@ -208,19 +209,29 @@ export default {
//Add đơn vị chủ quản
managingUnitAdd: {
AddmanagingUnit: 'Thêm nghệ sỹ',
AddmanagingBankAccount: 'Thêm ngân hàng',
titleAdd: 'Danh sách nghệ sỹ',
titleUnitBankAccount: 'Danh sách tài khoản ngân hàng thụ hưởng',
tableColumns: {
sttAdd: 'STT',
nameAdd: 'Tên Nghệ sỹ',
myedityAdd: 'Nghệ danh',
fieldsAdd: 'Lĩnh vực',
timeAdd: 'Thời gian hợp đồng',
action: 'Chức năng',
//ds nghệ sỹ
sttUpdate: 'STT',
nameUpdate: 'Tên Nghệ sỹ',
myedityUpdate: 'Nghệ danh',
fieldsUpdate: 'Lĩnh vực',
timeUpdate: 'Thời gian hợp đồng',
status: 'Trạng thái',
action: 'Chức năng',
//ds bankaccount
cardCode: 'Mã thẻ',
numberCard: 'Số ghi trên thẻ',
bank: 'Ngân hàng',
cardType: 'Loại thẻ',
isDefault: 'Mặc định',
},
statusLabel: {
active: 'Còn thời gian',
......@@ -230,28 +241,44 @@ export default {
title: {
add: 'Thêm nghệ sỹ',
update: 'Cập nhật nghệ sỹ',
addBankAccount: 'Thêm ngân hàng thụ hưởng',
updateBankAccount: 'Cập nhật ngân hàng thụ hưởng',
},
fieldLabels: {
//ds nghệ sỹ
artistName: 'Tên nghệ sỹ *',
contractTimeTo: 'Thời gian kết thúc hợp đồng *',
artistField: 'Lĩnh vực *',
contractTimeFrom: 'Thời gian bắt đầu hợp đồng *',
status: 'Trạng thái',
//ds bankaccount
cardCode: 'Mã thẻ *',
numberCard: 'Số ghi trên thẻ *',
bank: 'Ngân hàng *',
cardType: 'Loại thẻ *',
},
},
toolTipMessage: {
updateInfo: 'Cập nhật',
delete: 'Xóa nghệ sỹ',
updateBankAccount: 'Cập nhật',
deleteBankAccount: 'Xóa ngân hàng',
},
crudActions: {
save: 'Lưu',
cancel: 'Đóng',
},
validateMessages: {
requireArtistName: 'Vui lòng chọn nghệ sỹ',
//ds nghệ sỹ
requireArtistName: 'Vui lòng chọn Nghệ sỹ',
requireContractTimeTo: 'Vui lòng chọn Thời gian kết thúc hợp đồng',
requireArtistField: 'Vui lòng chọn Lĩnh vực',
requireContractTimeFromRules: 'Vui lòng chọn Thời gian bắt đầu hợp đồng',
requireContractTimeFrom: 'Vui lòng chọn Thời gian bắt đầu hợp đồng',
//ds bankaccount
requireBank: 'Vui lòng chọn Ngân hàng',
requireCardType: 'Vui lòng chọn Loại thẻ',
requireCardCode: 'Vui lòng nhập Mã thẻ',
requireNumberCard: 'Vui lòng nhập Số ghi trên thẻ',
},
confirmActionsTitle: {
confirmDelete: 'Bạn có chắc chắn muốn xóa hợp đồng với nghệ sỹ?',
......
......@@ -85,7 +85,9 @@
<q-td>
<div align="center">
<q-chip
:color="rowData.value ? 'positive' : 'orange'"
:color="
rowData.value === UnitStatus.active ? 'positive' : 'orange'
"
text-color="white"
size="sm"
>
......@@ -400,7 +402,7 @@ export default defineComponent({
address: unitAddress.value,
email: unitEmail.value,
phoneNumber: unitPhoneNumber.value,
status: unitStatus.value ? 1 : 2,
status: unitStatus.value,
fields: unitField.value,
contracts: unitArtistList.value,
};
......@@ -431,7 +433,7 @@ export default defineComponent({
address: unitAddress.value,
email: unitEmail.value,
phoneNumber: unitPhoneNumber.value,
status: unitStatus.value ? 1 : 2,
status: unitStatus.value,
fields: unitField.value,
contracts: unitArtistList.value,
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment