Add options for adding records in different views
This commit is contained in:
parent
262a70015b
commit
7b680ef09e
@ -2001,20 +2001,24 @@ export default {
|
|||||||
|
|
||||||
if (!(pageID || this.options.rowCreateUrl)) return
|
if (!(pageID || this.options.rowCreateUrl)) return
|
||||||
|
|
||||||
if (this.inModal) {
|
const route = {
|
||||||
|
name: this.options.rowCreateUrl || 'page.record.create',
|
||||||
|
params: { pageID, refRecord },
|
||||||
|
query: null,
|
||||||
|
edit: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.inModal || this.options.addRecordDisplayOption === 'modal') {
|
||||||
this.$root.$emit('show-record-modal', {
|
this.$root.$emit('show-record-modal', {
|
||||||
recordID: NoID,
|
recordID: NoID,
|
||||||
recordPageID: this.recordPageID,
|
recordPageID: this.recordPageID,
|
||||||
refRecord,
|
refRecord,
|
||||||
edit: true,
|
edit: true,
|
||||||
})
|
})
|
||||||
|
} else if (this.options.addRecordDisplayOption === 'newTab') {
|
||||||
|
window.open(this.$router.resolve(route).href)
|
||||||
} else {
|
} else {
|
||||||
this.$router.push({
|
this.$router.push(route)
|
||||||
name: this.options.rowCreateUrl || 'page.record.create',
|
|
||||||
params: { pageID, refRecord },
|
|
||||||
query: null,
|
|
||||||
edit: true,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -582,6 +582,7 @@
|
|||||||
/>
|
/>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
|
|
||||||
<b-col
|
<b-col
|
||||||
cols="12"
|
cols="12"
|
||||||
lg="6"
|
lg="6"
|
||||||
@ -619,6 +620,22 @@
|
|||||||
<b-col
|
<b-col
|
||||||
cols="12"
|
cols="12"
|
||||||
lg="6"
|
lg="6"
|
||||||
|
>
|
||||||
|
<b-form-group
|
||||||
|
:label="$t('recordList.record.addRecordOptions')"
|
||||||
|
label-class="text-primary"
|
||||||
|
>
|
||||||
|
<b-form-select
|
||||||
|
v-model="options.addRecordDisplayOption"
|
||||||
|
:options="recordCreateOptions"
|
||||||
|
:disabled="options.hideAddButton"
|
||||||
|
/>
|
||||||
|
</b-form-group>
|
||||||
|
</b-col>
|
||||||
|
|
||||||
|
<b-col
|
||||||
|
cols="12"
|
||||||
|
md="6"
|
||||||
>
|
>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
:label="$t('recordList.record.editMode')"
|
:label="$t('recordList.record.editMode')"
|
||||||
@ -855,6 +872,14 @@ export default {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
recordCreateOptions () {
|
||||||
|
return [
|
||||||
|
{ value: 'sameTab', text: this.$t('recordList.record.createInSameTab') },
|
||||||
|
{ value: 'newTab', text: this.$t('recordList.record.createInNewTab') },
|
||||||
|
{ value: 'modal', text: this.$t('recordList.record.createInModal') },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
recordListModule () {
|
recordListModule () {
|
||||||
if (this.options.moduleID !== NoID) {
|
if (this.options.moduleID !== NoID) {
|
||||||
return this.getModuleByID(this.options.moduleID)
|
return this.getModuleByID(this.options.moduleID)
|
||||||
|
|||||||
@ -35,6 +35,7 @@ export interface Options {
|
|||||||
perPage: number;
|
perPage: number;
|
||||||
recordDisplayOption: string;
|
recordDisplayOption: string;
|
||||||
recordSelectorDisplayOption: string;
|
recordSelectorDisplayOption: string;
|
||||||
|
addRecordDisplayOption: string;
|
||||||
magnifyOption: string;
|
magnifyOption: string;
|
||||||
|
|
||||||
fullPageNavigation: boolean;
|
fullPageNavigation: boolean;
|
||||||
@ -93,6 +94,7 @@ const defaults: Readonly<Options> = Object.freeze({
|
|||||||
perPage: 20,
|
perPage: 20,
|
||||||
recordDisplayOption: 'sameTab',
|
recordDisplayOption: 'sameTab',
|
||||||
recordSelectorDisplayOption: 'sameTab',
|
recordSelectorDisplayOption: 'sameTab',
|
||||||
|
addRecordDisplayOption: 'sameTab',
|
||||||
magnifyOption: '',
|
magnifyOption: '',
|
||||||
|
|
||||||
fullPageNavigation: false,
|
fullPageNavigation: false,
|
||||||
@ -138,7 +140,19 @@ export class PageBlockRecordList extends PageBlock {
|
|||||||
if (!o) return
|
if (!o) return
|
||||||
|
|
||||||
Apply(this.options, o, CortezaID, 'moduleID')
|
Apply(this.options, o, CortezaID, 'moduleID')
|
||||||
Apply(this.options, o, String, 'prefilter', 'presort', 'selectMode', 'positionField', 'refField', 'recordDisplayOption', 'magnifyOption', 'recordSelectorDisplayOption')
|
|
||||||
|
Apply(this.options, o, String,
|
||||||
|
'prefilter',
|
||||||
|
'presort',
|
||||||
|
'selectMode',
|
||||||
|
'positionField',
|
||||||
|
'refField',
|
||||||
|
'recordDisplayOption',
|
||||||
|
'magnifyOption',
|
||||||
|
'recordSelectorDisplayOption',
|
||||||
|
'addRecordDisplayOption'
|
||||||
|
)
|
||||||
|
|
||||||
Apply(this.options, o, Number, 'perPage', 'refreshRate')
|
Apply(this.options, o, Number, 'perPage', 'refreshRate')
|
||||||
|
|
||||||
if (o.fields) {
|
if (o.fields) {
|
||||||
|
|||||||
@ -498,6 +498,9 @@ recordList:
|
|||||||
openInSameTab: Open record in the same tab
|
openInSameTab: Open record in the same tab
|
||||||
openInNewTab: Open record in a new tab
|
openInNewTab: Open record in a new tab
|
||||||
openInModal: Open record in a modal
|
openInModal: Open record in a modal
|
||||||
|
createInSameTab: Create record in the same tab
|
||||||
|
createInNewTab: Create record in a new tab
|
||||||
|
createInModal: Create record in a modal
|
||||||
enableBulkRecordEdit: Enable bulk record edit
|
enableBulkRecordEdit: Enable bulk record edit
|
||||||
buttons: Record buttons
|
buttons: Record buttons
|
||||||
tooltip:
|
tooltip:
|
||||||
@ -510,6 +513,7 @@ recordList:
|
|||||||
permissions: Permissions
|
permissions: Permissions
|
||||||
recordDisplayOptions: On record click
|
recordDisplayOptions: On record click
|
||||||
recordSelectorDisplayOptions: On record selector click
|
recordSelectorDisplayOptions: On record selector click
|
||||||
|
addRecordOptions: On add record click
|
||||||
recordPage: record page
|
recordPage: record page
|
||||||
refField:
|
refField:
|
||||||
footnote: Field that links records with the parent record
|
footnote: Field that links records with the parent record
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user