first commit

This commit is contained in:
Sas Andy
2024-08-12 08:42:51 +07:00
parent 6deeec116e
commit 2051b6439d
82 changed files with 78274 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
// components/ComponentA.js
const ComponentA = {
template: `
<div>
<h2>Component A</h2>
<p>Count: {{ count }}</p>
<v-btn @click="increment">Increment</v-btn>
<v-btn @click="decrement">Decrement</v-btn>
</div>
`,
computed: {
count() {
return this.$store.state.count;
}
},
methods: {
increment() {
this.$store.dispatch('increment');
},
decrement() {
this.$store.dispatch('decrement');
}
}
};

View File

@@ -0,0 +1,21 @@
// components/ComponentB.js
const ComponentB = {
template: `
<div>
<h2>Component B</h2>
<p>Data: {{ data }}</p>
<v-btn @click="fetchData">Fetch Data</v-btn>
</div>
`,
computed: {
data() {
return this.$store.state.data;
}
},
methods: {
async fetchData() {
await this.$store.dispatch('fetchData');
}
}
};

View File

@@ -0,0 +1,116 @@
<template>
<div>
<v-container class="mb-6">
<v-row align="end" style="min-height: 480px;" no-gutters justify="center">
askldoisa
{{ email }}
<v-col>
<div class="d-flex justify-center">
<v-sheet class="pa-2 ma-2">
<h2 class="text-h6 font-weight-black">
{{ $t("message.login") }}
</h2>
</v-sheet>
</div>
<div class="d-flex justify-center mb-6">
<v-card
class="mx-auto pa-12 pb-8"
elevation="0"
min-width="400"
rounded="lg"
>
<div class="text-subtitle-1 text-medium-emphasis">
{{ $t("message.email") }}
</div>
<v-text-field
density="compact"
:placeholder="$t('message.placeholderEmail')"
prepend-inner-icon="mdi-email-outline"
variant="outlined"
></v-text-field>
<div
class="text-subtitle-1 text-medium-emphasis d-flex align-center justify-space-between"
>
{{ $t("message.password") }}
<a
class="text-caption text-decoration-none text-blue"
href="#"
rel="noopener noreferrer"
target="_blank"
>
{{ $t("message.forgotPassword") }}</a
>
</div>
<v-text-field
:append-inner-icon="visible ? 'mdi-eye-off' : 'mdi-eye'"
:type="visible ? 'text' : 'password'"
density="compact"
:placeholder="$t('message.placeholderPassword')"
prepend-inner-icon="mdi-lock-outline"
variant="outlined"
@click:append-inner="visible = !visible"
></v-text-field>
<div class="text-center">
<v-btn
:loading="loading"
@click="login"
class="mt-8 text-none"
color="primary"
size="large"
variant="elevated"
block
>
{{ $t("message.login") }}
<template v-slot:loader>
<v-progress-linear indeterminate></v-progress-linear>
</template>
</v-btn>
</div>
</v-card>
</div>
</v-col>
</v-row>
</v-container>
</div>
</template>
<script type="module">
export default {
name: "CobaComponent",
computed: {
// Akses state dari store
count() {
return this.$store.state.coba.count;
},
email() {
return this.$store.state.coba.email;
},
},
methods: {
// Dispatch action ke store
increment() {
this.$store.dispatch("increment");
},
},
};
// export default {
// name: "HelloWorld",
// // setup() {
// // // const store = useStore();
// // const email = computed(() => $store.state.email);
// // },
// computed: {
// email: {
// get() {
// return this.$store.state.store.email;
// },
// },
// },
// };
</script>
<style scoped>
h1 {
color: blue;
}
</style>

View File

@@ -0,0 +1,49 @@
<template>
<div>
<v-container class="mb-6">
<h1>Component 2</h1>
<h2>{{ email }}</h2>
</v-container>
</div>
</template>
<script type="module">
export default {
name: "component2",
computed: {
// Akses state dari store
count() {
return this.$store.state.coba2.count;
},
email() {
return this.$store.state.coba2.email;
},
},
methods: {
// Dispatch action ke store
increment() {
this.$store.dispatch("increment");
},
},
};
// export default {
// name: "HelloWorld",
// // setup() {
// // // const store = useStore();
// // const email = computed(() => $store.state.email);
// // },
// computed: {
// email: {
// get() {
// return this.$store.state.store.email;
// },
// },
// },
// };
</script>
<style scoped>
h1 {
color: blue;
}
</style>

View File

@@ -0,0 +1,50 @@
<template>
<v-app id="inspire">
<one-navbar></one-navbar>
<v-main>
<div class="w-100 rounded-xl mb-6 bg-primary-lighten mr-2 pa-3">
<h1 class="primary-lighten--text">Main component</h1>
<h2>{{ email }}</h2>
<v-btn color="primary" class="text-white">Secondary Button</v-btn>
<v-btn
class="text-white text-subtitle-1"
color="primary"
size="small"
variant="flat"
>
Create Event
</v-btn>
<coba-component></coba-component>
</div>
</v-main>
</v-app>
</template>
<script type="module">
import CobaComponent from "./coba.vue";
import NavbarComponent from "./one-navbar.vue";
export default {
name: "component2",
components: {
"coba-component": CobaComponent,
"one-navbar": NavbarComponent,
},
computed: {
// Akses state dari store
count() {
return this.$store.state.coba2.count;
},
email() {
return this.$store.state.coba2.email;
},
},
methods: {
// Dispatch action ke store
increment() {
this.$store.dispatch("increment");
},
},
};
</script>
<style scoped></style>

View File

@@ -0,0 +1,54 @@
<template>
<div>
<!-- :location="$vuetify.display.mobile ? 'bottom' : undefined" -->
<v-navigation-drawer style="border: 0;" v-model="drawer">
<v-list-item class="ml-2 mt-3">
<v-img
:aspect-ratio="1"
max-height="42px"
max-width="132px"
class="bg-white"
src="images/logo.png"
></v-img>
</v-list-item>
</v-navigation-drawer>
<v-app-bar class="elevation-0">
<v-app-bar-nav-icon @click="drawer = !drawer"></v-app-bar-nav-icon>
<v-app-bar-title>Application</v-app-bar-title>
</v-app-bar>
</div>
</template>
<script type="module">
export default {
name: "NavbarComponent",
data() {
return {
drawer: false,
};
},
computed: {
// Akses state dari store
count() {
return this.$store.state.coba2.count;
},
email() {
return this.$store.state.coba2.email;
},
},
methods: {
// Dispatch action ke store
increment() {
this.$store.dispatch("increment");
},
},
};
</script>
<style scoped>
h1 {
color: blue;
}
</style>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 4.4 MiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 24 MiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 594 KiB

BIN
login-coba/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 66 KiB

190
login-coba/index.html Normal file
View File

@@ -0,0 +1,190 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WESTONE</title>
<!-- Vuetify CSS -->
<link href="../css/vuetify.css" rel="stylesheet" />
<!-- Local Stylesheet for Fonts -->
<link rel="stylesheet" href="../css/styles.css" />
<link href="../css/materialdesignicon.css" rel="stylesheet" />
</head>
<body>
<div id="app"></div>
<!-- Vue.js -->
<!-- <script src="https://unpkg.com/vue@next"></script> -->
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<!-- <script src="../libraries/vue3.4.36.global.prod.js"></script> -->
<!-- Vuex -->
<script src="../libraries/vuex.js"></script>
<!-- Vuetify -->
<script src="../libraries/vuetify3.js"></script>
<!-- vue-i18n -->
<script src="../libraries/vue-i18n.global.js"></script>
<!-- Axios -->
<script src="../libraries/axios.js"></script>
<!-- Store JS -->
<!-- <script src="store.js"></script> -->
<!-- Component JS -->
<script src="components/ComponentA.js"></script>
<script src="components/ComponentB.js"></script>
<script src="theme.js"></script>
<!-- <script src="https://unpkg.com/vue3-sfc-loader/dist/vue3-sfc-loader.iife.js"></script> -->
<script src="../libraries/vue3-sfc-loader.js"></script>
<script type="module">
const { loadModule } = window["vue3-sfc-loader"];
import coba from "./modules/coba.js";
import coba2 from "./modules/coba2.js";
// import theme from "./theme.js";
const store = Vuex.createStore({
modules: {
coba: coba,
coba2: coba2,
},
});
const options = {
moduleCache: {
vue: Vue,
},
getFile(url) {
return fetch(url).then((response) =>
response.ok ? response.text() : Promise.reject(response)
);
},
addStyle(textContent) {
const style = document.createElement("style");
style.textContent = textContent;
const ref = document.head.getElementsByTagName("style")[0] || null;
document.head.insertBefore(style, ref);
},
};
// Locale messages
const messages = {
en: {
message: {
login: "Login",
email: "Email",
password: "Password",
forgotPassword: "Forgot password?",
placeholderEmail: "Enter your email",
placeholderPassword: "Enter your password",
},
},
id: {
message: {
login: "Masuk",
email: "Surel",
password: "Kata Sandi",
forgotPassword: "Lupa kata sandi?",
placeholderEmail: "Isikan email anda",
placeholderPassword: "Isikan kata sandi anda",
},
},
};
// Get the browser's preferred language
const browserLocale = navigator.language || navigator.languages[0];
// Initialize vue-i18n
const i18n = VueI18n.createI18n({
locale: browserLocale.startsWith("id") ? "id" : "en", // Set locale based on browser setting
fallbackLocale: "en", // Set fallback locale
messages, // Set locale messages
});
// Vue App
const app = Vue.createApp({
components: {
"component-a": ComponentA,
"component-b": ComponentB,
},
data() {
return {
visible: false,
bg_src: "./images/bg_cover.svg",
items: [
{
src: "./images/frame_1.svg",
},
{
src: "./images/frame_1.svg",
},
],
loading: false, // Initialize loading state
};
},
// <one-navbar></one-navbar>
template: `
<main-component></main-component>
`,
// <v-row no-gutters>
// <v-col cols="8">
// <hello-world></hello-world>
// <hello-world2></hello-world2>
// </v-col>
// <v-col cols="4">
// <div class="d-flex justify-center mb-6 mt-4 bg-surface-variant">
// <v-img
// class="bg-white"
// height="86px"
// src="./images/logo.svg"
// ></v-img>
// </div>
// </v-col>
// </v-row>
});
// themes: {
// light: {
// primary: "#2196F3",
// "primary-lighten": "#E3F2FD",
// "primary-darken": "#0D47A1",
// secondary: "#03a9f4",
// accent: "#ff5722",
// error: "#f44336",
// warning: "#ff9800",
// info: "#2196f3",
// success: "#4caf50",
// },
// dark: dark,
// },
// dark: false,
// // defaultTheme: "myCustomLightTheme",
const vuetify = Vuetify.createVuetify({
theme: {
themes: CustomTheme,
},
});
app.use(store);
app.use(vuetify);
app.use(i18n);
const components = {
"hello-world2": "./components/coba2.vue",
"hello-world": "./components/coba.vue",
"one-navbar": "./components/one-navbar.vue",
"main-component": "./components/main.vue",
};
Promise.all(
Object.entries(components).map(([name, path]) => {
return loadModule(path, options).then((component) => {
app.component(name, component);
});
})
)
.then(() => {
app.mount("#app");
})
.catch((error) => {
console.error("Error loading components:", error);
});
</script>
</body>
</html>

View File

@@ -0,0 +1,88 @@
// store/store.js
// src/store.js
// import { createStore } from '../../vuex.js';
// const store = createStore({
// state: {
// count: 0,
// email: "asadkjdda"
// },
// mutations: {
// increment(state) {
// state.count++;
// }
// },
// actions: {
// increment({ commit }) {
// commit('increment');
// }
// },
// getters: {
// count: (state) => state.count
// }
// });
// export default store;
const URL = "/westone-api/v1/system/auth";
const store = Vuex.createStore({
state() {
return {
count: 0,
data: null,
email: "lashlkdsa",
password: null,
dialog_success: false
};
},
mutations: {
increment(state) {
state.count++;
},
decrement(state) {
state.count--;
},
setData(state, payload) {
state.data = payload;
},
setEmail(state, data) {
state.email = data;
},
setPassword(state, data) {
state.password = data;
},
setDialogSuccess(state, data) {
state.dialog_success = data;
}
},
actions: {
increment({ commit }) {
commit('increment');
},
decrement({ commit }) {
commit('decrement');
},
async loginState({ state, commit }) {
const params = {
email: state.email,
password: state.pasword
};
try {
const response = await axios.post(URL + '/login', params);
commit('setData', response.data);
} catch (error) {
commit('setError', error);
}
},
async LoginParam({ commit }, params) {
try {
const response = await axios.post(URL + '/login', params);
commit('setData', response.data);
} catch (error) {
commit('setError', error);
}
}
}
});
export default store

View File

@@ -0,0 +1,88 @@
// store/store.js
// src/store.js
// import { createStore } from '../../vuex.js';
// const store = createStore({
// state: {
// count: 0,
// email: "asadkjdda"
// },
// mutations: {
// increment(state) {
// state.count++;
// }
// },
// actions: {
// increment({ commit }) {
// commit('increment');
// }
// },
// getters: {
// count: (state) => state.count
// }
// });
// export default store;
const URL = "/westone-api/v1/system/auth";
const store = Vuex.createStore({
state() {
return {
count: 0,
data: null,
email: "lashlkdsa",
password: null,
dialog_success: false
};
},
mutations: {
increment(state) {
state.count++;
},
decrement(state) {
state.count--;
},
setData(state, payload) {
state.data = payload;
},
setEmail(state, data) {
state.email = data;
},
setPassword(state, data) {
state.password = data;
},
setDialogSuccess(state, data) {
state.dialog_success = data;
}
},
actions: {
increment({ commit }) {
commit('increment');
},
decrement({ commit }) {
commit('decrement');
},
async loginState({ state, commit }) {
const params = {
email: state.email,
password: state.pasword
};
try {
const response = await axios.post(URL + '/login', params);
commit('setData', response.data);
} catch (error) {
commit('setError', error);
}
},
async LoginParam({ commit }, params) {
try {
const response = await axios.post(URL + '/login', params);
commit('setData', response.data);
} catch (error) {
commit('setError', error);
}
}
}
});
export default store;

View File

@@ -0,0 +1,13 @@
import coba from "coba.js";
import coba2 from "coba2.js";
// import system from "../../../apps/modules/system/system.js";
// import handover from "./modules/handover.js";
export const store = Vuex.createStore({
modules: {
coba: coba,
coba2: coba2,
},
});

14
login-coba/store.js Normal file
View File

@@ -0,0 +1,14 @@
import coba from "./modules/coba.js";
import coba2 from "./modules/coba2.js";
// import system from "../../../apps/modules/system/system.js";
// import handover from "./modules/handover.js";
const store = Vuex.createStore({
modules: {
coba: coba,
coba2: coba2,
},
});
export default store;

18
login-coba/theme.js Normal file
View File

@@ -0,0 +1,18 @@
var CustomTheme = {
light: {
dark: false,
colors: {
primary: "#FFC107",
// primary: "#2196F3",
"primary-lighten": "#E3F2FD",
"primary-darken": "#0D47A1",
white: "#FFFFFF",
secondary: "#03a9f4",
accent: "#ff5722",
error: "#f44336",
warning: "#ff9800",
info: "#2196f3",
success: "#4caf50",
},
},
}