Skip to content

Commit

Permalink
fixed projectList actions, fixes #113
Browse files Browse the repository at this point in the history
fixed home action buttons
fixed paid checkbox save
  • Loading branch information
Ron Valstar committed Mar 7, 2018
1 parent 88c519e commit 5d6063b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ProjectInvoice",
"version": "2.1.5",
"version": "2.1.6",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
2 changes: 1 addition & 1 deletion public/static/invoice.appcache
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CACHE MANIFEST

# v2.1.5
# v2.1.6

#files_start
css/app.79ef9d59.css
Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<footer><small class="small">v2.1.5</small></footer>
<footer><small class="small">v2.1.6</small></footer>
</template>

<script>
Expand Down
19 changes: 14 additions & 5 deletions src/components/ProjectList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<template v-if="col==='paid'">

<label v-on:click.stop class="checkbox"><input v-model="project.paid" data-change="onPaidChange()" type="checkbox" /><span></span></label>
<label v-on:click.stop class="checkbox"><input v-model="project.paid" v-on:change="onPaidChange" type="checkbox" /><span></span></label>

</template>
<template v-else-if="col==='invoiceNr'">
Expand All @@ -27,8 +27,8 @@
<currency :value="project[col]" />
</template>
<template v-else-if="col==='actions'">
<button v-if="project.invoices.length===0" v-on:click="onAddInvoice(project)"><span class="hide-low">Add invoice</span><span class="icon-file icon-add-round hide-high"></span></button>
<button v-else-if="project.overdue" v-on:click="onAddReminder(project)"><span class="hide-low">Add reminder</span><span class="icon-file icon-add-round hide-high"></span></button>
<button v-on:click.stop v-if="project.invoices.length===0" v-on:click="onAddInvoice(project)"><span class="hide-low">Add invoice</span><span class="icon-file icon-add-round hide-high"></span></button>
<button v-on:click.stop v-else-if="project.overdue" v-on:click="onAddReminder(project)"><span class="hide-low">Add reminder</span><span class="icon-file icon-add-round hide-high"></span></button>
</template>
<template v-else>
<router-link cdlass="small" :to="project.uri">{{project[col]}}</router-link>
Expand All @@ -55,6 +55,7 @@
<script>
import Currency from '@/components/Currency'
import Date from '@/components/Date'
import {save} from '@/formState'
export default {
name: 'ProjectList'
,props: {
Expand Down Expand Up @@ -103,14 +104,22 @@ export default {
this.projects.sort((a,b)=>a[key]>b[key]?gt:lt)
}
,onAddReminder(project){
console.log('onAddReminder',project); // todo: remove log
this.addInvoice(project)
}
,onAddInvoice(project){
console.log('onAddInvoice',project); // todo: remove log
this.addInvoice(project)
}
,onRowClick(project){
this.$router.push(project.uri)
}
,onPaidChange(){
save()
}
,addInvoice(project){
project.addInvoice()
save()
this.$router.push(project.uri)
}
,getTotalValue(property){
let returnValue = ''
if (this.projects&&this.projects.length) {
Expand Down
10 changes: 10 additions & 0 deletions src/model/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ const proto = {
this.lines.push({amount:0, hours:0, vat})
},

addInvoice(){
const {invoices} = this
invoices.push(createInvoice({
date: moment().format('YYYY-MM-DD'),
type: invoices.length===0?'invoice':'reminder', // todo: from const
interest: false,
exhortation: false
}))
},

get vatMax(){
return Math.max(...this.lines.map(line=>line.vat))
},
Expand Down
9 changes: 1 addition & 8 deletions src/views/Project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,7 @@ export default {
confirm('Delete this project?') && this.client.deleteProject(project) && (save(),this.$router.push(this.client.uri))
}
,onAddInvoice(){
const {project} = this
const {invoices} = project
invoices.push(createInvoice({
date: moment().format('YYYY-MM-DD'),
type: invoices.length===0?'invoice':'reminder', // todo: from const
interest: false,
exhortation: false
}))
this.project.addInvoice()
save()
}
,onRemoveInvoice(invoice){
Expand Down

0 comments on commit 5d6063b

Please sign in to comment.