Hello devs,
I have a camera entity that has replaceable components on it such as lens and chip. I'm showing the currently attached lens and chip on the Camera detail view but below that I want to show a chronological history detailing all of the replaced components and also including production and dispatch records. The screen would roughly look like this (where 'Hello' is printed is where I want the history to be):
Each time a component was swapped out, it would be added to the history. The history could look something like this:
I have created the Camera History panel by defining bottomPanels in my Camera.json file:
And then a custom view file:
But to do this I need to hook the view up to a completely custom query using the ORM. I've had a good look through the forum and can't figure out where I would create that query or how to pass the data to the view. Can anyone please help me with whether this is possible and if yes, which php files would I need to write and how would that connect with the view?
Many thanks,
Clare
I have a camera entity that has replaceable components on it such as lens and chip. I'm showing the currently attached lens and chip on the Camera detail view but below that I want to show a chronological history detailing all of the replaced components and also including production and dispatch records. The screen would roughly look like this (where 'Hello' is printed is where I want the history to be):
Each time a component was swapped out, it would be added to the history. The history could look something like this:
Code:
--------------------------------------------------------- | Date | Record Type | ID | Action | --------------------------------------------------------- | 20/10/23 | Lens | lens1 | Replaced | --------------------------------------------------------- | 10/10/23 | Lens | lens1 | Fixed | --------------------------------------------------------- | 20/01/22 | Dispatch | SN123123 | Sent | --------------------------------------------------------- | 20/01/22 | Production | SN123123 | Built | ---------------------------------------------------------
PHP Code:
"bottomPanels": {
"detail": [
{
"name": "cameraHistory",
"label": "Camera History",
"view": "custom:views/Camera/record/detail-bottom"
}
]
}
Code:
define('custom:views/Camera/record/detail-bottom', ['views/record/panels/bottom'], function (Dep) { console.log('custom bottom view'); return Dep.extend({ templateContent: '<div>{{viewObject.someKey}}</div>', setup: function () { this.someKey = 'Hello'; }, }); });
Many thanks,
Clare
Comment