Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start to implement payment module #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions img/payments.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"@nextcloud/router": "^2.1.2",
"@nextcloud/vue": "^7.12.1",
"vue": "^2.7.14",
"vue-frag": "^1.4.3",
"vue-router": "^3.6.5",
"vue-virtual-scroller": "^1.1.2",
"vuex": "^3.6.2"
},
"devDependencies": {
Expand Down
15 changes: 15 additions & 0 deletions src/components/LeftSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,34 @@
:title="t('my_company', 'Home')"
icon="icon-home"
:exact="true" />
<NcAppNavigationItem :to="{name: 'payments'}"
:title="t('my_company', 'Payments')"
:exact="true">
<NcIconSvgWrapper slot="icon" :svg="iconPaymentsRaw" />

Check warning on line 11 in src/components/LeftSidebar.vue

View workflow job for this annotation

GitHub Actions / eslint

`slot` attributes are deprecated
</NcAppNavigationItem>
</template>
</NcAppNavigation>
</template>

<script>
import NcAppNavigation from '@nextcloud/vue/dist/Components/NcAppNavigation.js'
import NcAppNavigationItem from '@nextcloud/vue/dist/Components/NcAppNavigationItem.js'
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'

// eslint-disable-next-line import/no-unresolved
import iconPaymentsRaw from '../../img/payments.svg?raw'

export default {
name: 'LeftSidebar',
components: {
NcAppNavigation,
NcAppNavigationItem,
NcIconSvgWrapper,
},
data() {
return {
iconPaymentsRaw,
}
},
}
</script>
6 changes: 6 additions & 0 deletions src/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import VueRouter from 'vue-router'
import { generateUrl } from '@nextcloud/router'

import Home from '../views/Home.vue'
import PaymentsList from '../views/Payments/PaymentsList.vue'

Vue.use(VueRouter)

Expand All @@ -18,5 +19,10 @@ export default new VueRouter({
component: Home,
name: 'home',
},
{
path: '/payments',
component: PaymentsList,
name: 'payments',
},
],
})
36 changes: 36 additions & 0 deletions src/views/Payments/PaymentListRow.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<Fragment :data-index="index">
<td>
<span>{{ item.uuid }}</span>
</td>
<td>
<span>{{ item.value }}</span>
</td>
<td>
<span>{{ item.date }}</span>
</td>
</Fragment>
</template>

<script>
import { Fragment } from 'vue-frag'

export default {
name: 'PaymentListRow',

components: {
Fragment,
},

props: {
item: {
type: Object,
required: true,
},
index: {
type: Number,
required: true,
},
},
}
</script>
91 changes: 91 additions & 0 deletions src/views/Payments/PaymentsList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<template>
<Fragment>
<NcEmptyContent v-if="list.length === 0"
:title="t('my_company', 'No payments')">
<template #icon>
<NcIconSvgWrapper :svg="iconPaymentsRaw" />
</template>
</NcEmptyContent>
<RecycleScroller v-else
class="scroller"
:items="list"
key-field="uuid"
list-tag="tbody"
role="table">
<template #before>
<PaymentsListHeader />
</template>
<template #default="{ item, index }">
<PaymentListRow :item="item"
:index="index" />
</template>
</RecycleScroller>
</Fragment>
</template>

<script>
import { Fragment } from 'vue-frag'
import { RecycleScroller } from 'vue-virtual-scroller'

import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'

import PaymentListRow from './PaymentListRow.vue'
import PaymentsListHeader from './PaymentsListHeader.vue'

// eslint-disable-next-line import/no-unresolved
import iconPaymentsRaw from '../../../img/payments.svg?raw'

export default {
name: 'PaymentsList',
components: {
Fragment,
RecycleScroller,
NcEmptyContent,
NcIconSvgWrapper,
PaymentsListHeader,
PaymentListRow,
},
props: {
list: {
type: Array,
default: () => [
{
uuid: 'cb91cea7-5ce3-45c3-8879-fdd96b86006a',
value: 2000.00,
date: '2023-03-30',
},
{
uuid: 'cb91cea7-5ce3-45c3-8879-fdd96b86006a',
value: 1000.00,
date: '2023-01-30',
},
],
},
},
data() {
return {
iconPaymentsRaw,
}
},
}
</script>

<style lang="scss" scoped>
.scroller {
height: 100%;
}
.empty {
:deep {
.icon-vue {
width: 64px;
height: 64px;

svg {
max-width: 64px;
max-height: 64px;
}
}
}
}
</style>
21 changes: 21 additions & 0 deletions src/views/Payments/PaymentsListHeader.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<tr>
<th scope="col">
<span class="hidden-visually">
{{ t('my_company', 'File') }}
</span>
</th>
<th scope="col">
<span>{{ t('my_company', 'Date') }}</span>
</th>
<th scope="col">
<span>{{ t('my_company', 'Value') }}</span>
</th>
</tr>
</template>

<script>
export default {
name: 'PaymentsListHeader',
}
</script>