mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
feat: ✨ Aggiunto metodo per ottenere tutti i model come opzioni di una select
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
||||
} from '../../Models';
|
||||
import type {
|
||||
FieldT,
|
||||
SelectOptionsT,
|
||||
SelectT,
|
||||
TextAreaT,
|
||||
TextFieldT
|
||||
@@ -539,4 +540,14 @@ export class RecordsPage extends Page {
|
||||
|
||||
return list.join('');
|
||||
}
|
||||
|
||||
async getModelSelectOptions(model: typeof Model, labelAttribute: string): Promise<SelectOptionsT> {
|
||||
const response = await model.all();
|
||||
const categories = response.getData();
|
||||
|
||||
return categories.map((instance: IModel) => ({
|
||||
value: instance.getId() as string,
|
||||
label: instance[labelAttribute] as string
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user