mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
more items crossed off
This commit is contained in:
committed by
Matt Hill
parent
636cf8deca
commit
b8381cabfe
@@ -82,7 +82,7 @@
|
|||||||
isNew: current && current[entry.key] === undefined,
|
isNew: current && current[entry.key] === undefined,
|
||||||
isEdited: entry.value.dirty
|
isEdited: entry.value.dirty
|
||||||
}"></form-label>
|
}"></form-label>
|
||||||
<ion-button fill="clear" color="primary" slot="end" (click)="addListItem(entry.key)">
|
<ion-button fill="clear" color="primary" slot="end" (click)="addListItemWrapper(entry.key, spec)">
|
||||||
<ion-icon slot="start" name="add"></ion-icon>
|
<ion-icon slot="start" name="add"></ion-icon>
|
||||||
Add
|
Add
|
||||||
</ion-button>
|
</ion-button>
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ export class FormObjectComponent {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addListItemWrapper (key: string, spec: ValueSpec) {
|
||||||
|
this.presentAlertChangeWarning(key, spec, () => this.addListItem(key))
|
||||||
|
}
|
||||||
|
|
||||||
addListItem (key: string, markDirty = true, val?: string): void {
|
addListItem (key: string, markDirty = true, val?: string): void {
|
||||||
const arr = this.formGroup.get(key) as FormArray
|
const arr = this.formGroup.get(key) as FormArray
|
||||||
if (markDirty) arr.markAsDirty()
|
if (markDirty) arr.markAsDirty()
|
||||||
@@ -149,28 +153,34 @@ export class FormObjectComponent {
|
|||||||
await modal.present()
|
await modal.present()
|
||||||
}
|
}
|
||||||
|
|
||||||
async presentAlertChangeWarning (key: string, spec: ValueSpec, okFn: Function = () => { }, cancelFn: Function = () => { }) {
|
async presentAlertChangeWarning (key: string, spec: ValueSpec, okFn?: Function, cancelFn?: Function) {
|
||||||
if (!spec['change-warning'] || this.warningAck[key]) return
|
console.log('Here here here', spec['change-warning'])
|
||||||
|
if (!spec['change-warning'] || this.warningAck[key]) return okFn ? okFn() : null
|
||||||
this.warningAck[key] = true
|
this.warningAck[key] = true
|
||||||
|
|
||||||
|
const buttons = [
|
||||||
|
{
|
||||||
|
text: 'Proceed',
|
||||||
|
handler: () => {
|
||||||
|
if (okFn) okFn()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
if (okFn || cancelFn) {
|
||||||
|
buttons.unshift({
|
||||||
|
text: 'Cancel',
|
||||||
|
handler: () => {
|
||||||
|
if (cancelFn) cancelFn()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const alert = await this.alertCtrl.create({
|
const alert = await this.alertCtrl.create({
|
||||||
header: 'Warning',
|
header: 'Warning',
|
||||||
subHeader: `Editing ${spec.name} has consequences:`,
|
subHeader: `Editing ${spec.name} has consequences:`,
|
||||||
message: spec['change-warning'],
|
message: spec['change-warning'],
|
||||||
buttons: [
|
buttons,
|
||||||
{
|
|
||||||
text: 'Cancel',
|
|
||||||
handler: () => {
|
|
||||||
cancelFn()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: 'Proceed',
|
|
||||||
handler: () => {
|
|
||||||
okFn()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
await alert.present()
|
await alert.present()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<ion-content>
|
<ion-content>
|
||||||
<ion-item-group>
|
<ion-item-group>
|
||||||
<ion-item *ngFor="let option of options | keyvalue : asIsOrder">
|
<ion-item *ngFor="let option of options | keyvalue : asIsOrder">
|
||||||
<ion-label>{{ option.key }}</ion-label>
|
<ion-label>{{ spec.spec['value-names'][option.key] }}</ion-label>
|
||||||
<ion-checkbox slot="end" [(ngModel)]="option.value" (click)="toggleSelected(option.key)"></ion-checkbox>
|
<ion-checkbox slot="end" [(ngModel)]="option.value" (click)="toggleSelected(option.key)"></ion-checkbox>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-item-group>
|
</ion-item-group>
|
||||||
|
|||||||
Reference in New Issue
Block a user