|
|
|
@ -94,41 +94,37 @@ function save(partID) {
|
|
|
|
|
|
|
|
|
|
partnos = partno_v.split(' ');
|
|
|
|
|
|
|
|
|
|
if (datasheet.length == 0) {
|
|
|
|
|
datasheet = [];
|
|
|
|
|
datasheet[0] = '';
|
|
|
|
|
}
|
|
|
|
|
var data = new FormData();
|
|
|
|
|
|
|
|
|
|
if (datasheet.length == 1)
|
|
|
|
|
data.append('datasheet-file', datasheet[0]);
|
|
|
|
|
data.append('block', block_v);
|
|
|
|
|
data.append('partno', partnos[0]);
|
|
|
|
|
if (partnos.length > 1)
|
|
|
|
|
data.append('partnoalt', partnos[1]);
|
|
|
|
|
if(partnos.length > 2)
|
|
|
|
|
data.append('partnoalt2', partnos[2]);
|
|
|
|
|
data.append('description', description_v);
|
|
|
|
|
data.append('quantity', quantity_v);
|
|
|
|
|
data.append('notes', notes_v);
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
// Your server script to process the upload
|
|
|
|
|
url: 'https://www.elab.kth.se/parts/alter/' + partID,
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
file: datasheet[0],
|
|
|
|
|
block: block_v,
|
|
|
|
|
partno: partnos[0],
|
|
|
|
|
partnoalt: partnos[1],
|
|
|
|
|
partnoalt2: partnos[2],
|
|
|
|
|
description: description_v,
|
|
|
|
|
quantity: quantity_v,
|
|
|
|
|
notes: notes_v
|
|
|
|
|
},
|
|
|
|
|
data: data,
|
|
|
|
|
|
|
|
|
|
// Tell jQuery not to process data or worry about content-type
|
|
|
|
|
// You *must* include these options!
|
|
|
|
|
cache: false,
|
|
|
|
|
contentType: false,
|
|
|
|
|
processData: false,
|
|
|
|
|
|
|
|
|
|
// Custom XMLHttpRequest
|
|
|
|
|
xhr: function() {
|
|
|
|
|
var xhr = $.ajaxSettings.xhr();
|
|
|
|
|
xhr.upload.onload = function(){
|
|
|
|
|
success: function(data) {
|
|
|
|
|
var datasheet_par = '<p id="datasheet-info"><i class="fa fa-check"></i></p>';
|
|
|
|
|
$('#datasheet-info').replaceWith(datasheet_par);
|
|
|
|
|
} ;
|
|
|
|
|
return xhr;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|