Initial import

This commit is contained in:
sas.fajri
2026-05-25 20:01:37 +07:00
commit 710d7c1b97
10371 changed files with 2381698 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"http://lebaran.aplikasi.web.id/smartlab_api/vuex/t02/search_bank";
export async function searchBank(query, page, rowPerPage = 15) {
try {
var resp = await axios.post(URL, {
query: query,
page: page,
rowPerPage: rowPerPage
});
if (resp.status != 200) {
return {
status: "ERR",
query: query,
message: resp.statusText
};
}
let data = resp.data;
data.query = query;
return data;
} catch (e) {
return {
status: "ERR",
query: query,
message: e.message
};
}
}

View File

@@ -0,0 +1,69 @@
var dialogFormComponent = {
template: `
<template>
<v-layout row justify-center>
<v-dialog v-model="dialog" persistent max-width="500px">
<v-btn slot="activator" color="primary" dark>Open Dialog</v-btn>
<v-card>
<v-card-title>
<span class="headline">User Profile</span>
</v-card-title>
<v-card-text>
<v-container grid-list-md>
<v-layout wrap>
<v-flex xs12 sm6 md4>
<v-text-field label="Legal first name" required></v-text-field>
</v-flex>
<v-flex xs12 sm6 md4>
<v-text-field label="Legal middle name" hint="example of helper text only on focus"></v-text-field>
</v-flex>
<v-flex xs12 sm6 md4>
<v-text-field
label="Legal last name"
hint="example of persistent helper text"
persistent-hint
required
></v-text-field>
</v-flex>
<v-flex xs12>
<v-text-field label="Email" required></v-text-field>
</v-flex>
<v-flex xs12>
<v-text-field label="Password" type="password" required></v-text-field>
</v-flex>
<v-flex xs12 sm6>
<v-select
:items="['0-17', '18-29', '30-54', '54+']"
label="Age"
required
></v-select>
</v-flex>
<v-flex xs12 sm6>
<v-autocomplete
:items="['Skiing', 'Ice hockey', 'Soccer', 'Basketball', 'Hockey', 'Reading', 'Writing', 'Coding', 'Basejump']"
label="Interests"
multiple
chips
></v-autocomplete>
</v-flex>
</v-layout>
</v-container>
<small>*indicates required field</small>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" flat @click.native="dialog = false">Close</v-btn>
<v-btn color="blue darken-1" flat @click.native="dialog = false">Save</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-layout>
</template>
`,
data: () => ({
dialog: false
})
};
export { dialogFormComponent };

View File

@@ -0,0 +1,139 @@
var listBankComponent = {
template: `
<v-card class="xs12 md12" >
<v-card-title>
<v-layout>
<v-flex xs12 sm8>
<v-toolbar-title>Bank Listing <v-btn depressed small color="primary">New Data</v-btn></v-toolbar-title>
</v-flex>
<v-flex xs12 sm4>
<v-spacer></v-spacer>
<v-text-field
v-model="query"
append-icon="search"
@click:clear="clearSearch"
@keydown.enter="doSearch"
@click:append="doSearch"
label="Search"
single-line
hide-details
clearable
class="xs12 md3"
></v-text-field>
</v-flex>
</v-layout>
</v-card-title>
<v-data-table :headers="headers" :items="banks"
:loading="isLoading"
hide-actions class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-center">{{ props.item.M_BankCode }}</td>
<td>{{ props.item.M_BankName }}</td>
<td>{{ props.item.M_BankAddress }}</td>
<td>{{ props.item.M_BankBranch }}</td>
<td><v-btn depressed small color="info">Edit</v-btn> <v-btn depressed small color="error">Delete</v-btn></td>
</template>
<template slot="no-data">
<v-alert :value="isError" color="error" icon="warning">
{{errorMessage}}
</v-alert>
<v-spacer></v-spacer>
</template>
<template slot="footer">
<td colspan="2" class="text-xs-left">
Total Records : {{totalRecord}}, page {{page}} of {{totalPage}}.
</td>
<td colspan="3" class="text-xs-right">
<v-pagination :length="totalPage" :value="page" :total-visible="10"
@next="nextPage" @prev="prevPage"
@input="gotoPage" >
</v-pagination>
</td>
</template>
</v-data-table>
</v-card>
`,
mounted() {
this.doSearch();
},
data() {
return {
query: "",
headers: [{
text: "Code",
align: "left",
sortable: false,
value: "M_BankCode"
},
{
text: "Name",
align: "left",
sortable: false,
value: "M_BankName"
},
{
text: "Address",
value: "M_BankAddress",
sortable: false,
align: "left",
width: "30%"
},
{
text: "Branch",
value: "M_BankBranch",
sortable: false,
align: "left"
},
{
text: "Action",
value: "action",
sortable: false,
align: "center",
width: "20%"
}
]
};
},
methods: {
clearSearch() {
this.query = "";
this.doSearch();
},
doSearch(page = 1, rowPerPage = 8) {
if (this.query == null) this.query = "";
this.$store.dispatch("searchBank", {
query: this.query,
page,
rowPerPage
});
},
prevPage() {
let c_page = this.page - 1;
this.doSearch(c_page);
},
nextPage() {
let c_page = this.page + 1;
this.doSearch(c_page);
},
gotoPage(e) {
let c_page = e;
this.doSearch(c_page);
}
},
computed: {
...Vuex.mapState({
isLoading: state => state.isLoading,
isError: state => state.isError,
errorMessage: state => state.errorMessage,
banks: state => state.rows,
totalRecord: state => state.totalRecord,
page: state => state.page,
totalPage: state => state.totalPage
})
},
updated() {
console.log("Component Updated");
}
};
export { listBankComponent };

View File

@@ -0,0 +1,138 @@
var listPatientComponent = {
template: `
<v-card class="xs12 md12" >
<v-card-title>
<v-layout>
<v-flex xs12 sm8>
<v-toolbar-title>Patient Listing</v-toolbar-title>
</v-flex>
<v-flex xs12 sm4>
<v-spacer></v-spacer>
<v-text-field
v-model="query"
append-icon="search"
@click:clear="clearSearch"
@keydown.enter="doSearch"
@click:append="doSearch"
label="Search"
single-line
hide-details
clearable
class="xs12 md3"
></v-text-field>
</v-flex>
</v-layout>
</v-card-title>
<v-data-table :headers="headers" :items="patients"
:loading="isLoading"
hide-actions class="elevation-1">
<template slot="items" slot-scope="props">
<td>{{ props.item.M_PatientNoReg }}</td>
<td>{{ props.item.M_PatientName }}</td>
<td class="text-xs-center">{{ props.item.M_PatientDOB }}</td>
<td>{{ props.item.M_PatientHP }}</td>
<td>{{ props.item.M_PatientAddress }}</td>
</template>
<template slot="no-data">
<v-alert :value="isError" color="error" icon="warning">
{{errorMessage}}
</v-alert>
<v-spacer></v-spacer>
</template>
<template slot="footer">
<td colspan="2" class="text-xs-left">
Total Records : {{totalRecord}}, page {{page}} of {{totalPage}}.
</td>
<td colspan="3" class="text-xs-right">
<v-pagination :length="totalPage" :value="page" :total-visible="10"
@next="nextPage" @prev="prevPage"
@input="gotoPage" >
</v-pagination>
</td>
</template>
</v-data-table>
</v-card>
`,
mounted() {
this.doSearch();
},
data() {
return {
query: "",
headers: [
{
text: "No. Reg",
align: "left",
sortable: false,
value: "M_PatientNoReg"
},
{
text: "Name",
align: "left",
sortable: false,
value: "M_PatientName"
},
{
text: "DOB",
align: "center",
sortable: false,
value: "M_PatientDOB"
},
{
text: "HP",
value: "M_PatientHP",
sortable: false,
align: "left"
},
{
text: "Address",
value: "M_PatientAddress",
sortable: false,
align: "left"
}
]
};
},
methods: {
clearSearch() {
this.query = "";
this.doSearch();
},
doSearch(page = 1, rowPerPage = 8) {
if (this.query == null) this.query = "";
this.$store.dispatch("searchPatient", {
query: this.query,
page,
rowPerPage
});
},
prevPage() {
let c_page = this.page - 1;
this.doSearch(c_page);
},
nextPage() {
let c_page = this.page + 1;
this.doSearch(c_page);
},
gotoPage(e) {
let c_page = e;
this.doSearch(c_page);
}
},
computed: {
...Vuex.mapState({
isLoading: state => state.isLoading,
isError: state => state.isError,
errorMessage: state => state.errorMessage,
patients: state => state.rows,
totalRecord: state => state.totalRecord,
page: state => state.page,
totalPage: state => state.totalPage
})
},
updated() {
console.log("Component Updated");
}
};
export { listPatientComponent };

View File

@@ -0,0 +1,12 @@
var searchComponent = {
template: `
<div>
<h1>Search Component</h1>
</div>
`,
data() {
return {};
},
methods: {}
};
export { searchComponent };

View File

@@ -0,0 +1,38 @@
var smartNavbarComponent = {
template: `
<span>
<v-navigation-drawer v-model="drawer" fixed app>
<v-list dense>
<v-list-tile>
<v-list-tile-action>
<v-icon>home</v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title>Home</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
<v-list-tile>
<v-list-tile-action>
<v-icon>contact_mail</v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title>Contact</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
</v-list>
</v-navigation-drawer>
<v-toolbar color="blue lighten-2" dark fixed app>
<v-toolbar-side-icon @click.stop="drawer = !drawer"></v-toolbar-side-icon>
<v-toolbar-title>Application</v-toolbar-title>
</v-toolbar>
</span>
`,
data: function() {
return {
drawer: false
};
},
methods: {}
};
export { smartNavbarComponent };

View File

@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Test 02 Vuex</title>
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
</head>
<body>
<div v-cloak id="app">
<v-app id="smartApp" >
<smart-navbar></smart-navbar>
<v-content class="blue lighten-5" >
<v-container fluid fill-height style="height:inherit">
<v-flex size="xs12">
<list-bank fill-height></list-bank>
</v-flex>
</v-container>
</v-content>
<v-footer color="blue lighten-2" app>
<span class="white--text">&copy; 2017</span>
</v-footer>
</v-app>
</div>
<!-- Vendor -->
<script src="../../../libs/vendor/axios.min.js"></script>
<script src="../../../libs/vendor/vue.js"></script>
<script src="../../../libs/vendor/vuex.js"></script>
<script src="../../../libs/vendor/vuetify.js"></script>
<!-- App Script -->
<?php
$ts = "?ts=" . Date("ymdhis");
?>
<script type="module">
import { store } from './store.js<?php echo $ts ?>';
import { smartNavbarComponent } from './components/smartNavbarComponent.js<?php echo $ts ?>';
import { listBankComponent } from './components/listBankComponent.js<?php echo $ts ?>';
import { dialogFormComponent } from './components/dialogFormComponent.js<?php echo $ts ?>';
//for testing
// window.store = store;
new Vue({
store,
el: '#app',
components: {
'smart-navbar': smartNavbarComponent,
'list-bank': listBankComponent,
'dialog-form':dialogFormComponent
},
data: {
drawer: false,
}
})
</script>
<style>
[v-cloak] {
display: none
}
</style>
</body>
</html>

View File

@@ -0,0 +1,71 @@
// State
// data ...
// Mutations
//
//
// Actions
import * as api from "./api.js";
export const store = new Vuex.Store({
state: {
rows: [],
midPages: [],
isLoading: false,
isError: false,
errorMessage: "",
query: "",
page: 0,
totalPage: 0,
totalRecord: 0
},
mutations: {
updateBank(state, data) {
// console.log(data);
if (data.status == "ERR") {
state.isError = true;
if (data.db_error) {
state.errorMessage = data.db_error.message;
} else {
state.errorMessage = data.message;
}
state.query = data.query;
state.page = 0;
state.totalPage = 0;
state.totalRecord = 0;
state.rows = [];
state.midPages = [];
} else {
state.isError = false;
state.errorMessage = "";
state.query = data.query;
state.page = data.page;
state.totalPage = data.totalPage;
state.totalRecord = data.totalRecord;
state.rows = data.rows;
state.midPages = data.midPages;
}
},
updateLoading(state, flag) {
state.isLoading = flag;
},
resetError(state) {
state.isError = false;
state.errorMessage = "";
}
},
actions: {
async searchBank(context, data) {
context.commit("updateLoading", true);
let resp = await api.searchBank(
data.query,
data.page,
data.rowPerPage
);
context.commit("updateLoading", false);
context.commit("updateBank", resp);
setTimeout(function() {
context.commit("resetError");
}, 5000);
}
}
});