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()
|
d.setGeneralInfoNextFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if event.Key() == tcell.KeyBacktab {
|
||||||
|
d.setGeneralInfoPrevFocus()
|
||||||
|
}
|
||||||
|
|
||||||
handler(event, setFocus)
|
handler(event, setFocus)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -216,6 +220,10 @@ func (d *AssetEditDialog) InputHandler() func(*tcell.EventKey, func(tview.Primit
|
|||||||
d.setLocationNextFocus()
|
d.setLocationNextFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if event.Key() == tcell.KeyBacktab {
|
||||||
|
d.setLocationPrevFocus()
|
||||||
|
}
|
||||||
|
|
||||||
handler(event, setFocus)
|
handler(event, setFocus)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -228,6 +236,10 @@ func (d *AssetEditDialog) InputHandler() func(*tcell.EventKey, func(tview.Primit
|
|||||||
d.setCommentsNextFocus()
|
d.setCommentsNextFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if event.Key() == tcell.KeyBacktab {
|
||||||
|
d.setCommentsPrevFocus()
|
||||||
|
}
|
||||||
|
|
||||||
handler(event, setFocus)
|
handler(event, setFocus)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -432,7 +444,7 @@ func (d *AssetEditDialog) setupLayout() {
|
|||||||
func (d *AssetEditDialog) setupGeneralInfoPageUI() {
|
func (d *AssetEditDialog) setupGeneralInfoPageUI() {
|
||||||
bgColor := style.DialogBgColor
|
bgColor := style.DialogBgColor
|
||||||
inputFieldBgColor := style.InputFieldBgColor
|
inputFieldBgColor := style.InputFieldBgColor
|
||||||
pageLabelWidth := 12
|
pageLabelWidth := 14
|
||||||
|
|
||||||
d.assetNameField.SetLabel("name:")
|
d.assetNameField.SetLabel("name:")
|
||||||
d.assetNameField.SetLabelWidth(pageLabelWidth)
|
d.assetNameField.SetLabelWidth(pageLabelWidth)
|
||||||
@@ -632,6 +644,44 @@ func (d *AssetEditDialog) setGeneralInfoNextFocus() {
|
|||||||
d.focusElement = editAssetFormFocus
|
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() {
|
func (d *AssetEditDialog) setLocationNextFocus() {
|
||||||
// Category -> Shelf
|
// Category -> Shelf
|
||||||
if d.assetCategoryField.HasFocus() {
|
if d.assetCategoryField.HasFocus() {
|
||||||
@@ -643,10 +693,30 @@ func (d *AssetEditDialog) setLocationNextFocus() {
|
|||||||
d.focusElement = editAssetFormFocus
|
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() {
|
func (d *AssetEditDialog) setCommentsNextFocus() {
|
||||||
d.focusElement = editAssetFormFocus
|
d.focusElement = editAssetFormFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *AssetEditDialog) setCommentsPrevFocus() {
|
||||||
|
d.focusElement = createCategoriesFocus
|
||||||
|
}
|
||||||
|
|
||||||
func (d *AssetEditDialog) EditAssetOptions() types.CreateAssetRequest {
|
func (d *AssetEditDialog) EditAssetOptions() types.CreateAssetRequest {
|
||||||
var (
|
var (
|
||||||
quantity int
|
quantity int
|
||||||
|
|||||||
Reference in New Issue
Block a user