Fixed bugs.
This commit is contained in:
@@ -65,9 +65,10 @@ const AssignmentsByAsset = () => {
|
||||
return {foundAsset}
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if(assetIdInput) assetIdInput.focus()
|
||||
})
|
||||
//This works too well. The field always gets focus anytime anything is typed anywhere.
|
||||
// useEffect(() => {
|
||||
// if(assetIdInput) assetIdInput.focus()
|
||||
// })
|
||||
|
||||
const unassign = () => {
|
||||
// Open the dialog to get condition and comment.
|
||||
@@ -81,7 +82,10 @@ const AssignmentsByAsset = () => {
|
||||
|
||||
if(unassign === true) {
|
||||
// Call assets.unassign(assetId, comment, condition, conditionDetails, date)
|
||||
Meteor.call('assets.unassign', foundAsset.assetId, unassignComment, unassignCondition, unassignConditionDetails)
|
||||
Meteor.call('assets.unassign', foundAsset.assetId, unassignComment, unassignCondition, unassignConditionDetails, (err, result) => {
|
||||
if(err) console.error(err)
|
||||
else if(assetIdInput) assetIdInput.focus()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,19 +124,23 @@ const AssignmentsByPerson = () => {
|
||||
|
||||
if(assign === true) {
|
||||
// Call assets.assign
|
||||
Meteor.call('assets.assign', foundAsset.assetId, selectedPerson.type, selectedPerson._id, assignCondition, assignConditionDetails)
|
||||
setAssetId("")
|
||||
// Set the focus back to the asset id text field
|
||||
// document.getElementById('assetIdInput').focus()
|
||||
// useEffect(() => {
|
||||
// if(assetIdInput) assetIdInput.focus()
|
||||
// })
|
||||
Meteor.call('assets.assign', foundAsset.assetId, selectedPerson.type, selectedPerson._id, assignCondition, assignConditionDetails, (err, result) => {
|
||||
if(err) console.error(err)
|
||||
else {
|
||||
// Clear the asset id field and set focus to it.
|
||||
setAssetId("")
|
||||
if(assetIdInput) assetIdInput.focus()
|
||||
}
|
||||
})
|
||||
|
||||
//document.getElementById('assetIdInput').focus()
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if(assetIdInput) assetIdInput.focus()
|
||||
})
|
||||
//This works too well. The field always gets focus anytime anything is typed anywhere.
|
||||
// useEffect(() => {
|
||||
// if(assetIdInput) assetIdInput.focus()
|
||||
// })
|
||||
|
||||
const unassign = (asset) => {
|
||||
// Open the dialog to get condition and comment.
|
||||
@@ -151,7 +155,10 @@ const AssignmentsByPerson = () => {
|
||||
|
||||
if(unassign === true) {
|
||||
// Call assets.unassign(assetId, comment, condition, conditionDetails, date)
|
||||
Meteor.call('assets.unassign', unassignAsset.assetId, unassignComment, unassignCondition, unassignConditionDetails)
|
||||
Meteor.call('assets.unassign', unassignAsset.assetId, unassignComment, unassignCondition, unassignConditionDetails, (err, result) => {
|
||||
if(err) console.error(err)
|
||||
else if(assetIdInput) assetIdInput.focus()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +233,7 @@ const AssignmentsByPerson = () => {
|
||||
<div style={{display: 'flex', flexDirection: 'column', margin: '1rem 0 0 .5rem'}}>
|
||||
{selectedPerson && (
|
||||
<div style={cssAssetTile}>
|
||||
<div style={{marginBottom: '1rem'}}><TextField id='assetIdInput' inputRef={input=>setAssetIdInput(input)} style={cssEditorField} variant="standard" label="Asset ID" value={assetId} onChange={(e) => {setAssetId(e.target.value)}}/></div>
|
||||
<div style={{marginBottom: '1rem'}}><TextField id='assetIdInput' inputRef={input=>setAssetIdInput(input)} style={cssEditorField} variant="standard" label="Asset ID" value={assetId} onChange={(e) => {setAssetId(e.target.value.toUpperCase())}}/></div>
|
||||
<div>{foundAsset && foundAsset.assetType.name}</div>
|
||||
<div>{foundAsset && foundAsset.serial}</div>
|
||||
{foundAsset && foundAsset.assignee && (
|
||||
|
||||
Reference in New Issue
Block a user