Skip to content

Commit

Permalink
edit record date, toggle control to block edits of previous weeks - n…
Browse files Browse the repository at this point in the history
…ot functional yet
  • Loading branch information
valasek committed Jan 1, 2019
1 parent fa14240 commit 2c66582
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 20 deletions.
24 changes: 9 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,24 @@ Web application to report consulting hours on projects using selected rates on a
## Todo

- IMPORTANT
/-- save edited date
-- create new record
-- duplicate record
- create new record
- duplicate record
- overview
-- show in days
-- edit overtime and total working time per week, month
-- compare weekly reported time against nominal total time
- show in days
- edit overtime and total working time per week, month
- compare weekly reported time against nominal total time
- Export plugin to excel and csv

# Fixes

- NEW RECORD
-- IMPORTANT fix wrong from and to dates
-- do not create new record if no consultant is selected
- IMPORTANT fix wrong from and to dates
- do not create new record if no consultant is selected
- Edit records
-- do not save the value id ESC is pressed
-- Do not call backend 2x e.g. for updateDescription
- do not save the value id ESC is pressed
- Do not call backend 2x e.g. for updateDescription

## Improvements business

- Ability to lock last week
- show only available rates per project
- Paginate and sort server-side - using vuetify data table
Expand All @@ -42,14 +40,10 @@ Web application to report consulting hours on projects using selected rates on a
## Improvements technical

- email confirmation

- letsencrypt tls

- move remembered state from local storage to the backend once user entity available

- administration of a DB - https://getqor.com/en
https://medium.com/statuscode/how-i-write-go-http-services-after-seven-years-37c208122831

- refactor routes as on https://www.codementor.io/codehakase/building-a-restful-api-with-golang-a6yivzqdo
- connect Vue with go - https://juliensalinas.com/en/golang-API-backend-vuejs-SPA-frontend-docker-modern-application/

Expand Down
18 changes: 18 additions & 0 deletions client/src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
<v-date-picker v-model="dateMonth" :landscape="false" type="month" @change="monthMenu = false" />
</v-menu>
</v-list-tile>
<v-list-tile>
<v-switch v-model="previousWeeksUnLock" :label="previousWeeksUnLockText" color="error" hide-details />
</v-list-tile>
</v-list-group>
</v-list>
</v-navigation-drawer>
Expand Down Expand Up @@ -142,6 +145,21 @@
this.$store.dispatch('context/resetNotification')
}
},
previousWeeksUnLock: {
get () {
return this.$store.state.context.previousWeeksUnLock
},
set (newValue) {
this.$store.dispatch('context/TogglePreviousWeeksUnLock')
}
},
previousWeeksUnLockText () {
if (this.$store.state.context.previousWeeksUnLock) {
return 'Previous weeks unlocked'
} else {
return 'Previous weeks locked'
}
},
dateMonth: {
get () {
return this.$store.state.context.dateMonth
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/ReportTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@
onUpdateDate (newValue) {
let payload = {
id: newValue._id,
type: 'description',
value: newValue.description
type: 'date',
value: newValue.date
}
this.$store.dispatch('reportedHours/updateAttributeValue', payload)
},
Expand Down
12 changes: 9 additions & 3 deletions client/src/store/modules/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const state = {
dateMonth: new Date().toISOString().substr(0, 7),
dateFrom: getMonday(new Date()),
dateTo: getSunday(new Date()),
dailyWorkingHours: 8
dailyWorkingHours: 8,
previousWeeksUnLock: false
}

const getters = {}
Expand All @@ -23,14 +24,15 @@ const actions = {
dispatch('jumpToWeek', monday)
commit('SET_MONTH', month)
},

setNotification ({ commit }, payload) {
commit('SET_NOTIFICATION', payload)
},

resetNotification ({ commit }) {
commit('RESET_NOTIFICATION')
},
TogglePreviousWeeksUnLock ({ commit }) {
commit('TOGGLE_PREVIOUS_WEEKS_UNLOCK')
},
changeWeek ({ commit }, direction) {
commit('SET_WEEK', direction)
},
Expand Down Expand Up @@ -82,6 +84,10 @@ const mutations = {
state.notification = false
state.notificationText = ''
state.notificationType = defaultNotificationType
},

TOGGLE_PREVIOUS_WEEKS_UNLOCK (state) {
state.previousWeeksUnLock = !state.previousWeeksUnLock
}

}
Expand Down
8 changes: 8 additions & 0 deletions models/reportedRecords.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ func (db *ReportedRecordManager) ReportedRecordUpdate(r UpdatedValue) ReportedRe
if err := db.db.First(&reportedRecord, updateValue.ID).Update(updateValue.Type, updateValue.Value); err != nil {
return reportedRecord
}
case "date":
value, err := time.Parse("2006-01-02", updateValue.Value)
if err != nil {
fmt.Println(err)
}
if err := db.db.First(&reportedRecord, updateValue.ID).Update(updateValue.Type, value); err != nil {
return reportedRecord
}
default:
fmt.Println("unknown attribute type: ", r.Type)
return ReportedRecord{}
Expand Down

0 comments on commit 2c66582

Please sign in to comment.