diff --git a/.env b/.env index 739d228..a8d4e90 100644 --- a/.env +++ b/.env @@ -1,2 +1,3 @@ +VUE_APP_ROOT_URL=http://localhost:8080 VUE_APP_ROOT_API=http://localhost:9090/api VUE_APP_PUBLIC_KEY=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx3MRA7zxvaWKrtmPl2hRJLFiyryvj0ZUlmWw9OZIgqwJUDBTsg5yFX4hCQrANV1yy5ibTqAn2APdNCdhGgp8R2YLWrUR2vVGbmnKXXzEDsFpT6cgo \ No newline at end of file diff --git a/public/bg-login-copy.jpg b/public/bg-login-copy.jpg new file mode 100644 index 0000000..f246dbc Binary files /dev/null and b/public/bg-login-copy.jpg differ diff --git a/public/css/style.css b/public/css/style.css index 8d03474..8ea30cc 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -197,10 +197,10 @@ h2 { h3 { color: #0996C2; } -.dx-link .dx-link-edit .dx-icon-edit .dx-link-icon { +.dx-link.dx-link-edit.dx-icon-edit.dx-link-icon { color: #e8d102; } -.dx-link .dx-link-delete .dx-icon-trash .dx-link-icon { +.dx-link.dx-link-delete.dx-icon-trash.dx-link-icon { color: #FF2C2C; } .dx-item-content .dx-toolbar-item-content { diff --git a/src/app-navigation.js b/src/app-navigation.js index 702aee0..08d8c1a 100644 --- a/src/app-navigation.js +++ b/src/app-navigation.js @@ -73,7 +73,7 @@ export default [ icon: "images/icon/ico-2-config.png", items: [ { - text: 'Manajemen Roles', + text: 'Manajemen Role', path: '/master-config/roles-config', }, { diff --git a/src/auth.js b/src/auth.js index 5f10065..a4c45ed 100644 --- a/src/auth.js +++ b/src/auth.js @@ -13,12 +13,52 @@ export default { try { // Send request console.log(email, password); - this._user = { ...defaultUser, email }; + // this._user = { ...defaultUser, email }; - return { - isOk: true, - data: this._user + // return { + // isOk: true, + // data: this._user + // }; + + const requestOptions = { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ email: email, password: password }), }; + + const response = await fetch('http://localhost:9090/api/authentication/login', requestOptions); + const data = await response.json(); + + console.log(data); + //console.log(data.data.length); + + // this._user = { + // id: response.data.id, + // email: response.data.role, + // name: response.data.keterangan, + // role_id: response.data.id, + // }; + + if(data.status == 'sukses') { + const defaultUser = { + email: data.data.email, + avatarUrl: 'https://js.devexpress.com/Demos/WidgetsGallery/JSDemos/images/employees/06.png', + name: data.data.name, + }; + this._user = { ...defaultUser }; + + return { + isOk: true, + data: this._user + }; + } else { + //--- jika gagal munculkan pesan gagal + return { + isOk: false, + message: "Authentication failed" + }; + } + } catch { return { diff --git a/src/layouts/single-card copy 2.vue b/src/layouts/single-card copy 2.vue new file mode 100644 index 0000000..37aad33 --- /dev/null +++ b/src/layouts/single-card copy 2.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/src/layouts/single-card copy.vue b/src/layouts/single-card copy.vue new file mode 100644 index 0000000..217801c --- /dev/null +++ b/src/layouts/single-card copy.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/src/layouts/single-card.vue b/src/layouts/single-card.vue index 217801c..37aad33 100644 --- a/src/layouts/single-card.vue +++ b/src/layouts/single-card.vue @@ -1,5 +1,8 @@ @@ -143,4 +153,6 @@ export default { color: rgba($base-text-color, alpha($base-text-color) * 0.7); } } + +html, body { height: 100%; } diff --git a/src/views/login-form.vue b/src/views/login-form.vue index 98b007b..ba87bcb 100644 --- a/src/views/login-form.vue +++ b/src/views/login-form.vue @@ -116,7 +116,7 @@ export default { DxItem, DxLabel, DxButtonItem, - DxButtonOptions + DxButtonOptions, } }; @@ -140,4 +140,6 @@ export default { color: rgba($base-text-color, alpha($base-text-color) * 0.7); } } + +html, body { height: 100%; } diff --git a/src/views/master-config/permissions-config.vue b/src/views/master-config/permissions-config.vue index 5dda680..8618a38 100644 --- a/src/views/master-config/permissions-config.vue +++ b/src/views/master-config/permissions-config.vue @@ -7,7 +7,7 @@
diff --git a/src/views/master-config/roles-config.vue b/src/views/master-config/roles-config.vue index 2a315d0..5997c8e 100644 --- a/src/views/master-config/roles-config.vue +++ b/src/views/master-config/roles-config.vue @@ -6,17 +6,17 @@
+ :column-auto-width="true"> - + + + - + @@ -61,17 +63,12 @@ - + - - +
@@ -91,18 +88,14 @@ import DxDataGrid, { DxPaging, DxSearchPanel, DxToolbar, - DxTexts + DxTexts, + DxRequiredRule } from "devextreme-vue/data-grid"; import CustomStore from "devextreme/data/custom_store"; -import { Workbook } from 'exceljs'; -import { saveAs } from 'file-saver-es'; -import { exportDataGrid as exportDataGridToExcel } from 'devextreme/excel_exporter'; -import { jsPDF } from 'jspdf'; -import { exportDataGrid as exportDataGridToPDF } from 'devextreme/pdf_exporter'; const URL = process.env.VUE_APP_ROOT_API+'/roles'; -const customDataSource = new CustomStore({ +const dataSource = new CustomStore({ key: 'id', load: () => { @@ -151,62 +144,14 @@ export default { DxPaging, DxSearchPanel, DxToolbar, - DxTexts - }, - methods: { - onExporting(e) { - e.cancel = true; - - switch (e.format) { - case "pdf": { - const doc = new jsPDF(); - exportDataGridToPDF({ - jsPDFDocument: doc, - component: e.component, - indent: 5, - }).then(() => { - doc.save('Jenispengadaan.pdf'); - }); - } - break; - - case "xlsx": { - const workbook = new Workbook(); - const worksheet = workbook.addWorksheet('Manajemen Roles'); - - exportDataGridToExcel({ - component: e.component, - worksheet: worksheet, - autoFilterEnabled: true, - }).then(() => { - workbook.xlsx.writeBuffer().then((buffer) => { - saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx'); - }); - }); - } - break; - } - - }, - onCellPrepared(e) { - var isEditing = e.row.isEditing, $links = e.cellElement.find(".dx-link"); - - $links.text(""); - - if(isEditing){ - $links.filter(".dx-link-save").addClass("dx-icon-save").addClass("yellowClass"); - $links.filter(".dx-link-cancel").addClass("dx-icon-revert").addClass("yellowClass"); - } else { - $links.filter(".dx-link-edit").addClass("dx-icon-edit").addClass("greenClass"); - $links.filter(".dx-link-delete").addClass("dx-icon-trash").addClass("redClass"); - } - }, + DxTexts, + DxRequiredRule, }, data() { return { //jsonUrl: URL, - customDataSource, + dataSource, } }, } diff --git a/src/views/master-config/users-config.vue b/src/views/master-config/users-config.vue index ccc02d8..33fb7d7 100644 --- a/src/views/master-config/users-config.vue +++ b/src/views/master-config/users-config.vue @@ -6,11 +6,10 @@
+ :column-auto-width="true"> - - - - + + + + + + + + + + + + @@ -67,19 +74,24 @@ - - + + + + + + + + + + + + -
@@ -99,18 +111,143 @@ import DxDataGrid, { DxPaging, DxSearchPanel, DxToolbar, - DxTexts + DxTexts, + DxRequiredRule, + DxLookup } from "devextreme-vue/data-grid"; import CustomStore from "devextreme/data/custom_store"; -import { Workbook } from 'exceljs'; -import { saveAs } from 'file-saver-es'; -import { exportDataGrid as exportDataGridToExcel } from 'devextreme/excel_exporter'; -import { jsPDF } from 'jspdf'; -import { exportDataGrid as exportDataGridToPDF } from 'devextreme/pdf_exporter'; const URL = process.env.VUE_APP_ROOT_API+'/users'; +const URL_instansi = process.env.VUE_APP_ROOT_API+'/instansi'; +const URL_bidang = process.env.VUE_APP_ROOT_API+'/bidang'; +const URL_jabatan = process.env.VUE_APP_ROOT_API+'/jabatan'; +const URL_role = process.env.VUE_APP_ROOT_API+'/roles'; -const customDataSource = new CustomStore({ +const instansiOptions = new CustomStore({ + key: 'id', + + load:() => { + return fetch(URL_instansi+'?size=1000') + .then((response) => response.json()) + .then(response => { + console.log(response.data); + return { + data: response.data + }; + }) + // .then(data => { + // console.log(JSON.parse(data)); + // }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + }, + + byKey: (key) => { + return fetch(URL_instansi+'/' + key) + .then((response) => response.json()) + .then(response => { + console.log(response.instansi); + return { + data: response.instansi + }; + }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + } +}); + +const bidangOptions = new CustomStore({ + key: 'id', + + load:() => { + return fetch(URL_bidang+'?size=1000') + .then((response) => response.json()) + .then(response => { + console.log(response.data); + return { + data: response.data + }; + }) + // .then(data => { + // console.log(JSON.parse(data)); + // }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + }, + + byKey: (key) => { + return fetch(URL_bidang+'/' + key) + .then((response) => response.json()) + .then(response => { + console.log(response.bidang); + return { + data: response.bidang + }; + }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + } +}); + +const jabatanOptions = new CustomStore({ + key: 'id', + + load:() => { + return fetch(URL_jabatan+'?size=1000') + .then((response) => response.json()) + .then(response => { + console.log(response.data); + return { + data: response.data + }; + }) + // .then(data => { + // console.log(JSON.parse(data)); + // }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + }, + + byKey: (key) => { + return fetch(URL_jabatan+'/' + key) + .then((response) => response.json()) + .then(response => { + console.log(response.jabatan); + return { + data: response.jabatan + }; + }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + } +}); + +const roleOptions = new CustomStore({ + key: 'id', + + load:() => { + return fetch(URL_role+'?size=1000') + .then((response) => response.json()) + .then(response => { + console.log(response.data); + return { + data: response.data + }; + }) + // .then(data => { + // console.log(JSON.parse(data)); + // }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + }, + + byKey: (key) => { + return fetch(URL_role+'/' + key) + .then((response) => response.json()) + .then(response => { + console.log(response.role); + return { + data: response.role + }; + }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + } +}); + +const dataSource = new CustomStore({ key: 'id', load: () => { @@ -159,62 +296,18 @@ export default { DxPaging, DxSearchPanel, DxToolbar, - DxTexts + DxTexts, + DxRequiredRule, + DxLookup }, - methods: { - onExporting(e) { - e.cancel = true; - - switch (e.format) { - case "pdf": { - const doc = new jsPDF(); - exportDataGridToPDF({ - jsPDFDocument: doc, - component: e.component, - indent: 5, - }).then(() => { - doc.save('Jenispengadaan.pdf'); - }); - } - break; - - case "xlsx": { - const workbook = new Workbook(); - const worksheet = workbook.addWorksheet('Manajemen User'); - - exportDataGridToExcel({ - component: e.component, - worksheet: worksheet, - autoFilterEnabled: true, - }).then(() => { - workbook.xlsx.writeBuffer().then((buffer) => { - saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx'); - }); - }); - } - break; - } - - }, - onCellPrepared(e) { - var isEditing = e.row.isEditing, $links = e.cellElement.find(".dx-link"); - - $links.text(""); - - if(isEditing){ - $links.filter(".dx-link-save").addClass("dx-icon-save").addClass("yellowClass"); - $links.filter(".dx-link-cancel").addClass("dx-icon-revert").addClass("yellowClass"); - } else { - $links.filter(".dx-link-edit").addClass("dx-icon-edit").addClass("greenClass"); - $links.filter(".dx-link-delete").addClass("dx-icon-trash").addClass("redClass"); - } - }, - }, - data() { return { //jsonUrl: URL, - customDataSource, + dataSource, + instansis: instansiOptions, + bidangs: bidangOptions, + jabatans: jabatanOptions, + roles: roleOptions } }, } diff --git a/src/views/master-data/bidang-page copy.vue b/src/views/master-data/bidang-page copy.vue new file mode 100644 index 0000000..342ad3a --- /dev/null +++ b/src/views/master-data/bidang-page copy.vue @@ -0,0 +1,261 @@ + + + + + diff --git a/src/views/master-data/bidang-page.vue b/src/views/master-data/bidang-page.vue index 0ef0c7d..342ad3a 100644 --- a/src/views/master-data/bidang-page.vue +++ b/src/views/master-data/bidang-page.vue @@ -6,8 +6,8 @@
@@ -17,7 +17,6 @@ :allow-updating="true" :allow-deleting="true" :use-icons="true" - form="popup" mode="popup"> - - + + @@ -63,8 +62,8 @@ info-text="Hal {0} dari {1} ({2} data)" /> - - + + @@ -111,6 +110,8 @@ const URL = process.env.VUE_APP_ROOT_API+'/bidang'; const URL_instansi = process.env.VUE_APP_ROOT_API+'/instansi'; const instansiOptions = new CustomStore({ + key: 'id', + load:() => { return fetch(URL_instansi+'?size=1000') .then((response) => response.json()) @@ -124,10 +125,22 @@ const instansiOptions = new CustomStore({ // console.log(JSON.parse(data)); // }) .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + }, + + byKey: (key) => { + return fetch(URL_instansi+'/' + key) + .then((response) => response.json()) + .then(response => { + console.log(response.instansi); + return { + data: response.instansi + }; + }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); } }); -const customDataSource = new CustomStore({ +const dataSource = new CustomStore({ key: 'id', load: () => { @@ -233,11 +246,12 @@ export default { data() { return { //jsonUrl: URL, - customDataSource, - instansiEditorOptions: { - items: instansiOptions, - searchEnabled: true, value: '' - }, + dataSource, + instansis: instansiOptions, + // instansis: { + // items: instansiOptions, + // searchEnabled: true, value: '' + // }, } }, } diff --git a/src/views/master-data/instansi-page.vue b/src/views/master-data/instansi-page.vue index 7056938..c9aa9e1 100644 --- a/src/views/master-data/instansi-page.vue +++ b/src/views/master-data/instansi-page.vue @@ -7,7 +7,7 @@
diff --git a/src/views/master-data/jabatan-page.vue b/src/views/master-data/jabatan-page.vue index 051cb0c..8083c7f 100644 --- a/src/views/master-data/jabatan-page.vue +++ b/src/views/master-data/jabatan-page.vue @@ -6,28 +6,31 @@
+ :column-auto-width="true"> + add-row="Tambah" + edit-row="Ubah" + delete-row="Hapus" + confirm-delete-message="Apakah anda yakin untuk menghapus data ini?" + save-row-changes="Simpan" + cancel-row-changes="Batal"> + + + + + + @@ -37,7 +40,7 @@ :hide-on-outside-click="true" :show-title="true" :width="400" - :height="400" + :height="450" title="Form Jabatan" /> @@ -61,6 +64,12 @@ info-text="Hal {0} dari {1} ({2} data)" /> + + + + + + @@ -68,11 +77,6 @@ -
@@ -93,18 +97,78 @@ import DxDataGrid, { DxSearchPanel, DxToolbar, DxTexts, - DxRequiredRule + DxRequiredRule, + DxLookup } from "devextreme-vue/data-grid"; import CustomStore from "devextreme/data/custom_store"; -import { Workbook } from 'exceljs'; -import { saveAs } from 'file-saver-es'; -import { exportDataGrid as exportDataGridToExcel } from 'devextreme/excel_exporter'; -import { jsPDF } from 'jspdf'; -import { exportDataGrid as exportDataGridToPDF } from 'devextreme/pdf_exporter'; const URL = process.env.VUE_APP_ROOT_API+'/jabatan'; +const URL_instansi = process.env.VUE_APP_ROOT_API+'/instansi'; +const URL_bidang = process.env.VUE_APP_ROOT_API+'/bidang'; -const customDataSource = new CustomStore({ +const instansiOptions = new CustomStore({ + key: 'id', + + load:() => { + return fetch(URL_instansi+'?size=1000') + .then((response) => response.json()) + .then(response => { + console.log(response.data); + return { + data: response.data + }; + }) + // .then(data => { + // console.log(JSON.parse(data)); + // }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + }, + + byKey: (key) => { + return fetch(URL_instansi+'/' + key) + .then((response) => response.json()) + .then(response => { + console.log(response.instansi); + return { + data: response.instansi + }; + }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + } +}); + +const bidangOptions = new CustomStore({ + key: 'id', + + load:() => { + return fetch(URL_bidang+'?size=1000') + .then((response) => response.json()) + .then(response => { + console.log(response.data); + return { + data: response.data + }; + }) + // .then(data => { + // console.log(JSON.parse(data)); + // }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + }, + + byKey: (key) => { + return fetch(URL_bidang+'/' + key) + .then((response) => response.json()) + .then(response => { + console.log(response.bidang); + return { + data: response.bidang + }; + }) + .catch(() => { throw new Error('Terdapat kesalahan memuat data'); }); + } +}); + +const dataSource = new CustomStore({ key: 'id', load: () => { @@ -154,62 +218,16 @@ export default { DxSearchPanel, DxToolbar, DxTexts, - DxRequiredRule - }, - methods: { - onExporting(e) { - e.cancel = true; - - switch (e.format) { - case "pdf": { - const doc = new jsPDF(); - exportDataGridToPDF({ - jsPDFDocument: doc, - component: e.component, - indent: 5, - }).then(() => { - doc.save('Jenispengadaan.pdf'); - }); - } - break; - - case "xlsx": { - const workbook = new Workbook(); - const worksheet = workbook.addWorksheet('Jabatan'); - - exportDataGridToExcel({ - component: e.component, - worksheet: worksheet, - autoFilterEnabled: true, - }).then(() => { - workbook.xlsx.writeBuffer().then((buffer) => { - saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx'); - }); - }); - } - break; - } - - }, - onCellPrepared(e) { - var isEditing = e.row.isEditing, $links = e.cellElement.find(".dx-link"); - - $links.text(""); - - if(isEditing){ - $links.filter(".dx-link-save").addClass("dx-icon-save").addClass("yellowClass"); - $links.filter(".dx-link-cancel").addClass("dx-icon-revert").addClass("yellowClass"); - } else { - $links.filter(".dx-link-edit").addClass("dx-icon-edit").addClass("greenClass"); - $links.filter(".dx-link-delete").addClass("dx-icon-trash").addClass("redClass"); - } - }, + DxRequiredRule, + DxLookup }, data() { return { //jsonUrl: URL, - customDataSource, + dataSource, + instansis: instansiOptions, + bidangs: bidangOptions, } }, } diff --git a/src/views/master-data/jenis-anggaran copy.vue b/src/views/master-data/jenis-anggaran copy.vue index 09d8f08..258198c 100644 --- a/src/views/master-data/jenis-anggaran copy.vue +++ b/src/views/master-data/jenis-anggaran copy.vue @@ -7,7 +7,7 @@
diff --git a/src/views/master-data/jenis-anggaran.vue b/src/views/master-data/jenis-anggaran.vue index bd07be2..42fa9e0 100644 --- a/src/views/master-data/jenis-anggaran.vue +++ b/src/views/master-data/jenis-anggaran.vue @@ -6,8 +6,8 @@
@@ -29,7 +29,7 @@ - +