(function(){"use strict";angular.module("legaltrace.common",["legaltrace.config","ngCookies","ui.date","sgs.common.notification"]).factory("languageHttpInterceptor",["$cookies","$q","legalTraceConfig",function(n,t,i){return{request:function(r){if(r.url.indexOf("html")!==-1){var u=r.url.indexOf("?")===-1?"?":"&";r.url=r.url+u+"Version="+i.version;n.LegalTrace&&(r.url=r.url+"&"+n.LegalTrace)}return r||t.when(r)}}}]).factory("errorHttpInterceptor",["$q","$window","logger",function(n,t,i){return{responseError:function(r){if(r&&r.status&&r.status===500&&angular.forEach(r.data,function(n){n.Message!==undefined&&i.logError(n.Message,null,!0,!0)}),r.status==401){t.location.reload();return}return n.reject(r)}}}]).factory("stacktraceService",[function(){return{print:printStackTrace}}]).factory("errorLogService",["$log","$window","$http","stacktraceService",function(n,t,i,r){function u(u,f){n.error.apply(n,arguments);try{var e=u.toString(),o=r.print({e:u});i.post("/private/api/log",angular.toJson({ErrorUrl:t.location.href,ErrorMessage:e,StackTrace:o,Cause:f||""}))}catch(s){n.warn("Error logging failed");n.log(s)}}return{log:u}}]).factory("$exceptionHandler",["$injector",function(n){return function(t,i){var r=n.get("errorLogService");r.log(t,i)}}]).factory("operationHttpInterceptor",["$q","logger",function(n,t){var i={CREATE:"Your data has been successfully created.",INSERT:"Your data has been successfully inserted.",UPDATE:"Your data has been successfully updated.",DELETE:"Your data has been successfully deleted.",SELECT:"Your data has been successfully selected."};return{response:function(r){var u=r.headers("LT-Operation");return u&&i[u]&&t.logSuccess(i[u],null,!0,!0),r||n.when(r)}}}]).filter("appDate",["$filter","uiDateConfig",function(n,t){var i=n("date");return function(n){return i(n,t.appDateFormat)}}]).filter("appDateTime",["$filter","uiDateConfig",function(n,t){var i=n("date");return function(n){return i(n,t.appDateTimeFormat)}}]).filter("appDateTimeSecond",["$filter","uiDateConfig",function(n,t){var i=n("date");return function(n){return i(n,t.appDateTimeSecondFormat)}}]).filter("boolToText",["$filter",function(){return function(n){return n?"Yes":"No"}}]).filter("upper",["$filter",function(){return function(n){if(n)return n.toUpperCase()}}]).filter("decimalToTextTwoDec",["$filter",function(){return function(n){return n&&!isNaN(n)?parseFloat(n).toFixed(2):""}}]).filter("decimalToTextThreeDec",["$filter",function(){return function(n){return n&&!isNaN(n)?parseFloat(n).toFixed(3):""}}]).config(["$httpProvider",function(n){n.interceptors.push("languageHttpInterceptor");n.interceptors.push("errorHttpInterceptor");n.interceptors.push("operationHttpInterceptor");n.interceptors.push("postCountInterceptor")}])})(),function(){"use strict";angular.module("legaltrace",["ngCookies","ngRoute","ngAnimate","ngSanitize","ui.date","ui.bootstrap.modal","sgs.common.modal","sgs.common.validation","sgs.common.ui","legaltrace.common","legaltrace.controllers"]);angular.module("legaltrace.controllers",["ngResource","sgs.common.modal","ui.bootstrap.modal"]).controller("AccountController",["$scope","$resource","$window","$location","sgsModal",function(n,t,i,r,u){var f=t("api/login/authentication");n.register=function(){var n=u.open({templateUrl:"app/templates/accountConfirm.html",controller:"AccountConfirmController"});n.result.then(function(){var n=u.open({templateUrl:"app/templates/accountCreate.html",controller:"AccountCreateController",windowClass:"modal-xxl",resolve:{orgId:function(){return""}}});n.result.then(function(n){u.open({templateUrl:"app/templates/accountSuccess.html",controller:"AccountSuccessController",resolve:{accountSuccess:function(){return n}}})})})};n.login=function(){var t=u.open({templateUrl:"app/templates/login.html",controller:"LoginController",location:r,windowClass:"modal-login"});t.result.then(function(t){var r,e;t.Status==="TO_BE_CORRECTED"?(r=u.open({templateUrl:"app/templates/accountCreate.html",controller:"AccountCreateController",windowClass:"modal-xxl",resolve:{orgId:function(){return t.AccountId}}}),r.result.then(function(n){u.open({templateUrl:"app/templates/accountSuccess.html",controller:"AccountSuccessController",resolve:{accountSuccess:function(){return n}}})})):(t.Status==="FIRST_ACCEPT_TERMS_OF_ACCESS"||t.Status==="NEW_ACCEPT_TERMS_OF_ACCESS")&&(e=u.open({templateUrl:"app/templates/AcceptTermsOfAccess.html",controller:"AcceptTermOfAccessController",windowClass:"modal-sm",resolve:{acceptTerms:function(){return t}}}),e.result.then(function(t){t&&(n.wait=f.save(t,function(n){n.URL&&(i.location=n.URL)}))}))})};n.logout=function(){i.location="Default.aspx?Logout=1"};n.termOfAccess=function(){u.open({templateUrl:"app/templates/TermOfAccess.html",controller:"TermOfAccessController",windowClass:"modal-xxl"})};n.lostPassword=function(){var t=u.open({templateUrl:"app/templates/lostPasswordLogin.html",controller:"LostPasswordController",windowClass:"modal-sm"});t.result.then(function(t){if(t.Status==="VALIDATED"){var r=u.open({templateUrl:"app/templates/lostPasswordConfirm.html",controller:"LostPasswordConfirmController",windowClass:"modal-sm",resolve:{loginInfo:function(){return t}}});r.result.then(function(t){t&&(n.wait=f.save(t,function(n){n.URL&&(i.location=n.URL)}))})}})};i.location.search.indexOf("login=1")>=0&&n.login()}]).controller("LoginController",["$scope","$resource","$window","$location","$modalInstance","sgsModal",function(n,t,i,r,u,f){var e=t("api/login");n.form={Valid:!1,Submitted:!1,Edited:!1};n.model={};n.labels={};n.ok=function(){n.modelState=[];n.model.FromUrl=r.$$absUrl;n.wait=e.save(n.model,function(t){if(t.Status==="VALIDATED")u.close(t),t.URL&&(i.location=t.URL);else if(t.Status==="INVALID"||t.Status==="DISABLED")u.close(t),f.alert(t.Message+"<br /> <i>"+t.Reason+"<\/i>");else if(t.Status==="WAITING")u.close(t),f.alert(t.Message+"<br />");else if(t.Status==="TO_BE_CORRECTED")u.close(t);else if(t.Status==="FIRST_ACCEPT_TERMS_OF_ACCESS"||t.Status==="NEW_ACCEPT_TERMS_OF_ACCESS")u.close(t);else{var r=[];r.push(t.Message);n.modelState=r}},function(t){var i=[];angular.forEach(t.data,function(n){i.push(n.ErrorMessage)});n.modelState=i})};n.cancel=function(){u.dismiss()};n.$on("sgsValidationEvent",function(t,i){n.form.Valid=i.valid});n.$on("sgsFormEditedEvent",function(t,i){n.form.Edited=i.pristine})}]).controller("LostPasswordController",["$scope","$resource","$window","$location","$modalInstance","sgsModal",function(n,t,i,r,u,f){var e=t("api/lostPassword/check");n.form={Valid:!1,Submitted:!1,Edited:!1};n.model={};n.labels={};n.ok=function(){n.modelState=[];n.model.FromUrl=r.$$absUrl;n.wait=e.save(n.model,function(t){if(t.Status==="VALIDATED")n.model=t,u.close(t);else if(t.Status==="INVALID"||t.Status==="DISABLED")u.close(t),f.alert(t.Message+"<br /> <i>"+t.Reason+"<\/i>");else{var i=[];i.push(t.Message);n.modelState=i}},function(t){var i=[];angular.forEach(t.data,function(n){i.push(n.ErrorMessage)});n.modelState=i})};n.cancel=function(){u.dismiss()};n.$on("sgsValidationEvent",function(t,i){n.form.Valid=i.valid});n.$on("sgsFormEditedEvent",function(t,i){n.form.Edited=i.pristine})}]).controller("LostPasswordConfirmController",["$scope","$resource","$modalInstance","loginInfo",function(n,t,i,r){var u=t("api/lostPassword");n.model=r;n.ok=function(){n.wait=u.save(r,function(){i.close()})};n.cancel=function(){i.close()}}]).controller("PublicNewsController",["$scope","$resource","$window","$location","sgsModal",function(n,t,i,r,u){var f=t("api/publicnews");n.model={};n.model=f.get();n.showNews=function(n){u.open({templateUrl:"app/templates/NewsOverview.html",controller:"PublicNewsViewController",windowClass:"modal-lg",resolve:{news:function(){return n}}})}}]).controller("PublicNewsViewController",["$scope","$resource","$modalInstance","news",function(n,t,i,r){n.model=r;n.cancel=function(){i.close()}}]).controller("AccountConfirmController",["$scope","$resource","$modalInstance",function(n,t,i){n.ok=function(){i.close()};n.cancel=function(){i.dismiss()}}]).controller("TermOfAccessController",["$scope","$resource","$modalInstance",function(n,t,i){var r=t("api/termsOfAccess/current");n.model={};n.model=r.get();n.cancel=function(){i.dismiss()};n.ok=function(){i.close()}}]).controller("AcceptTermOfAccessController",["$scope","$resource","$modalInstance","sgsModal","acceptTerms",function(n,t,i,r,u){var f=t("api/termsOfAccess/accept");n.model=u;n.cancel=function(){i.close()};n.ok=function(){f.save(n.model,function(n){i.close(n)},function(t){n.errors=t.data})};n.termOfAccess=function(){r.open({templateUrl:"app/templates/TermOfAccess.html",controller:"TermOfAccessController",windowClass:"modal-xxl"})}}]).controller("AccountSuccessController",["$scope","$resource","$modalInstance","accountSuccess",function(n,t,i,r){n.accountNb=r.accountNb;n.ok=function(){i.close()}}]).controller("AccountCreateController",["$scope","$resource","$modalInstance","sgsModal","orgId",function(n,t,i,r,u){var f=t("api/accountCreate");n.form={Valid:!1,Submitted:!1,Edited:!1};n.ok=function(){n.form.Submitted=!0;n.form.Valid&&f.save(n.model,function(n){i.close(n)},function(t){n.errors=t.data})};n.fileAddedId=function(t){n.model.ManagerDocument.File=t};n.fileAddedTax=function(t){n.model.CompanyDocument.File=t};n.rolesSelected=function(n){var t=!1;return angular.forEach(n,function(n){n.Checked&&(t=!0)}),t};n.cancel=function(){n.form.Edited?r.confirm("Are you sure you want to close the window and discard your modifications?").result.then(function(){i.dismiss()}):i.dismiss()};n.$on("sgsValidationEvent",function(t,i){n.form.Valid=i.valid});n.$on("sgsFormEditedEvent",function(t,i){n.form.Edited=i.pristine});n.model=f.get({accountId:u},function(t){n.model.ManagerDocument=n.model.ManagerDocument||{};n.model.ManagerDocument.FileType=t.ManagerDocTypes[0]});n.termOfAccess=function(){r.open({templateUrl:"app/templates/TermOfAccess.html",controller:"TermOfAccessController",windowClass:"modal-xxl"})}}])}()