window.app.ng=angular.module("app",["ui.router","ngAnimate","ui.bootstrap","angular-growl","ngFileUpload","ngCookies","filters","pascalprecht.translate","ng.group","angularCSS","ngSanitize","form-validation","http-interceptors","unops.conversations","breadcrumbs","ngMessages","angular-timezone-selector","frapontillo.bootstrap-switch"]);Array.prototype.move=function(n,t){this.splice(t,0,this.splice(n,1)[0])};String.prototype.splitCamelCase=function(){return this.replace(/([a-z](?=[A-Z]))/g,"$1 ")};angular.module("breadcrumbs",[]).service("breadcrumbsService",[function(){function n(){this.items=[]}var t=[];n.prototype.add=function(n,t){return this.items.push({url:n,anchor:t}),this};n.prototype.pop=function(){return this.items.length>0&&this.items.pop(),this};n.prototype.clear=function(){return this.items.length=0,this};this.get=function(i){var r=i||"default";return t[r]=t[r]||new n,t[r]}}]).directive("breadcrumbs",[function(){return{restrict:"AE",templateUrl:app.root+"/Scripts/App/Breadcrumbs/Breadcrumbs.html",scope:{breadcrumbs:"="},controllerAs:"ctrl",controller:["breadcrumbsService",function(n){this.items=n.get(this.breadcrumbs).items;this.rootUrl=app.root}]}}]);app.ng.controller("App.Controller.ChecklistDocumentUploader",["urls","$http","Upload","$filter","$confirm",function(n,t,i,r,u){var f=this,e;f.urls=n;e=function(){t.get(n.documents.getWhiteList(),{}).success(function(n){f.whiteList=n})};e();f.removeDocument=function(i){u(r("customTranslate")("VendorResponse.Detail.Documents.ConfirmDelete","Are you sure you want to remove this document ?")).then(function(){var r={Documents:[i],EntityGuid:f.relatedEntityGuid,RequiredDocumentId:f.requiredDocument.Id,LotId:f.lotId};t.post(n.document.api.deleteDocuments(),r).success(function(){f.onUploadedDocumentRemoved({requiredDocument:f.requiredDocument,lotId:f.lotId})})})};f.onUseSelectedDocuments=function(i){var r={Documents:i,EntityGuid:f.relatedEntityGuid,RequiredDocumentId:f.requiredDocument.Id,LotId:f.lotId};t.post(n.document.api.addExistingDocumentToEntity(),r).success(function(){f.onDocumentFromLibraryAdded({requiredDocument:f.requiredDocument,lotId:f.lotId})})};f.uploadFile=function(t){for(var u=0,r=0;r<t.length;r++)u++,i.upload({url:n.documents.upload(),fields:{relatedEntityGuid:f.relatedEntityGuid,requiredDocumentId:f.requiredDocument.Id,lotId:f.lotId,entityMeta:f.requiredDocument.TypeDisplayName,uploadType:f.uploadType,tenderId:f.tenderId},file:t[r]}).success(function(){if(--u==0)f.onDocumentUploaded({requiredDocument:f.requiredDocument,lotId:f.lotId})})}}]);app.ng.directive("checklistDocumentUploader",[function(){return{transclude:!0,replace:!0,templateUrl:app.root+"/Scripts/App/ChecklistDocumentUploader/ChecklistDocumentUploader.html",scope:{requiredDocument:"=",relatedEntityGuid:"=",lotId:"=?",editable:"=",uploadType:"=",tenderId:"=",onUploadedDocumentRemoved:"&",onDocumentUploaded:"&",onDocumentFromLibraryAdded:"&"},controller:"App.Controller.ChecklistDocumentUploader",controllerAs:"checklistDocUploaderVm",bindToController:!0}}]);app.ng.directive("textarea",["$timeout",function(n){return{restrict:"E",require:"?ngModel",scope:{nocke:"@",ngMaxlength:"=",height:"=",width:"=",maxlength:"@"},link:function(t,i,r,u){var f,o,e;if(!t.nocke&&typeof r.nocke=="undefined"){f={};f.toolbarGroups=[{name:"basicstyles",groups:["basicstyles"]},{name:"paragraph",groups:["list","indent"]},{name:"links"},{name:"about"}];t.height&&(f.height=t.height);t.width&&(f.width=t.width);f.removePlugins="elementspath,about";f.removeButtons="Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript";f.customConfig=!1;f.stylesSet=!1;f.enterMode=CKEDITOR.ENTER_BR;o=t.maxlength||t.ngMaxlength;o&&(f.extraPlugins="wordcount",f.wordcount={showParagraphs:!1,showWordCount:!1,showCharCount:!0,countSpacesAsChars:!0,countHTML:!0,maxCharCount:o});e=CKEDITOR.replace(i[0],f);e.on("instanceReady",function(){if(e.element.$.removeAttribute("ng-required"),e.element.$.removeAttribute("required"),u){n(function(){e.setData(u.$viewValue)},10);function i(){t.$evalAsync(function(){u.$setViewValue(e.getData())})}e.on("change",i);e.on("key",i);u.$render=function(){n(function(){e.setData(u.$viewValue)},10)}}})}}}}]);app.ng.controller("App.Controller.ClarificationRequest",["$scope","$rootScope","urls","$http","$state","$filter",function(n,t,r,u,f,e){var o="ClarificationRequest";n.urls=r;u.get(r.clarificationRequest.api.getForVendor(n.model.Id)).success(function(t){n.clarificationRequests=t});n.newClarificationRequest=function(){f.go("main.Entity.New",{tenderId:angular.isUndefined(n.model.Id)?n.model.TenderId:n.model.Id,entityName:o})};n.getClarificationText=function(t){for(i in n.model.Clarifications)if(n.model.Clarifications[i].Id===t)return n.model.Clarifications[i].Answer;return e("customTranslate")("External.ClarificationRequest.ClarificationNoData","No data was found.")}}]);app.ng.controller("App.Controller.ClarificationRequest.New",["$scope","$rootScope","urls","$http","entityInfo","$state","growl","appUtils",function(n,t,i,r,u,f,e,o){n.category="";n.descriptions=app.Enums.ClarificationRequestCategoryDescription;n.categories=app.Enums.ClarificationRequestCategory;n.isPilot=u.isPilot;n.urls=i;n.model={TenderId:u.tenderId,Text:null,Category:o.getClarificationRequestCategoryEnum()};n.defaultTextareaMaxChar=app.DefaultTextareaMaxChar;n.save=function(){r.post(i.api.createNew(u),n.model).success(function(){n.goBack()}).error(function(n){e.addErrorMessage(n.ExceptionMessage)})};n.goBack=function(){t.entityInfo.name==="VendorResponse"?f.go("main.VendorResponse.TenderInfo.ClarificationRequests",{id:t.entityInfo.id}):f.go("main.Entity.Detail",{entityId:t.entityInfo.id,entityName:t.entityInfo.name})};r.get(i.tender.api.getTenderIsPilot(u.tenderId)).success(function(t){n.isPilot=t});n.setCategory=i=>{i!=null&&(n.category=t.enums.ClarificationRequestCategory[i].DisplayName,n.model.Category=t.enums.ClarificationRequestCategory[i].Value);return}}]);app.ng.directive("clarificationRequest",[function(){return{restrict:"A",transclude:!1,templateUrl:app.root+"/Scripts/App/ClarificationRequest/ClarificationRequest.html",scope:{model:"="},controller:"App.Controller.ClarificationRequest"}}]);app.ng.controller("App.Controller.Clock",["$scope","$interval","$http","urls",function(n,t,i,r){function h(){var t,i,n;f.isLoaded=!0;t="YYYY-MM-DD HH:mm";u&&(t="YYYY-MM-DD HH mm");u=!u;i=moment.utc().add(e.Diff,"seconds");n=i.format(t)+" UTC";o&&(n="<b>"+n+"<\/b>",o=!1);f.utcDisplay=n}var f=this,u;f.isLoaded=!1;var e={Diff:0},o=!1,s=function(){var n=moment.utc().toDate().toISOString();i.get(r.time.api.getCurrent(n),{noLoader:!0,ignoreError:!0}).then(function(n){var t=e.Diff-n.data.Diff;o=Math.abs(t)>5;e=n.data})};s();t(s,3e5);u=!1;h();t(h,1e3)}]);app.ng.directive("clock",[function(){return{restrict:"AE",transclude:!1,templateUrl:app.root+"/Scripts/App/Clock/Clock.html",controller:"App.Controller.Clock",controllerAs:"clock"}}]);app.ng.factory("$confirm",["$modal","$filter",function(n,t){return function(i,r){var u=t("customTranslate")("Shared.Confirm.Header","Please confirm"),f=t("customTranslate")("Shared.Confirm.Yes","Yes"),e=t("customTranslate")("Shared.Confirm.No","No"),o=t("customTranslate")("Shared.Confirm.Cancel","Cancel");return n.open({template:"<div><div class='modal-header'><h4>"+u+"<\/h4><\/div><div class='modal-body'>"+i+"<\/div><div class='modal-footer'><button class='btn btn-default' ng-click='$close()' type='button' autofocus>"+f+"<\/button><button class='btn btn-default' ng-click='$dismiss()' type='button'>"+(angular.isDefined(r)&&r?e:o)+"<\/button><\/div><\/div>"}).result}}]),function(){window.app.ng.constant("session",{vendorId:window.vendorId}).constant("config",{rootUrl:window.app.root}).run(["$window","$rootScope","$location","$state","urls","userSession","paginationConfig","$filter","$interval","$cookies",function(n,t,i,r,u,f,e,o){var s=window.app;t.data=s.data;t.userPreference=s.userPreference;t.enums=s.Enums;t.urls=u;t.$on("$stateChangeStart",function(n,i,u){if(i.authenticate&&!f.isAuthenticated())return t.returnToState=i.name,t.returnToStateParams=u,n.preventDefault(),r.go("main.Home")});e.firstText=o("customTranslate")("External.Pagination.First","First");e.previousText=o("customTranslate")("External.Pagination.Previous","Previous");e.nextText=o("customTranslate")("External.Pagination.Next","Next");e.lastText=o("customTranslate")("External.Pagination.Last","Last")}]).config(["$locationProvider",function(n){n.html5Mode(!1)}]).config(["$translateProvider",function(n){var t="dummy";n.translations(t,window.app.StringResources);n.preferredLanguage(t);n.useSanitizeValueStrategy("escape")}]).config(["$provide",function(n){n.decorator("dateFilter",["$delegate",function(n){var t=n;return function(){var i=arguments,n;return arguments.length===1&&(n=arguments[0],n=n instanceof Date?n:moment.utc(n).toDate(),i=[n,window.app.DateFormat,"UTC"]),t.apply(this,i)}}])}]).config(["growlProvider",function(n){n.globalTimeToLive(8e3);n.onlyUniqueMessages(!1)}]).config(["conversationsConfigProvider",function(n){n.setDefaults({url:window.app.root+"/api/conversations",appName:window.app.name,templateUrl:window.app.root+"/Scripts/App/Conversation/conversation.html",commentTemplateUrl:window.app.root+"/Scripts/App/Conversation/conversation-comment.html"})}]).config(["$stateProvider","$urlRouterProvider","$urlMatcherFactoryProvider",function(n,t,i){function f(n,t){return u.root+"/Scripts/App/"+n.entityName+"/"+t}var u,r;i.caseInsensitive(!0);t.otherwise("/404");t.when("","/");u=window.app;n.cstate=function(t,i){var r=(t.match(/\./g)||[]).length,u=angular.extend({onEnter:["breadcrumbsService","$state","$stateParams","$rootScope","$filter",function(n,u,f,e,o){var h,c,l,a,s,v;if(r<=1&&n.get().clear(),i.initialBreadcrumbs)for(h=i.initialBreadcrumbs(f,u),c=0;h&&c<h.length;c++)l=h[c],s=o("customTranslate")(l.anchor.translationKey,l.anchor.defaultText),n.get().add(l.url,s);(a=u.get(t),a.abstract!==!0)&&(s=typeof i.title=="object"?o("customTranslate")(i.title.translationKey,i.title.defaultText):typeof i.title=="string"?i.title:t.substr(t.lastIndexOf(".")+1),f[i.titlePostfix]&&(s+=" #"+f[i.titlePostfix]),a.name!="main.Home"&&(v=u.href(t,f),n.get().add(v,s)),e.title=s+" - UNOPS e-Sourcing")}],onExit:["breadcrumbsService",function(n){n.get().pop()}]},i);return n.state(t,u)};r=function(){return function(n,t){return{translationKey:n,defaultText:t}}};n.cstate("main",{templateUrl:u.root+"/Scripts/App/Root/Root.html",controller:"App.Controller.Root"}).cstate("main.Home",{url:"/",controller:"App.Controller.Home",controllerAs:"homeVm",templateUrl:u.root+"/Scripts/App/Home/Home.html",title:r("customTranslate")("External.Page.Title:main.Home","Home")}).cstate("main.401",{url:"/401",controller:"App.Controller.Error.401",templateUrl:u.root+"/Scripts/App/Error/401.html",title:r("customTranslate")("External.Page.Title:main.401","User is not authenticated")}).cstate("main.403",{url:"/403",templateUrl:u.root+"/Scripts/App/Error/403.html",title:r("customTranslate")("External.Page.Title:main.403","403")}).cstate("main.404",{url:"/404",templateUrl:u.root+"/Scripts/App/Error/404.html",title:r("customTranslate")("External.Page.Title:main.404","404")}).cstate("main.500",{url:"/500",templateUrl:u.root+"/Scripts/App/Error/500.html",title:r("customTranslate")("External.Page.Title:main.500","500")}).cstate("main.Help",{url:"/Help",templateUrl:u.root+"/Scripts/App/Help/Root.html",title:r("customTranslate")("External.Page.Title:main.Help","Help")}).cstate("main.Help.Guides",{url:"/Guides",templateUrl:u.root+"/Scripts/App/Help/Guides.html",controller:"App.Controller.Help.Guides",controllerAs:"ctrl",title:r("customTranslate")("External.Page.Title:main.Help.Guides","Guides")}).cstate("main.Help.Contact",{url:"/Contact",templateUrl:u.root+"/Scripts/App/Help/Contact.html",controller:"App.Controller.Help.Contact",title:r("customTranslate")("External.Page.Title:main.Help.Contact","Contact")}).cstate("main.Help.Videos",{url:"/Videos",templateUrl:u.root+"/Scripts/App/Help/Videos.html",controller:"App.Controller.Help.Videos",controllerAs:"ctrl",title:r("customTranslate")("External.Page.Title:main.Help.Videos","Videos")}).cstate("main.Help.Faq",{url:"/Faq",templateUrl:u.root+"/Scripts/App/Help/Faq.html",controller:"App.Controller.Help.Faq",controllerAs:"ctrl",title:r("customTranslate")("External.Page.Title:main.Help.Faq","Faq")}).cstate("main.PrivacyNotice",{url:"/PrivacyNotice",templateUrl:u.root+"/Scripts/App/PrivacyNotice/PrivacyNotice.html",title:r("customTranslate")("External.Page.Title:main.PrivacyNotice","Privacy notice")}).cstate("main.Login",{url:"/Login",templateUrl:u.root+"/Scripts/App/Login/Login.html",controller:"App.Controller.Login",title:r("customTranslate")("External.Page.Title:main.Login","Login")}).cstate("main.LoginSuccess",{url:"/LoginSuccess",templateUrl:u.root+"/Scripts/App/Home/Home.html",title:r("customTranslate")("External.Page.Title:main.LoginSuccess","Login success")}).cstate("main.LogoutSuccess",{url:"/LogoutSuccess",templateUrl:u.root+"/Scripts/App/Home/Home.html",title:r("customTranslate")("External.Page.Title:main.LogoutSuccess","Logout success")}).cstate("main.Notice",{url:"/Notice/{id:int}",templateUrl:u.root+"/Scripts/App/Notice/Detail.html",controller:"App.Controller.Notice.Detail",title:r("customTranslate")("External.Page.Title:main.Notice","Notice"),resolve:{entityInfo:["$stateParams",function(n){return{id:n.id}}]},authenticate:!0}).cstate("main.Notices",{url:"/Notices",templateUrl:u.root+"/Scripts/App/NoticeSearch/Search.html",controller:"App.Controller.Notice.Search",title:r("customTranslate")("External.Page.Title:main.Notices","Notices"),authenticate:!0}).cstate("main.MyDocuments",{url:"/MyDocuments",templateUrl:u.root+"/Scripts/App/MyDocuments/MyDocuments.html",controller:"App.Controller.MyDocuments",title:r("customTranslate")("External.Page.Title:main.MyDocuments","My documents"),authenticate:!0}).cstate("main.MyExpressionsOfInterest",{url:"/MyExpressionsOfInterest",templateUrl:u.root+"/Scripts/App/MyExpressionsOfInterest/MyExpressionsOfInterest.html",controller:"App.Controller.MyExpressionsOfInterest",title:r("customTranslate")("External.Page.Title:main.MyExpressionsOfInterest","My expressions of interest"),authenticate:!0}).cstate("main.NotificationInbox",{url:"/Inbox",templateUrl:u.root+"/Scripts/App/NotificationInbox/Search.html",controller:"App.Controller.NotificationInbox.Search",controllerAs:"notificationVm",title:r("customTranslate")("External.Page.Title:main.NotificationInbox","My Inbox"),authenticate:!0}).cstate("main.VendorResponse",{url:"/VendorResponse/{id:int}",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.html",controller:"App.Controller.VendorResponse.Detail",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.id,vendorResponseId:n.id}}]},abstract:!0,authenticate:!0}).cstate("main.VendorResponse.Overview",{url:"/Overview",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.Overview.html",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.id,vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.Overview","Overview"),authenticate:!0}).cstate("main.VendorResponse.PrintPreview",{url:"/PrintPreview",templateUrl:u.root+"/Scripts/App/VendorResponse/PrintPreview.html",controller:["$scope","$stateParams","$controller",function(n,t,i){i("App.Controller.VendorResponse.PrintPreview",{$scope:n,entityInfo:{id:t.id,name:"VendorResponse"}})}],resolve:{entityInfo:["$stateParams",function(n){return{id:n.id,name:"VendorResponse"}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.PrintPreview","Print preview"),titlePostfix:"id",authenticate:!0}).cstate("main.VendorResponse.ExpressionOfInterest",{url:"/EOI/{eoiId:int}",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.Eoi.html",controller:"App.Controller.ExpressionOfInterest.Detail",controllerAs:"vm",resolve:{entityInfo:["$stateParams",function(n){return{name:"ExpressionOfInterest",id:n.eoiId,vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.ExpressionOfInterest","Expression of interest"),authenticate:!0}).cstate("main.VendorResponse.TenderInfo",{url:"/TenderInfo",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.TenderInfo.html",title:r("customTranslate")("External.Page.Title:main.VendorResponse.TenderInfo","Tender Info"),authenticate:!0}).cstate("main.VendorResponse.TenderInfo.GeneralInfo",{url:"/GeneralInfo",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.TenderInfo.GeneralInfo.html",controller:"App.Controller.VendorResponse.TenderInfo.General",title:r("customTranslate")("External.Page.Title:main.VendorResponse.TenderInfo.GeneralInfo","General information"),authenticate:!0}).cstate("main.VendorResponse.TenderInfo.DataSheet",{url:"/DataSheet",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.TenderInfo.DataSheet.html",title:r("customTranslate")("External.Page.Title:main.VendorResponse.TenderInfo.DataSheet","Data Sheet"),authenticate:!0}).cstate("main.VendorResponse.TenderInfo.Revisions",{url:"/Revisions",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.TenderInfo.Revisions.html",title:r("customTranslate")("External.Page.Title:main.VendorResponse.TenderInfo.Revisions","Revisions"),authenticate:!0}).cstate("main.VendorResponse.TenderInfo.Documents",{url:"/Documents",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.TenderInfo.Documents.html",title:r("customTranslate")("External.Page.Title:main.VendorResponse.TenderInfo.Documents","Documents"),authenticate:!0}).cstate("main.VendorResponse.TenderInfo.TenderFaq",{url:"/TenderFaq",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.TenderInfo.TenderFaq.html",controller:"App.Controller.VendorResponse.TenderFaq",controllerAs:"ctrl",title:r("customTranslate")("External.Page.Title:main.VendorResponse.TenderFaq","Tender Faq"),authenticate:!0}).cstate("main.VendorResponse.TenderInfo.Criteria",{url:"/Criteria",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.TenderInfo.Criteria.html",title:r("customTranslate")("External.Page.Title:main.VendorResponse.TenderInfo.Criteria","Criteria"),authenticate:!0}).cstate("main.VendorResponse.TenderInfo.ClarificationRequests",{url:"/ClarificationRequests",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.TenderInfo.ClarificationRequests.html",title:r("customTranslate")("External.Page.Title:main.VendorResponse.TenderInfo.ClarificationRequests","Clarification requests"),authenticate:!0}).cstate("main.VendorResponse.VendorSubmission",{url:"/VendorSubmission",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.VendorSubmission.html",title:r("customTranslate")("External.Page.Title:main.VendorResponse.VendorSubmission","Vendor submission"),authenticate:!0}).cstate("main.VendorResponse.VendorSubmission.Lots",{url:"/Lots",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.Lots.html",controller:"App.Controller.VendorResponse.Lots",controllerAs:"vmLots",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.id,vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.VendorSubmission.Lots","Lots"),authenticate:!0}).cstate("main.VendorResponse.VendorSubmission.Questionnaires",{url:"/Questionnaires",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.Questionnaires.html",controller:"App.Controller.VendorResponse.Questionnaires",controllerAs:"vm",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.id,vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.VendorSubmission.Questionnaires","Questionnaires"),authenticate:!0}).cstate("main.VendorResponse.VendorSubmission.SupplierForms",{url:"/SupplierForms",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.SupplierForms.html",controller:"App.Controller.VendorResponse.SupplierForms",controllerAs:"vm",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.id,vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.VendorSubmission.SupplierForms","SupplierForms"),authenticate:!0}).cstate("main.VendorResponse.VendorSubmission.TenderForms",{url:"/TenderForms",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.TenderForms.html",controller:"App.Controller.VendorResponse.TenderForms",controllerAs:"vm",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.id,vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.VendorSubmission.TenderForms","TenderForms"),authenticate:!0}).cstate("main.VendorResponse.VendorSubmission.LotGenericForms",{url:"/LotGenericForms",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.LotGenericForms.html",controller:"App.Controller.VendorResponse.LotGenericForms",controllerAs:"vm",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.id,vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.VendorSubmission.LotGenericForms","LotGenericForms"),authenticate:!0}).cstate("main.VendorResponse.VendorSubmission.LotSpecificForms",{url:"/LotSpecificForms",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.LotSpecificForms.html",controller:"App.Controller.VendorResponse.LotSpecificForms",controllerAs:"vm",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.id,vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.VendorSubmission.LotSpecificForms","LotSpecificForms"),authenticate:!0}).cstate("main.VendorResponse.VendorSubmission.Documents",{url:"/Documents",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.Documents.html",controller:"App.Controller.VendorResponse.Documents",controllerAs:"vm",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.VendorSubmission.Documents","Documents"),authenticate:!0}).cstate("main.VendorResponse.VendorSubmission.FinancialDetail",{url:"/FinancialDetail",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.Financial.html",controller:"App.Controller.VendorResponse.FinancialDetail",controllerAs:"vm",resolve:{entityInfo:["$stateParams",function(n){return{name:"FinancialDetail",vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.VendorSubmission.FinancialDetail","Financial detail"),authenticate:!0}).cstate("main.VendorResponse.VendorSubmission.Submit",{url:"/Submit",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.Submit.html",controller:"App.Controller.VendorResponse.Submit",controllerAs:"vm",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.id,vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.VendorSubmission.Submit","Submit"),authenticate:!0}).cstate("main.VendorResponse.AlternativeOffer",{url:"/AlternativeOffer/{originalReponseId:int}",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.AlternativeOffer.html",controller:"App.Controller.VendorResponse.AlternativeOffer",controllerAs:"vm",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.originalReponseId}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.AlternativeOffer","Clarification requests"),authenticate:!0}).cstate("main.VendorResponse.VendorConfirmation",{url:"/VendorConfirmation",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.VendorConfirmation.html",controller:"App.Controller.VendorResponse.VendorConfirmation",controllerAs:"vendorConfirmationVm",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorConfirmation",vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.VendorConfirmation","Vendor confirmation"),authenticate:!0}).cstate("main.VendorResponse.SubmissionClarifications",{url:"/SubmissionClarifications",templateUrl:u.root+"/Scripts/App/VendorResponse/Detail.SubmissionClarifications.html",controller:"App.Controller.VendorResponse.SubmissionClarifications",controllerAs:"vm",resolve:{entityInfo:["$stateParams",function(n){return{name:"VendorResponse",id:n.id,vendorResponseId:n.id}}]},title:r("customTranslate")("External.Page.Title:main.VendorResponse.SubmissionClarifications","Submission clarifications"),authenticate:!0}).cstate("main.Entity",{url:"/:entityName",abstract:!0,template:"<ui-view/>",initialBreadcrumbs:function(n,t){return n.entityName==="Notice"?[{url:t.href("main.Notices"),anchor:r("customTranslate")("External.Page.Title:Notices","Notices")}]:n.entityName==="ExpressionOfInterest"?[{url:t.href("main.MyExpressionsOfInterest"),anchor:r("customTranslate")("External.Page.Title:MyExpressionsOfInterest","My expressions of interest")}]:void 0},authenticate:!0}).cstate("main.Entity.New",{url:"/New/:tenderId",templateUrl:function(n){return f(n,"New.html")},controller:["$scope","$stateParams","$controller",function(n,t,i){i("App.Controller."+t.entityName+".New",{$scope:n,entityInfo:{name:t.entityName,tenderId:t.tenderId}})}],resolve:{entityInfo:["$stateParams",function(n){return{name:n.entityName,tenderId:n.tenderId}}]},title:r("customTranslate")("CreateNew","New"),titlePostfix:"tenderId",authenticate:!0}).cstate("main.Entity.Edit",{url:"/:entityId/Edit",templateUrl:function(n){return f(n,"Edit.html")},controller:["$scope","$stateParams","$controller",function(n,t,i){i("App.Controller."+t.entityName+".Edit",{$scope:n,entityInfo:{id:t.entityId,name:t.entityName}})}],resolve:{entityInfo:["$stateParams",function(n){return{id:n.entityId,name:n.entityName}}]},title:r("customTranslate")("Edit","Edit"),titlePostfix:"entityId",authenticate:!0}).cstate("main.Entity.Detail",{url:"/:entityId",templateUrl:function(n){return f(n,"Detail.html")},controller:["$scope","$stateParams","$controller",function(n,t,i){i("App.Controller."+t.entityName+".Detail",{$scope:n,entityInfo:{id:t.entityId,name:t.entityName}})}],resolve:{entityInfo:["$stateParams",function(n){return{id:n.entityId,name:n.entityName}}]},authenticate:!0})}])}();angular.module("filters",[]).filter("truncate",function(){return function(n,t,i){return isNaN(t)&&(t=10),i===undefined&&(i="..."),n.length<=t||n.length-i.length<=t?n:String(n).substring(0,t-i.length)+i}}).filter("customTranslate",["$translate","$http","translations","$sce",function(n,t,i,r){return function(t,u){var f=n.instant(t),e;return f===t&&app.userPreference.languageId==1&&(e={Id:-1,Key:t,Text:u,languageId:1},i.persist(e),f=u),window.app.enableTranslationSymbols&&(f="►"+f+"◄"),r.trustAsHtml(f)}}]).filter("to_trusted",["$sce",function(n){return function(t){return n.trustAsHtml(t)}}]).filter("datetime",["dateFilter",function(n){return function(t){if(!t)return"N/A";var i=t instanceof Date?t:moment.utc(t).toDate();return n(i,app.DateTimeFormat,"UTC")+" UTC"}}]).filter("datetimeInGuessedTimezone",[function(){return function(n){return n?moment(n+"Z").tz(moment.tz.guess()).format("LLLL Z z."):""}}]).filter("dateInVerboseFormat",[function(){return function(n){return n?moment(n+"Z").format("dddd, LL"):""}}]).filter("startFrom",function(){return function(n,t){return n?(t=+t,n.slice(t)):n}}).filter("unique",function(){return function(n,t){var i=[],r=[];return angular.forEach(n,function(n){var u=n[t];r.indexOf(u)===-1&&(r.push(u),i.push(n))}),i}});angular.module("form-validation",[]).directive("form",[function(){return{restrict:"E",require:"form",priority:0,link:function(n,t,i,r){var f=$._data(t[0],"events"),u=[];angular.forEach(f.submit,function(n){u.push(n.handler)});t.unbind("submit");t.on("submit",function(n){var f,e,t,i;if(r.$valid===!1){for(f in r.$error)if(r.$error.hasOwnProperty(f))for(e=r.$error[f],t=0;t<e.length;t++)i=e[t],i&&i.applyValidityStyle&&i.applyValidityStyle();console&&console.log(r.$error);alert("Please make sure to enter all fields correctly.");return}angular.forEach(u,function(t){t(n)})});r.resetForm=function(){r.$setPristine();r.$setUntouched();n.$broadcast("form:reset")}}}}]).directive("formGroup",[function(){return{restrict:"C",scope:!1,controller:["$scope","$element",function(n,t){this.applyValidityStyle=function(i){n.$evalAsync(function(){i===!0?t.removeClass("has-error"):t.addClass("has-error")})};var i=this;n.$on("form:reset",function(){i.applyValidityStyle(!0)})}]}}]).directive("ngModel",[function(){return{scope:!1,restrict:"A",require:["ngModel","?^^formGroup"],link:function(n,t,i,r){var u=r[0],f=r[1];f&&(u.applyValidityStyle=function(){f.applyValidityStyle(u.$valid)},n.$watch(function(){return u.$valid},function(n,t){n!==t&&f.applyValidityStyle(u.$valid||u.$pristine)}),n.$on("form:reset",function(){u.$setPristine();u.$setUntouched()}))}}}]);angular.module("http-interceptors",[]).config(["$httpProvider",function(n){n.interceptors.push(["$q","$rootScope","$injector","$filter",function(n,t,i,r){function e(n){n.config.noLoader!==!0&&(u-=1,u===0&&t.$broadcast("loaderEnd"))}function o(n){n.noLoader!==!0&&(u+=1,u===1&&t.$broadcast("loaderStart"))}function s(n){f=f||i.get("$modal");f.open({windowClass:"modal-danger",template:"<div><div class='modal-header'><h4>Error<\/h4><\/div><div class='modal-body'>"+n+"<\/div><div class='modal-footer'><button class='btn btn-primary' ng-click='$close()' type='button' autofocus>OK<\/button><\/div><\/div>"})}var u=0,f;return{request:function(t){var i=n.defer();return o(t),i.resolve(t),i.promise},response:function(n){return e(n),n},responseError:function(t){if(t.status===401)return window.location.href=window.app.root+"/#/401",n.reject(t);if(!t.config.ignoreError){var i=t.config&&t.config.url?"<p>"+r("customTranslate")("HttpInterceptor.Error.Default","Uh oh! There was a connection problem.")+"<\/p><small class=help-block>"+r("customTranslate")("HttpInterceptor.Error.FailureWhileAccessingUrl","Failure occurred while accessing: ")+t.config.url+"<\/small>":r("customTranslate")("HttpInterceptor.Error.Unknown","Unknown error"),u=angular.isObject(t.data)?t.data.ExceptionMessage:t.data;s(u||i)}return(e(t),t.status===404&&t.config.redirect404)?(window.location.href=window.app.root+"/#/404",n.reject(t)):t.status===403?(window.location.href=window.app.root+"/#/403",n.reject(t)):n.reject(t)}}}])}]);app.ng.controller("App.Controller.Countdown",["$scope","$interval","$http","urls",function(n,t,i,r){function s(){if(!angular.isUndefined(n.target)){n.isLoaded=!0;var i=moment.utc().add(e.Diff,"seconds");n.millis=moment.utc(n.target).diff(i);n.millis>0?(n.seconds=u(Math.floor(n.millis/1e3%60)),n.minutes=u(Math.floor(n.millis/6e4%60)),n.hours=u(Math.floor(n.millis/36e5%24)),n.days=Math.floor(n.millis/864e5)):(n.countdownComplete=!0,f&&t.cancel(f))}}var e,o,u,f;n.isLoaded=!1;n.countdownComplete=!1;angular.isUndefined(n.completionText)&&(n.completionText="");e={Diff:0};o=function(){var n=moment.utc().toDate().toISOString();i.get(r.time.api.getCurrent(n),{noLoader:!0,ignoreError:!0}).then(function(n){e=n.data})};o();t(o,3e5);u=function(n){return n<10?"0"+n:n};f=null;s();f=t(s,1e3)}]);app.ng.directive("countdown",[function(){return{restrict:"A",transclude:!1,templateUrl:app.root+"/Scripts/App/Countdown/Countdown.html",scope:{target:"=",title:"@",completionText:"@"},controller:"App.Controller.Countdown"}}]);app.ng.controller("App.Controller.CountryPicker",["$scope","$rootScope","$http","urls",function(n,t,i,r){n.userPreference=t.userPreference;n.allCountriesModel={};var u=function(){i.get(r.api.get({name:"Country",id:0})).then(function(t){n.allCountriesModel=t.data})};u();n.searchCountries=function(n){return i.post(r.searchCountries(),JSON.stringify(n)).then(function(n){return n.data})};n.allCountries=function(){n.onSelect(n.allCountriesModel)};n.removeCountry=function(t){n.countries.splice(t,1);n.onCountrySelected({countries:n.countries})};n.onSelect=function(t){var i=!1;if(n.country="",t.Id===0){if(n.countries=[t],n.onCountrySelected)n.onCountrySelected({countries:n.countries});return}n.countries.forEach(function(r){r.Id===0?n.removeCountry(r.index):r.Id===t.Id&&(i=!0)});i||n.countries.push(t);n.onCountrySelected({countries:n.countries})}}]);app.ng.directive("countryPicker",[function(){return{restrict:"A",transclude:!1,templateUrl:app.root+"/Scripts/App/CountryPicker/CountryPicker.html",scope:{countries:"=",onCountrySelected:"&"},controller:"App.Controller.CountryPicker"}}]);app.ng.controller("App.Controller.CriteriaGroupedByStage",[function(){var n=this;n.getGroupSum=function(){var i=0,t;if(n.group)for(t=0;t<n.group.items.length;t++)i+=n.group.items[t].Score;return i}}]);app.ng.directive("criteriaGroupedByStage",[function(){return{restrict:"A",replace:!0,templateUrl:app.root+"/Scripts/App/CriteriaGroupedByStage/CriteriaGroupedByStage.html",scope:{isNumericStage:"=",group:"=",tender:"="},controller:"App.Controller.CriteriaGroupedByStage",controllerAs:"criteriaGroupedByStageVm",bindToController:!0}}]);app.ng.controller("App.Controller.CurrencyPicker",["$scope","urls","$http",function(n,t,i){function u(n){for(var t=0;t<r.allCurrencies.length;t++)if(r.allCurrencies[t].Id===n)return r.allCurrencies[t];return null}var r=this;r.allCurrencies=[];angular.isDefined(n.vendorResponseIdToLimitCurrencies)&&n.vendorResponseIdToLimitCurrencies?i.get(t.vendorResponse.api.getTenderCurrencies(n.vendorResponseIdToLimitCurrencies)).success(function(n){r.allCurrencies=n}):r.allCurrencies=app.Currencies;n.showAddCurrency=function(){r.addingCurrency={}};n.addCurrency=function(){var t=u(r.addingCurrency.Id);_.where(n.currencies,{Id:r.addingCurrency.Id}).length||n.currencies.push(t);r.addingCurrency=null};n.removeCurrency=function(t){for(var i=0;i<n.currencies.length;i++)n.currencies[i].Id===t.Id&&n.currencies.splice(i,1)};n.updateSelectedValue=function(){n.selectedValue=r._selectedItemValue>0?r._selectedItemValue:null};n.$watch("selectedValue",function(){n.selectedValue>0&&(r._selectedItemValue=n.selectedValue)})}]);app.ng.directive("currencyPicker",[function(){return{restrict:"A",templateUrl:app.root+"/Scripts/App/CurrencyPicker/CurrencyPicker.html",scope:{currencies:"=",isMultipleSelections:"=",selectedValue:"=",isRequired:"=",vendorResponseIdToLimitCurrencies:"="},controller:"App.Controller.CurrencyPicker",controllerAs:"vm"}}]);app.ng.controller("App.Controller.ReadOnlyDataSheet",["$scope","$rootScope","$filter",function(n){n.getEnumText=function(){}}]);app.ng.directive("readOnlyDataSheet",[function(){return{restrict:"A",templateUrl:function(n,t){return app.root+"/Scripts/App/DataSheet/ReadOnlyDataSheet"+t.tenderType+".html"},scope:{tenderType:"=",tender:"=",isInternal:"="}}}]);app.ng.controller("App.Controller.DatetimePicker",["$scope","$filter",function(n,t){var i=this,h=angular.copy(i.datetimeModel),u=!1,r=new Date,e,s;i.timeEndOfDay?(r.setHours(23),r.setMinutes(59),r.setSeconds(59),r.setMilliseconds(999)):(!i.showTimeInput||i.timeBeginOfDay?r.setHours(0):r.setHours(12),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0));var o=function(){if(!i.datetimeModel)return"";return i.showTimeInput?t("datetime")(i.datetimeModel):t("date")(i.datetimeModel)},c=function(){var n=moment.tz.guess();return n==="Europe/Paris"&&(n="Europe/Copenhagen"),n},f=function(){var n=moment.tz(i.datetimeModel?i.datetimeModel:r,"UTC");i.utc={};i.utc.display=o();i.local=i.local||{};i.local.tz=i.local.tz||c();i.local.datetime=n.clone().tz(i.local.tz).toDate()};i.formControl={inputPlaceHolder:i.showTimeInput?t("customTranslate")("DatetimePicker.SelectDatetime","Select date and time"):t("customTranslate")("DatetimePicker.SelectDate","Select date"),dpFormat:"yyyy-MM-dd",dpOptions:{formatYear:"yy",startingDay:1},dpMinDate:null,dpMaxDate:null,tpHstep:1,tpMstep:1,tpIsmeridian:!1,tpDisplayInputTime:i.showTimeInput,isOpen:!1,toggleDropdown:function(n){n.stopPropagation();i.formControl.isOpen=!i.formControl.isOpen},reset:function(){i.datetimeModel=angular.copy(h);f()},setToday:function(){var n=angular.copy(r);n.setHours(i.local.datetime.getHours());n.setMinutes(i.local.datetime.getMinutes());i.local.datetime=n}};f();e=function(){var t,n;i.formControl.isOpen&&(u=!0,t=moment(i.local.datetime).format("YYYY-MM-DD HH:mm"),i.showTimeInput?i.datetimeModel=moment.tz(t,i.local.tz).tz("UTC").toDate():(n=moment.utc(t),n.utc().hours(r.getHours()),n.utc().minutes(r.getMinutes()),n.utc().seconds(r.getSeconds()),n.utc().milliseconds(r.getMilliseconds()),i.datetimeModel=n.utc().toDate()),i.utc.display=o())};s=function(){if(u){u=!1;return}f()};n.$watch(function(){return i.minDate},function(){i.formControl.dpMinDate=new Date(i.minDate)});n.$watch(function(){return i.maxDate},function(){i.formControl.dpMaxDate=new Date(i.maxDate)});n.$watch(function(){return i.local.datetime},e);n.$watch(function(){return i.local.tz},e);n.$watch(function(){return i.datetimeModel},s)}]);app.ng.directive("datetimePicker",[function(){return{require:"^datepicker",restrict:"A",transclude:!0,templateUrl:app.root+"/Scripts/App/DatetimePicker/DatetimePicker.html",scope:{name:"@",minDate:"=",maxDate:"=",isRequired:"=",showTimeInput:"=",hideCalendarButton:"=",datetimeModel:"=",isDisabled:"=",timeBeginOfDay:"=",timeEndOfDay:"="},controller:"App.Controller.DatetimePicker",controllerAs:"datetimePicker",bindToController:!0}}]);app.ng.directive("datetimeView",[function(){return{restrict:"EA",templateUrl:app.root+"/Scripts/App/DatetimeView/DatetimeView.html",scope:{ngModel:"=",showHelpIcon:"="}}}]);app.ng.directive("dateView",[function(){return{restrict:"EA",templateUrl:app.root+"/Scripts/App/DateView/DateView.html",scope:{ngModel:"=",showHelpIcon:"="}}}]);app.ng.controller("App.Controller.DocumentList",["$scope","urls","$http","Upload","growl","$filter","$confirm",function(n,t,i,r,u,f,e){var o,s;if(n.urls=t,n.labelYes=f("customTranslate")("DocumentList.YesLabel","yes").toString(),n.labelNo=f("customTranslate")("DocumentList.NoLabel","no").toString(),n.whiteList=app.WhiteList,n.footerColSpan=3,n.showVisibilitySlider&&n.footerColSpan++,n.canDeleteDocs&&!n.readOnly&&n.footerColSpan++,n.documentFilter=function(t){return!n.categories||!n.categories.length?!0:n.categories.indexOf(t.Metadata)!==-1},o=function(){n.entityGuid&&i.get(t.documents.forEntity(n.entityGuid),{}).success(function(t){n.documents=f("filter")(t,n.documentFilter)})},o(),n.uploadFile=function(i,e){var s,h;for(n.loadingDocs=[],s=0;s<i.length;s++)h=i[s],n.loadingDocs.push(s),n.upload=r.upload({url:t.documents.upload(),fields:{tenderId:n.tag,relatedEntityGuid:n.entityGuid,entityMeta:e,isVisibleForExternal:angular.isUndefined(n.showVisibilitySlider)?null:!0,uploadType:n.uploadType},file:h}).progress(function(){}).success(function(t){if(n.onDocumentUploaded)n.onDocumentUploaded({$document:t});n.loadingDocs.pop();n.documents=n.documents||[];n.documents.push(t);n.loadingDocs.length||o();u.addSuccessMessage(f("customTranslate")("DocumentList.UploadSucccess","File uploaded successfully"))}).error(function(n){u.addErrorMessage(f("customTranslate")("DocumentList.UploadFileError","Cannot upload file(s), ")+n)})},n.change=function(n){i.post(t.documents.updateVisibility(),n).success(function(){u.addSuccessMessage(f("customTranslate")("DocumentList.VisibleForVendor.Confirmation","Visibility for vendor changed."))})},n.deleteDocument=function(r){e(f("customTranslate")("DocumentList.ConfirmDelete","Are you sure you wish to delete this document?")).then(function(){i.get(t.documents.delete(r.Guid)).success(function(){n.onDocumentDeleted&&n.onDocumentDeleted();o()}).error(function(n){u.addErrorMessage(f("customTranslate")("DocumentList.DeleteFileError","Cannot delete file, ")+n)})})},n.onApiInit){s={documents:function(t){return(t||angular.isArray(t))&&n.$evalAsync(function(){n.documents=t;n.loadingDocs=[]}),n.documents}};n.onApiInit({$api:s})}}]);app.ng.directive("documentList",[function(){return{restrict:"A",transclude:!1,templateUrl:app.root+"/Scripts/App/DocumentList/DocumentList.html",scope:{entityGuid:"=",entityMeta:"=?",readOnly:"=",canDeleteDocs:"=",onDocumentUploaded:"&",onDocumentDeleted:"&",onApiInit:"&",documents:"=?",categories:"=",view:"=",showVisibilitySlider:"=",limit:"=",disableDelete:"=",uploadType:"=",tag:"=",showDownload:"="},controller:"App.Controller.DocumentList"}}]);app.ng.controller("App.Controller.EoiStatus",["$scope","$rootScope","urls","userSession","$http",function(n,t,i,r,u){n.urls=i;n.userSession=r;var f=n.model.ClosedDateTime;typeof f=="string"&&(f=new Date(f));n.canExpressInterest=f>new Date;n.expressInterest=function(n){u.post(i.eoi.api.createForSourcing(),n).success(function(t){t&&t.Id>0&&t.VendorResponses.length&&(n.MyVendorResponseId=t.VendorResponses[0].Id)})}}]);app.ng.directive("eoiStatus",[function(){return{restrict:"A",transclude:!1,templateUrl:app.root+"/Scripts/App/EoiStatus/EoiStatus.html",scope:{model:"="},controller:"App.Controller.EoiStatus"}}]);app.ng.controller("App.Controller.Error.401",["$rootScope","$scope","$state",function(n,t,i){i.go("main.Home")}]);app.ng.controller("App.Controller.FileUpload",["Upload","growl","$filter",function(n,t,i){var r=this;r.maxFileSize=app.FileUploadMaxFileSize;r.isCompact=r.isCompact||!1;angular.isArray(r.categories)&&(r.category=r.categories[0]);r.onManualFileSelect=function(n){r.onFileSelect(n)};r.onFileSelect=function(n){if(!r.checkErrors(n))r.onFileSelected({files:n,category:r.category})};r.checkErrors=function(n){for(var r,f=!1,u=0;u<n.length;u++)if(r=n[u],r.$error){switch(r.$error){case"maxSize":t.addErrorMessage(i("customTranslate")("FileUpload.MaxSizeReached","File max size: ")+r.$errorParam);break;case"pattern":t.addErrorMessage(i("customTranslate")("FileUpload.FileTypeNotAllowed","The selected file type is not allowed. Allowed file types are: ")+r.$errorParam)}f=!0}return f}}]);app.ng.directive("fileUpload",[function(){return{transclude:!0,replace:!0,templateUrl:app.root+"/Scripts/App/FileUpload/FileUpload.html",scope:{onFileSelected:"&",categories:"=",view:"=",allowMultiple:"=",whiteList:"=",tag:"=",isCompact:"="},controller:"App.Controller.FileUpload",controllerAs:"vm",bindToController:!0}}]);app.ng.controller("App.Controller.FormDocumentUploader",["$rootScope","urls","$http","Upload","$filter","$confirm",function(n,t,i,r,u,f){var e=this,o;e.urls=t;e.isCompact=e.isCompact||!1;e.uploadTypes=n.enums.UploadType;e.sectionAnswerUploadType=_.find(e.uploadTypes,function(n){return n.Key==="SectionAnswerResponse"}).Value;e.sectionColumnAnswerUploadType=_.find(e.uploadTypes,function(n){return n.Key==="SectionColumnAnswerResponse"}).Value;o=function(){i.get(t.documents.getWhiteList(),{}).success(function(n){e.whiteList=n})};o();e.removeDocument=function(n){f(u("customTranslate")("VendorResponse.Detail.Documents.ConfirmDelete","Are you sure you want to remove this document ?")).then(function(){var r={Documents:[n],EntityGuid:e.relatedEntityGuid,RequiredDocumentId:null,LotId:e.lotId,FormType:null};e.uploadType===e.sectionAnswerUploadType&&i.post(t.document.api.deleteSectionAnswerDocuments(),r).success(function(){e.onUploadedDocumentRemoved({answer:e.answer})});e.uploadType===e.sectionColumnAnswerUploadType?i.post(t.document.api.deleteSectionColumnAnswerDocuments(),r).success(function(){e.onUploadedDocumentRemoved({answer:e.answer})}):growl.addErrorMessage(u("customTranslate")("VendorResponse.Detail.Documents.CannotRemoveDocument","Cannot remove this document."))})};e.onUseSelectedDocuments=function(n){var r={Documents:n,EntityGuid:e.relatedEntityGuid,RequiredDocumentId:null,LotId:e.lotId,FormType:null};i.post(t.document.api.addExistingDocumentToEntity(),r).success(function(){e.onDocumentFromLibraryAdded({answer:e.answer})})};e.uploadFile=function(n){for(var u=0,i=0;i<n.length;i++)u++,r.upload({url:t.documents.upload(),fields:{relatedEntityGuid:e.relatedEntityGuid,requiredDocumentId:null,lotId:e.lotId,entityMeta:e.answer.TypeDisplayName,uploadType:e.uploadType,tenderId:e.tenderId},file:n[i]}).success(function(){if(--u==0)e.onDocumentUploaded({answer:e.answer})})}}]);app.ng.directive("formDocumentUploader",[function(){return{transclude:!0,replace:!0,templateUrl:app.root+"/Scripts/App/FormDocumentUploader/FormDocumentUploader.html",scope:{answer:"=",relatedEntityGuid:"=",lotId:"=?",editable:"=",uploadType:"=",tenderId:"=",onUploadedDocumentRemoved:"&",onDocumentUploaded:"&",onDocumentFromLibraryAdded:"&",isCompact:"="},controller:"App.Controller.FormDocumentUploader",controllerAs:"formDocUploaderVm",bindToController:!0}}]);app.ng.controller("App.Controller.FormPicker",["$scope","$rootScope",function(){var n=this;n.getFormDisplayName=function(n,t){var i=_.find(t,function(t){return t.Id===n});return angular.isObject(i)?i.Title:"N/A"};n.onChange=function(){n.callback(n.selectedFormId)}}]);app.ng.directive("formPicker",[function(){return{restrict:"E",templateUrl:app.root+"/Scripts/App/FormPicker/FormPicker.html",scope:{availableForms:"=",selectedFormId:"=",isRequired:"=",styleSmallInput:"=",callback:"="},controller:"App.Controller.FormPicker",controllerAs:"formPickerVm",bindToController:!0}}]);app.ng.controller("App.Controller.Help.Contact",["$scope","$rootScope","$sce",function(n,t,i){var r="<a href='mailt&#111;&#58;esou&#114;&#99;ing&#64;unop&#37;73&#46;&#111;%72&#37;67'>eS&#111;urcing HelpDesk<\/a>";n.getSupportEmail=function(){return i.trustAsHtml(r)}}]);app.ng.controller("App.Controller.Help.Faq",["$scope","$rootScope","$cookies","$http","urls","userSession",function(n,t,i,r,u,f){var e=this;e.urls=u;e.languageId=f.isAuthenticated()?window.app.userPreference.languageId:i.anonymousUserLanguage;r.get(e.urls.faq.api.getAll(e.languageId||1)).success(function(n){e.faqs=n});e.ToggleExpanded=function(n){angular.forEach(e.faqs,function(t,i){e.faqs[i].isExpanded=e.faqs[i].Number===n?!e.faqs[i].isExpanded:!1})};e.Initialise=function(){angular.forEach(e.faqs,function(n,t){e.faqs[t].isExpanded=!1})};e.Initialise()}]);app.ng.controller("App.Controller.Help.Guides",["$scope","$rootScope","$sce","$filter",function(n,t,i,r){var u=this;u.helpGuides=[{title:r("customTranslate")("External.Help.Guides.VendorGuide.English","Vendor guide"),file:app.root+"/Scripts/App/Help/Guides/UNOPS_eSourcing_Vendor Guide_v1.8_EN.pdf"},{title:r("customTranslate")("External.Help.Guides.VendorGuide.French","Guide pour fournisseurs"),file:app.root+"/Scripts/App/Help/Guides/UNOPS_eSourcing_Vendor Guide_v1.8_FR.pdf"},{title:r("customTranslate")("External.Help.Guides.VendorGuide.Spanish","Guía para proveedores"),file:app.root+"/Scripts/App/Help/Guides/UNOPS_eSourcing_Vendor Guide_v1.8_ES.pdf"}]}]);app.ng.controller("App.Controller.Help.Videos",["$scope","$rootScope","$sce","$filter","$modal",function(n,t,i,r,u){var f=this;f.videos={};f.videos.en=[{title:r("customTranslate")("External.Help.Videos.VendorWebinar","Vendor webinar"),url:"https://www.youtube.com/embed/ZbocSfjYnOU"},{title:r("customTranslate")("External.Help.Videos.SearchForTenderInUngm","Search for a UNOPS tender notice in UNGM"),url:"https://www.youtube.com/embed/PHdWhdWen0A"},{title:r("customTranslate")("External.Help.Videos.IntentionToSubmit","Inform UNOPS about your intention to submit a response"),url:"https://www.youtube.com/embed/Bpzd2M6ZauU"},{title:r("customTranslate")("External.Help.Videos.RequestClarification","Request a clarification on a tender"),url:"https://www.youtube.com/embed/Kx0jfl24v1E"},{title:r("customTranslate")("External.Help.Videos.SubmitResponse","Submit a response to a tender"),url:"https://www.youtube.com/embed/5N4t2kmNsgU"},{title:r("customTranslate")("External.Help.Videos.ManageVendorResponse","View, edit and withdraw a vendor response to a tender"),url:"https://www.youtube.com/embed/0OVRsrMPXi0"},{title:r("customTranslate")("External.Help.Videos.RespondToEvalClarification","Respond to UNOPS evaluation clarifications"),url:"https://www.youtube.com/embed/LfmYlRKBc7M"},{title:r("customTranslate")("External.Help.Videos.CheckTenderStatus","Check tender status"),url:"https://www.youtube.com/embed/__MSXSsARjE"}];f.videos.es=[{title:r("customTranslate")("External.Help.Videos.Es.SearchForTenderInUngm","ES | Buscar un anuncio de licitación de UNOPS en UNGM"),url:"https://www.youtube.com/embed/ZGhvD1qegao"},{title:r("customTranslate")("External.Help.Videos.Es.IntentionToSubmit","ES | Informar a UNOPS de su intención de presentar una respuesta a un anuncio"),url:"https://www.youtube.com/embed/PyHkt4WRBlI"},{title:r("customTranslate")("External.Help.Videos.Es.RequestClarification","ES | Solicitar una aclaración sobre un anuncio"),url:"https://www.youtube.com/embed/vrusZhOm_as"},{title:r("customTranslate")("External.Help.Videos.Es.SubmitResponse","ES | Presentar una respuesta a un anuncio"),url:"https://www.youtube.com/embed/m3WWfQA5_Yw"},{title:r("customTranslate")("External.Help.Videos.Es.ManageVendorResponse","ES | Ver, modificar o retirar una respuesta a un anuncio"),url:"https://www.youtube.com/embed/kyBZFm3842U"},{title:r("customTranslate")("External.Help.Videos.Es.RespondToEvalClarification","ES | Responda a las solicitudes de aclaración de UNOPS durante la evaluación"),url:"https://www.youtube.com/embed/iSCRcWSAsQ4"},{title:r("customTranslate")("External.Help.Videos.Es.CheckTenderStatus","ES | Consultar el estado de un anuncio"),url:"https://www.youtube.com/embed/WGUHgApSI9E"}];f.videos.fr=[{title:r("customTranslate")("External.Help.Videos.Fr.SearchForTenderInUngm","FR | Rechercher un avis de marché de l’UNOPS sur l’UNGM"),url:"https://www.youtube.com/embed/w7nuCJrlSHI"},{title:r("customTranslate")("External.Help.Videos.Fr.IntentionToSubmit","FR | Informer l'UNOPS de votre intention de soumettre ou non une réponse à l'avis"),url:"https://www.youtube.com/embed/0fyNZwVW31s"},{title:r("customTranslate")("External.Help.Videos.Fr.RequestClarification","FR | Demander une clarification sur un avis"),url:"https://www.youtube.com/embed/WfTug6wBTqc"},{title:r("customTranslate")("External.Help.Videos.Fr.SubmitResponse","FR | Soumettre une réponse à un avis"),url:"https://www.youtube.com/embed/XWXNU6i1JP4"},{title:r("customTranslate")("External.Help.Videos.Fr.ManageVendorResponse","FR | Voir, modifier ou retirer la réponse d'un fournisseur à un avis"),url:"https://www.youtube.com/embed/K7ZucOVKyfY"},{title:r("customTranslate")("External.Help.Videos.Fr.RespondToEvalClarification","FR | Répondre aux demandes de clarification de l'UNOPS"),url:"https://www.youtube.com/embed/zcct8rlI9Ho"},{title:r("customTranslate")("External.Help.Videos.Fr.CheckTenderStatus","FR | Consulter le statut des avis"),url:"https://www.youtube.com/embed/kLjX1pu1rm8"}];f.showVideo=function(n){u.open({windowClass:"modal-success",template:"<div><div class='modal-header'><h4>UNOPS eSourcing video<\/h4><\/div><div class='modal-body'><iframe width='420' height='315' src='"+n+"' frameborder='0' allowfullscreen><\/iframe><\/div><div class='modal-footer'><button class='btn btn-primary' ng-click='$close()' type='button'>Close<\/button><\/div><\/div>"})};f.oneAtATime=!0;f.status={isEnHeaderOpen:!1,isEsHeaderOpen:!1,isFrHeaderOpen:!1};f.heading={english:r("customTranslate")("External.Help.Videos.HeadingEnglish","English"),spanish:r("customTranslate")("External.Help.Videos.HeadingSpanish","Spanish"),french:r("customTranslate")("External.Help.Videos.HeadingFrench","French")};switch(angular.lowercase(t.userPreference.languageIso)){case"es":f.status.isEsHeaderOpen=!0;break;case"fr":f.status.isFrHeaderOpen=!0;break;default:f.status.isEnHeaderOpen=!0}}]);app.ng.controller("App.Controller.Home",["$scope","$rootScope","urls","$http","$cookies","userSession","growl","$filter",function(n,t,i,r,u,f,e,o){function l(){f.isAuthenticated()&&(s.search(),r.get(i.vendorResponse.api.getMyByState()).success(function(n){s.vrByState.Drafted=n.Drafted;s.vrByState.Submitted=n.Submitted}))}function a(){u.anonymousUserLanguage&&(s.loginFormData.LanguageId=parseInt(u.anonymousUserLanguage));f.login(s.loginFormData,h,c)}function h(){t.$broadcast("loginSuccess",{userName:s.loginFormData.Email})}function c(){s.loginFormData.Email="";s.loginFormData.Password="";e.addErrorMessage(o("customTranslate")("External.Login.LoginError","The email or password you entered is incorrect!"))}function v(){s.noResults=!1;r.get(i.vendorResponse.api.getMy(),{params:s.searchCriteria}).success(function(n){n.TotalCount===0&&(s.noResults=!0);s.results=n.Results;s.awardUrl=n.AwardUrl;s.totalCount=n.TotalCount})}function y(){s.search()}function p(n){s.sortDirection=s.sortField===n&&s.sortDirection==="+"?"-":"+";s.sortField=n;s.searchCriteria.SortFields=[s.sortDirection+s.sortField];s.search()}function w(){s.searchCriteria={Reference:null,Title:null,TenderStateExternal:null,IsResponseSubmitted:null,PublishedStartDate:null,PublishedEndDate:null,DeadlineStartDate:null,DeadlineEndDate:null,CurrentPage:1,PageSize:10,SortFields:s.sortDirection+s.sortField};s.totalCount=0}var s=this;s.urls=i;s.loginFormData={Email:"",Password:"",LanguageId:null};s.vrByState={Drafted:0,Submitted:0};s.sortField="ExpressionOfInterest.Tender.Deadline";s.sortDirection="-";s.searchCriteria={Reference:null,Title:null,IsTenderOpen:null,IsResponseSubmitted:null,PublishedStartDate:null,PublishedEndDate:null,DeadlineStartDate:null,DeadlineEndDate:null,CurrentPage:1,PageSize:10,SortFields:s.sortDirection+s.sortField};s.tenderStates=[{DisplayName:o("customTranslate")("External.MyResponses.TenderState.Open","Open"),Value:1},{DisplayName:o("customTranslate")("External.MyResponses.TenderState.Evaluation","Evaluation"),Value:2},{DisplayName:o("customTranslate")("External.MyResponses.TenderState.Finalised","Finalised"),Value:3}];s.submissionStates=[{DisplayName:o("customTranslate")("External.MyResponses.SubmissionState.Draft","Draft"),Value:!1},{DisplayName:o("customTranslate")("External.MyResponses.SubmissionState.Submitted","Submitted"),Value:!0}];s.load=l;s.login=a;s.processLoginSuccess=h;s.processLoginError=c;s.search=v;s.pageChanged=y;s.sortBy=p;s.clearCriteria=w;s.load()}]);window.app.ng.directive("itemList",[function(){return{restrict:"A",transclude:!0,templateUrl:app.root+"/Scripts/App/ItemList/ItemList.html",scope:{items:"=itemList",mode:"=?itemListMode",defaultMessage:"=?itemListDefaultMessage"}}}]);app.ng.directive("loader",[function(){return{restrict:"A",transclude:!0,template:"<div class='loader' ng-show='loading'><\/div>",scope:{},controller:["$scope",function(n){n.$on("loaderStart",function(){n.loading=!0});n.$on("loaderEnd",function(){n.$evalAsync(function(){n.loading=!1})})}]}}]);app.ng.controller("App.Controller.Login",["$scope","$rootScope","urls","growl","userSession","$filter","$cookies",function(n,t,i,r,u,f,e){n.urls=i;n.loginFormData={Email:"",Password:"",LanguageId:null};var o=function(){t.$broadcast("loginSuccess",{userName:n.loginFormData.Email})},s=function(){n.loginFormData.Email="";n.loginFormData.Password="";r.addErrorMessage(f("customTranslate")("External.Login.LoginError","The email or password you entered is incorrect!"))};n.login=function(){e.anonymousUserLanguage&&(n.loginFormData.LanguageId=parseInt(e.anonymousUserLanguage));u.login(n.loginFormData,o,s)}}]);app.ng.controller("App.Controller.LotOptionView",["$rootScope",function(n){var t=this;t.getLotOptionDisplayName=function(t){var i=_.find(n.enums.LotOption,function(n){return n.Value===t});return angular.isObject(i)?i.DisplayName:"N/A"};t.getLotDisplayName=function(n,t,i){var r=_.find(t,function(t){return t.Id===n});return angular.isObject(r)?i?r.DisplayName:r.DisplayNameExternal:"N/A"};t.showSpecificLot=function(n,t){return n==2&&t}}]);app.ng.directive("lotOptionView",[function(){return{restrict:"E",templateUrl:app.root+"/Scripts/App/LotOptionView/LotOptionView.html",scope:{availableLots:"=",lotOption:"=",lotId:"=",isInternal:"="},controller:"App.Controller.LotOptionView",controllerAs:"lotOptionViewVm"}}]);app.ng.controller("App.Controller.LotPicker",["$scope","$rootScope",function(){var n=this;n.getLotDisplayName=function(n,t){var i=_.find(t,function(t){return t.Id===n});return angular.isObject(i)?i.DisplayName:"N/A"};n.onChange=function(){n.callback(n.selectedLotId)}}]);app.ng.directive("lotPicker",[function(){return{restrict:"E",templateUrl:app.root+"/Scripts/App/LotPicker/LotPicker.html",scope:{availableLots:"=",selectedLotId:"=",isRequired:"=",styleSmallInput:"=",callback:"="},controller:"App.Controller.LotPicker",controllerAs:"lotPickerVm",bindToController:!0}}]);app.ng.controller("App.Controller.MultipleSelection",["$scope",function(n){n.isFirstInit=!0;n.optionChanged=function(t,i){if(t.target.checked?n.answers.push(i[n.valueFieldName].toString()):n.answers.splice(n.answers.indexOf(i[n.valueFieldName].toString()),1),n.onOptionChanged)if(angular.isFunction(n.$parent.onOptionChanged))n.$parent.onOptionChanged(n.answers);else n.onOptionChanged(n.answers)};n.isOptionChecked=function(t){return n.answers&&n.answers.indexOf(t[n.valueFieldName].toString())>-1?!0:!1};n.isOptionDisabled=function(t,i){if(n.selectedAndDisabledOptions){var r=JSON.parse(n.selectedAndDisabledOptions);if(r[0]==i[n.valueFieldName])return!0}return t}}]);app.ng.directive("multipleSelection",[function(){return{restrict:"A",templateUrl:app.root+"/Scripts/App/MultipleSelection/MultipleSelection.html",scope:{name:"@",isRequired:"=",isDisabled:"=",valueFieldName:"@",displayFieldName:"@",options:"=",selectedAndDisabledOptions:"@",onOptionChanged:"&"},controller:"App.Controller.MultipleSelection",require:"ngModel",link:function(n,t,i,r){r.$formatters.push(function(t){if(n.selectedAndDisabledOptions){var i=JSON.parse(n.selectedAndDisabledOptions),r=t?t.split(","):[];angular.forEach(i,function(n){r.indexOf(n)===-1&&(t?t+=","+n.toString():t=n.toString())})}return{answers:t?t.split(","):[]}});r.$render=function(){n.answers=r.$viewValue.answers};n.$watchCollection("answers",function(){r.$setViewValue({answers:n.answers})});r.$parsers.push(function(t){return n.isRequired&&(t.answers&&t.answers.length>0?r.$setValidity("required",!0):r.$setValidity("required",!1)),n.isFirstInit&&(r.$setPristine(),n.isFirstInit=!1),t.answers.toString()})}}}]);app.ng.controller("App.Controller.MyDocumentsPicker",["$scope","$rootScope","urls","$http","growl","Upload","$filter","$modal",function(n,t,i,r,u,f,e,o){n.isCompact=n.isCompact||!1;n.showModal=function(){n.modalInstance=o.open({scope:n,templateUrl:app.root+"/Scripts/App/MyDocumentsPicker/MyDocumentsPickerModal.html",controller:"App.Controller.MyDocumentsPickerModal",size:"lg",resolve:{}});n.modalInstance.result.then(function(t){if(t&&t.length)n.onUseSelectedDocuments({selectedDocuments:t})})}}]);app.ng.controller("App.Controller.MyDocumentsPickerModal",["$scope","$rootScope","urls","$http","growl","Upload","$filter","$confirm",function(n,t,i,r,u,f,e,o){n.urls=i;n.entityGuid=null;n.entityMeta=null;n.sortDirection="asc";n.myDocuments=n.myDocuments||[];n.isManageable=n.$parent.isManageable||!1;var s=function(){r.get(i.documents.getWhiteList(),{}).success(function(t){n.whiteList=t})};s();n.clearFilter=function(){n.filter={CurrentPage:1,PageSize:10,OrderBy:"Id"};n.search()};n.search=function(){n.filter.OrderBy=(n.sortField?n.sortField:"Id")+" "+(n.sortDirection?n.sortDirection:"");r.get(i.document.api.getDocumentsForVendor(),{params:n.filter}).success(function(t){n.results=t.Results;n.totalCount=t.TotalCount})};n.sortBy=function(t,i){t!==undefined&&(i=t+"."+i);n.sortField==i?n.sortDirection=n.sortDirection=="asc"?"desc":"asc":n.sortField=i;n.filter.CurrentPage=1;n.search()};n.pageChanged=function(){n.search()};n.clearFilter();n.delete=function(t){o(e("customTranslate")("External.Document.MyDocuments.Confirm.Delete","Are you sure you want to delete this document? This cannot be undone.")).then(function(){r.delete(i.document.api.delete(n.results[t].Id)).success(function(){n.results.splice(t,1);u.addSuccessMessage(e("customTranslate")("External.Document.MyDocuments.Success.Deleted","Document deleted."))})})};n.uploadFile=function(t){var r,o;for(n.loadingDocs=[],r=0;r<t.length;r++)o=t[r],n.loadingDocs.push(r),n.upload=f.upload({url:i.documents.upload(),fields:{tenderId:n.tag,relatedEntityGuid:n.entityGuid,entityMeta:n.entityMeta,uploadType:n.uploadType},file:o}).success(function(){n.loadingDocs.pop();n.loadingDocs.length||(u.addSuccessMessage(e("customTranslate")("External.Document.MyDocuments.Success.Uploaded","File(s) uploaded.")),n.clearFilter())})};n.select=function(t){var i=n.results[t],r=!1,u;n.country="";for(u in n.myDocuments)if(u.Id==i.Id){r=!0;break}r||n.myDocuments.push(i)};n.unSelect=function(t){n.myDocuments.splice(t,1)};n.useSelectedDocuments=function(){n.$close(n.myDocuments)}}]);app.ng.directive("myDocuments",[function(){return{restrict:"A",transclude:!1,templateUrl:app.root+"/Scripts/App/MyDocumentsPicker/MyDocumentsPickerModal.html",scope:{myDocuments:"=?",onUseSelectedDocuments:"&",isManageable:"="},controller:"App.Controller.MyDocumentsPickerModal"}}]);app.ng.directive("myDocumentsPicker",[function(){return{restrict:"A",transclude:!1,templateUrl:app.root+"/Scripts/App/MyDocumentsPicker/MyDocumentsPicker.html",scope:{myDocuments:"=?",onUseSelectedDocuments:"&",isManageable:"=",uploadType:"=",tag:"=",isCompact:"="},controller:"App.Controller.MyDocumentsPicker"}}]);app.ng.controller("App.Controller.Notice.Detail",["$scope","urls","$http","entityInfo","userSession","$state",function(n,t,i,r,u,f){i.get(t.notice.api.getVendorResponseId(r.id)).success(function(n){f.go("main.VendorResponse.TenderInfo.GeneralInfo",{id:n})})}]);app.ng.controller("App.Controller.Notice.Search",["$scope","$rootScope","urls","$http","$filter","growl",function(n,t,i,r,u,f){var e={All:0,Eoi:1,Rfp:2,Rfq:4,Itb:8,Rpq:16,Rfi:32,Gsp:64,Notset:128};n.columns=[{displayName:"Title",entityName:"Title",width:"col-sm-3",hasInfoLink:!0},{displayName:"Deadline",entityName:"ClosedDateTime",width:"col-sm-2",hasInfoLink:!1},{displayName:"Published",entityName:"PublishedDateTime",width:"col-sm-2",hasInfoLink:!1},{displayName:"Type of notice",entityName:"NoticeTypeDisplayText",width:"col-sm-2",hasInfoLink:!1},{displayName:"Reference",entityName:"Reference",width:"col-sm-1",hasInfoLink:!1},{displayName:"Beneficiary country",entityName:"BeneficiaryCountries",width:"col-sm-2",hasInfoLink:!1}];n.paginationInfo={totalItems:0,pageSize:10,maxSize:10,currentPage:1};n.filterFormControl={dpToday:null,dpPubStartDateMax:null,cbNotSetSelected:!1,cbItbSelected:!1,cbRfpSelected:!1,cbRpqSelected:!1,cbEoiSelected:!1,cbRfqSelected:!1,cbRfiSelected:!1,txtMaxLength:250,btMoreCriteriaDisplayed:!1,cpCountries:[]};n.filterInfo={Title:"",Description:"",Reference:"",PublishedStartDate:null,PublishedEndDate:n.filterFormControl.dpToday,DeadlineStartDate:n.filterFormControl.dpToday,DeadlineEndDate:null,BeneficiaryCountryIds:[],NoticeTypes:e.All,SortField:n.columns[2].entityName,SortAscending:!1,PageIndex:n.paginationInfo.currentPage,PageSize:n.paginationInfo.pageSize};n.sourcingNotices=null;var o=function(){r.post(i.getSourcingsNotice(),n.filterInfo).success(function(t){n.paginationInfo.totalItems=t.Total;n.sourcingNotices=t.CurrentSourcingNotices}).error(function(n){f.addErrorMessage("Cannot get data from server, "+n.ExceptionMessage)})},h=function(){var t=new Date;t.setHours(0,0,0,0);n.sourcingNotices=null;n.paginationInfo.currentPage=1;n.paginationInfo.totalItems=0;n.filterFormControl.dpToday=t;n.filterFormControl.dpPubStartDateMax=null;n.filterFormControl.cbNotSetSelected=!1;n.filterFormControl.cbItbSelected=!1;n.filterFormControl.cbRfpSelected=!1;n.filterFormControl.cbRpqSelected=!1;n.filterFormControl.cbEoiSelected=!1;n.filterFormControl.cbRfqSelected=!1;n.filterFormControl.cbRfiSelected=!1;n.filterFormControl.cpCountries=[];n.filterInfo.Title="";n.filterInfo.Description="";n.filterInfo.Reference="";n.filterInfo.PublishedStartDate=null;n.filterInfo.PublishedEndDate=null;n.filterInfo.DeadlineStartDate=null;n.filterInfo.DeadlineEndDate=null;n.filterInfo.BeneficiaryCountryIds=[];n.filterInfo.NoticeTypes=e.All;n.filterInfo.SortField=n.columns[2].entityName;n.filterInfo.SortAscending=!1;n.filterInfo.PageIndex=n.paginationInfo.currentPage;n.filterInfo.PageSize=n.paginationInfo.pageSize},s=function(){var t=new Date,i;t.setHours(0,0,0,0);i=new Date;i.setHours(23,59,59,999);n.filterFormControl.dpToday=t;n.filterFormControl.dpPubStartDateMax=t;n.filterInfo.PublishedEndDate=i;n.filterInfo.DeadlineStartDate=t;o()};s();n.sortBy=function(t){n.filterInfo.SortField===t?n.filterInfo.SortAscending=!n.filterInfo.SortAscending:(n.filterInfo.SortField=t,n.filterInfo.SortAscending=!0);o()};n.pageChanged=function(){n.filterInfo.PageIndex=n.paginationInfo.currentPage;o()};n.pageSizeChanged=function(t){n.paginationInfo.pageSize=parseInt(t,10);n.filterInfo.PageIndex=1;n.filterInfo.PageSize=n.paginationInfo.pageSize;o()};n.onClearCriteriaClicked=function(){h();s()};n.onSearchClicked=function(){if(n.filterInfo.NoticeTypes=e.All,n.filterFormControl.cbNotSetSelected&&(n.filterInfo.NoticeTypes|=e.Notset),n.filterFormControl.cbItbSelected&&(n.filterInfo.NoticeTypes|=e.Itb),n.filterFormControl.cbRfpSelected&&(n.filterInfo.NoticeTypes|=e.Rfp),n.filterFormControl.cbRpqSelected&&(n.filterInfo.NoticeTypes|=e.Rpq),n.filterFormControl.cbEoiSelected&&(n.filterInfo.NoticeTypes|=e.Eoi),n.filterFormControl.cbRfqSelected&&(n.filterInfo.NoticeTypes|=e.Rfq),n.filterFormControl.cbRfiSelected&&(n.filterInfo.NoticeTypes|=e.Rfi),n.filterInfo.BeneficiaryCountryIds=[],n.filterFormControl.cpCountries){for(var i=!1,t=0;t<n.filterFormControl.cpCountries.length;t++)(n.filterInfo.BeneficiaryCountryIds[t]=n.filterFormControl.cpCountries[t].Id)===0&&(i=!0);t>0&&!i&&(n.filterInfo.BeneficiaryCountryIds[t]=0)}n.filterInfo.PageIndex=n.paginationInfo.currentPage;n.filterInfo.PageSize=n.paginationInfo.pageSize;o()};n.getNoticeInfo=function(n,i){var r,u;if(i.entityName==="BeneficiaryCountries"){for(r="",u=0;u<n.BeneficiaryCountries.length;u++)r.length>0&&(r+=", "),r+=n.BeneficiaryCountries[u][t.userPreference.language];return r}return i.entityName==="ClosedDateTime"?n.ClosedDateTime:i.entityName==="PublishedDateTime"?n.PublishedDateTime:i.entityName==="Reference"?n.Reference:n[i.entityName]};n.getNoticeLink=function(n){return i.entity("Notice",n.NoticeId)};n.displayMoreCriteria=function(){n.filterFormControl.btMoreCriteriaDisplayed=!0};n.hideMoreCriteria=function(){n.filterFormControl.btMoreCriteriaDisplayed=!1};n.onCountrySelected=function(t){n.filterFormControl.cpCountries=t};n.$watch("filterInfo.PublishedEndDate",function(){n.filterFormControl.dpPubStartDateMax=n.filterInfo.PublishedEndDate instanceof Date?n.filterInfo.PublishedEndDate:n.filterFormControl.dpToday})}]);app.ng.controller("App.Controller.NotificationInbox.Search",["$filter","$http","urls",function(n,t,i){var r=this,u=null;r.appName="UNOPS eSourcing";r.columnHeaders=[{entityName:"Subject",displayName:n("customTranslate")("External.Inbox.SubjectHeader","Subject"),width:"50%",hasInfoLink:!1,isDateTime:!1},{entityName:"From",displayName:n("customTranslate")("External.Inbox.FromHeader","From"),width:"15%",hasInfoLink:!1,isDateTime:!1},{entityName:"CreatedDate",displayName:n("customTranslate")("External.Inbox.DateHeader","Date"),width:"15%",hasInfoLink:!1,isDateTime:!0},{entityName:"Reference",displayName:n("customTranslate")("External.Inbox.ReferenceHeader","Tender reference"),width:"20%",hasInfoLink:!0,isDateTime:!1}];var o=function(){var n=new Date;return n.setHours(0,0,0,0),{dpToday:n,txtInputMaxLength:250}},e=function(){return{totalItems:0,pageSize:10,maxSize:10,currentPage:1}},s=function(){var n=e();return{ReceivedStartDate:null,ReceivedEndDate:null,Subject:"",Reference:"",SortField:r.columnHeaders[2].entityName,SortAscending:!1,PageIndex:n.currentPage,PageSize:n.pageSize}},f=function(){u=null;t.get(i.getUserNotifications(),{params:r.filterInfo}).success(function(n){r.paginationInfo.totalItems=n.Total;r.notifications=n.Notifications})};r.pageChanged=function(){r.filterInfo.PageIndex=r.paginationInfo.currentPage;f()};r.pageSizeChanged=function(n){r.paginationInfo.pageSize=parseInt(n,10);r.filterInfo.PageIndex=1;r.filterInfo.PageSize=r.paginationInfo.pageSize;f()};r.onClearCriteriaClicked=function(){r.notifications=null;r.filterFormControl=o();r.paginationInfo=e();r.filterInfo=s();f()};r.onSearchClicked=function(){r.filterInfo.PageIndex=r.paginationInfo.currentPage;r.filterInfo.PageSize=r.paginationInfo.pageSize;f()};r.sortBy=function(n){n!="Reference"&&(r.filterInfo.SortField===n?r.filterInfo.SortAscending=!r.filterInfo.SortAscending:(r.filterInfo.SortField=n,r.filterInfo.SortAscending=!0),f())};r.getNotificationInfoLink=function(n,t){return t.hasInfoLink&&t.entityName==="Reference"?n.TenderUrl:""};r.getNotificationInfo=function(n,t){return t.entityName==="Subject"?n.Subject:t.entityName==="From"?r.appName:t.entityName==="CreatedDate"?n.CreatedDate:t.entityName==="Reference"?n.Reference:""};r.getNotificationMsg=function(n){return n.Body};r.toggleShowBody=function(n){angular.isObject(u)&&u!==n&&(u.showBody=!1);u=n;u.showBody=u.showBody?!1:!0};r.onClearCriteriaClicked()}]);app.ng.controller("App.Controller.Root",["$scope","$rootScope","urls","$state","$cookies","growl","userSession","$filter","$timeout","$http",function(n,t,i,r,u,f,e,o,s,h){var c,l,a;n.languages=window.app.Languages;n.userPreference=window.app.userPreference;n.urls=i;n.isAuthenticated=!1;n.username="";c=function(){e.isAuthenticated()?(n.username=e.getUserName(),n.isAuthenticated=!0):e.isExpired()&&(n.isAuthenticated=!1,n.username="",f.addErrorMessage(o("customTranslate")("External.Login.SessionExpired","Your session has expired! Please log in again.")),e.clear())};c();l=function(){n.isAuthenticated=!1;n.username="";f.addWarnMessage(o("customTranslate")("External.Login.LoginSuccessful","You are successfully logged out!"));i.go(i.root())};a=function(){};n.$on("loginSuccess",function(){t.$broadcast("loaderStart");s(n.redirectToTarget,200)});n.onLogoutClicked=function(){var n={UserName:this.$parent.username};e.logout(n,l,a)};n.redirectToTarget=function(){t.returnToState?(r.go(t.returnToState,t.returnToStateParams,{location:"replace"}),s(n.delayedReload,200)):i.go(i.loginSuccess())};n.delayedReload=function(){window.location.reload()};n.viewMessageInbox=function(){r.go("main.NotificationInbox")};n.changeLanguage=function(n,r){u.anonymousUserLanguage=n;t.$broadcast("loaderStart");r?h.post(i.preferences(),n).success(function(){t.$broadcast("loaderStart");window.location.reload()}):window.location.reload()}}]);app.ng.factory("appUtils",["urls","$http","$rootScope",function(n,t,i){var r=function(){var n=[],t=[],r=[],u=[],f=[];this.getQuestionTypeEnum=function(){var t,r;if(n.length<=0)for(t=0;t<i.enums.QuestionType.length;t++)r=i.enums.QuestionType[t],n[r.Key]={Value:r.Value,DisplayName:r.DisplayName};return n};this.getSectionTypeEnum=function(){var n,r;if(t.length<=0)for(n=0;n<i.enums.SectionType.length;n++)r=i.enums.SectionType[n],t[r.Key]={Value:r.Value,DisplayName:r.DisplayName};return t};this.getSectionColumnTypeEnum=function(){var n,t;if(r.length<=0)for(n=0;n<i.enums.SectionColumnType.length;n++)t=i.enums.SectionColumnType[n],r[t.Key]={Value:t.Value,DisplayName:t.DisplayName};return r};this.getDimensionOptionAnswerEnum=function(){var n,t;if(u.length<=0)for(n=0;n<i.enums.DimensionOptionAnswerType.length;n++)t=i.enums.DimensionOptionAnswerType[n],u[t.Key]={Value:t.Value,DisplayName:t.DisplayName};return u};this.getClarificationRequestCategoryEnum=function(){var n,t;if(f.length<=0)for(n=0;n<i.enums.ClarificationRequestCategory.length;n++)t=i.enums.ClarificationRequestCategory[n],f[t.Key]={Value:t.Value,DisplayName:t.DisplayName};return f}};return new r}]);app.ng.service("urls",["config",function(){this.root=function(){return app.root};this.go=function(n){window.location.href=n};this.entity=function(n,t){return app.root+"/#/"+n+"/"+t};this.editEntity=function(n,t){return app.root+"/#/"+n+"/"+t+"/Edit"};this.help=function(){return app.root+"/#/Help"};this.helpGuides=function(){return app.root+"/#/Help/Guides"};this.privacyNotice=function(){return app.root+"/#/PrivacyNotice"};this.login=function(){return app.root+"/#/Login"};this.loginSuccess=function(){return app.root};this.logoutSuccess=function(){return app.root+"/#/LogoutSuccess"};this.ungmLogin=function(){return app.root+"/Api/Account/LoginUngm"};this.ungmUserInfo=function(){return app.root+"/Api/Account/UserInformationUngm"};this.ungmLogout=function(){return app.root+"/Api/Account/LogoutUngm"};this.getUserNotifications=function(){return app.root+"/Api/Account/GetUserNotifications"};this.documents={upload:function(){return app.root+"/Document/Upload"},download:function(n){return app.root+"/Document/Download?guid="+n},view:function(n){return"https://drive.google.com/file/d/"+n+"/view"},viewFolder:function(n){return"https://drive.google.com/drive/folders/"+n},zippedForEntity:function(n){return app.root+"/Document/GetZippedForEntity/?entityGuid="+n},zippedForRequiredDocument:function(n,t,i){var r=app.root+"/Document/GetZippedForRequiredDocument/?entityGuid="+n+"&requiredDocumentId="+t;return angular.isNumber(i)&&(r=r+"&lotId="+i),r},getWhiteList:function(){return app.root+"/Api/Document/GetWhiteList"},forEntity:function(n){return app.root+"/Api/Document/GetForEntity?entityGuid="+n}};this.viewActiveNotices=function(){return app.root+"/#/Notices"};this.myTenders=function(){return app.root+"/#/Responses"};this.notice={api:{getVendorResponseId:function(n){return app.root+"/Api/Notice/GetVendorResponseId?noticeId="+n}}};this.clarificationRequest={api:{getForVendor:function(n){return app.root+"/Api/ClarificationRequest/GetForVendor?tenderId="+n}}};this.newClarificationRequest=function(n){return app.root+"/#/ClarificationRequest/New/"+n};this.removeClarificationRequest=function(n){return app.root+"/Api/ClarificationRequest/Delete/"+n};this.getSourcingsNotice=function(){return app.root+"/Api/Notice/SearchNotice"};this.searchCountries=function(){return app.root+"/Api/Country/Search"};this.api={createNew:function(n){return app.root+"/Api/"+n.name+"/New"},update:function(n){return app.root+"/Api/"+n.name+"/Update"},get:function(n){return app.root+"/Api/"+n.name+"/"+n.id},all:function(n){return app.root+"/Api/"+n.name+"/All"}};this.document={myDocuments:function(){return app.root+"/#/MyDocuments"},api:{getDocumentsForVendor:function(){return app.root+"/Api/Document/GetDocumentsForVendor"},"delete":function(n){return app.root+"/Api/Document/Delete/"+n},addExistingDocumentToEntity:function(){return app.root+"/Api/Document/AddExistingDocumentsToEntity"},deleteDocuments:function(){return app.root+"/Api/Document/DeleteDocuments"},deleteSectionAnswerDocuments:function(){return app.root+"/Api/Document/DeleteSectionAnswerDocuments"},deleteSectionColumnAnswerDocuments:function(){return app.root+"/Api/Document/DeleteSectionColumnAnswerDocuments"},getForRequiredDocument:function(n,t,i){var r=app.root+"/Api/Document/GetForRequiredDocument?entityGuid="+n+"&requiredDocumentId="+t;return angular.isNumber(i)&&(r=r+"&lotId="+i),r},getForSectionAnswer:function(n){return app.root+"/Api/Document/GetForSectionAnswer?entityGuid="+n},getForSectionColumnAnswer:function(n){return app.root+"/Api/Document/GetForSectionColumnAnswer?entityGuid="+n}}};this.eoi={detail:function(n){return app.root+"/#/ExpressionOfInterest/"+n},myEoi:function(){return app.root+"/#/MyExpressionsOfInterest"},api:{createForSourcing:function(){return app.root+"/Api/ExpressionOfInterest/CreateForSourcing"},getMy:function(){return app.root+"/Api/ExpressionOfInterest/GetMy"},"delete":function(n){return app.root+"/Api/ExpressionOfInterest/Delete/"+n},undelete:function(){return app.root+"/Api/ExpressionOfInterest/Undelete"}}};this.ungm={root:function(){return app.ungmRoot},notice:function(n){return app.ungmNoticeRoot+n},register:function(){return app.ungmRegistrationUrl}};this.vendorResponse={detail:function(n){return app.root+"/#/VendorResponse/"+n},myResponses:function(){return app.root+"/#/Responses"},alternativeResponses:function(n,t){return app.root+"/#/VendorResponse/"+n+"/AlternativeOffer/"+t},api:{"new":function(){return app.root+"/Api/VendorResponse/New"},updateQuestionnaireAnswers:function(){return app.root+"/Api/VendorResponse/UpdateQuestionnaireAnswers"},updateFormAnswers:function(){return app.root+"/Api/VendorResponse/UpdateFormAnswers"},addPlaceHolderSectionColumnAnswer:function(){return app.root+"/Api/VendorResponse/AddPlaceHolderSectionColumnAnswer"},removeSectionColumnAnswer:function(){return app.root+"/Api/VendorResponse/RemoveSectionColumnAnswer"},submit:function(){return app.root+"/Api/VendorResponse/Submit"},withdraw:function(){return app.root+"/Api/VendorResponse/Withdraw"},get:function(n){return app.root+"/Api/VendorResponse/Get/"+n},getVendorResponseLotsByForm:function(){return app.root+"/Api/VendorResponse/GetVendorResponseLotsByForm"},getVendorResponseForms:function(){return app.root+"/Api/VendorResponse/GetVendorResponseForms"},getVendorResponseForm:function(){return app.root+"/Api/VendorResponse/GetVendorResponseForm"},getMy:function(){return app.root+"/Api/VendorResponse/GetMy"},getMyByState:function(){return app.root+"/Api/VendorResponse/GetMyByState"},getTender:function(n){return app.root+"/Api/VendorResponse/GetTender?responseId="+n},getTenderCurrencies:function(n){return app.root+"/Api/VendorResponse/GetTenderCurrencies?responseId="+n},"delete":function(n){return app.root+"/Api/VendorResponse/Delete/"+n},postComment:function(n){return app.root+"/Api/VendorResponseClarification/"+n+"/Comments"},getSummary:function(n){return app.root+"/Api/VendorResponse/Summary?vendorResponseid="+n},createAlternativeResponse:function(n){return app.root+"/Api/VendorResponse/"+n+"/CreateAlternativeResponse"},getGeneralRequiredDocuments:function(n){return app.root+"/Api/VendorResponse/GetGeneralRequiredDocsForVendorResponse?vendorResponseId="+n}}};this.lot={api:{getForVendorResponse:function(n){return app.root+"/Api/Lot/GetForVendorResponse?vendorResponseId="+n},searchForVendorResponse:function(){return app.root+"/Api/Lot/SearchForVendorResponse"},hasOtherBidedLots:function(){return app.root+"/Api/Lot/HasOtherBidedLots"},update:function(){return app.root+"/Api/Lot/UpdateForVendorResponse"},toggleLotIntents:function(){return app.root+"/Api/Lot/ToggleLotIntents"}}};this.financialDetail={detail:function(n){return app.root+"/#/VendorResponse/"+n+"/FinancialDetails"},api:{get:function(n){return app.root+"/Api/FinancialDetail/Get/"+n},getList:function(n){return app.root+"/Api/FinancialDetail/GetByVendorResponseId/"+n},search:function(){return app.root+"/Api/FinancialDetail/SearchByVendorResponseId"},update:function(){return app.root+"/Api/FinancialDetail/Update"}}};this.time={api:{getCurrent:function(n){return app.root+"/Api/Time/GetCurrent/?d="+n}}};this.printPreview={vendorResponse:function(n){return app.root+"/#/VendorResponse/"+n+"/PrintPreview"},api:{getVendorResponse:function(n){return app.root+"/Api/PrintPreview/GetVendorResponse/"+n}}};this.vendorConfirmation={api:{getByVendorResponseId:function(n){return app.root+"/Api/VendorConfirmation/GetByVendorResponseId?vendorResponseId="+n},newPerLot:function(){return app.root+"/Api/VendorConfirmation/NewPerLot"}}};this.faq={api:{getAll:function(n){return app.root+"/Api/Faq/GetAll?languageId="+n}}};this.tenderFaq={api:{getAll:function(n,t){return app.root+"/Api/TenderFaq/GetAll?languageId="+n+"&tenderId="+t}}};this.preferences=function(){return app.root+"/Api/Preferences/SetLanguage"};this.form={api:{getFormsForVendorResponse:function(n){return app.root+"/Api/Form/GetFormsForVendorResponse?vendorResponseId="+n}}};this.tender={api:{getTenderIsPilot:function(n){return app.root+"/Api/Tender/IsPilot/"+n}}}}]);app.ng.service("translations",["$http","$timeout",function(n,t){window.pendingQueue||(window.pendingQueue=[]);var i=function(){for(var t=0;t<pendingQueue.length;t++)n.post(app.root+"/Api/StringResource/New",pendingQueue[t],{noLoader:!0})};this.getFromQueue=function(n){for(var t=0;t<pendingQueue.length;t++)if(pendingQueue[t].Key===n)return pendingQueue[t];return null};this.persist=function(n){this.getFromQueue(n.Key)||(pendingQueue.push(n),pendingQueue.length===1&&t(i,1e3))}}]);app.ng.factory("userSession",["urls","$http","$rootScope","$cookies","$window",function(n,t,i,r){var u=function(){function f(){var n=r.authenticationToken;return!(angular.isUndefined(n)||n===null||n==="")}function u(){switch(r.userSessionStatus){case i.authenticated:f()||(r.userSessionStatus=i.expired,r.userName="");break;case i.unauthenticated:case i.expired:f()&&(r.userSessionStatus=i.authenticated);break;default:r.userSessionStatus=i.unauthenticated;r.userName=""}}var i={unauthenticated:"1",authenticated:"2",expired:"3"};this.login=function(u,f,e){t.post(n.ungmLogin(),u).success(function(){r.userName=u.Email;r.userSessionStatus=i.authenticated;f()}).error(e)};this.logout=function(i,r,u){this.clear();t.post(n.ungmLogout(),i).success(r).error(u)};this.isUnauthenticated=function(){return u(),r.userSessionStatus===i.unauthenticated};this.isAuthenticated=function(){return u(),r.userSessionStatus===i.authenticated};this.isExpired=function(){return u(),r.userSessionStatus===i.expired};this.clear=function(){r.userSessionStatus=i.unauthenticated;r.userName=""};this.getUserName=function(){return r.userName}};return new u}]);app.ng.controller("App.Controller.ExpressionOfInterest.Detail",["urls","$http","entityInfo",function(n,t,i){var r=this;t.get(n.api.get(i)).success(function(n){r.eoi=n})}]);app.ng.controller("App.Controller.VendorResponse.AlternativeOffer",["urls","$http","entityInfo",function(n,t,i){var r=this;r.hasDraftAlternativeResponse=!1;t.get(n.api.get(i)).success(function(n){if(r.venderResponse=n,r.hasAlternativeOffer=r.venderResponse.AlternativeResponses!==null&&r.venderResponse.AlternativeResponses.length>0,r.hasAlternativeOffer)for(var t=0;t<r.venderResponse.AlternativeResponses.length;t++)if(!r.venderResponse.AlternativeResponses[t].IsSubmitted){r.hasDraftAlternativeResponse=!0;break}})}]);app.ng.controller("App.Controller.VendorResponse.Detail",["$scope","$rootScope","urls","$http","entityInfo","growl","appUtils","$filter","Upload","$window","$state","userSession","$confirm",function(n,t,i,r,u,f,e,o,s,h,c,l,a){n.urls=i;n.freeTextAnswerMaxLength=2e3;n.numericAnswerStep=1e-5;n.questionTypes=t.enums.QuestionType;n.questionTypeEnum=e.getQuestionTypeEnum();n.sectionTypes=t.enums.SectionType;n.sectionTypeEnum=e.getSectionTypeEnum();t.entityInfo=u;n.myDocuments=[];n.forms={};n.appRoot=app.root;n.$state=c;n.vendorResponse={};n.vendorResponse.userSession=l;r.get(i.vendorResponse.api.getTender(u.id)).success(function(t){n.vendorResponse.tender=t});var v=function(){n.blockers=[];r.get(i.vendorResponse.api.getSummary(u.id)).success(function(t){n.summary=t;n.summary.NumQuestionsAnswered<n.summary.NumQuestionsRequired&&n.blockers.push(o("customTranslate")("VendorResponse.Submit.Blockers.Questionnaires","You must answer all mandatory questions under the questionnaires tab"));n.summary.NumSectionsAnswered<n.summary.NumSectionsRequired&&n.blockers.push(o("customTranslate")("VendorResponse.Submit.Blockers.Sections","You must answer all mandatory sections under the forms tab"));n.summary.NumSupplierSectionsAnswered<n.summary.NumSupplierSectionsRequired&&n.blockers.push(o("customTranslate")("VendorResponse.Submit.Blockers.SupplierSections","You must answer all mandatory sections under the supplier forms tab"));n.summary.NumTenderSectionsAnswered<n.summary.NumTenderSectionsRequired&&n.blockers.push(o("customTranslate")("VendorResponse.Submit.Blockers.TenderSections","You must answer all mandatory sections under the tender forms tab"));n.summary.NumLotGenericSectionsAnswered<n.summary.NumLotGenericSectionsRequired&&n.blockers.push(o("customTranslate")("VendorResponse.Submit.Blockers.LotGenericSections","You must answer all mandatory sections under the lot-generic forms tab"));n.summary.NumLotSpecificSectionsAnswered<n.summary.NumLotSpecificSectionsRequired&&n.blockers.push(o("customTranslate")("VendorResponse.Submit.Blockers.LotSpecificSections","You must answer all mandatory sections under the lot-specific forms tab"));n.summary.NumDocumentsRequiredEntered<n.summary.NumDocumentsRequired&&n.blockers.push(o("customTranslate")("VendorResponse.Submit.Blockers.Documents","You must upload all mandatory documents under the documents tab"));(n.summary.HasLots||n.summary.HasHighNumOfLots)&&!n.summary.HasLotBid&&n.blockers.push(o("customTranslate")("VendorResponse.Submit.Blockers.NoBids","You must bid for at least one lot"));n.summary.NumFinancialDetailEntered<n.summary.NumFinancialDetailRequired&&n.blockers.push(o("customTranslate")("VendorResponse.Submit.Blockers.FinancialDetails","You must complete all information under the financial details tab"));n.summary.NumFinancialEnvelopesRequiredEntered<n.summary.NumFinancialEnvelopesRequired&&n.blockers.push(o("customTranslate")("VendorResponse.Submit.Blockers.FinancialEnvelopes","You must upload all mandatory financial envelopes under the financial details tab"));n.summary.OriginalVendorResponseId!=null&&n.summary.IsOriginalVendorResponseSubmitted==!1&&n.blockers.push(o("customTranslate")("VendorResponse.Submit.Blockers.AlternativeOfferSubmissions","You must submit an original offer prior to alternative offers"))})};v();n.$on("reloadVendorResponseSummary",v);n.delete=function(){a(o("customTranslate")("VendorResponse.Detail.ConfirmDelete","Are you sure you want to delete this submission? This cannot be undone.")).then(function(){r.delete(i.vendorResponse.api.delete(n.summary.Id)).success(function(){f.addSuccessMessage(o("customTranslate")("VendorResponse.Detail.Message.Deleted","Submission deleted."));c.go("main.Responses")})})};n.printPreview=function(){h.open(i.printPreview.vendorResponse(n.summary.Id))};n.createAlternativeResponse=function(n){a(o("customTranslate")("VendorResponse.Confirm.CreateAlternativeResponse","Are you sure you want to submit an alternative offer?")).then(function(){r.post(i.vendorResponse.api.createAlternativeResponse(n)).success(function(n){f.addSuccessMessage(o("customTranslate")("VendorResponse.Detail.Message.CreateAlternativeResponse","Alternative response has been created."));c.go("main.VendorResponse.Overview",{vendorResponseId:n,id:n})})})};n.isNumericStage=function(n){switch(n){case 1:case 2:case 3:case 4:return!1;case 5:case 6:return!0}};n.getGroupSum=function(n){for(var i=0,t=0;t<n.items.length;t++)i+=n.items[t].Score;return i};n.isNotNumericStageFilter=function(){return function(t){return!n.isNumericStage(t.Stage)}};n.isNumericStageFilter=function(){return function(t){return n.isNumericStage(t.Stage)}}}]);app.ng.controller("App.Controller.VendorResponse.Documents",["$rootScope","urls","$http","entityInfo","$filter","growl","Upload",function(n,t,i,r,u,f){var e=this,o;e.urls=t;i.get(t.vendorResponse.api.getGeneralRequiredDocuments(r.id)).success(function(n){e.vendorResponseDoc=n});o=function(r,u){i.get(t.document.api.getForRequiredDocument(e.vendorResponseDoc.VendorResponsGuid,r.Id,u)).success(function(t){r.myDocuments=[];r.Documents=t;n.$broadcast("reloadVendorResponseSummary",{})})};e.onDocumentRemoved=function(n,t){f.addSuccessMessage(u("customTranslate")("VendorResponse.Detail.Documents.Deleted","Document removed."));o(n,t)};e.onDocumentFromLibraryAdded=function(n,t){o(n,t)};e.onDocumentUploaded=function(n,t){f.addSuccessMessage(u("customTranslate")("External.VendorResponse.Document.Success.Uploaded","File(s) uploaded."));o(n,t)};e.getLotTitle=function(n){return angular.isObject(n)?n.Number>0?"Lot "+n.Number+" - "+n.Name:n.Name:u("customTranslate")("External.VendorResponse.Detail.RequiredDocumentLegend","Required documents")};e.filterForNoLot=function(){return function(n){return n.LotOption===null}};e.filterForMainTenderLot=function(){return function(n){return n.LotOption===1}};e.filterForEveryLotAndSpecificLot=function(n){return function(t){return t.LotOption===2||t.LotOption===3&&t.LotId===n.Id}}}]);app.ng.controller("App.Controller.VendorResponse.FinancialDetail",["$rootScope","urls","$http","entityInfo","$filter","growl","_","appUtils",function(n,t,i,r,u,f,e,o){function c(n){return Number(n)}function l(n,t){return s.dimensionOptionAnswerTypeEnum[t]&&n.ColumnDimensionOptionAnswerType===s.dimensionOptionAnswerTypeEnum[t].Value}function a(){return app.FreeTextDimensionOptionAnswerMaxChar}var s=this,h;s.currencies=app.Currencies;s.urls=t;s.enums=n.enums;s.defaultTextareaMaxChar=app.DefaultTextareaMaxChar;s.uploadType=1;s.selectedFinancialDetail=[];s.selectedIndex=-1;s.filter={};s.financialDetailSearchResult={};s.filter.CurrentPage=1;s.filter.PageSize=app.FinancialDetailLotsPageSize;i.get(t.vendorResponse.api.getTenderCurrencies(r.vendorResponseId)).success(function(n){s.allCurrencies=n});s.dimensionOptionAnswerTypeEnum=o.getDimensionOptionAnswerEnum();s.parseStringToNumber=c;s.isDimensionOptionAnswerOfType=l;s.getFreeTextDimensionOptionAnswerMaxChar=a;h=function(){s.filter.OrderBy=s.sortField?s.sortField+" "+(s.sortDirection?s.sortDirection:""):"";s.filter.VendorResponseId=r.vendorResponseId;i.get(t.financialDetail.api.search(),{params:s.filter}).success(function(n){s.totalCount=n.TotalCount;s.financialDetail=n.FinancialDetailResults;s.financialOfferLabel=s.enums.FinancialOfferLabel[s.financialDetail.FinancialOfferLabelIndex].DisplayName;s.financialDetail.FinancialDetails.length==1&&(s.financialDetail.FinancialDetails[0].showFinancialDetails=!0);s.selectedFinancialDetail=[]})};h();s.documentChanged=function(r,u){i.get(t.financialDetail.api.get(r)).success(function(t){s.financialDetail.FinancialDetails[u]=t;s.financialDetail.FinancialDetails[u].showFinancialDetails=!0;n.$broadcast("reloadVendorResponseSummary",{})})};s.edit=function(n,t){s.selectedFinancialDetail[t]=angular.copy(n);n.showEdit=!0};s.save=function(n,t){if(s.financialDetail.IsPilot){var i=0;angular.forEach(s.selectedFinancialDetail[t].CustomUnitPriceAnswers,function(n){s.financialDetail.FinancialDetails[t].CustomUnitPriceAnswers[i].AnswerText=n.AnswerText;i+=1})}else s.financialDetail.FinancialDetails[t].TotalValue=s.selectedFinancialDetail[t].TotalValue,s.financialDetail.FinancialDetails[t].CurrencyId=s.selectedFinancialDetail[t].CurrencyId,s.financialDetail.FinancialDetails[t].Comments=s.selectedFinancialDetail[t].Comments;s.update(s.financialDetail.FinancialDetails[t],t)};s.update=function(t,r){i.post(s.urls.financialDetail.api.update(),t).success(function(t){s.financialDetail.FinancialDetails[r]=t;s.financialDetail.FinancialDetails[r].showFinancialDetails=!0;f.addSuccessMessage(u("customTranslate")("VendorResponse.Detail.Financial.ConfirmUpdated","Financial details updated."));n.$broadcast("reloadVendorResponseSummary",{})})};s.pageChanged=function(){h()}}]);app.ng.controller("App.Controller.VendorResponse.LotGenericForms",["$rootScope","urls","$http","entityInfo","growl","appUtils","$filter","_","$confirm",function(n,t,i,r,u,f,e,o,s){function v(){h.formsFilter.FormType=o.find(h.formTypes,function(n){return n.Key==="LotGeneric"}).Value;i.get(t.vendorResponse.api.getVendorResponseForms(),{params:h.formsFilter}).success(function(n){h.vendorResponse=n})}function y(){angular.forEach(h.vendorResponse.Form.Sections,function(n){n.showSection=!0;n.disableSection=!1})}function p(n){h.formFilter.FormId=n.Id;h.formFilter.FormTitle=n.Title;i.get(t.vendorResponse.api.getVendorResponseForm(),{params:h.formFilter}).success(function(n){h.vendorResponse.Form=n;h.initForms()})}function w(){var r={VendorResponse:h.vendorResponse,LotId:null};i.post(t.vendorResponse.api.updateFormAnswers(),r).success(function(t){var i=o.find(h.vendorResponse.Forms,function(n){return n.Id==t.Id});i.IsComplete=t.IsComplete;h.initForms();u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Message.Saved","Answer(s) saved."));n.$broadcast("reloadVendorResponseSummary",{})})}function b(n){return Number(n)}function k(n,t){return h.sectionTypeEnum[t]&&n.Type===h.sectionTypeEnum[t].Value}function d(n){return h.isSectionOfType(n,"LongFreeText")?app.LongFreeTextSectionTypeMaxChar:app.ShortFreeTextSectionTypeMaxChar}function g(n){return!n.AnswerText&&n.IsRequired}function nt(n,t){return h.sectionColumnTypeEnum[t]&&n.Type===h.sectionColumnTypeEnum[t].Value}function tt(n){return h.isSectionColumnOfType(n,"LongFreeText")?app.LongFreeTextSectionColumnTypeMaxChar:app.ShortFreeTextSectionColumnTypeMaxChar}function it(n,t){return(!t||!t.AnswerText)&&n.IsRequired}function rt(r,u){var f={VendorResponse:h.vendorResponse,SectionId:r,LotId:null};i.post(t.vendorResponse.api.addPlaceHolderSectionColumnAnswer(),f).success(function(t){angular.forEach(t,function(t){var i=o.find(u,function(n){return n.Id===t.SectionColumnId});i.Answers.push(t);c();n.$broadcast("reloadVendorResponseSummary",{})})})}function ut(r,u,f){s(e("customTranslate")("External.VendorResponse.Detail.ConfirmRemoveRow","Are you sure you want to remove this row?")).then(function(){var e={VendorResponse:h.vendorResponse,SectionId:r,RowId:f,LotId:null};i.post(t.vendorResponse.api.removeSectionColumnAnswer(),e).success(function(){for(var i,t=0;t<u.length;t++)for(i=0;i<u[t].Answers.length;i++)u[t].Answers[i]&&u[t].Answers[i].RowId===f&&u[t].Answers.splice(i,1);for(t=0;t<u.length;t++)for(i=0;i<u[t].Answers.length;i++)u[t].Answers[i].RowId=i+1;c();n.$broadcast("reloadVendorResponseSummary",{})})})}function l(r){i.get(t.document.api.getForSectionAnswer(r.AnswerGuid)).success(function(t){r.Documents=t;c();n.$broadcast("reloadVendorResponseSummary",{})})}function ft(n){u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Documents.Deleted","Document removed."));l(n)}function et(n){l(n)}function ot(n){u.addSuccessMessage(e("customTranslate")("External.VendorResponse.Document.Success.Uploaded","File(s) uploaded."));l(n,null)}function a(r){i.get(t.document.api.getForSectionColumnAnswer(r.AnswerGuid)).success(function(t){r.Documents=t;c();n.$broadcast("reloadVendorResponseSummary",{})})}function st(n){u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Documents.Deleted","Document removed."));a(n)}function ht(n){a(n)}function ct(n){u.addSuccessMessage(e("customTranslate")("External.VendorResponse.Document.Success.Uploaded","File(s) uploaded."));a(n,null)}function c(){i.get(t.vendorResponse.api.getVendorResponseForm(),{params:h.formFilter}).success(function(n){var t=o.find(h.vendorResponse.Forms,function(t){return t.Id==n.Id});t.IsComplete=n.IsComplete})}var h=this;n.entityInfo=r;h.forms={};h.numericAnswerStep=1e-5;h.loadForm=p;h.initForms=y;h.save=w;h.parseStringToNumber=b;h.formTypes=n.enums.FormType;h.sectionTypes=n.enums.SectionType;h.sectionTypeEnum=f.getSectionTypeEnum();h.uploadTypes=n.enums.UploadType;h.isSectionOfType=k;h.isAnswerRequired=g;h.getFreeTextSectionTypeMaxChar=d;h.sectionColumnTypes=n.enums.SectionColumnType;h.sectionColumnTypeEnum=f.getSectionColumnTypeEnum();h.isSectionColumnOfType=nt;h.isSectionColumnAnswerRequired=it;h.getFreeTextSectionColumnTypeMaxChar=tt;h.addRow=rt;h.removeRow=ut;h.forms={};h.formId=null;h.isCompact=h.isCompact||!1;h.sectionAnswerUploadType=o.find(h.uploadTypes,function(n){return n.Key==="SectionAnswerResponse"}).Value;h.sectionColumnAnswerUploadType=o.find(h.uploadTypes,function(n){return n.Key==="SectionColumnAnswerResponse"}).Value;h.onSectionAnswerDocumentRemoved=ft;h.onSectionAnswerDocumentFromLibraryAdded=et;h.onSectionAnswerDocumentUploaded=ot;h.onSectionColumnAnswerDocumentRemoved=st;h.onSectionColumnAnswerDocumentFromLibraryAdded=ht;h.onSectionColumnAnswerDocumentUploaded=ct;h.formFilter={VendorResponseId:r.id,FormId:null,FormTitle:null,LotId:null};h.formsFilter={VendorResponseId:r.id,FormType:null};v()}]);app.ng.controller("App.Controller.VendorResponse.Lots",["$scope","$rootScope","urls","growl","$filter","$http","entityInfo","$confirm",function(n,t,i,r,u,f,e,o){var s=this;s.urls=i;s.vendorResponseId=e.vendorResponseId;s.labelBid=u("customTranslate")("External.VendorResponse.Detail.Lots.BidLabel","bid").toString();s.labelNoBid=u("customTranslate")("External.VendorResponse.Detail.Lots.NoBidLabel","no bid").toString();s.ignoreNextChangeEvent=!1;s.filter={};s.lotSearchResult={};s.filter.CurrentPage=1;s.filter.PageSize=app.VendorSubmissionLotsPageSize;s.search=function(){s.filter.OrderBy=s.sortField?s.sortField+" "+(s.sortDirection?s.sortDirection:""):"Lot.Number asc";s.filter.VendorResponseId=s.vendorResponseId;f.get(s.urls.lot.api.searchForVendorResponse(),{params:s.filter}).success(function(n){s.totalCount=n.TotalCount;s.intentAll=n.IsAllNoBid?!1:n.IsAllBid?!0:!1;s.lots=n.VendorResponseLotResults.VendorResponseLots;s.canEdit=n.VendorResponseLotResults.Permissions.CanEdit})};s.search();s.change=function(n){if(n.ignoreNextChangeEvent){n.ignoreNextChangeEvent=!1;return}var i=function(){f.post(s.urls.lot.api.update(),n).success(function(){r.addSuccessMessage(u("customTranslate")("External.VendorResponse.Detail.Lots.BidSelectionConfirmation","Lot bid selection changed."));t.$broadcast("reloadVendorResponseSummary",{})})};n.HasBid?i():f.get(s.urls.lot.api.hasOtherBidedLots(),{params:n}).success(function(t){if(t){var r=u("customTranslate")("External.VendorResponse.Detail.Lots.ConfirmNoBidKeepData","Are you sure you want to change this? Please note that if you have already inserted input on the Questionnaires, Document Checklist and/or Financial Offer Details that affect this Lot, your information will be saved, in case you still wish to quote for this Lot."),f=function(){n.ignoreNextChangeEvent=!0;n.HasBid=!0};o(r).then(i,f)}else n.HasBid=!0,alert(u("customTranslate")("External.VendorResponse.Detail.Lots.AtLeastOneLotWarning","You cannot bid on less than one lot."))})};s.pageChanged=function(){s.search()};s.toggleLotIntents=function(n){if(s.ignoreNextChangeEvent){s.ignoreNextChangeEvent=!1;return}var i=function(){var i={VendorResponseId:s.vendorResponseId,IntentAll:n};f.post(s.urls.lot.api.toggleLotIntents(),i).success(function(){r.addSuccessMessage(u("customTranslate")("External.VendorResponse.Detail.Lots.BidSelectionsConfirmation","Lot bid selections changed."));t.$broadcast("reloadVendorResponseSummary",{});s.search()})},e=u("customTranslate")("External.VendorResponse.Detail.Lots.ConfirmChangeBidIntentAll","Are you sure you want to change this for all lots?"),h=function(){s.ignoreNextChangeEvent=!0;s.intentAll=!n};o(e).then(i,h)}}]);app.ng.controller("App.Controller.VendorResponse.LotSpecificForms",["$rootScope","urls","$http","entityInfo","growl","appUtils","$filter","_","$confirm",function(n,t,i,r,u,f,e,o,s){function v(){h.formsFilter.FormType=o.find(h.formTypes,function(n){return n.Key==="LotSpecific"}).Value;i.get(t.vendorResponse.api.getVendorResponseForms(),{params:h.formsFilter}).success(function(n){h.vendorResponse=n})}function y(){angular.forEach(h.vendorResponse.Form.Sections,function(n){n.showSection=!0;n.disableSection=!1})}function p(n){h.lots={};h.formFilter.LotId=null;h.vendorResponse.Form=null;h.lotFilter.FormId=n.Id;h.formFilter.FormId=n.Id;i.get(t.vendorResponse.api.getVendorResponseLotsByForm(),{params:h.lotFilter}).success(function(n){h.lots=n})}function w(n){h.formFilter.LotId=n;i.get(t.vendorResponse.api.getVendorResponseForm(),{params:h.formFilter}).success(function(n){h.vendorResponse.Form=n;var t=o.find(h.vendorResponse.Forms,function(t){return t.Id==n.Id});t.IsComplete=n.IsComplete;h.initForms()})}function b(){var r={VendorResponse:h.vendorResponse,LotId:h.formFilter.LotId};i.post(t.vendorResponse.api.updateFormAnswers(),r).success(function(r){var f=o.find(h.vendorResponse.Forms,function(n){return n.Id==r.Id});f.IsComplete=r.IsComplete;h.initForms();i.get(t.vendorResponse.api.getVendorResponseLotsByForm(),{params:h.lotFilter}).success(function(n){h.lots=n});u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Message.Saved","Answer(s) saved."));n.$broadcast("reloadVendorResponseSummary",{})})}function k(n){return Number(n)}function d(n,t){return h.sectionTypeEnum[t]&&n.Type===h.sectionTypeEnum[t].Value}function g(n){return h.isSectionOfType(n,"LongFreeText")?app.LongFreeTextSectionTypeMaxChar:app.ShortFreeTextSectionTypeMaxChar}function nt(n){return!n.AnswerText&&n.IsRequired}function tt(n,t){return h.sectionColumnTypeEnum[t]&&n.Type===h.sectionColumnTypeEnum[t].Value}function it(n){return h.isSectionColumnOfType(n,"LongFreeText")?app.LongFreeTextSectionColumnTypeMaxChar:app.ShortFreeTextSectionColumnTypeMaxChar}function rt(n,t){return(!t||!t.AnswerText)&&n.IsRequired}function ut(r,u){var f={VendorResponse:h.vendorResponse,SectionId:r,LotId:h.formFilter.LotId};i.post(t.vendorResponse.api.addPlaceHolderSectionColumnAnswer(),f).success(function(t){angular.forEach(t,function(t){var i=o.find(u,function(n){return n.Id===t.SectionColumnId});i.Answers.push(t);c();n.$broadcast("reloadVendorResponseSummary",{})})})}function ft(r,u,f){s(e("customTranslate")("External.VendorResponse.Detail.ConfirmRemoveRow","Are you sure you want to remove this row?")).then(function(){var e={VendorResponse:h.vendorResponse,SectionId:r,RowId:f,LotId:h.formFilter.LotId};i.post(t.vendorResponse.api.removeSectionColumnAnswer(),e).success(function(){for(var i,t=0;t<u.length;t++)for(i=0;i<u[t].Answers.length;i++)u[t].Answers[i]&&u[t].Answers[i].RowId===f&&u[t].Answers.splice(i,1);for(t=0;t<u.length;t++)for(i=0;i<u[t].Answers.length;i++)u[t].Answers[i].RowId=i+1;c();n.$broadcast("reloadVendorResponseSummary",{})})})}function l(r){i.get(t.document.api.getForSectionAnswer(r.AnswerGuid)).success(function(t){r.Documents=t;c();n.$broadcast("reloadVendorResponseSummary",{})})}function et(n){u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Documents.Deleted","Document removed."));l(n)}function ot(n){l(n)}function st(n){u.addSuccessMessage(e("customTranslate")("External.VendorResponse.Document.Success.Uploaded","File(s) uploaded."));l(n,null)}function a(r){i.get(t.document.api.getForSectionColumnAnswer(r.AnswerGuid)).success(function(t){r.Documents=t;c();n.$broadcast("reloadVendorResponseSummary",{})})}function ht(n){u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Documents.Deleted","Document removed."));a(n)}function ct(n){a(n)}function lt(n){u.addSuccessMessage(e("customTranslate")("External.VendorResponse.Document.Success.Uploaded","File(s) uploaded."));a(n,null)}function c(){i.get(t.vendorResponse.api.getVendorResponseForm(),{params:h.formFilter}).success(function(n){var t=o.find(h.vendorResponse.Forms,function(t){return t.Id==n.Id});t.IsComplete=n.IsComplete})}var h=this;n.entityInfo=r;h.forms={};h.numericAnswerStep=1e-5;h.loadLots=p;h.loadForm=w;h.initForms=y;h.save=b;h.parseStringToNumber=k;h.formTypes=n.enums.FormType;h.sectionTypes=n.enums.SectionType;h.sectionTypeEnum=f.getSectionTypeEnum();h.uploadTypes=n.enums.UploadType;h.isSectionOfType=d;h.isAnswerRequired=nt;h.getFreeTextSectionTypeMaxChar=g;h.sectionColumnTypes=n.enums.SectionColumnType;h.sectionColumnTypeEnum=f.getSectionColumnTypeEnum();h.isSectionColumnOfType=tt;h.isSectionColumnAnswerRequired=rt;h.getFreeTextSectionColumnTypeMaxChar=it;h.addRow=ut;h.removeRow=ft;h.forms={};h.formId=null;h.isCompact=h.isCompact||!1;h.sectionAnswerUploadType=o.find(h.uploadTypes,function(n){return n.Key==="SectionAnswerResponse"}).Value;h.sectionColumnAnswerUploadType=o.find(h.uploadTypes,function(n){return n.Key==="SectionColumnAnswerResponse"}).Value;h.onSectionAnswerDocumentRemoved=et;h.onSectionAnswerDocumentFromLibraryAdded=ot;h.onSectionAnswerDocumentUploaded=st;h.onSectionColumnAnswerDocumentRemoved=ht;h.onSectionColumnAnswerDocumentFromLibraryAdded=ct;h.onSectionColumnAnswerDocumentUploaded=lt;h.formFilter={VendorResponseId:r.id,FormId:null,LotId:null};h.formsFilter={VendorResponseId:r.id,FormType:null};h.lotFilter={VendorResponseId:r.id,FormId:null};v()}]);app.ng.controller("App.Controller.VendorResponse.PrintPreview",["$scope","$rootScope","urls","$http","entityInfo","$window","growl","appUtils",function(n,t,i,r,u,f,e,o){n.urls=i;t.entityInfo=u;n.questionTypeEnum=o.getQuestionTypeEnum();var s=function(){r.get(i.printPreview.api.getVendorResponse(u.id)).success(function(t){n.model=t}).error(function(){e.addErrorMessage(result.ExceptionMessage)})};s();n.print=function(){f.document.close();f.focus();f.print();f.close()};n.close=function(){f.close()};n.isDateQuestionType=function(t){return!n.questionTypeEnum.Date||t.Type!==n.questionTypeEnum.Date.Value?!1:!0};n.isMultipleChoiceCheckboxQuestionType=function(t){return n.questionTypeEnum.MultipleChoice?t.Type===n.questionTypeEnum.MultipleChoice.Value&&t.AllowMultipleSelection:!1};n.getOptionAnswer=function(n){var i,t;if(!n.AnswerText||n.AnswerText.length===0)return[];for(i=[],answerIds=n.AnswerText.split(","),t=0;t<n.Options.length;t++)answerIds.indexOf(n.Options[t].Id.toString())>-1&&i.push(n.Options[t].Text);return i}}]);app.ng.controller("App.Controller.VendorResponse.Questionnaires",["$rootScope","urls","$http","entityInfo","growl","appUtils","$filter",function(n,t,i,r,u,f,e){function s(){angular.forEach(o.vendorResponse.Questionnaires,function(n){angular.forEach(n.Questionnaires,function(n){n.showQuestionnaire=!1;n.disableQuestionnaire=!1;angular.forEach(n.Questions,function(n){n.showQuestion=!0;n.disableQuestion=!1})})})}function h(){i.post(t.vendorResponse.api.updateQuestionnaireAnswers(),o.vendorResponse).success(function(t){o.vendorResponse=t;o.initQuestionnaires();u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Message.Saved","Answer(s) saved."));n.$broadcast("reloadVendorResponseSummary",{})})}function c(n){return Number(n)}function l(n,t){return o.questionTypeEnum[t]&&n.Type===o.questionTypeEnum[t].Value}function a(n){return o.isQuestionOfType(n,"LongFreeText")?app.LongFreeTextQuestionTypeMaxChar:app.ShortFreeTextQuestionTypeMaxChar}function v(n){return!n.AnswerText&&n.IsOptional}function y(){return function(n){return n.Questionnaires.length>0}}var o=this;n.entityInfo=r;o.numericAnswerStep=1e-5;o.questionTypes=n.enums.QuestionType;o.forms={};o.questionTypeEnum=f.getQuestionTypeEnum();o.initQuestionnaires=s;o.save=h;o.parseStringToNumber=c;o.isQuestionOfType=l;o.getFreeTextQuestionTypeMaxChar=a;o.isAnswerRequired=v;o.lotHasQuestionnaire=y;i.get(t.api.get(r)).success(function(n){o.vendorResponse=n;o.initQuestionnaires()})}]);app.ng.controller("App.Controller.VendorResponse.SubmissionClarifications",["urls","$http","entityInfo",function(n,t,i){var r=this;t.get(n.api.get(i)).success(function(n){r.vendorResponse=n});r.replyToClarification=function(i,r){t.post(n.vendorResponse.api.postComment(i.Id),{text:r.text,parentCommentId:r.parentCommentId,documentIds:r.$data.documentIds}).success(function(n){r.$data.documentListApi.documents([]);r.success(n)})}}]);app.ng.controller("App.Controller.VendorResponse.Submit",["$rootScope","$scope","urls","$http","entityInfo","growl","$filter","$confirm",function(n,t,i,r,u,f,e,o){var s=this;s.tenderDeadlinePassed=!1;t.$parent.$watch("vendorResponse.tender",function(n){n&&(s.tenderDeadlinePassed=new Date>new Date(n.Deadline))});r.get(i.api.get(u)).success(function(n){s.vendorResponse=n});s.submit=function(){o(e("customTranslate")("VendorResponse.Detail.ConfirmSubmit","Are you sure you want to submit this response now? Note that you will not be able to make any further changes to your response after submission.")).then(function(){r.post(i.vendorResponse.api.submit(),s.vendorResponse).success(function(t){s.vendorResponse=t;n.$broadcast("reloadVendorResponseSummary",{});f.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Message.Submitted","Answer(s) submitted."))})})};s.withdraw=function(){o(e("customTranslate")("VendorResponse.Detail.ConfirmWithdraw","Are you sure you want to withdraw this submission? You can resubmit your response any time before the tender notice deadline.")).then(function(){s.vendorResponse.IsSubmitted=!1;r.post(i.vendorResponse.api.withdraw(),s.vendorResponse).success(function(t){s.vendorResponse=t;n.$broadcast("reloadVendorResponseSummary",{})});f.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Message.Withdrawn","Submission withdrawn."))})}}]);app.ng.controller("App.Controller.VendorResponse.SupplierForms",["$rootScope","urls","$http","entityInfo","growl","appUtils","$filter","_","$confirm",function(n,t,i,r,u,f,e,o,s){function v(){h.formsFilter.FormType=o.find(h.formTypes,function(n){return n.Key==="Supplier"}).Value;i.get(t.vendorResponse.api.getVendorResponseForms(),{params:h.formsFilter}).success(function(n){h.vendorResponse=n})}function y(){angular.forEach(h.vendorResponse.Form.Sections,function(n){n.showSection=!0;n.disableSection=!1})}function p(n){h.formFilter.FormId=n;h.formFilter.IsTryPrefill=!0;i.get(t.vendorResponse.api.getVendorResponseForm(),{params:h.formFilter}).success(function(n){h.vendorResponse.Form=n;h.initForms()})}function w(){var r={VendorResponse:h.vendorResponse,LotId:null};i.post(t.vendorResponse.api.updateFormAnswers(),r).success(function(t){var i=o.find(h.vendorResponse.Forms,function(n){return n.Id==t.Id});i.IsComplete=t.IsComplete;h.initForms();u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Message.Saved","Answer(s) saved."));n.$broadcast("reloadVendorResponseSummary",{})})}function b(n){return Number(n)}function k(n,t){return h.sectionTypeEnum[t]&&n.Type===h.sectionTypeEnum[t].Value}function d(n){return h.isSectionOfType(n,"LongFreeText")?app.LongFreeTextSectionTypeMaxChar:app.ShortFreeTextSectionTypeMaxChar}function g(n){return!n.AnswerText&&n.IsRequired}function nt(n,t){return h.sectionColumnTypeEnum[t]&&n.Type===h.sectionColumnTypeEnum[t].Value}function tt(n){return h.isSectionColumnOfType(n,"LongFreeText")?app.LongFreeTextSectionColumnTypeMaxChar:app.ShortFreeTextSectionColumnTypeMaxChar}function it(n,t){return(!t||!t.AnswerText)&&n.IsRequired}function rt(r,u){var f={VendorResponse:h.vendorResponse,SectionId:r,LotId:null};i.post(t.vendorResponse.api.addPlaceHolderSectionColumnAnswer(),f).success(function(t){angular.forEach(t,function(t){var i=o.find(u,function(n){return n.Id===t.SectionColumnId});i.Answers.push(t);c();n.$broadcast("reloadVendorResponseSummary",{})})})}function ut(r,u,f){s(e("customTranslate")("External.VendorResponse.Detail.ConfirmRemoveRow","Are you sure you want to remove this row?")).then(function(){var e={VendorResponse:h.vendorResponse,SectionId:r,RowId:f,LotId:null};i.post(t.vendorResponse.api.removeSectionColumnAnswer(),e).success(function(){for(var i,t=0;t<u.length;t++)for(i=0;i<u[t].Answers.length;i++)u[t].Answers[i]&&u[t].Answers[i].RowId===f&&u[t].Answers.splice(i,1);for(t=0;t<u.length;t++)for(i=0;i<u[t].Answers.length;i++)u[t].Answers[i].RowId=i+1;c();n.$broadcast("reloadVendorResponseSummary",{})})})}function l(r){i.get(t.document.api.getForSectionAnswer(r.AnswerGuid)).success(function(t){r.Documents=t;c();n.$broadcast("reloadVendorResponseSummary",{})})}function ft(n){u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Documents.Deleted","Document removed."));l(n)}function et(n){l(n)}function ot(n){u.addSuccessMessage(e("customTranslate")("External.VendorResponse.Document.Success.Uploaded","File(s) uploaded."));l(n,null)}function a(r){i.get(t.document.api.getForSectionColumnAnswer(r.AnswerGuid)).success(function(t){r.Documents=t;c();n.$broadcast("reloadVendorResponseSummary",{})})}function st(n){u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Documents.Deleted","Document removed."));a(n)}function ht(n){a(n)}function ct(n){u.addSuccessMessage(e("customTranslate")("External.VendorResponse.Document.Success.Uploaded","File(s) uploaded."));a(n,null)}function c(){h.formFilter.IsTryPrefill=!1;i.get(t.vendorResponse.api.getVendorResponseForm(),{params:h.formFilter}).success(function(n){var t=o.find(h.vendorResponse.Forms,function(t){return t.Id==n.Id});t.IsComplete=n.IsComplete})}var h=this;n.entityInfo=r;h.forms={};h.numericAnswerStep=1e-5;h.loadForm=p;h.initForms=y;h.save=w;h.parseStringToNumber=b;h.formTypes=n.enums.FormType;h.sectionTypes=n.enums.SectionType;h.sectionTypeEnum=f.getSectionTypeEnum();h.uploadTypes=n.enums.UploadType;h.isSectionOfType=k;h.isAnswerRequired=g;h.getFreeTextSectionTypeMaxChar=d;h.sectionColumnTypes=n.enums.SectionColumnType;h.sectionColumnTypeEnum=f.getSectionColumnTypeEnum();h.isSectionColumnOfType=nt;h.isSectionColumnAnswerRequired=it;h.getFreeTextSectionColumnTypeMaxChar=tt;h.addRow=rt;h.removeRow=ut;h.forms={};h.formId=null;h.isCompact=h.isCompact||!1;h.sectionAnswerUploadType=o.find(h.uploadTypes,function(n){return n.Key==="SectionAnswerResponse"}).Value;h.sectionColumnAnswerUploadType=o.find(h.uploadTypes,function(n){return n.Key==="SectionColumnAnswerResponse"}).Value;h.onSectionAnswerDocumentRemoved=ft;h.onSectionAnswerDocumentFromLibraryAdded=et;h.onSectionAnswerDocumentUploaded=ot;h.onSectionColumnAnswerDocumentRemoved=st;h.onSectionColumnAnswerDocumentFromLibraryAdded=ht;h.onSectionColumnAnswerDocumentUploaded=ct;h.formFilter={VendorResponseId:r.id,FormId:null,LotId:null};h.formsFilter={VendorResponseId:r.id,FormType:null};v()}]);app.ng.controller("App.Controller.VendorResponse.TenderFaq",["$scope","$rootScope","$cookies","$http","urls","userSession","entityInfo",function(n,t,i,r,u,f,e){var o=this;o.urls=u;t.entityInfo=e;console.log(e);o.languageId=f.isAuthenticated()?window.app.userPreference.languageId:i.anonymousUserLanguage;r.get(o.urls.tenderFaq.api.getAll(o.languageId||1,e.id)).success(function(n){o.tenderFaqs=n;console.log(n)});o.ToggleExpanded=function(n){angular.forEach(o.tenderFaqs,function(t,i){o.tenderFaqs[i].isExpanded=o.tenderFaqs[i].Number===n?!o.tenderFaqs[i].isExpanded:!1})};o.Initialise=function(){angular.forEach(o.tenderFaq,function(n,t){o.tenderFaq[t].isExpanded=!1})};o.Initialise()}]);app.ng.controller("App.Controller.VendorResponse.TenderForms",["$rootScope","urls","$http","entityInfo","growl","appUtils","$filter","_","$confirm",function(n,t,i,r,u,f,e,o,s){function v(){h.formsFilter.FormType=o.find(h.formTypes,function(n){return n.Key==="Tender"}).Value;i.get(t.vendorResponse.api.getVendorResponseForms(),{params:h.formsFilter}).success(function(n){h.vendorResponse=n})}function y(){angular.forEach(h.vendorResponse.Form.Sections,function(n){n.showSection=!0;n.disableSection=!1})}function p(n){h.formFilter.FormId=n;i.get(t.vendorResponse.api.getVendorResponseForm(),{params:h.formFilter}).success(function(n){h.vendorResponse.Form=n;h.initForms()})}function w(){var r={VendorResponse:h.vendorResponse,LotId:null};i.post(t.vendorResponse.api.updateFormAnswers(),r).success(function(t){var i=o.find(h.vendorResponse.Forms,function(n){return n.Id==t.Id});i.IsComplete=t.IsComplete;h.initForms();u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Message.Saved","Answer(s) saved."));n.$broadcast("reloadVendorResponseSummary",{})})}function b(n){return Number(n)}function k(n,t){return h.sectionTypeEnum[t]&&n.Type===h.sectionTypeEnum[t].Value}function d(n){return h.isSectionOfType(n,"LongFreeText")?app.LongFreeTextSectionTypeMaxChar:app.ShortFreeTextSectionTypeMaxChar}function g(n){return!n.AnswerText&&n.IsRequired}function nt(n,t){return h.sectionColumnTypeEnum[t]&&n.Type===h.sectionColumnTypeEnum[t].Value}function tt(n){return h.isSectionColumnOfType(n,"LongFreeText")?app.LongFreeTextSectionColumnTypeMaxChar:app.ShortFreeTextSectionColumnTypeMaxChar}function it(n,t){return(!t||!t.AnswerText)&&n.IsRequired}function rt(r,u){var f={VendorResponse:h.vendorResponse,SectionId:r,LotId:null};i.post(t.vendorResponse.api.addPlaceHolderSectionColumnAnswer(),f).success(function(t){angular.forEach(t,function(t){var i=o.find(u,function(n){return n.Id===t.SectionColumnId});i.Answers.push(t);c();n.$broadcast("reloadVendorResponseSummary",{})})})}function ut(r,u,f){s(e("customTranslate")("External.VendorResponse.Detail.ConfirmRemoveRow","Are you sure you want to remove this row?")).then(function(){var e={VendorResponse:h.vendorResponse,SectionId:r,RowId:f,LotId:null};i.post(t.vendorResponse.api.removeSectionColumnAnswer(),e).success(function(){for(var i,t=0;t<u.length;t++)for(i=0;i<u[t].Answers.length;i++)u[t].Answers[i]&&u[t].Answers[i].RowId===f&&u[t].Answers.splice(i,1);for(t=0;t<u.length;t++)for(i=0;i<u[t].Answers.length;i++)u[t].Answers[i].RowId=i+1;c();n.$broadcast("reloadVendorResponseSummary",{})})})}function l(r){i.get(t.document.api.getForSectionAnswer(r.AnswerGuid)).success(function(t){r.Documents=t;c();n.$broadcast("reloadVendorResponseSummary",{})})}function ft(n){u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Documents.Deleted","Document removed."));l(n)}function et(n){l(n)}function ot(n){u.addSuccessMessage(e("customTranslate")("External.VendorResponse.Document.Success.Uploaded","File(s) uploaded."));l(n,null)}function a(r){i.get(t.document.api.getForSectionColumnAnswer(r.AnswerGuid)).success(function(t){r.Documents=t;c();n.$broadcast("reloadVendorResponseSummary",{})})}function st(n){u.addSuccessMessage(e("customTranslate")("VendorResponse.Detail.Documents.Deleted","Document removed."));a(n)}function ht(n){a(n)}function ct(n){u.addSuccessMessage(e("customTranslate")("External.VendorResponse.Document.Success.Uploaded","File(s) uploaded."));a(n,null)}function c(){i.get(t.vendorResponse.api.getVendorResponseForm(),{params:h.formFilter}).success(function(n){var t=o.find(h.vendorResponse.Forms,function(t){return t.Id==n.Id});t.IsComplete=n.IsComplete})}var h=this;n.entityInfo=r;h.forms={};h.numericAnswerStep=1e-5;h.loadForm=p;h.initForms=y;h.save=w;h.parseStringToNumber=b;h.formTypes=n.enums.FormType;h.sectionTypes=n.enums.SectionType;h.sectionTypeEnum=f.getSectionTypeEnum();h.uploadTypes=n.enums.UploadType;h.isSectionOfType=k;h.isAnswerRequired=g;h.getFreeTextSectionTypeMaxChar=d;h.sectionColumnTypes=n.enums.SectionColumnType;h.sectionColumnTypeEnum=f.getSectionColumnTypeEnum();h.isSectionColumnOfType=nt;h.isSectionColumnAnswerRequired=it;h.getFreeTextSectionColumnTypeMaxChar=tt;h.addRow=rt;h.removeRow=ut;h.forms={};h.formId=null;h.isCompact=h.isCompact||!1;h.sectionAnswerUploadType=o.find(h.uploadTypes,function(n){return n.Key==="SectionAnswerResponse"}).Value;h.sectionColumnAnswerUploadType=o.find(h.uploadTypes,function(n){return n.Key==="SectionColumnAnswerResponse"}).Value;h.onSectionAnswerDocumentRemoved=ft;h.onSectionAnswerDocumentFromLibraryAdded=et;h.onSectionAnswerDocumentUploaded=ot;h.onSectionColumnAnswerDocumentRemoved=st;h.onSectionColumnAnswerDocumentFromLibraryAdded=ht;h.onSectionColumnAnswerDocumentUploaded=ct;h.formFilter={VendorResponseId:r.id,FormId:null,LotId:null};h.formsFilter={VendorResponseId:r.id,FormType:null};v()}]);app.ng.controller("App.Controller.VendorResponse.TenderInfo.General",["$scope","$rootScope","$filter",function(n){n.requirementTypes=app.Enums.RequirementType;n.userPreference=app.userPreference}]);app.ng.controller("App.Controller.VendorResponse.VendorConfirmation",["$rootScope","urls","$http","entityInfo","growl","appUtils","$filter",function(n,t,i,r,u,f,e){function c(){i.get(t.vendorConfirmation.api.getByVendorResponseId(r.vendorResponseId)).success(function(n){n.VendorConfirmations.length&&(o.isEditable=!1);o.model=n;n.IsLots&&angular.forEach(o.model.TenderLots,function(n){angular.isDefined(n.Intent)||(n.Intent=!0,s(n))});o.model.IsLots=n.IsLots;o.model.TenderIsOpen=n.TenderIsOpen})}function l(){o.model.Intent=!0;o.intentGiven=!0;o.showReason=!1;o.save()}function a(){o.model.Intent=!1;o.intentGiven=!0;o.showReason=!0}function v(){o.showDetails=o.model.IntentDeclinationReason==8||o.model.IntentDeclinationReason==14}function y(){if(o.model.IsLots){var n=[];angular.forEach(o.model.TenderLots,function(t){n.push({VendorResponseId:r.vendorResponseId,LotId:t.Id,Intent:t.Intent,IntentDeclinationReason:t.IntentDeclinationReason!==null?t.IntentDeclinationReason:o.IntentDeclinationReason,IntentDeclinationDetails:t.IntentDeclinationDetails})});i.post(t.vendorConfirmation.api.newPerLot(),n).success(function(){o.load();u.addSuccessMessage(e("customTranslate")("External.VendorResponse.VendorResponseConfirmation.SavedAll","Your confirmations have been saved"))})}else o.model.VendorResponseId=r.vendorResponseId,o.model.IntentDeclinationReason=angular.isDefined(o.model.IntentDeclinationReason)?o.model.IntentDeclinationReason:o.IntentDeclinationReason,i.post(t.api.createNew(r),o.model).success(function(){o.load();u.addSuccessMessage(e("customTranslate")("External.VendorResponse.VendorResponseConfirmation.Saved","Your confirmation has been saved"))})}function p(n){n.Intent?s(n):h(n)}function w(n){angular.forEach(n,function(n){var t=o.defaultIntent;n.Intent=t;t?s(n):h(n)})}function s(n){n.IntentDeclinationReason=0;n.IntentDeclinationDetails=null}function h(n){n.IntentDeclinationReason=null;n.IntentDeclinationDetails=null}var o=this;o.declinationOptions=app.Enums.VendorResponseDeclinationOption;o.vendorIntentOptions=app.Enums.VendorIntentOption;o.isEditable=!0;o.showReason=!1;o.showDetails=!1;o.intentGiven=!1;o.defaultIntent=!0;o.defaultTextareaMaxChar=app.DefaultTextareaMaxChar;o.labelYes=e("customTranslate")("VendorConfirmation.YesLabel","Yes").toString();o.labelNo=e("customTranslate")("VendorConfirmation.NoLabel","No").toString();o.notApplicable=e("customTranslate")("VendorConfirmation.NotApplicable","Not applicable").toString();o.intentDeclinationDetailsClass="";o.IntentDeclinationReason=0;o.model={IsLots:!1,TenderIsOpen:!1,IntentDeclinationReason:null,IntentDeclinationDetails:null,TenderLots:[],VendorResponseId:r.vendorResponseId};o.load=c;o.selectYes=l;o.selectNo=a;o.changeReason=v;o.save=y;o.change=p;o.toggleLotIntents=w;o.load()}])