Compare commits
2 Commits
870c36a15d
...
5bfbe6a172
| Author | SHA1 | Date | |
|---|---|---|---|
| 5bfbe6a172 | |||
| 356c1b3295 |
19
.gitea/workflows/deploy.yml
Normal file
19
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Deploy Application
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build and restart Docker containers
|
||||
run: |
|
||||
docker-compose down
|
||||
docker-compose build
|
||||
docker-compose up -d
|
||||
@@ -6,13 +6,13 @@
|
||||
</button>
|
||||
<div class="dropdown-content">
|
||||
<button
|
||||
v-for="option in attendanceStore.lastThreeMonth"
|
||||
:key="option"
|
||||
v-for="option in attendanceStore.lastMonths"
|
||||
:key="`${option.year}-${option.month}`"
|
||||
@click="select(option)"
|
||||
>
|
||||
<span class="button-text">
|
||||
<span>{{ utils.getMonthName(option) }}</span>
|
||||
<span>{{ attendanceStore.year }}</span>
|
||||
<span>{{ utils.getMonthName(option.month) }}</span>
|
||||
<span>{{ option.year }}</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -30,15 +30,13 @@ const showMenu = ref(false)
|
||||
const dropdownRef = ref(null)
|
||||
const loading = ref(false)
|
||||
|
||||
const select = async (newMonth) => {
|
||||
const select = async (option) => {
|
||||
// console.log('newMonth: ', newMonth)
|
||||
showMenu.value = false
|
||||
loading.value = true
|
||||
|
||||
const year = attendanceStore.year
|
||||
|
||||
try {
|
||||
const response = await getData(year, newMonth) // przykładowa data
|
||||
const response = await getData(option.year, option.month) // przykładowa data
|
||||
attendanceStore.loadFromResponse(response)
|
||||
} catch (error) {
|
||||
error.value = 'Błąd pobierania danych.'
|
||||
|
||||
@@ -12,7 +12,8 @@ export const useAttendanceStore = defineStore('attendanceStore', () => {
|
||||
const days = ref([])
|
||||
|
||||
// const lastThreeMonth = ['lipiec', 'czerwiec', 'maj']
|
||||
const lastThreeMonth = utils.getLastMonths(new Date().getMonth() + 1, 5)
|
||||
// const lastMonths = ref(utils.getLastMonthsWithYear(5))
|
||||
const lastMonths = utils.getLastMonthsWithYear(5)
|
||||
const sumOfHours = computed(() => days.value[days.value.length - 1]?.accumulatedHours || 0)
|
||||
const workedHours = computed(() => sumOfHours.value - holidayHours.value - sickHours.value)
|
||||
const overtimeHours = computed(() => days.value[days.value.length - 1]?.balanceHours || 0)
|
||||
@@ -115,7 +116,7 @@ export const useAttendanceStore = defineStore('attendanceStore', () => {
|
||||
holidayHours,
|
||||
sickHours,
|
||||
toGoHours,
|
||||
lastThreeMonth,
|
||||
lastMonths,
|
||||
// actions
|
||||
loadFromResponse,
|
||||
updateDay,
|
||||
|
||||
@@ -253,6 +253,23 @@ function calculateMonthFromDay(startDay, days) {
|
||||
}
|
||||
}
|
||||
|
||||
function getLastMonthsWithYear(count) {
|
||||
const result = []
|
||||
const today = new Date()
|
||||
let year = today.getFullYear()
|
||||
let month = today.getMonth() // 0-11
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
result.push({ year: year, month: month + 1 })
|
||||
month--
|
||||
if (month < 0) {
|
||||
month = 11
|
||||
year--
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export default {
|
||||
getDayOfWeek,
|
||||
extractTimeFromDateString,
|
||||
@@ -267,4 +284,5 @@ export default {
|
||||
getMonthNumber,
|
||||
getMonthName,
|
||||
daysOfWeek,
|
||||
getLastMonthsWithYear,
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ onMounted(async () => {
|
||||
loading.value = true
|
||||
const currentDate = new Date()
|
||||
try {
|
||||
const response = await getData(currentDate.getFullYear(), currentDate.getMonth())
|
||||
const response = await getData(currentDate.getFullYear(), currentDate.getMonth() + 1)
|
||||
input.value = response
|
||||
attendanceStore.loadFromResponse(response)
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user