Skip to content
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 lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function index(?string $projectId = null, ?int $billId = null): TemplateR
}
$state['useTime'] = ($state['useTime'] ?? '0') !== '0';
$state['showMyBalance'] = ($state['showMyBalance'] ?? '0') !== '0';
$state['hideOwnBalance'] = ($state['hideOwnBalance'] ?? '0') !== '0';

$this->initialStateService->provideInitialState('cospend-state', $state);
$this->eventDispatcher->dispatchTyped(new RenderReferenceEvent());
Expand Down
18 changes: 11 additions & 7 deletions src/Settlement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ import MemberAvatar from './components/avatar/MemberAvatar.vue'
import { showSuccess, showError } from '@nextcloud/dialogs'
import moment from '@nextcloud/moment'
import { getLocale } from '@nextcloud/l10n'
import { getCurrentUser } from '@nextcloud/auth'
import { getSmartMemberName } from './utils.js'
import * as constants from './constants.js'
import * as network from './network.js'
Expand Down Expand Up @@ -352,14 +353,17 @@ export default {
return this.stringify(this.maxDate)
},
balances() {
const currentUserId = getCurrentUser()?.uid
return this.balancesObject
? Object.keys(this.balancesObject).map((k) => {
return {
mid: k,
balance: this.balancesObject[k],
memberName: this.getMemberName(k),
}
})
? Object.keys(this.balancesObject)
.filter((k) => !(this.cospend.hideOwnBalance && this.members[k]?.userid === currentUserId))
.map((k) => {
return {
mid: k,
balance: this.balancesObject[k],
memberName: this.getMemberName(k),
}
})
: null
},
dateInfoText() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppNavigationMemberItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
:size="24"
:force-is-no-user="project.federated" />
</template>
<template v-if="inNavigation"
<template v-if="inNavigation && !(cospend.hideOwnBalance && member.userid && isCurrentUser(member.userid))"
#counter>
<NcCounterBubble :class="balanceClass"
:count="balanceCounter"
Expand Down
8 changes: 4 additions & 4 deletions src/components/CospendSettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@
{{ t('cospend', 'Use time in dates') }}
</NcFormBoxSwitch>
<NcFormBoxSwitch
v-model="showMyBalance"
@update:model-value="onCheckboxChange($event, 'showMyBalance')">
{{ t('cospend', 'Show my cumulated balance') }}
v-model="hideOwnBalance"
@update:model-value="onCheckboxChange($event, 'hideOwnBalance')">
{{ t('cospend', 'Hide my balance') }}
</NcFormBoxSwitch>
</NcFormBox>
</NcAppSettingsSection>
Expand Down Expand Up @@ -218,7 +218,7 @@ export default {
memberOrder: OCA.Cospend.state.memberOrder || 'name',
maxPrecision: OCA.Cospend.state.maxPrecision as number || 2,
useTime: OCA.Cospend.state.useTime as boolean ?? true,
showMyBalance: OCA.Cospend.state.showMyBalance as boolean ?? false,
hideOwnBalance: OCA.Cospend.state.hideOwnBalance as boolean ?? false,
importingProject: false,
importingSWProject: false,
cospendVersion: OC.getCapabilities()?.cospend?.version || '??',
Expand Down
Loading