Skip to content

Commit b6b5e98

Browse files
committed
Rev. Bugs fix & Dark mode
1 parent 4e0f064 commit b6b5e98

File tree

5 files changed

+69
-28
lines changed

5 files changed

+69
-28
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
VITE_APP_TITLE=BillJack
2-
VITE_APP_VERSION=v1.0.1
2+
VITE_APP_VERSION=v1.1.1

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</head>
99

1010
<body
11-
class="relative antialiased tracking-tight text-gray-500 font-inter bg-black"
11+
class="relative antialiased tracking-tight text-gray-500 font-inter bg-white dark:bg-black"
1212
>
1313
<div id="app"></div>
1414
<script type="module" src="/src/main.js"></script>

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "billjack",
3-
"version": "1.0.1",
3+
"version": "1.1.1",
44
"scripts": {
55
"dev": "vite",
66
"build": "vite build",
@@ -21,4 +21,4 @@
2121
"tailwindcss": "^3.0.23",
2222
"vite": "^2.8.4"
2323
}
24-
}
24+
}

src/App.vue

Lines changed: 64 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
import { ref, shallowRef } from "@vue/runtime-core";
2+
import { computed, ref, shallowRef } from "@vue/runtime-core";
33
import http from "./plugins/http-common";
44
import md5 from "md5";
55
import moment from 'moment';
@@ -17,9 +17,20 @@ let api_key = ref(import.meta.env.VITE_API_KEY)
1717
let title = ref(import.meta.env.VITE_APP_TITLE)
1818
let version = ref(import.meta.env.VITE_APP_VERSION)
1919
let component = shallowRef(PLNComponent)
20+
let isDark = ref(false)
2021
2122
document.title = title.value
2223
24+
const darkTheme = computed(() => {
25+
if(isDark.value) {
26+
document.documentElement.classList.add('dark')
27+
return true
28+
} else {
29+
document.documentElement.classList.remove('dark')
30+
return false
31+
}
32+
})
33+
2334
const checkBill = async () => {
2435
let uniq = "id" + new Date().getTime();
2536
let user = "0895401001560";
@@ -43,22 +54,23 @@ const checkBill = async () => {
4354
4455
let { data } = await http.post("/bill/check", dataForm);
4556
response_code.value = data.data.response_code
46-
let period = data.data.period.split(',')
47-
detail_data.value = {
48-
id_customer: data.data.hp,
49-
message: data.data.message,
50-
customer: data.data.tr_name,
51-
admin: data.data.admin,
52-
nominal: data.data.nominal,
53-
price: data.data.price,
54-
period: {
55-
first: period[0],
56-
last: period[1]
57-
},
58-
}
59-
57+
console.log(data.data)
6058
6159
if(response_code.value === '00'){
60+
let period = data.data.period.split(',')
61+
detail_data.value = {
62+
id_customer: data.data.hp,
63+
message: data.data.message,
64+
customer: data.data.tr_name,
65+
admin: data.data.admin,
66+
nominal: data.data.nominal,
67+
price: data.data.price,
68+
period: {
69+
first: period[0],
70+
last: period[1]
71+
},
72+
}
73+
6274
if(type_bill.value == 'PLN') {
6375
result_bills.value = data.data.desc.tagihan.detail
6476
component.value = PLNComponent
@@ -67,9 +79,11 @@ const checkBill = async () => {
6779
component.value = PDAMComponent
6880
}
6981
} else {
82+
detail_data.value = {
83+
message: data.data.message,
84+
}
7085
result_bills.value = []
7186
}
72-
console.log(result_bills.value)
7387
}
7488
7589
const format_price = (value) => {
@@ -94,32 +108,58 @@ const reset = () => {
94108
<img class="block w-8 h-8" src="./assets/img/logo.svg" alt="" />
95109
</a>
96110
<div class="flex items-center mb-4 md:block">
97-
<a class="mr-8 font-semibold hover:text-white" href="#"
111+
<a class="mr-8 font-semibold dark:hover:text-white" href="#"
98112
>About</a
99113
>
100-
<p class="btn text-gray-400 hover:text-white">{{ version }} </p>
114+
<p class="btn mr-8 text-gray-400 dark:hover:text-white">{{ version }} </p>
115+
<button @click="isDark = !isDark" class="btn text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-1">
116+
<svg
117+
class="w-5 h-5"
118+
fill="currentColor"
119+
viewBox="0 0 20 20"
120+
xmlns="http://www.w3.org/2000/svg"
121+
v-if="darkTheme"
122+
>
123+
<path
124+
d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"
125+
></path>
126+
</svg>
127+
<svg
128+
class="w-5 h-5"
129+
fill="currentColor"
130+
viewBox="0 0 20 20"
131+
xmlns="http://www.w3.org/2000/svg"
132+
v-else
133+
>
134+
<path
135+
d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"
136+
fill-rule="evenodd"
137+
clip-rule="evenodd"
138+
></path>
139+
</svg>
140+
</button>
101141
</div>
102142
</div>
103143
<h1
104-
class="px-8 mt-16 mb-4 text-5xl font-extrabold leading-tight text-center text-white xl:text-6xl"
144+
class="px-8 mt-16 mb-4 text-5xl font-extrabold leading-tight text-center text-gray-700 dark:text-white xl:text-6xl"
105145
>
106146
Check your bill with <span class="text-blue-700">{{ title }}</span>
107147
</h1>
108148
109149
<div class="my-8 mx-auto max-w-xl xl:max-w-2xl flex flex-col">
110150
<div class="flex flex-row w-full">
111-
<select v-model="type_bill" @change="reset" class="border-0 px-3 py-3 w-1/5 placeholder-gray-300 text-gray-600 bg-white rounded-l-full shadow focus:outline-none focus:ring ease-linear transition-all duration-150">
151+
<select v-model="type_bill" @change="reset" class="border-0 px-3 py-3 w-1/3 md:w-1/4 lg:w-1/5 placeholder-gray-300 text-gray-600 bg-white rounded-l-full shadow-lg border-solid border-l-2 border-t-2 border-b-2 focus:outline-none focus:ring ease-linear transition-all duration-150">
112152
<option value="PLN">PLN</option>
113153
<option value="PDAM">PDAM</option>
114154
</select>
115155
<input
116156
type="text"
117-
class="border-0 px-3 py-3 w-4/5 placeholder-gray-300 text-gray-600 bg-white rounded-r-full shadow focus:outline-none focus:ring ease-linear transition-all duration-150"
157+
class="border-0 px-3 py-3 w-4/5 placeholder-gray-300 text-gray-600 bg-white rounded-r-full shadow-lg border-solid border-r-2 border-t-2 border-b-2 focus:outline-none focus:ring ease-linear transition-all duration-150"
118158
placeholder="Customer Number"
119159
v-model="input_number"
120160
/>
121161
</div>
122-
<select v-model="pdam_code" v-show="type_bill == 'PDAM'" @change="reset" class="border-0 px-3 py-3 my-5 w-full placeholder-gray-300 text-gray-600 bg-white rounded-full shadow focus:outline-none focus:ring ease-linear transition-all duration-150">
162+
<select v-model="pdam_code" v-show="type_bill == 'PDAM'" @change="reset" class="border-0 px-3 py-3 my-5 w-full placeholder-gray-300 text-gray-600 bg-white rounded-full shadow-lg border-solid border-2 focus:outline-none focus:ring ease-linear transition-all duration-150">
123163
<option v-for="(city, index) in city" :value="city.code" > {{ city.name }} </option>
124164
</select>
125165
</div>
@@ -292,8 +332,8 @@ const reset = () => {
292332
<div class="flex flex-col justify-between mb-8 text-center sm:flex-row">
293333
<p class="order-last mb-4 text-sm text-gray-500 sm:order-first">
294334
Designed by
295-
<a href="https://cruip.com/" class="text-white">Cruip</a>. Coded by
296-
<a href="https://michelegera.dev/" class="text-white">michelegera</a>
335+
<a href="https://cruip.com/" class="text-black dark:text-white">Cruip</a>. Coded by
336+
<a href="https://michelegera.dev/" class="text-black dark:text-white">michelegera</a>
297337
</p>
298338
</div>
299339
</div>

tailwind.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
darkMode: 'class',
23
content: [
34
"./index.html",
45
"./src/**/*.{vue,js,ts,jsx,tsx}",

0 commit comments

Comments
 (0)