diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index eae0d6923bfb..e76a91db5e13 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -529,7 +529,7 @@ class AccountController extends \BaseController { if ($file = Input::file('logo')) { $path = Input::file('logo')->getRealPath(); - File::delete('logo/' . $account->account_key . '.jpg'); + File::delete('logo/' . $account->account_key . '.jpg'); Image::make($path)->resize(120, 80, true, false)->save('logo/' . $account->account_key . '.jpg'); } @@ -540,6 +540,14 @@ class AccountController extends \BaseController { } } + public function removeLogo() { + + File::delete('logo/' . Auth::user()->account->account_key . '.jpg'); + + Session::flash('message', 'Successfully removed logo'); + return Redirect::to('company/details'); + } + public function checkEmail() { $email = User::withTrashed()->where('email', '=', Input::get('email'))->where('id', '<>', Auth::user()->id)->first(); diff --git a/app/routes.php b/app/routes.php index 329213dec6da..e5dd5c296fc1 100755 --- a/app/routes.php +++ b/app/routes.php @@ -92,6 +92,7 @@ Route::group(array('before' => 'auth'), function() Route::get('company/{section?}', 'AccountController@showSection'); Route::post('company/{section?}', 'AccountController@doSection'); Route::post('user/setTheme', 'UserController@setTheme'); + Route::post('remove_logo', 'AccountController@removeLogo'); Route::resource('clients', 'ClientController'); Route::get('api/clients', array('as'=>'api.clients', 'uses'=>'ClientController@getDatatable')); diff --git a/app/views/accounts/details.blade.php b/app/views/accounts/details.blade.php index 839e718ae54f..25784c742280 100755 --- a/app/views/accounts/details.blade.php +++ b/app/views/accounts/details.blade.php @@ -33,7 +33,8 @@ @if (file_exists($account->getLogoPath()))
- {{ HTML::image($account->getLogoPath(), "Logo") }} + {{ HTML::image($account->getLogoPath(), "Logo") }}   + Remove logo

@endif @@ -82,12 +83,22 @@ {{ Former::close() }} + {{ Form::open(['url' => 'remove_logo', 'class' => 'removeLogoForm']) }} + {{ Form::close() }} + + @stop \ No newline at end of file diff --git a/app/views/header.blade.php b/app/views/header.blade.php index 6db13f6aa85f..f439b6a46dda 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -18,8 +18,8 @@ - - + + diff --git a/public/js/jspdf.min.js b/public/js/jspdf.min.js index 1e8ea01aa56e..33b6c904be97 100755 --- a/public/js/jspdf.min.js +++ b/public/js/jspdf.min.js @@ -1,158 +1,140 @@ -/* - jsPDF 0.9.0rc2 ( 2013-08-07T15:00 commit ID c9c47d1de98fabb0681ad9fba049ef644f8f22ba ) -Copyright (c) 2010-2012 James Hall, james@snapshotmedia.co.uk, https://github.com/MrRio/jsPDF -Copyright (c) 2012 Willow Systems Corporation, willow-systems.com -MIT license. - - ----------------------------------------------------------------------------------------------- - JavaScript PubSub library - 2012 (c) ddotsenko@willowsystems.com - based on Peter Higgins (dante@dojotoolkit.org) - Loosely based on Dojo publish/subscribe API, limited in scope. Rewritten blindly. - Original is (c) Dojo Foundation 2004-2010. Released under either AFL or new BSD, see: - http://dojofoundation.org/license for more information. - ----------------------------------------------------------------------------------------------- - -jsPDF addImage plugin (JPEG only at this time) -Copyright (c) 2012 https://github.com/siefkenj/ - -jsPDF fromHTML plugin. BETA stage. API subject to change. Needs browser, jQuery -Copyright (c) 2012 2012 Willow Systems Corporation, willow-systems.com - +/** + * jsPDF - PDF Document creation from JavaScript + * Version 1.0.0-trunk Built on 2014-03-10T05:30 + * Commit dbb2fbceea2f397d479b802fa4fdf10e6d7c6963 + * + * Copyright (c) 2010-2014 James Hall, https://github.com/MrRio/jsPDF + * 2010 Aaron Spike, https://github.com/acspike + * 2012 Willow Systems Corporation, willow-systems.com + * 2012 Pablo Hess, https://github.com/pablohess + * 2012 Florian Jenett, https://github.com/fjenett + * 2013 Warren Weckesser, https://github.com/warrenweckesser + * 2013 Youssef Beddad, https://github.com/lifof + * 2013 Lee Driscoll, https://github.com/lsdriscoll + * 2013 Stefan Slonevskiy, https://github.com/stefslon + * 2013 Jeremy Morel, https://github.com/jmorel + * 2013 Christoph Hartmann, https://github.com/chris-rock + * 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria + * 2014 James Makes, https://github.com/dollaruw + * 2014 Diego Casorran, https://github.com/diegocr + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * siefkenj, ahwolf, rickygu, Midnith, saintclair, eaparango, + * kim3er, mfo, alnorth, + */ +/** + * jsPDF addImage plugin (JPEG only at this time) + * Copyright (c) 2012 Jason Siefken, https://github.com/siefkenj/ + * 2013 Chris Dowling, https://github.com/gingerchris + * 2013 Trinh Ho, https://github.com/ineedfat + * 2013 Edwin Alejandro Perez, https://github.com/eaparango + * 2013 Norah Smith, https://github.com/burnburnrocket + * 2014 Diego Casorran, https://github.com/diegocr + */ +/** + * jsPDF Cell plugin + * Copyright (c) 2013 Youssef Beddad, youssef.beddad@gmail.com + * 2013 Eduardo Menezes de Morais, eduardo.morais@usp.br + * 2013 Lee Driscoll, https://github.com/lsdriscoll + * 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria + * 2014 James Hall, james@parall.ax + * 2014 Diego Casorran, https://github.com/diegocr + */ +/** + * jsPDF fromHTML plugin. BETA stage. API subject to change. Needs browser, jQuery + * Copyright (c) 2012 Willow Systems Corporation, willow-systems.com + * 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria + * 2014 Diego Casorran, https://github.com/diegocr + */ +/** + * jsPDF JavaScript plugin + * Copyright (c) 2013 Youssef Beddad, youssef.beddad@gmail.com + */ +/** jsPDF Silly SVG plugin Copyright (c) 2012 Willow Systems Corporation, willow-systems.com - +*/ +/** jsPDF split_text_to_size plugin Copyright (c) 2012 Willow Systems Corporation, willow-systems.com MIT license. - +*/ +/** jsPDF standard_fonts_metrics plugin Copyright (c) 2012 Willow Systems Corporation, willow-systems.com MIT license. */ -var jsPDF=function(){function e(l,c,g,q){l="undefined"===typeof l?"p":l.toString().toLowerCase();"undefined"===typeof c&&(c="mm");"undefined"===typeof g&&(g="a4");"undefined"===typeof q&&"undefined"===typeof zpipe&&(q=!1);var k=g.toString().toLowerCase(),b=[],a=0,h=q;q={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19], -b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224, -792],tabloid:[792,1224]};var G="0 g",f=0,p=[],I=2,F=!1,E=[],r={},A={},z=16,w,x,u,s,J={title:"",subject:"",author:"",keywords:"",creator:""},y=0,U=0,B={},H=new m(B),C,v=function(b){return b.toFixed(2)},V=function(b){var a=b.toFixed(0);return 10>b?"0"+a:a},n=function(h){F?p[f].push(h):(b.push(h),a+=h.length+1)},O=function(){I++;E[I]=a;n(I+" 0 obj");return I},R=function(b){n("stream");n(b);n("endstream")},K,da,S,t=function(b,h){var a;a=b;var f=h,c,d,g,k,l,p;void 0===f&&(f={});c=f.sourceEncoding?c:"Unicode"; -g=f.outputEncoding;if((f.autoencode||g)&&(r[w].metadata&&r[w].metadata[c]&&r[w].metadata[c].encoding)&&(c=r[w].metadata[c].encoding,!g&&r[w].encoding&&(g=r[w].encoding),!g&&c.codePages&&(g=c.codePages[0]),"string"===typeof g&&(g=c[g]),g)){l=!1;k=[];c=0;for(d=a.length;c>8&&(l=!0);a=k.join("")}for(c=a.length;void 0===l&&0!==c;)a.charCodeAt(c-1)>>8&&(l=!0),c--;if(l){k=f.noBOM?[]:[254,255];c=0;for(d=a.length;c< -d;c++){p=a.charCodeAt(c);f=p>>8;if(f>>8)throw Error("Character at position "+c.toString(10)+" of string '"+a+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");k.push(f);k.push(p-(f<<8))}a=String.fromCharCode.apply(void 0,k)}return a.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},X=function(){f++;F=!0;p[f]=[];n(v(0.200025*s)+" w");n("0 G");0!==y&&n(y.toString(10)+" J");0!==U&&n(U.toString(10)+" j");H.publish("addPage",{pageNumber:f})},D=function(a,b){var h;void 0===a&&(a=r[w].fontName); -void 0===b&&(b=r[w].fontStyle);try{h=A[a][b]}catch(f){h=void 0}if(!h)throw Error("Unable to look up font label for font '"+a+"', '"+b+"'. Refer to getFontList() for available fonts.");return h},L=function(){F=!1;b=[];E=[];n("%PDF-1.3");K=u*s;da=x*s;var c,g,d,k,l;for(c=1;c<=f;c++){O();n("<>");n("endobj");g=p[c].join("\n");O();if(h){d=[];for(k=0;k>8&255,l>>16&255,l>>24&255])];g="";for(k in d)d.hasOwnProperty(k)&&(g+=String.fromCharCode.apply(null,d[k]));n("<>")}else n("<>");R(g);n("endobj")}E[1]=a;n("1 0 obj");n("<>");n("endobj");for(var q in r)r.hasOwnProperty(q)&& -(c=r[q],c.objectNumber=O(),n("<>"),n("endobj"));H.publish("putResources");E[2]=a;n("2 0 obj");n("<<");n("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]");n("/Font <<");for(var e in r)r.hasOwnProperty(e)&&n("/"+e+" "+r[e].objectNumber+" 0 R");n(">>");n("/XObject <<");H.publish("putXobjectDict");n(">>");n(">>");n("endobj");H.publish("postPutResources");O();n("<<");n("/Producer (jsPDF 0.9.0rc2)"); -J.title&&n("/Title ("+t(J.title)+")");J.subject&&n("/Subject ("+t(J.subject)+")");J.author&&n("/Author ("+t(J.author)+")");J.keywords&&n("/Keywords ("+t(J.keywords)+")");J.creator&&n("/Creator ("+t(J.creator)+")");q=new Date;n("/CreationDate (D:"+[q.getFullYear(),V(q.getMonth()+1),V(q.getDate()),V(q.getHours()),V(q.getMinutes()),V(q.getSeconds())].join("")+")");n(">>");n("endobj");O();n("<<");n("/Type /Catalog");n("/Pages 1 0 R");n("/OpenAction [3 0 R /FitH null]");n("/PageLayout /OneColumn");H.publish("putCatalog"); -n(">>");n("endobj");q=a;n("xref");n("0 "+(I+1));n("0000000000 65535 f ");for(e=1;e<=I;e++)c=E[e].toFixed(0),c=10>c.length?Array(11-c.length).join("0")+c:c,n(c+" 00000 n ");n("trailer");n("<<");n("/Size "+(I+1));n("/Root "+I+" 0 R");n("/Info "+(I-1)+" 0 R");n(">>");n("startxref");n(q);n("%%EOF");F=!0;return b.join("\n")},Z=function(a){var b="S";if("F"===a)b="f";else if("FD"===a||"DF"===a)b="B";return b},aa=function(a,b){var h,c,f,g;switch(a){case void 0:return L();case "save":if(navigator.getUserMedia&& -(void 0===window.URL||void 0===window.URL.createObjectURL))return B.output("dataurlnewwindow");h=L();c=h.length;f=new Uint8Array(new ArrayBuffer(c));for(g=0;gx&&(l=u,u=x,x=l);else if("l"===l||"landscape"===l)l="l",x>u&&(l=u,u=x,x=l);else throw"Invalid orientation: "+l;B.internal={pdfEscape:t,getStyle:Z,getFont:function(){return r[D.apply(B, -arguments)]},getFontSize:function(){return z},getLineHeight:function(){return 1.15*z},btoa:btoa,write:function(a,b,h,c){n(1===arguments.length?a:Array.prototype.join.call(arguments," "))},getCoordinateString:function(a){return v(a*s)},getVerticalCoordinateString:function(a){return v((x-a)*s)},collections:{},newObject:O,putStream:R,events:H,scaleFactor:s,pageSize:{width:u,height:x},output:function(a,b){return aa(a,b)},getNumberOfPages:function(){return p.length-1},pages:p};B.addPage=function(){X(); -return this};B.text=function(a,b,h,c){var f,g;"number"===typeof a&&(f=a,g=b,a=h,b=f,h=g);"string"===typeof a&&a.match(/[\n\r]/)&&(a=a.split(/\r\n|\r|\n/g));"undefined"===typeof c?c={noBOM:!0,autoencode:!0}:(void 0===c.noBOM&&(c.noBOM=!0),void 0===c.autoencode&&(c.autoencode=!0));if("string"===typeof a)c=t(a,c);else if(a instanceof Array){a=a.concat();for(f=a.length-1;-1!==f;f--)a[f]=t(a[f],c);c=a.join(") Tj\nT* (")}else throw Error('Type of text must be string or Array. "'+a+'" is not recognized.'); -n("BT\n/"+w+" "+z+" Tf\n"+1.15*z+" TL\n"+G+"\n"+v(b*s)+" "+v((x-h)*s)+" Td\n("+c+") Tj\nET");return this};B.line=function(a,b,h,c){n(v(a*s)+" "+v((x-b)*s)+" m "+v(h*s)+" "+v((x-c)*s)+" l S");return this};B.lines=function(a,b,h,c,f,g){var k,d,l,p,q,e,I,G;"number"===typeof a&&(k=a,d=b,a=h,b=k,h=d);f=Z(f);c=void 0===c?[1,1]:c;n((b*s).toFixed(3)+" "+((x-h)*s).toFixed(3)+" m ");k=c[0];c=c[1];d=a.length;G=h;for(h=0;h>18&63,q=b>>12&63,k=b>> -6&63,b&=63,e[h++]=c[g]+c[q]+c[k]+c[b];while(a>16&255,g=q>>8&255,q&=255,64===k?e[h++]=String.fromCharCode(c):64===b?e[h++]=String.fromCharCode(c,g):e[h++]=String.fromCharCode(c,g,q);while(a>");if("trns"in g&&g.trns.constructor==Array)for(var a="",h=0;h>");b(g.data);k("endobj")}},m=function(){var d=this.internal.collections.addImage_images,c=this.internal.write,g,e;for(e in d)g=d[e],c("/I"+g.i,g.n,"0","R")};e.addImage=function(e,c,g,q,k,b){if("object"===typeof e&&1===e.nodeType){c=document.createElement("canvas");c.width=e.clientWidth; -c.height=e.clientHeight;var a=c.getContext("2d");if(!a)throw"addImage requires canvas to be supported by browser.";a.drawImage(e,0,0,c.width,c.height);e=c.toDataURL("image/jpeg");c="JPEG"}if("JPEG"!==c.toUpperCase())throw Error("addImage currently only supports format 'JPEG', not '"+c+"'");var h;c=this.internal.collections.addImage_images;var a=this.internal.getCoordinateString,G=this.internal.getVerticalCoordinateString;"data:image/jpeg;base64,"===e.substring(0,23)&&(e=atob(e.replace("data:image/jpeg;base64,", -"")));if(c)if(Object.keys)h=Object.keys(c).length;else{var f=c,p=0;for(h in f)f.hasOwnProperty(h)&&p++;h=p}else h=0,this.internal.collections.addImage_images=c={},this.internal.events.subscribe("putResources",d),this.internal.events.subscribe("putXobjectDict",m);a:{var f=e,I;if(255===!f.charCodeAt(0)||216===!f.charCodeAt(1)||255===!f.charCodeAt(2)||224===!f.charCodeAt(3)||74===!f.charCodeAt(6)||70===!f.charCodeAt(7)||73===!f.charCodeAt(8)||70===!f.charCodeAt(9)||0===!f.charCodeAt(10))throw Error("getJpegSize requires a binary jpeg file"); -I=256*f.charCodeAt(4)+f.charCodeAt(5);for(var p=4,F=f.length;pk&&(k=-72*e.w/k/this.internal.scaleFactor);0>b&&(b=-72*e.h/b/this.internal.scaleFactor);0===k&&(k=b*e.w/e.h);0===b&&(b=k*e.h/e.w);this.internal.write("q",a(k),"0 0",a(b),a(g),G(q+b),"cm /I"+e.i,"Do Q");return this}})(jsPDF.API); -(function(e){function d(b,a,h,c){this.pdf=b;this.x=a;this.y=h;this.settings=c;this.init();return this}function m(b){var a=k[b];if(a)return a;a={"xx-small":9,"x-small":11,small:13,medium:16,large:19,"x-large":23,"xx-large":28,auto:0}[b];if(void 0!==a||(a=parseFloat(b)))return k[b]=a/16;a=b.match(/([\d\.]+)(px)/);return 3===a.length?k[b]=parseFloat(a[1])/16:k[b]=1}function l(b,a,h){var d=b.childNodes,f;f=$(b);b={};for(var k,e=f.css("font-family").split(","),F=e.shift();!k&&F;)k=c[F.trim().toLowerCase()], -F=e.shift();b["font-family"]=k||"times";b["font-style"]=q[f.css("font-style")]||"normal";k=g[f.css("font-weight")]||"normal";"bold"===k&&(b["font-style"]="normal"===b["font-style"]?k:k+b["font-style"]);b["font-size"]=m(f.css("font-size"))||1;b["line-height"]=m(f.css("line-height"))||1;b.display="inline"===f.css("display")?"inline":"block";"block"===b.display&&(b["margin-top"]=m(f.css("margin-top"))||0,b["margin-bottom"]=m(f.css("margin-bottom"))||0,b["padding-top"]=m(f.css("padding-top"))||0,b["padding-bottom"]= -m(f.css("padding-bottom"))||0);if(k="block"===b.display)a.setBlockBoundary(),a.setBlockStyle(b);e=0;for(F=d.length;ew){k=this.pdf.splitTextToSize(k,w,f);for(q.push([k.shift(), -e]);k.length;)q=[[k.shift(),e]],l.push(q);m=this.pdf.getStringUnitWidth(q[0][0],f)*f.fontSize/h}else q.push([k,e]),m+=d;return l};d.prototype.RenderTextFragment=function(b,a){var h=this.pdf.internal.getFont(a["font-family"],a["font-style"]);this.pdf.internal.write("/"+h.id,(12*a["font-size"]).toFixed(2),"Tf","("+this.pdf.internal.pdfEscape(b)+") Tj")};d.prototype.renderParagraph=function(){for(var b=this.paragraph.text,a=0,h=b.length,c,f=!1,d=!1;!f&&a!==h;)(c=b[a]=b[a].trimLeft())&&(f=!0),a++;for(a= -h-1;h&&!d&&-1!==a;)(c=b[a]=b[a].trimRight())&&(d=!0),a--;f=/\s+$/g;d=!0;for(a=0;a!==h;a++)c=b[a].replace(/\s+/g," "),d&&(c=c.trimLeft()),c&&(d=f.test(c)),b[a]=c;a=this.paragraph.style;c=(h=this.paragraph.blockstyle)||{};this.paragraph={text:[],style:[],blockstyle:{},priorblockstyle:h};if(b.join("").trim()){b=this.splitFragmentsIntoLines(b,a);a=12/this.pdf.internal.scaleFactor;f=(Math.max((h["margin-top"]||0)-(c["margin-bottom"]||0),0)+(h["padding-top"]||0))*a;h=((h["margin-bottom"]||0)+(h["padding-bottom"]|| -0))*a;c=this.pdf.internal.write;var g,k;this.y+=f;for(c("q","BT",this.pdf.internal.getCoordinateString(this.x),this.pdf.internal.getVerticalCoordinateString(this.y),"Td");b.length;){f=b.shift();g=d=0;for(k=f.length;g!==k;g++)f[g][0].trim()&&(d=Math.max(d,f[g][1]["line-height"],f[g][1]["font-size"]));c(0,(-12*d).toFixed(2),"Td");g=0;for(k=f.length;g!==k;g++)f[g][0]&&this.RenderTextFragment(f[g][0],f[g][1]);this.y+=d*a}c("ET","Q");this.y+=h}};d.prototype.setBlockBoundary=function(){this.renderParagraph()}; -d.prototype.setBlockStyle=function(b){this.paragraph.blockstyle=b};d.prototype.addText=function(b,a){this.paragraph.text.push(b);this.paragraph.style.push(a)};var c={helvetica:"helvetica","sans-serif":"helvetica",serif:"times",times:"times","times new roman":"times",monospace:"courier",courier:"courier"},g={100:"normal",200:"normal",300:"normal",400:"normal",500:"bold",600:"bold",700:"bold",800:"bold",900:"bold",normal:"normal",bold:"bold",bolder:"bold",lighter:"normal"},q={normal:"normal",italic:"italic", -oblique:"italic"},k={normal:1};e.fromHTML=function(b,a,c,g){if("string"===typeof b){var f="jsPDFhtmlText"+Date.now().toString()+(1E3*Math.random()).toFixed(0);$('