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

feature/PC388-73/add-taak-modal-on-widget #50

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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/account-outline-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion img/account-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/briefcase-account-outline-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion img/briefcase-account-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/calendar-month-outline-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion img/calendar-month-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/chat-outline-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion img/chat-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/office-building-outline-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion img/office-building-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions src/services/getTheme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Determines the current theme of the document.
*
* This function checks the `data-theme-light` and `data-theme-default` attributes
* on the document body to determine the theme. If `data-theme-light` is present,
* it returns 'light'. If `data-theme-default` is present, it checks the user's
* preferred color scheme using the `window.matchMedia` API and returns 'light' or 'dark'
* accordingly. If neither attribute is present, it defaults to 'dark'.
*
* @return { 'light' | 'dark' } The current theme, either 'light' or 'dark'.
*/
export const getTheme = () => {
if (document.body.hasAttribute('data-theme-light')) {
return 'light'
}

if (document.body.hasAttribute('data-theme-dark')) {
return 'dark'
}

if (document.body.hasAttribute('data-theme-default')) {
return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'
}
return 'light'
}
7 changes: 6 additions & 1 deletion src/views/widgets/ContactMomentenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { berichtStore, navigationStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import Plus from 'vue-material-design-icons/Plus.vue'
import ChatOutline from 'vue-material-design-icons/ChatOutline.vue'
import BerichtForm from '../../modals/berichten/EditBericht.vue'
Expand Down Expand Up @@ -75,12 +76,16 @@ export default {
id: bericht.id,
mainText: bericht.title,
subText: bericht.aanmaakDatum,
avatarUrl: '/apps-extra/zaakafhandelapp/img/chat-outline.svg',
avatarUrl: this.getItemIcon(),
}))

this.loading = false
})
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/chat-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/chat-outline.svg'
},
openModal() {
this.isModalOpen = true
berichtStore.setBerichtItem(null)
Expand Down
7 changes: 6 additions & 1 deletion src/views/widgets/OpenZakenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { zaakStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import OpenInApp from 'vue-material-design-icons/OpenInApp.vue'
import Folder from 'vue-material-design-icons/Folder.vue'

Expand Down Expand Up @@ -68,12 +69,16 @@ export default {
id: zaak.id,
mainText: zaak.identificatie,
subText: zaak.zaaktype,
avatarUrl: '/apps-extra/zaakafhandelapp/img/briefcase-account-outline.svg',
avatarUrl: this.getItemIcon(),
}))

this.loading = false
})
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/briefcase-account-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/briefcase-account-outline.svg'
},
search() {
console.info('click')
},
Expand Down
9 changes: 7 additions & 2 deletions src/views/widgets/OrganisatiesWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { klantStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton, NcTextField } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import Search from 'vue-material-design-icons/Magnify.vue'
import OfficeBuildingOutline from 'vue-material-design-icons/OfficeBuildingOutline.vue'

Expand Down Expand Up @@ -82,7 +83,7 @@ export default {
id: organisatie.id,
mainText: organisatie.bedrijfsnaam,
subText: organisatie.websiteUrl,
avatarUrl: '/apps-extra/zaakafhandelapp/img/office-building-outline.svg',
avatarUrl: this.getItemIcon(),
}))

this.loading = false
Expand All @@ -96,14 +97,18 @@ export default {
id: organisatie.id,
mainText: organisatie.bedrijfsnaam,
subText: organisatie.websiteUrl,
avatarUrl: '/apps-extra/zaakafhandelapp/img/office-building-outline.svg',
avatarUrl: this.getItemIcon(),
}))
this.loading = false
})
.finally(() => {
this.loading = false
})
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/office-building-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/office-building-outline.svg'
},
onShow() {
window.open('/apps/opencatalogi/catalogi', '_self')
},
Expand Down
9 changes: 7 additions & 2 deletions src/views/widgets/PersonenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { klantStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton, NcTextField } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import Search from 'vue-material-design-icons/Magnify.vue'
import AccountOutline from 'vue-material-design-icons/AccountOutline.vue'

Expand Down Expand Up @@ -84,7 +85,7 @@ export default {
id: person.id,
mainText: `${person.voornaam} ${person.tussenvoegsel} ${person.achternaam}`,
subText: person.emailadres,
avatarUrl: '/apps-extra/zaakafhandelapp/img/account-outline.svg',
avatarUrl: this.getItemIcon(),
}))
this.loading = false
})
Expand All @@ -97,14 +98,18 @@ export default {
id: person.id,
mainText: `${person.voornaam} ${person.tussenvoegsel} ${person.achternaam}`,
subText: person.emailadres,
avatarUrl: '/apps-extra/zaakafhandelapp/img/account-outline.svg',
avatarUrl: this.getItemIcon(),
}))
this.loading = false
})
.finally(() => {
this.loading = false
})
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/account-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/account-outline.svg'
},
onShow() {
window.open('/apps/opencatalogi/catalogi', '_self')
},
Expand Down
7 changes: 6 additions & 1 deletion src/views/widgets/TakenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { taakStore, navigationStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import Plus from 'vue-material-design-icons/Plus.vue'
import Folder from 'vue-material-design-icons/Folder.vue'
import TakenForm from '../../modals/taken/EditTaak.vue'
Expand Down Expand Up @@ -75,12 +76,16 @@ export default {
id: taak.id,
mainText: taak.title,
subText: taak.type,
avatarUrl: '/apps-extra/zaakafhandelapp/img/briefcase-account-outline.svg',
avatarUrl: this.getItemIcon(),
}))

this.loading = false
})
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/calendar-month-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/calendar-month-outline.svg'
},
openModal() {
this.isModalOpen = true
taakStore.setTaakItem(null)
Expand Down
7 changes: 6 additions & 1 deletion src/views/widgets/ZakenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { navigationStore, zaakStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import Plus from 'vue-material-design-icons/Plus.vue'
import Folder from 'vue-material-design-icons/Folder.vue'

Expand Down Expand Up @@ -73,7 +74,7 @@ export default {
id: zaak.id,
mainText: zaak.identificatie,
subText: zaak.zaaktype,
avatarUrl: '/apps-extra/zaakafhandelapp/img/briefcase-account-outline.svg',
avatarUrl: this.getItemIcon(),
}))

this.loading = false
Expand All @@ -88,6 +89,10 @@ export default {
this.isModalOpen = false
navigationStore.setModal(null)
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/briefcase-account-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/briefcase-account-outline.svg'
},
search() {
console.info('click')
},
Expand Down
Loading