diff --git a/app/components/app/division-position/entry.vue b/app/components/app/division-position/entry.vue new file mode 100644 index 00000000..da4782c0 --- /dev/null +++ b/app/components/app/division-position/entry.vue @@ -0,0 +1,192 @@ + + + + + + + Kode Jabatan + + + + + + Nama Jabatan + + + + + + Pengisi Jabatan + + + + + + Status Kepala + + + + + Ya + + + + Tidak + + + + + + + + Kembali + + + Simpan + + + + diff --git a/app/components/app/division/detail/index.vue b/app/components/app/division/detail/index.vue new file mode 100644 index 00000000..dd5a4c59 --- /dev/null +++ b/app/components/app/division/detail/index.vue @@ -0,0 +1,34 @@ + + + + {{ division.code || '-' }} + {{ division.name || '-' }} + + + diff --git a/app/components/app/division/detail/list-cfg.ts b/app/components/app/division/detail/list-cfg.ts new file mode 100644 index 00000000..235a20cc --- /dev/null +++ b/app/components/app/division/detail/list-cfg.ts @@ -0,0 +1,62 @@ +import type { Config, RecComponent } from '~/components/pub/my-ui/data-table' +import { defineAsyncComponent } from 'vue' +import type { DivisionPosition } from '~/models/division-position' + +type SmallDetailDto = any + +const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue')) + +export const config: Config = { + cols: [{}, {}, {}, {}, {}, { width: 50 }], + + headers: [ + [ + { label: 'Kode Jabatan' }, + { label: 'Nama Jabatan' }, + { label: 'Pengisi Jabatan' }, + { label: 'Status Kepala' }, + { label: '' }, + ], + ], + + keys: ['code', 'name', 'employee', 'head', 'action'], + + delKeyNames: [ + { key: 'code', label: 'Kode' }, + { key: 'name', label: 'Nama' }, + ], + + parses: { + division: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + return recX.division?.name || '-' + }, + employee: (rec: unknown): unknown => { + const recX = rec as DivisionPosition + const fullName = + `${recX.employee?.person.frontTitle} ${recX.employee?.person.name} ${recX.employee?.person.endTitle}`.trim() + + return fullName || '-' + }, + head: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + return recX.headStatus ? 'Ya' : 'Tidak' + }, + }, + + components: { + action(rec, idx) { + const res: RecComponent = { + idx, + rec: rec as object, + component: action, + props: { + size: 'sm', + }, + } + return res + }, + }, + + htmls: {}, +} diff --git a/app/components/app/division/detail/list.vue b/app/components/app/division/detail/list.vue new file mode 100644 index 00000000..2f7908cb --- /dev/null +++ b/app/components/app/division/detail/list.vue @@ -0,0 +1,39 @@ + + + + + + + + diff --git a/app/components/content/division/detail.vue b/app/components/content/division/detail.vue new file mode 100644 index 00000000..fe2641c6 --- /dev/null +++ b/app/components/content/division/detail.vue @@ -0,0 +1,214 @@ + + + + + + + + + + + { + onResetState() + isFormEntryDialogOpen = value + } + " + > + , resetForm: () => void) => { + console.log(values) + if (recId > 0) { + handleActionEdit(recId, values, getDivisionPositionList, onResetState, toast) + return + } + handleActionSave(values, getDivisionPositionList, onResetState, toast) + } + " + @cancel="handleCancelForm" + /> + + handleActionRemove(recId, getDivisionPositionList, toast)" + @cancel="" + > + + + + {{ field.label }}: + {{ record[field.key] }} + + + + + diff --git a/app/models/division-position.ts b/app/models/division-position.ts index 3bd5e63a..dc263ada 100644 --- a/app/models/division-position.ts +++ b/app/models/division-position.ts @@ -1,11 +1,13 @@ import { type Base, genBase } from './_base' - +import type { Employee } from './employee' export interface DivisionPosition extends Base { code: string name: string headStatus?: boolean division_id: number employee_id?: number + + employee?: Employee | null } export function genDivisionPosition(): DivisionPosition { diff --git a/app/models/division.ts b/app/models/division.ts index 0f6d9185..c54a0e24 100644 --- a/app/models/division.ts +++ b/app/models/division.ts @@ -1,10 +1,13 @@ -import { type Base, genBase } from "./_base" - +import { type Base, genBase } from './_base' +import type { DivisionPosition } from './division-position' export interface Division extends Base { code: string name: string parent_id?: number | null childrens?: Division[] | null + + // preload + divisionPosition?: DivisionPosition[] | null } export function genDivision(): Division { diff --git a/app/models/installation-position.ts b/app/models/installation-position.ts new file mode 100644 index 00000000..aa0a9ebf --- /dev/null +++ b/app/models/installation-position.ts @@ -0,0 +1,20 @@ +import { type Base, genBase } from './_base' + +export interface InstallationPosition extends Base { + installation_id: number + code: string + name: string + headStatus?: boolean + employee_id?: number +} + +export function genInstallationPosition(): InstallationPosition { + return { + ...genBase(), + installation_id: 0, + code: '', + name: '', + headStatus: false, + employee_id: 0, + } +} diff --git a/app/models/specialist-position.ts b/app/models/specialist-position.ts new file mode 100644 index 00000000..58c53f9e --- /dev/null +++ b/app/models/specialist-position.ts @@ -0,0 +1,20 @@ +import { type Base, genBase } from './_base' + +export interface SpecialistPosition extends Base { + specialist_id: number + code: string + name: string + headStatus?: boolean + employee_id?: number +} + +export function genSpecialistPosition(): SpecialistPosition { + return { + ...genBase(), + specialist_id: 0, + code: '', + name: '', + headStatus: false, + employee_id: 0, + } +} diff --git a/app/models/subspecialist-position.ts b/app/models/subspecialist-position.ts new file mode 100644 index 00000000..5fdfa639 --- /dev/null +++ b/app/models/subspecialist-position.ts @@ -0,0 +1,20 @@ +import { type Base, genBase } from './_base' + +export interface SubSpecialistPosition extends Base { + subspecialist_id: number + code: string + name: string + headStatus?: boolean + employee_id?: number +} + +export function genSubSpecialistPosition(): SubSpecialistPosition { + return { + ...genBase(), + subspecialist_id: 0, + code: '', + name: '', + headStatus: false, + employee_id: 0, + } +} diff --git a/app/models/unit-position.ts b/app/models/unit-position.ts new file mode 100644 index 00000000..14925584 --- /dev/null +++ b/app/models/unit-position.ts @@ -0,0 +1,20 @@ +import { type Base, genBase } from './_base' + +export interface UnitPosition extends Base { + unit_id: number + code: string + name: string + headStatus?: boolean + employee_id?: number +} + +export function genUnitPosition(): UnitPosition { + return { + ...genBase(), + unit_id: 0, + code: '', + name: '', + headStatus: false, + employee_id: 0, + } +} diff --git a/app/pages/(features)/org-src/division/[id]/index.vue b/app/pages/(features)/org-src/division/[id]/index.vue new file mode 100644 index 00000000..658652d9 --- /dev/null +++ b/app/pages/(features)/org-src/division/[id]/index.vue @@ -0,0 +1,42 @@ + + + + + + + + diff --git a/app/services/employee.service.ts b/app/services/employee.service.ts index d3691c83..3121e7a2 100644 --- a/app/services/employee.service.ts +++ b/app/services/employee.service.ts @@ -1,4 +1,5 @@ // Base +import type { Employee } from '~/models/employee' import * as base from './_crud-base' const path = '/api/v1/employee' @@ -29,9 +30,9 @@ export async function getValueLabelList(params: any = null): Promise<{ value: st const result = await getList(params) if (result.success) { const resultData = result.body?.data || [] - data = resultData.map((item: any) => ({ - value: item.id ? Number(item.id) : item.code, - label: item.name, + data = resultData.map((item: Employee) => ({ + value: item.id, + label: `${item.person.frontTitle} ${item.person.name} ${item.person.endTitle}`.trim(), })) } return data
+ {{ field.label }}: + {{ record[field.key] }} +