Skip to content
Snippets Groups Projects
Commit e8389076 authored by TonyFord's avatar TonyFord
Browse files

bug fix

parent 8146fdc1
No related branches found
No related tags found
No related merge requests found
......@@ -157,33 +157,9 @@ function importYml(){
var error='';
$('#order-yml').toggleClass('is-invalid',false);
var lastf='';
yml.split('\n').forEach(
yml.split('\t').forEach(
function(v,i){
if( v == '' ) return;
if( v.split(/-/g)[0].trim() == '' || v.split(/-/g)[0].trim() == '\t' ){
$('#'+lastf).val( v.split(/-/g)[1].replace(/\[|\]| /g,'').trim() );
return;
}
var p=v.split(':')[0].trim();
var v=v.split(':').slice(1).join(':').trim();
if( $('#'+p).length == 1 ){
if( $('#'+p)[0].localName == 'select' ){
if( p == 'price-reference' ){
lastf=p; return;
} else if( $('#'+p).val(v).val() != v ){
error+='#'+p+' value ['+v+'] not exists in the list!';
}
}
} else {
error+='#'+p+' not found in form!';
}
if( error != ''){
alert( 'error: \n'+error );
error='';
$('#order-yml').toggleClass('is-invalid',true);
} else {
$('#'+p).val(v.replace(/\<br\>/ig,'\n'));
}
$($('.order-form')[i]).val( v.trim().replace(/\n/g,'') );
}
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment