7878 {{ t('forms', 'Show expiration date on form') }}
7979 </NcCheckboxRadioSwitch >
8080 </div >
81+ <NcCheckboxRadioSwitch
82+ :model-value =" hasMaxSubmissions "
83+ :disabled =" formArchived || locked "
84+ type="switch"
85+ @update :model-value =" onMaxSubmissionsChange " >
86+ {{ t('forms', 'Limit number of responses') }}
87+ </NcCheckboxRadioSwitch >
88+ <div
89+ v-show =" hasMaxSubmissions && !formArchived"
90+ class =" settings-div--indent" >
91+ <NcInputField
92+ v-model =" maxSubmissionsValue "
93+ type="number"
94+ :min =" 1 "
95+ :disabled =" locked "
96+ :label =" t (' forms' , ' Maximum number of responses' )"
97+ @update :model-value =" onMaxSubmissionsValueChange " />
98+ <p class =" settings-hint" >
99+ {{
100+ t(
101+ 'forms',
102+ 'Form will be closed automatically when the limit is reached.',
103+ )
104+ }}
105+ </p >
106+ </div >
81107 <NcCheckboxRadioSwitch
82108 :model-value =" formClosed "
83109 :disabled =" formArchived || locked "
@@ -184,6 +210,7 @@ import NcButton from '@nextcloud/vue/components/NcButton'
184210import NcCheckboxRadioSwitch from ' @nextcloud/vue/components/NcCheckboxRadioSwitch'
185211import NcDateTimePicker from ' @nextcloud/vue/components/NcDateTimePicker'
186212import NcIconSvgWrapper from ' @nextcloud/vue/components/NcIconSvgWrapper'
213+ import NcInputField from ' @nextcloud/vue/components/NcInputField'
187214import NcNoteCard from ' @nextcloud/vue/components/NcNoteCard'
188215import TransferOwnership from ' ./TransferOwnership.vue'
189216import svgLockOpen from ' ../../../img/lock_open.svg?raw'
@@ -193,6 +220,7 @@ import { FormState } from '../../models/Constants.ts'
193220export default {
194221 components: {
195222 NcButton,
223+ NcInputField,
196224 NcCheckboxRadioSwitch,
197225 NcDateTimePicker,
198226 NcIconSvgWrapper,
@@ -302,6 +330,23 @@ export default {
302330 return this .form .state !== FormState .FormActive
303331 },
304332
333+ hasMaxSubmissions () {
334+ return (
335+ this .form .maxSubmissions !== null
336+ && this .form .maxSubmissions !== undefined
337+ )
338+ },
339+
340+ maxSubmissionsValue: {
341+ get () {
342+ return this .form .maxSubmissions ?? 1
343+ },
344+
345+ set (value ) {
346+ this .$emit (' update:form-prop' , ' maxSubmissions' , value)
347+ },
348+ },
349+
305350 isExpired () {
306351 return this .form .expires && moment ().unix () > this .form .expires
307352 },
@@ -365,6 +410,16 @@ export default {
365410 )
366411 },
367412
413+ onMaxSubmissionsChange (checked ) {
414+ this .$emit (' update:form-prop' , ' maxSubmissions' , checked ? 1 : null )
415+ },
416+
417+ onMaxSubmissionsValueChange (value ) {
418+ if (value > 0 ) {
419+ this .$emit (' update:form-prop' , ' maxSubmissions' , value)
420+ }
421+ },
422+
368423 onFormClosedChange (isClosed ) {
369424 this .$emit (
370425 ' update:form-prop' ,
0 commit comments