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 (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', {
|
||||
recordID: NoID,
|
||||
recordPageID: this.recordPageID,
|
||||
refRecord,
|
||||
edit: true,
|
||||
})
|
||||
} else if (this.options.addRecordDisplayOption === 'newTab') {
|
||||
window.open(this.$router.resolve(route).href)
|
||||
} else {
|
||||
this.$router.push({
|
||||
name: this.options.rowCreateUrl || 'page.record.create',
|
||||
params: { pageID, refRecord },
|
||||
query: null,
|
||||
edit: true,
|
||||
})
|
||||
this.$router.push(route)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -582,6 +582,7 @@
|
||||
/>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
|
||||
<b-col
|
||||
cols="12"
|
||||
lg="6"
|
||||
@ -619,6 +620,22 @@
|
||||
<b-col
|
||||
cols="12"
|
||||
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
|
||||
: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 () {
|
||||
if (this.options.moduleID !== NoID) {
|
||||
return this.getModuleByID(this.options.moduleID)
|
||||
|
||||
@ -35,6 +35,7 @@ export interface Options {
|
||||
perPage: number;
|
||||
recordDisplayOption: string;
|
||||
recordSelectorDisplayOption: string;
|
||||
addRecordDisplayOption: string;
|
||||
magnifyOption: string;
|
||||
|
||||
fullPageNavigation: boolean;
|
||||
@ -93,6 +94,7 @@ const defaults: Readonly<Options> = Object.freeze({
|
||||
perPage: 20,
|
||||
recordDisplayOption: 'sameTab',
|
||||
recordSelectorDisplayOption: 'sameTab',
|
||||
addRecordDisplayOption: 'sameTab',
|
||||
magnifyOption: '',
|
||||
|
||||
fullPageNavigation: false,
|
||||
@ -138,7 +140,19 @@ export class PageBlockRecordList extends PageBlock {
|
||||
if (!o) return
|
||||
|
||||
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')
|
||||
|
||||
if (o.fields) {
|
||||
|
||||
@ -498,6 +498,9 @@ recordList:
|
||||
openInSameTab: Open record in the same tab
|
||||
openInNewTab: Open record in a new tab
|
||||
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
|
||||
buttons: Record buttons
|
||||
tooltip:
|
||||
@ -510,6 +513,7 @@ recordList:
|
||||
permissions: Permissions
|
||||
recordDisplayOptions: On record click
|
||||
recordSelectorDisplayOptions: On record selector click
|
||||
addRecordOptions: On add record click
|
||||
recordPage: record page
|
||||
refField:
|
||||
footnote: Field that links records with the parent record
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user