fix: asset edit menu
This commit is contained in:
@@ -204,6 +204,10 @@ func (d *AssetEditDialog) InputHandler() func(*tcell.EventKey, func(tview.Primit
|
||||
d.setGeneralInfoNextFocus()
|
||||
}
|
||||
|
||||
if event.Key() == tcell.KeyBacktab {
|
||||
d.setGeneralInfoPrevFocus()
|
||||
}
|
||||
|
||||
handler(event, setFocus)
|
||||
|
||||
return
|
||||
@@ -216,6 +220,10 @@ func (d *AssetEditDialog) InputHandler() func(*tcell.EventKey, func(tview.Primit
|
||||
d.setLocationNextFocus()
|
||||
}
|
||||
|
||||
if event.Key() == tcell.KeyBacktab {
|
||||
d.setLocationPrevFocus()
|
||||
}
|
||||
|
||||
handler(event, setFocus)
|
||||
|
||||
return
|
||||
@@ -228,6 +236,10 @@ func (d *AssetEditDialog) InputHandler() func(*tcell.EventKey, func(tview.Primit
|
||||
d.setCommentsNextFocus()
|
||||
}
|
||||
|
||||
if event.Key() == tcell.KeyBacktab {
|
||||
d.setCommentsPrevFocus()
|
||||
}
|
||||
|
||||
handler(event, setFocus)
|
||||
|
||||
return
|
||||
@@ -432,7 +444,7 @@ func (d *AssetEditDialog) setupLayout() {
|
||||
func (d *AssetEditDialog) setupGeneralInfoPageUI() {
|
||||
bgColor := style.DialogBgColor
|
||||
inputFieldBgColor := style.InputFieldBgColor
|
||||
pageLabelWidth := 12
|
||||
pageLabelWidth := 14
|
||||
|
||||
d.assetNameField.SetLabel("name:")
|
||||
d.assetNameField.SetLabelWidth(pageLabelWidth)
|
||||
@@ -632,6 +644,44 @@ func (d *AssetEditDialog) setGeneralInfoNextFocus() {
|
||||
d.focusElement = editAssetFormFocus
|
||||
}
|
||||
|
||||
func (d *AssetEditDialog) setGeneralInfoPrevFocus() {
|
||||
if d.assetNameField.HasFocus() {
|
||||
d.focusElement = createCategoriesFocus
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if d.assetQuantityField.HasFocus() {
|
||||
d.focusElement = createAssetNameFieldFocus
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if d.assetLengthField.HasFocus() {
|
||||
d.focusElement = createAssetQuantityFieldFocus
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if d.assetManufacturerField.HasFocus() {
|
||||
d.focusElement = createAssetLengthFieldFocus
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if d.assetModelField.HasFocus() {
|
||||
d.focusElement = createAssetManufacturerFieldFocus
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if d.assetPriceField.HasFocus() {
|
||||
d.focusElement = createAssetModelFieldFocus
|
||||
}
|
||||
|
||||
d.focusElement = createAssetPriceFieldFocus
|
||||
}
|
||||
|
||||
func (d *AssetEditDialog) setLocationNextFocus() {
|
||||
// Category -> Shelf
|
||||
if d.assetCategoryField.HasFocus() {
|
||||
@@ -643,10 +693,30 @@ func (d *AssetEditDialog) setLocationNextFocus() {
|
||||
d.focusElement = editAssetFormFocus
|
||||
}
|
||||
|
||||
func (d *AssetEditDialog) setLocationPrevFocus() {
|
||||
if d.assetCategoryField.HasFocus() {
|
||||
d.focusElement = createCategoriesFocus
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if d.assetShelfField.HasFocus() {
|
||||
d.focusElement = createAssetCategoryFieldFocus
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
d.focusElement = createAssetShelfFieldFocus
|
||||
}
|
||||
|
||||
func (d *AssetEditDialog) setCommentsNextFocus() {
|
||||
d.focusElement = editAssetFormFocus
|
||||
}
|
||||
|
||||
func (d *AssetEditDialog) setCommentsPrevFocus() {
|
||||
d.focusElement = createCategoriesFocus
|
||||
}
|
||||
|
||||
func (d *AssetEditDialog) EditAssetOptions() types.CreateAssetRequest {
|
||||
var (
|
||||
quantity int
|
||||
|
||||
Reference in New Issue
Block a user