be9eddd7 by Jeff Balicki

edit pdf done

1 parent 362be453
...@@ -139,10 +139,10 @@ class ApiController extends Controller ...@@ -139,10 +139,10 @@ class ApiController extends Controller
139 139
140 $pdf = new PdfController(); 140 $pdf = new PdfController();
141 $pdf = $pdf->pdf($pdfId); 141 $pdf = $pdf->pdf($pdfId);
142 //$response = $pdf; 142 $response = $pdfId;
143 $statusCode = 200; 143 $statusCode = 200;
144 144
145 return Response::json('good', $statusCode); 145 return Response::json( $response, $statusCode);
146 146
147 147
148 148
...@@ -177,13 +177,14 @@ class ApiController extends Controller ...@@ -177,13 +177,14 @@ class ApiController extends Controller
177 public function getpdfgoogle($json) 177 public function getpdfgoogle($json)
178 { 178 {
179 179
180 $id = new pdfModel(); 180 $rows = new pdfModel();
181 $id = $id->getpdfid($json)->get(); 181 $id = $rows->getpdfid($json)->get();
182 182
183 $rows = new pdfModel(); 183 // $rows = new pdfModel();
184 $rows = $rows->getpdf($id[0]->pdfid)->get(); 184 $rows = $rows->getpdf($id[0]->pdfid)->get();
185 $response = $rows; 185 $response = $rows;
186 $statusCode = 200; 186 $statusCode = 200;
187 //var_dump($rows);
187 return Response::json($response, $statusCode); 188 return Response::json($response, $statusCode);
188 189
189 } 190 }
......
...@@ -33,7 +33,7 @@ class PdfController extends Controller ...@@ -33,7 +33,7 @@ class PdfController extends Controller
33 $searchpath = "$folder"; 33 $searchpath = "$folder";
34 $pdffile = $searchpath.'/'.$rows[0]->file; 34 $pdffile = $searchpath.'/'.$rows[0]->file;
35 //$outfile=""; 35 //$outfile="";
36 $title = "Test Pages"; 36
37 $pageHeight = $rows[0]->pheight; 37 $pageHeight = $rows[0]->pheight;
38 $pageWidth = $rows[0]->pwidth; 38 $pageWidth = $rows[0]->pwidth;
39 39
...@@ -61,8 +61,8 @@ try { ...@@ -61,8 +61,8 @@ try {
61 if ($p->begin_document($outfile, "") == 0) 61 if ($p->begin_document($outfile, "") == 0)
62 die("Error: " . $p->get_errmsg()); 62 die("Error: " . $p->get_errmsg());
63 63
64 $p->set_info("Creator", "Rock Star Jeff"); 64 $p->set_info("Creator", "Tenzing Communications");
65 $p->set_info("Title", $title ); 65 $p->set_info("Title", $rows[0]->name );
66 66
67 /* Open the input PDF */ 67 /* Open the input PDF */
68 $response = $storagePath.$pdffile; 68 $response = $storagePath.$pdffile;
......
...@@ -32,12 +32,12 @@ class pdfModel extends Model ...@@ -32,12 +32,12 @@ class pdfModel extends Model
32 32
33 33
34 $rows = DB::table('PDF') 34 $rows = DB::table('PDF')
35
35 ->join('changesPDF', 'PDF_idPDF', '=', 'idPDF') 36 ->join('changesPDF', 'PDF_idPDF', '=', 'idPDF')
36 ->join('stylesPDF', 'stylesPDF_idstylesPDF', '=', 'idstylesPDF') 37 ->join('stylesPDF', 'stylesPDF_idstylesPDF', '=', 'idstylesPDF')
37 ->join('change_typePDF', 'idchange_typePDF', '=', 'change_typePDF_idchange_typePDF') 38 ->join('change_typePDF', 'idchange_typePDF', '=', 'change_typePDF_idchange_typePDF')
38 ->where('PDF.idPDF','=', $id) 39 ->where('PDF.idPDF','=', $id)
39 ->orderBy('changesPDF.order', 'asc'); 40 ->orderBy('changesPDF.order', 'ASC');
40
41 41
42 return $rows; 42 return $rows;
43 } 43 }
...@@ -137,7 +137,7 @@ class pdfModel extends Model ...@@ -137,7 +137,7 @@ class pdfModel extends Model
137 ); 137 );
138 138
139 $idchangesPDF = DB::table('changesPDF')->insertGetId( 139 $idchangesPDF = DB::table('changesPDF')->insertGetId(
140 array('PDF_idPDF' => $pdfId, 'change_typePDF_idchange_typePDF' => $change->idchange_typePDF, 'stylesPDF_idstylesPDF' => $idstylesPDF, 'locationUp' => $change->locationUp, 'locationRight' => $change->locationRight, 'width' => $change->width, 'height' => $change->height, 'pages' => $change->pages, 'content' => $content, 'z-index' => '') 140 array('PDF_idPDF' => $pdfId, 'change_typePDF_idchange_typePDF' => $change->idchange_typePDF, 'stylesPDF_idstylesPDF' => $idstylesPDF, 'locationUp' => $change->locationUp, 'locationRight' => $change->locationRight, 'width' => $change->width, 'height' => $change->height, 'names'=> $change->names, 'example'=> $change->example, 'tips'=> $change->tips, 'order'=> $change->order, 'pages' => $change->pages, 'content' => $content, 'z-index' => '')
141 ); 141 );
142 142
143 } 143 }
......
1 //var pluginUrl = "http://localhost:8888/Forms"; 1 var pluginUrl = "http://localhost:8888/Forms";
2 //var pdf_customizer = "http://localhost:8888/pdf-customizer/public"; 2 var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
3
4
5 //var pluginUrl = "http://contact.gotenzing.com";
6 //var pdf_customizer = "http://pdf-customizer.synapsus.co";
7
8
9 var imageHeight="";
10 var imageWidth="";
11 var edit = false;
3 12
4 13
5 var pluginUrl = "http://contact.gotenzing.com";
6 var pdf_customizer = "http://pdf-customizer.synapsus.co";
7 14
8 function getAuth() { 15 function getAuth() {
9 jQuery(document).ready(function($) { 16 jQuery(document).ready(function($) {
...@@ -138,8 +145,21 @@ function getOneJson(id) { ...@@ -138,8 +145,21 @@ function getOneJson(id) {
138 $.getJSON("" + pdf_customizer + "/api/v1/get-pdf-google/" + id, function(data) { 145 $.getJSON("" + pdf_customizer + "/api/v1/get-pdf-google/" + id, function(data) {
139 // Get the element with id summary and set the inner text to the result. 146 // Get the element with id summary and set the inner text to the result.
140 var json = JSON.stringify(data); 147 var json = JSON.stringify(data);
148 edit = false;
149 changePdfOptions(json,edit);
150 });
151 });
152 }
153 function getBackOneJson(id) {
154 jQuery(document).ready(function($) {
155 $.getJSON("" + pdf_customizer + "/api/v1/get-pdf/" + id, function(data) {
156 // Get the element with id summary and set the inner text to the result.
157 var json = JSON.stringify(data);
158 //$('#google_drive').show();
159 edit = true;
160
141 161
142 changePdfOptions(json); 162 changePdfOptions(json,edit);
143 }); 163 });
144 }); 164 });
145 } 165 }
...@@ -159,16 +179,25 @@ function pickPdfFromList(json) { ...@@ -159,16 +179,25 @@ function pickPdfFromList(json) {
159 } 179 }
160 180
161 strVar += ' <div class="callout primary"><div class="row column"> <h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>'; 181 strVar += ' <div class="callout primary"><div class="row column"> <h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>';
162 strVar += ' '; 182 strVar += '</div></div></div><div id="contentAreaOver"></div> ';
163 document.getElementById('contentArea').innerHTML = strVar; 183 document.getElementById('contentArea').innerHTML = strVar;
164 }); 184 });
165 } 185 }
166 186
167 function changePdfOptions(json) { 187 function changePdfOptions(json, edit) {
168 jQuery(function($) { 188 jQuery(function($) {
189 if(edit == false){
190 $('#contentAreaOver').hide();
191 }
192
193
194 console.log( json );
195
169 json = JSON.parse(json); 196 json = JSON.parse(json);
197
170 $(document).ready(function() { 198 $(document).ready(function() {
171 199
200
172 $("#changescontentdate").datepicker({ 201 $("#changescontentdate").datepicker({
173 plugins: "tabfocus", 202 plugins: "tabfocus",
174 changeMonth: true, 203 changeMonth: true,
...@@ -191,6 +220,7 @@ function changePdfOptions(json) { ...@@ -191,6 +220,7 @@ function changePdfOptions(json) {
191 error.insertAfter(element); 220 error.insertAfter(element);
192 } 221 }
193 } 222 }
223
194 }); 224 });
195 }); 225 });
196 226
...@@ -199,14 +229,31 @@ function changePdfOptions(json) { ...@@ -199,14 +229,31 @@ function changePdfOptions(json) {
199 var pdfChange = ""; 229 var pdfChange = "";
200 var f = 0; 230 var f = 0;
201 231
202 var scaleImage = 350 / json[0].pwidth; 232 var windowWidth = 0.68 * $(window).width();
233 var windowHeight = 0.86 * $(window).height();
234
235 var windowHBG = 0.923 * $(window).height();
236
237 if(json[0].pwidth > json[0].pheight){
238 var scaleImage = windowWidth / json[0].pwidth;
203 var imageHeight = json[0].pheight * scaleImage; 239 var imageHeight = json[0].pheight * scaleImage;
204 var imageWidth = 350; 240 var imageWidth = windowWidth;
205 console.log(json[0].pheight, scaleImage, imageHeight); 241 var imgLeft = 0;
242 var imgTop = 25;
243 }else{
244 var scaleImage = windowHeight / json[0].pheight;
245 var imageHeight = windowHeight;
246 var imageWidth = json[0].pwidth * scaleImage;
247 var imgLeft = 30;
248 var imgTop = 2;
249 }
250
251
252 console.log(windowWidth ,windowHeight, imageWidth, imageHeight);
206 253
207 pdflist += '<div id="pdfPreview" class="column">'; 254 pdflist += '<div id="pdfPreview" style="" class="column">';
208 // pdflist += '<img id="pdfimage" src="' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '" width="300px">'; 255 // pdflist += '<img id="pdfimage" src="' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '" width="300px">';
209 pdflist += '<canvas id="Canvas" width="' + imageWidth + '" height="' + imageHeight + '" style=" margin-top:30px; border-style: solid; border-width:1px; background-image: url(' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '); background-size:' + imageWidth + 'px ' + imageHeight + 'px"></div>'; 256 pdflist += '<canvas id="Canvas" width="' + imageWidth + '" height="' + imageHeight + '" style=" margin-top:'+imgTop+'%; display: block; margin-left: auto; margin-right: auto; border-style: solid; border-width:1px; background-image: url(' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '); background-size:' + imageWidth + 'px ' + imageHeight + 'px"></div>';
210 pdfChange += '<form id="changes" name="changes" enctype="multipart/form-data" action="" METHOD="POST"></br><h4>' + json[0].name + '</h4>'; 257 pdfChange += '<form id="changes" name="changes" enctype="multipart/form-data" action="" METHOD="POST"></br><h4>' + json[0].name + '</h4>';
211 pdfChange += '<input type="hidden" id="id" name="id" value="' + json[0].idPDF + '">'; 258 pdfChange += '<input type="hidden" id="id" name="id" value="' + json[0].idPDF + '">';
212 for (i = 0; i < json.length; ++i) { 259 for (i = 0; i < json.length; ++i) {
...@@ -222,9 +269,16 @@ function changePdfOptions(json) { ...@@ -222,9 +269,16 @@ function changePdfOptions(json) {
222 pdfChange += '<span id="span' + i + '">' + json[i].tips + '</span><br/>'; 269 pdfChange += '<span id="span' + i + '">' + json[i].tips + '</span><br/>';
223 } 270 }
224 if (json[i].change_type == "img") { 271 if (json[i].change_type == "img") {
225 pdfChange += json[i].names + ':<label onfocusout="HideBox()" onfocus=" ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="focusButton' + i + '" class="custom-file-input" tabindex="0"><input tabindex="-1" class="fileupload upload required" id="changescontent[' + i + ']" type="file" name="content[' + i + ']" ><span class="file-button"><span class="file-name file-button"></span><strong>Browse</strong></span></label>'; 272 if(edit == true){
273 pdfChange += '<input value="'+json[i].content+'" tabindex="-1" class="required" id="hiddenchangescontent[' + i + ']" type="hidden" name="content[' + i + ']" >';
274 pdfChange += json[i].names + ':<label onfocusout="HideBox()" onfocus=" ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="focusButton' + i + '" class="custom-file-input" tabindex="0"><input tabindex="-1" class="fileupload upload" id="changescontent[' + i + ']" type="file" name="content[' + i + ']" ><span class="file-button"><span class="file-name file-button">'+json[i].content+'</span><strong>Browse</strong></span></label>';
275
276 }else{
277 pdfChange += json[i].names + ':<label onfocusout="HideBox()" onfocus=" ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="focusButton' + i + '" class="custom-file-input" tabindex="0"><input value="'+json[i].content+'" tabindex="-1" class="fileupload upload required" id="changescontent[' + i + ']" type="file" name="content[' + i + ']" ><span class="file-button"><span class="file-name file-button">'+json[i].content+'</span><strong>Browse</strong></span></label>';
278 }
226 pdfChange += '<span id="span' + i + '">' + json[i].tips + '</span><br/>'; 279 pdfChange += '<span id="span' + i + '">' + json[i].tips + '</span><br/>';
227 } 280
281 }
228 if (json[i].change_type == "date") { 282 if (json[i].change_type == "date") {
229 pdfChange += json[i].names + ': <input onfocusout="HideBoxwithdate()" onfocus="ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontentdate" type="text" class="required date" name="content[' + i + ']" value="' + json[i].content + '"">'; 283 pdfChange += json[i].names + ': <input onfocusout="HideBoxwithdate()" onfocus="ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontentdate" type="text" class="required date" name="content[' + i + ']" value="' + json[i].content + '"">';
230 pdfChange += '<span id="span' + i + '"> </span><br/>'; 284 pdfChange += '<span id="span' + i + '"> </span><br/>';
...@@ -232,19 +286,23 @@ function changePdfOptions(json) { ...@@ -232,19 +286,23 @@ function changePdfOptions(json) {
232 } 286 }
233 287
234 } 288 }
235 pdfChange += '<input type="submit" value="Save and download">'; 289 pdfChange += '<input type="submit" value="Save and Continue">';
236 pdfChange += '</form>'; 290 pdfChange += '</form>';
237 291
238 strVar2 += ' <div class="callout primary"><div class="row column"><h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>';
239 strVar2 += ''; 292 strVar2 += '';
240 strVar2 += ' </div></div><div id="wrapper" class="black small-up-2 medium-up-3 large-up-3">'; 293 strVar2 += '';
241 strVar2 += pdflist + '<div id="changesColumn" class="column" >' + pdfChange + '<div id="tezingLogo"></div></div><div id="pdfFooter"></div></div>'; 294 strVar2 += '</div><div id="wrapper" class="black small-up-2 medium-up-3 large-up-3" style="height:'+windowHBG+'px;"> <a class="closeEditer"><i class="fa fa-times fa-1x"></i></a>';
295 strVar2 += pdflist + '<div id="changesColumn" style="height:'+windowHBG+'px;" class="column" >' + pdfChange + '<div id="tezingLogo"></div></div><div id="pdfFooter"></div></div>';
242 296
243 document.getElementById('contentArea').innerHTML = strVar2; 297 document.getElementById('contentAreaOver').innerHTML = strVar2;
244 document.getElementById('google_drive').innerHTML = " ";
245 298
299 if(edit == false){
300 $("#contentAreaOver").slideToggle();
301 $('#google_drive').slideToggle();
302 //document.getElementById('google_drive').innerHTML = " ";
303 }
304
246 305
247
248 var tinymces = tinymce.init({ 306 var tinymces = tinymce.init({
249 selector: '.textarea', 307 selector: '.textarea',
250 entity_encoding: "raw", 308 entity_encoding: "raw",
...@@ -281,6 +339,14 @@ function changePdfOptions(json) { ...@@ -281,6 +339,14 @@ function changePdfOptions(json) {
281 }); 339 });
282 } 340 }
283 }); 341 });
342
343 $('.closeEditer').click(function() {
344 $("#contentAreaOver").slideToggle(function(){
345 edit = false;
346 tinyMCE.remove();
347 });
348 $('#google_drive').slideToggle();
349 });
284 350
285 var files; 351 var files;
286 var imagefiles = []; 352 var imagefiles = [];
...@@ -319,9 +385,10 @@ function changePdfOptions(json) { ...@@ -319,9 +385,10 @@ function changePdfOptions(json) {
319 385
320 }); 386 });
321 $("#changes").submit(function(e) { 387 $("#changes").submit(function(e) {
388
322 e.preventDefault(); 389 e.preventDefault();
323 390
324 if ($("#changes").valid()) { 391
325 392
326 $(tinymce.get()).each(function(i, el) { 393 $(tinymce.get()).each(function(i, el) {
327 394
...@@ -330,8 +397,24 @@ function changePdfOptions(json) { ...@@ -330,8 +397,24 @@ function changePdfOptions(json) {
330 $('#changes').hide(); 397 $('#changes').hide();
331 tinymce.get(el.id).remove(); 398 tinymce.get(el.id).remove();
332 }); 399 });
333 400
401 if ($("#changes").valid()) {
402 var ids =[];
403 if(edit == true){
404 $("#changes input[type=file]").each(function() {
405 if($(this).get(0).files.length == 0 ){
406
407
408 document.getElementById(this.id).remove();
409 }else{
410 console.log("hidden"+this.id);
411 document.getElementById("hidden"+this.id).remove();
412
413
414 }
415 });}
334 var form = $("#changes"); 416 var form = $("#changes");
417 console.log(form);
335 418
336 returnfileOptions(imagefiles, form); 419 returnfileOptions(imagefiles, form);
337 return false; 420 return false;
...@@ -380,6 +463,8 @@ function returnfileOptions(files, form) { ...@@ -380,6 +463,8 @@ function returnfileOptions(files, form) {
380 463
381 }); 464 });
382 } 465 }
466
467
383 468
384 469
385 function returnOptions(form) { 470 function returnOptions(form) {
...@@ -387,21 +472,22 @@ function returnOptions(form) { ...@@ -387,21 +472,22 @@ function returnOptions(form) {
387 472
388 $.getJSON("" + pdf_customizer + "/api/v1/get-pdf/" + id.value, function(dataReturnd) { 473 $.getJSON("" + pdf_customizer + "/api/v1/get-pdf/" + id.value, function(dataReturnd) {
389 // Get the element with id summary and set the inner text to the result. 474 // Get the element with id summary and set the inner text to the result.
475
390 var json = dataReturnd; 476 var json = dataReturnd;
391 //console.log(json); 477
392 478
393 479
394 var jsonReturn = '{"pdf":[{"name":"' + json[0].name + '", "folder":"' + json[0].folder + '", "pdfLocation":"' + json[0].file + '","pageWidth":"' + json[0].pageWidth + '","pageHeight":"' + json[0].pageHeight + '"}],"changes":[' 480 var jsonReturn = '{"pdf":[{"name":"' + json[0].name + '", "folder":"' + json[0].folder + '", "pdfLocation":"' + json[0].file + '","pageWidth":"' + json[0].pwidth + '","pageHeight":"' + json[0].pheight + '"}],"changes":['
395 var e = 1; 481 var e = 1;
396 for (i = 0; i < json.length; ++i) { 482 for (i = 0; i < json.length; ++i) {
397 483
398 484
399 var style = JSON.stringify(json[i].style); 485 var style = JSON.stringify(json[i].style);
400 var content = JSON.stringify(form[0][e].value); 486 var content = JSON.stringify(form[0][e].value);
401 console.log(form[0][e].value); 487 //console.log(form[0][e].value);
402 488 //console.log(json[i].label+' '+json[i].order);
403 489
404 jsonReturn += '{"label":"' + json[i].label + '", "locationUp":"' + json[i].locationUp + '", "locationRight":"' + json[i].locationRight + '","width":"' + json[i].width + '","height":"' + json[i].height + '", "pages":"' + json[i].pages + '", "content":' + content + ', "z-index":null, "idstylesPDF":"' + json[i].idstylesPDF + '", "style":' + style + ', "order":"' + json[i].order + '", "idchange_typePDF":"' + json[i].idchange_typePDF + '", "change_type":"' + json[i].change_type + '", "fileLocation":"' + pluginUrl + '/wp-content/uploads/pdf/"}'; 490 jsonReturn += '{"label":"' + json[i].label + '", "locationUp":"' + json[i].locationUp + '", "locationRight":"' + json[i].locationRight + '","width":"' + json[i].width + '","height":"' + json[i].height + '", "pages":"' + json[i].pages + '", "content":' + content + ', "z-index":null, "idstylesPDF":"' + json[i].idstylesPDF + '", "style":' + style +', "names":"' + json[i].names +'", "example":"' + json[i].example +'", "tips":"' + json[i].tips + '", "order":"' + json[i].order + '", "idchange_typePDF":"' + json[i].idchange_typePDF + '", "change_type":"' + json[i].change_type + '", "fileLocation":"' + pluginUrl + '/wp-content/uploads/pdf/"}';
405 491
406 492
407 if (i < json.length - 1) { 493 if (i < json.length - 1) {
...@@ -410,7 +496,33 @@ function returnOptions(form) { ...@@ -410,7 +496,33 @@ function returnOptions(form) {
410 ++e 496 ++e
411 } 497 }
412 jsonReturn += ' ]}'; 498 jsonReturn += ' ]}';
499
500 var windowWidth = 0.68 * $(window).width();
501 var windowHeight = 0.86 * $(window).height();
502
503 var windowHBG = 0.923 * $(window).height();
504
505 if(json[0].pwidth > json[0].pheight){
506 var scaleImage = windowWidth / json[0].pwidth;
507 var imageHeight = json[0].pheight * scaleImage;
508 var imageWidth = windowWidth;
509 var imgLeft = 0;
510 var imgTop = 25;
511 }else{
512 var scaleImage = windowHeight / json[0].pheight;
513 var imageHeight = windowHeight;
514 var imageWidth = json[0].pwidth * scaleImage;
515 var imgLeft = 30;
516 var imgTop = 2;
517 }
413 // console.log(jsonReturn); 518 // console.log(jsonReturn);
519
520
521
522
523 $("#Canvas").fadeOut(60000000);
524
525
414 526
415 527
416 $.ajax({ 528 $.ajax({
...@@ -418,25 +530,48 @@ function returnOptions(form) { ...@@ -418,25 +530,48 @@ function returnOptions(form) {
418 type: "POST", 530 type: "POST",
419 dataType: 'json', 531 dataType: 'json',
420 data: jsonReturn, 532 data: jsonReturn,
421 processData: false, 533
422 contentType: "application/json", 534 contentType: "application/json",
423 CrossDomain: true, 535 CrossDomain: true,
424 async: true, 536
425 success: function(data) { 537 success: function(data) {
538
426 var strVar2 = "" 539 var strVar2 = ""
427 strVar2 += ' <div class="callout primary"><div class="row column"><h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>'; 540 // strVar2 += ' <div class="callout primary"><div class="row column"><h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>';
428 strVar2 += '</div></div><div class="row small-up-2 medium-up-3 large-up-3">'; 541 //strVar2 += '</div></div><div class="row small-up-2 medium-up-3 large-up-3">';
429 strVar2 += '<br/><br/>' + '<a class="downloadpdf" href="' + pdf_customizer + '/fileentry/getPDF/' + json[0].folder + '/new_' + json[0].file + '" download="' + json[0].file + '" ><i class="fa fa-cloud-download fa-5x"></i></br>Download Here</a></div>'; 542 strVar2 += '<div id="seepdf" style=" display:hidden; width:'+imageWidth+'px;" ><a class="media" style="display: block; margin-left:auto; margin-right:auto; " href="' + pdf_customizer + '/fileentry/getPDF/' + json[0].folder + '/new_' + json[0].file + '" download="' + json[0].file + '" ></a></div>';
543 //<i class="fa fa-cloud-download fa-5x"></i></br>Download Here</a>
544
545 document.getElementById('pdfPreview').innerHTML = strVar2;
546 $('#changes').replaceWith('<div id="changes"></div>')
547 var strVar3 ='<div id="button"><input id="editMe" type="submit" value="Edit"><a href="' + pdf_customizer + '/fileentry/getPDF/' + json[0].folder + '/new_' + json[0].file + '" download="' + json[0].file + '" ><input id="downloadMe" type="submit" value="Download"></a> </div>';
548 document.getElementById('changes').innerHTML = strVar3;
549
550 //console.log(data);
551
552 // $('#changes').show();
553
554 $("#seepdf").fadeIn(60000000);
555 $('a.media').media({width:imageWidth, height:imageHeight});
556
557 $('#editMe').click(function() {
558 $("#google_drive").hide();
559 getBackOneJson(data);
560 });
561
430 562
431 563
432 document.getElementById('contentArea').innerHTML = strVar2
433 }, 564 },
434 error: function(xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response 565 error: function(xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response
435 alert(xhr.status); 566 alert(xhr.status);
436 document.getElementById('contentArea').innerHTML = xhr.responseText; 567 document.getElementById('pdfPreview').innerHTML = xhr.responseText;
568
437 } 569 }
570
571
438 }); 572 });
439 573
574
440 }); 575 });
441 }); 576 });
442 } 577 }
...\ No newline at end of file ...\ No newline at end of file
......