- Booking not available if is in the past
- Delete record only if "Active Edit" is on - Image stretch width reduced. - Signin more dense
This commit is contained in:
@@ -16,6 +16,8 @@ export default class CGridTableRec extends Vue {
|
||||
@Prop({ required: true }) public mytitle: string
|
||||
@Prop({ required: true }) public mycolumns: any[]
|
||||
@Prop({ required: true }) public colkey: string
|
||||
@Prop({ required: false, default: '' }) public nodataLabel: string
|
||||
@Prop({ required: false, default: '' }) public noresultLabel: string
|
||||
public $q
|
||||
public $t
|
||||
public loading: boolean = false
|
||||
@@ -42,6 +44,7 @@ export default class CGridTableRec extends Vue {
|
||||
public returnedData
|
||||
public returnedCount
|
||||
public colVisib: any[] = []
|
||||
public colExtra: any[] = []
|
||||
|
||||
get canEdit() {
|
||||
return this.funcActivated.includes(lists.MenuAction.CAN_EDIT_TABLE)
|
||||
@@ -101,8 +104,12 @@ export default class CGridTableRec extends Vue {
|
||||
public created() {
|
||||
// this.serverData = this.mylist.slice() // [{ chiave: 'chiave1', valore: 'valore 1' }]
|
||||
this.mycolumns.forEach((elem) => {
|
||||
if (elem.field)
|
||||
if (elem.field !== '')
|
||||
this.colVisib.push(elem.field)
|
||||
|
||||
if (elem.visible && elem.field === '')
|
||||
this.colExtra.push(elem.name)
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
@@ -253,7 +260,8 @@ export default class CGridTableRec extends Vue {
|
||||
|
||||
public mounted() {
|
||||
this.mycolumns.forEach((rec: IColGridTable) => {
|
||||
rec.label = this.$t(rec.label_trans)
|
||||
if (rec.label_trans)
|
||||
rec.label = this.$t(rec.label_trans)
|
||||
})
|
||||
|
||||
this.onRequest({
|
||||
@@ -274,4 +282,24 @@ export default class CGridTableRec extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
public visCol(col) {
|
||||
if (col.visuonlyEditVal) {
|
||||
if (this.canEdit) {
|
||||
return col.visuonlyEditVal
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
public visuValByType(col, val) {
|
||||
if (col.isdate) {
|
||||
return tools.getstrDateTime(val)
|
||||
} else {
|
||||
return val
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
@request="onRequest"
|
||||
binary-state-sort
|
||||
:visible-columns="colVisib"
|
||||
:no-data-label="nodataLabel"
|
||||
:no-results-label="noresultLabel"
|
||||
>
|
||||
|
||||
|
||||
@@ -20,7 +22,7 @@
|
||||
v-if="colVisib.includes(col.field)"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
class="text-italic text-red text-weight-bold"
|
||||
class="text-italic text-weight-bold"
|
||||
>
|
||||
{{ col.label }}
|
||||
</q-th>
|
||||
@@ -45,7 +47,7 @@
|
||||
borderless
|
||||
dense
|
||||
options-dense
|
||||
display-value="Colonne"
|
||||
:display-value="$t('grid.columns')"
|
||||
emit-value
|
||||
map-options
|
||||
:options="mycolumns"
|
||||
@@ -57,14 +59,9 @@
|
||||
</template>
|
||||
|
||||
<q-tr slot="body" slot-scope="props" :props="props">
|
||||
|
||||
<q-td v-for="col in mycolumns" :key="col.name" :props="props" v-if="colVisib.includes(col.field)">
|
||||
<div v-if="col.action">
|
||||
<q-btn flat round color="red" icon="fas fa-trash-alt"
|
||||
@click="clickFunz(props.row, col)"></q-btn>
|
||||
</div>
|
||||
<div v-else :class="getclassCol(col)">
|
||||
{{ props.row[col.name] }}
|
||||
<div :class="getclassCol(col)">
|
||||
{{ visuValByType(col, props.row[col.name]) }}
|
||||
<q-popup-edit v-if="canEdit" v-model="props.row[col.name]" :disable="col.disable"
|
||||
:title="col.title" buttons
|
||||
@save="SaveValue" @show="selItem(props.row, col.field)">
|
||||
@@ -73,6 +70,12 @@
|
||||
</q-popup-edit>
|
||||
</div>
|
||||
</q-td>
|
||||
<q-td v-for="col in mycolumns" :key="col.name" :props="props" v-if="colExtra.includes(col.name)">
|
||||
<div v-if="col.action && visCol(col)">
|
||||
<q-btn flat round color="red" :icon="col.icon" size="sm"
|
||||
@click="clickFunz(props.row, col)"></q-btn>
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
<!--
|
||||
<q-btn
|
||||
|
||||
Reference in New Issue
Block a user