now can create a new person and refimg from viewer - all works

This commit is contained in:
2022-07-17 23:03:46 +10:00
parent 4f63e09946
commit 382647a91b
3 changed files with 74 additions and 27 deletions

View File

@@ -291,11 +291,27 @@ function OverrideForceMatch( person_id, key )
} )
}
function CreatePersonAndRefimg( key )
{
d='&face_id='+item[key].id
+'&tag='+$('#tag').val()
+'&firstname='+$('#firstname').val()
+'&surname='+$('#surname').val()
+'&refimg_data='+item[key].refimg_data
$.ajax({ type: 'POST', data: d, url: '/match_with_create_person',
success: function(data) {
objs[current].faces[item[key].which_face].who=data.who
objs[current].faces[item[key].which_face].distance=data.distance
$('#dbox').modal('hide')
$('#faces').prop('checked',true)
DrawImg()
}
})
}
function AddRefImgTo( person_id, key )
{
d='&face_id='+item[key].id+'&person_id='+person_id+
'&file_eid='+current+'&refimg_data='+item[key].refimg_data
console.log( d )
d='&face_id='+item[key].id+'&person_id='+person_id+'&refimg_data='+item[key].refimg_data
$.ajax({ type: 'POST', data: d, url: '/add_refimg_to_person',
success: function(data) {
objs[current].faces[item[key].which_face].who=data.who
@@ -411,6 +427,9 @@ function FaceDBox(key, item)
success: function(img_data) {
item[key].refimg_data=img_data
$('#face_img').html( '<img src="data:image/jpeg;base64,' + img_data + '"></img>' )
// used for create_new_person only, so this will do nothing for
// option menu items
$('#refimg_data').val(img_data)
}
} )
div+='</p></div><div class="col-6">'
@@ -431,7 +450,24 @@ function FaceDBox(key, item)
}
if ( key == 'no_match_new_person' )
{
div+='<br>create new person NOT YET'
div+='<input type="hidden" id="refimg_data" name="refimg_data" value=""></input>'
div+=`
<div class="row col-12">
<label class="col-3" for="tag">Tag (searchable name):</label>
<input class="form-control col" id="tag" name="tag" required="" type="text" value="">
</div>
<div class="row col-12">
<label class="col-3" for="firstname">FirstName(s):</label>
<input class="form-control col" id="firstname" name="firstname" required="" type="text" value="">
</div>
<div class="row col-12">
<label class="col-3" for="surname">Surname:</label>
<input class="form-control col" id="surname" name="surname" required="" type="text" value="">
</div>
<div class="row col-12">
`
div+='<button class="btn btn-primary offset-3 col-2" type="button"'
div+='onClick="CreatePersonAndRefimg(\''+key+'\')">Save</button>'
}
if ( key == 'no_match_new_refimg' )
{