-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f040c7
commit 898aa14
Showing
15 changed files
with
329 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!-- | ||
Copyright 2024 ODK Central Developers | ||
See the NOTICE file at the top-level directory of this distribution and at | ||
https://github.com/getodk/central-frontend/blob/master/NOTICE. | ||
|
||
This file is part of ODK Central. It is subject to the license terms in | ||
the LICENSE file found in the top-level directory of this distribution and at | ||
https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central, | ||
including this file, may be copied, modified, propagated, or distributed | ||
except according to the terms contained in the LICENSE file. | ||
--> | ||
<template> | ||
<hover-card icon="tag" :truncate-dt="false"> | ||
<template #title> | ||
<template v-if="submission.instanceName != null"> | ||
{{ submission.instanceName }} | ||
</template> | ||
<template v-else> | ||
<span v-for="(part, index) in idParts" :key="index">{{ part }}</span> | ||
</template> | ||
</template> | ||
<template #subtitle>{{ $t('resource.submission') }}</template> | ||
<template #body> | ||
<dl class="dl-horizontal"> | ||
<dt>{{ $t('resource.form') }}</dt> | ||
<dd>{{ form.nameOrId }}</dd> | ||
|
||
<dt>{{ $t('header.submitterName') }}</dt> | ||
<dd>{{ submission.__system.submitterName }}</dd> | ||
|
||
<dt>{{ $t('header.submissionDate') }}</dt> | ||
<dd><date-time :iso="submission.__system.submissionDate"/></dd> | ||
|
||
<dt>{{ $t('common.reviewState') }}</dt> | ||
<dd> | ||
<submission-review-state :value="submission.__system.reviewState"/> | ||
</dd> | ||
</dl> | ||
</template> | ||
</hover-card> | ||
</template> | ||
|
||
<script setup> | ||
import { computed } from 'vue'; | ||
|
||
import DateTime from '../date-time.vue'; | ||
import HoverCard from '../hover-card.vue'; | ||
import SubmissionReviewState from '../submission/review-state.vue'; | ||
|
||
import { useRequestData } from '../../request-data'; | ||
|
||
defineOptions({ | ||
name: 'HoverCardSubmission' | ||
}); | ||
|
||
const { form, submission } = useRequestData(); | ||
|
||
const idParts = computed(() => { | ||
const id = submission.__id; | ||
const match = id.match(/^((?:uuid:)?[0-9a-f]{8})[0-9a-f-]+([0-9a-f]{8})$/); | ||
return match != null ? [match[1], '…', match[2]] : [id]; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!-- | ||
Copyright 2024 ODK Central Developers | ||
See the NOTICE file at the top-level directory of this distribution and at | ||
https://github.com/getodk/central-frontend/blob/master/NOTICE. | ||
|
||
This file is part of ODK Central. It is subject to the license terms in | ||
the LICENSE file found in the top-level directory of this distribution and at | ||
https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central, | ||
including this file, may be copied, modified, propagated, or distributed | ||
except according to the terms contained in the LICENSE file. | ||
--> | ||
|
||
<!-- Specifying :key so that if `to` changes, the element will be replaced. If a | ||
hover card is shown next to the element, it will be hidden. --> | ||
<template> | ||
<router-link ref="link" :key="to" :to="to"> | ||
{{ submission.currentVersion.instanceName ?? submission.instanceId }} | ||
</router-link> | ||
</template> | ||
|
||
<script setup> | ||
import { computed, ref } from 'vue'; | ||
|
||
import useHoverCard from '../../composables/hover-card'; | ||
import useRoutes from '../../composables/routes'; | ||
|
||
defineOptions({ | ||
name: 'SubmissionLink' | ||
}); | ||
const props = defineProps({ | ||
projectId: { | ||
type: [Number, String], | ||
required: true | ||
}, | ||
xmlFormId: { | ||
type: String, | ||
required: true | ||
}, | ||
// A submission in the format of a REST API response (not OData). It is not | ||
// expected to be a transformed submission resource. For example, | ||
// props.submission.instanceNameOrId is not expected to be defined. | ||
submission: { | ||
type: Object, | ||
required: true | ||
} | ||
}); | ||
|
||
const { submissionPath } = useRoutes(); | ||
const to = computed(() => | ||
submissionPath(props.projectId, props.xmlFormId, props.submission.instanceId)); | ||
|
||
const link = ref(null); | ||
useHoverCard(computed(() => link.value?.$el), 'submission', () => ({ | ||
projectId: props.projectId, | ||
xmlFormId: props.xmlFormId, | ||
instanceId: props.submission.instanceId | ||
})); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.