{"version":3,"sources":["controllers.js"],"names":["MainCtrl","$rootScope","$scope","$http","$timeout","rightLocation","top","location","href","includes","ele","angular","element","document","querySelector","click","PartnersDB","undefined","user","get","then","d","data","e","console","log","OfferClientDataForOperatorCtrl","$modal","$log","$location","toaster","OfferRequestCtrl","$window","filterFilter","SystemPanelAdminHelperSrv","Partners","AllStatuses","name","value","MultiselectFilter","item","Request","SaveDataEmail","Requestors","RequestItems","NextSteps","config","itemsPerPage","maxPages","fillLastPage","requests","filteredRequests","$watch","categoryDic","pop","filterBuffer","filterModel","OfferGuid","Client","Operator","Status","DateFrom","moment","subtract","toISOString","Phrase","timeoutPromise","delayInMs","ResetFilters","$broadcast","RefreshFilter","Guid","DefaultStatuses","Result","SaveUserFilterPreferences","put","$on","event","args","enterPressedOnInput","keyEvent","which","cancel","loading","filterJson","JSON","stringify","listRequest","currentPage","setCurrentFilter","post","repinRequest","modalInstance","open","animation","templateUrl","controller","scope","size","resolve","result","changeStatus","filterRequest","search","CustomerExternalDocument","_v0","toLowerCase","_v1","_v2","OfferClientResonse_Guid","indexOf","User_Name","Customer","CustomerFullName","CustomerIdentificationNumber","Partner","Partner_Name","SaveDataPhone","TypeOfDelivery","TaxCode","Tax","Quantity","ShowNotesForOffer","offerId","NotesForOffer","showRequest","id","Process","Data","Documents","checkInBik","Array","length","useProfile2","useProfile2Owner","RequestorOwners","useProfile2Representative","RequestorRepresentatives","SmsHistory","MailHistory","ifShowContactPerson","PartnerData","getNextSteps","getTopics","CurrentRequestData","currentPageMode","editAgreementData","closeAgreementData","AggragatedCalulationId","saveAgreementData","currentProductData","editProductData","backProductData","saveProductData","addRequestItem","push","deleteRequestItem","idx","splice","calculate","pNet","parseFloat","NetPrice","q","taxCode","tax","discount","Discount","NetValue","GrossPrice","GrossValue","TaxValue","editResponse","simulateRequest","processRequest","sendRequest","confirm","sendRecalculate","simulate","sendProposal","Simulation","FullRecalculation","PartnerUserGuid","PartnerUserName","LastName","FirstName","PartnerName","SaveInProcess","StatusCode","error","Error","Message","openResponse","window","sendResponse","_docs","DocumentCounter","_","where","Confirmed","addDocuments","makeShipmentOrder","monitorShipment","shipmentActivity","voidShipment","verifyInG2I","confirmDocument","fileId","fileIds","confirmAllDocuments","forEach","doc","FileId","deleteDocument","showDocument","setProcessStatus","step","Step","onRequestorIdentificationNumber1Changed","InnerCommunicationTopics","Topics","UnreadMessages","editCommunicationData","closeCommunicationData","saveCommunicationData","contactPerson","SaveDataContactPerson","email","phone","Response","editBasketData","calculationId","categoryForRequestDic","changeConditions","PackageId","conditions","updateConditions","_self","this","areYouSure","message","okLabel","cancelLabel","okProcess","processUpdateConditions","cancelProcess","savePackageId","RequestedCalculationPackageId","changes","wasRequestsListChanged","closeBasketData","options","$modalInstance","close","dismiss","saveBasketData","processSaveOfferData","request","checkPayment","payment_id","dotpayid","packageList","editOfferData","onRequestedCalculationPackageIdChange","closeOfferData","saveOfferData","packageId","addons2","ADDONS2","addons3","ADDONS3","getTermsForItem","fItem","find","AdditionalProducts","ProductId","showOrderList","SystemCtrl","adminModeCounter","adminMode","enableAdminMode","newRequestByPartner","settings","newRequestUrl","newRequest","currentFunction","showFunction","func","showPartnerFunction","showPage","showFinancialProductsPage","changeUserPassword","UserChangePasswordCtrl","CurrentPassword","Password","PasswordConfirm","saveNewPassword","ChangePasswordOnLogon","MonitorCtrl","isCollapsed","MonitorRecord","Refresh","Test","TestAll","i","PartitionKey","GetReport","timePeriod","encodeURIComponent","From","To","OpenReportModal","template","ok","RyzykoCtrl","PermSave","type","link","G2IRaportUrl","G2IReport","RaportUrl","fileName","generateG2IReportFirma","generateG2IReportOsobaOwner","generateG2IReportOsobaRepresentative","AgreementInfoCtrl","agreementList","list","addAgreement","dataForNewAgreementInfo","AggragatedCalculation_Guid","AgreementNumber","ProductType","AddDate","WhoAdded","editAgreementInfo","toDate","deleteAgreementInfo","RepinRequestModalCtrl","confirmRepinRequest","userGuid","Users","filteredUsersList","searchUsers","filterUsersRequest","v","FN","_v3","LN","_v4","p","map","k","Login","url","PartnerURL","Email","ChangeRequestStatusModalCtrl","changeRequestStatus","statusValue","currentStatus","Initial","Prepaid","ProcessTypeName","AgreementInfoModalCtrl","currentTab","agreementPeople","agreementUsers","AgreementAcceptPeopleGuids","filter","DefaultAcceptAgreements","addOrRemoveFromChecked","NoteFormCtrl","Item","HasReminder","ReminderHour","GetCurrentUserMail","ReminderRecipients","newValue","oldValue","ReminderDate","getHours","setHours","date","dateMoment","hideNoteVisiblityProperty","NotesForOfferCtrl"],"mappings":"AAAA,YAEA,IAAIA,UAAW,SAAUC,EAAYC,EAAQC,EAAOC,GAEnD,GAAIC,GAAgBC,IAAIC,SAASC,KAAKC,SAAS,8BAC/CP,GAAOG,cAAgBA,EAGvBD,EAAS,WACR,GAAIC,EAAe,CAClB,GAAIK,GAAMC,QAAQC,QAAQC,SAASC,cAAc,mBACjDJ,GAAI,GAAGK,UAEN,KAIHd,EAAWe,cACSC,SAAhBf,EAAOgB,MACVf,EAAMgB,IAAI,sCAAsCC,KAAK,SAAUC,GAC9DpB,EAAWe,cAMXf,EAAWe,WAAaK,EAAEC,MAExB,SAAUC,GAAKC,QAAQC,IAAIF,MAI5BG,+BAAiC,SAAUzB,EAAYC,EAAQyB,EAAQC,EAAMC,EAAW1B,EAAO2B,KAK/FC,iBAAmB,SAAU9B,EAAYC,EAAQyB,EAAQC,EAAMC,EAAW1B,EAAOC,EAAU4B,EAASF,EAASG,EAAcC,GAE9HhC,EAAOiC,YACPjC,EAAOkC,cACNC,KAAM,YACNC,WAEAD,KAAM,OACNC,MAAO,IAEPD,KAAM,0BACNC,MAAO,KAEPD,KAAM,wBACNC,MAAO,KAEPD,KAAM,4BACNC,MAAO,KAEPD,KAAM,kCACNC,MAAO,KAEPD,KAAM,0BACNC,MAAO,KAEPD,KAAM,uBACNC,MAAO,KAEPD,KAAM,0BACNC,MAAO,KAEPD,KAAM,sEAAuEC,MAAO,KAEpFD,KAAM,0EAA2EC,MAAO,KAExFD,KAAM,4BACNC,MA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C7CnB,EAAOsC,KAAKiV,mBAAqBpW,EAAEC,QAItCpB,EAAOkD,OAAO,mBAAoB,SAAUsU,EAAUC,GACjDD,IAAaC,GAAYD,GAAUxX,EAAOsX,uBAG3CH,IACHnX,EAAOsC,KAAO6U,EACVnX,EAAOsC,KAAKoV,eACf1X,EAAOsC,KAAKoV,aAAe9T,OAAO5D,EAAOsC,KAAKoV,cAAc5C,SAC5D9U,EAAOsC,KAAK+U,aAAerX,EAAOsC,KAAKoV,aAAaC,aAItD3X,EAAO4X,SAAW,SAAUC,GAC3B,GAAIC,GAAalU,OAAOiU,GAAM/C,QAC9BgD,GAAWF,SAAS5X,EAAOsC,KAAK+U,cAChCrX,EAAOsC,KAAKoV,aAAe9T,OAAOkU,IAKnC9X,EAAOuT,GAAK;AACX7D,EAAeC,MAAM3P,EAAOsC,OAG7BtC,EAAOgF,OAAS,WACf0K,EAAeE,QAAQ,WAGxB5P,EAAO+X,0BAA4B,WAClC,MAAmB,aAAfvM,GAA6C,kBAAfA,IAQhCwM,kBAAoB,SAAUhY,EAAQ0P,EAAgBhI,GACzD1H,EAAO0H,cAAgBA,EAEvB1H,EAAOuT,GAAK,WACX7D,EAAeC,SAGhB3P,EAAOgF,OAAS,WACf0K,EAAeE,QAAQ","file":"controllers.min.js","sourcesContent":["'use strict';\r\n\r\nvar MainCtrl = function ($rootScope, $scope, $http, $timeout) {\r\n\r\n\tvar rightLocation = top.location.href.includes('leaselink.azurewebsites.net');\r\n\t$scope.rightLocation = rightLocation;\r\n\r\n\r\n\t$timeout(function () {\r\n\t\tif (rightLocation) {\r\n\t\t\tvar ele = angular.element(document.querySelector('#przekierowanie'));\r\n\t\t\tele[0].click();\r\n\t\t}\r\n\t}, 10000);\r\n\r\n\r\n\r\n\t$rootScope.PartnersDB = [];\r\n\tif ($scope.user !== undefined /*&& $scope.user.Role !== 'PARTNER_OPERATOR'*/) {\r\n\t\t$http.get('/offerbusinessdata/GetPartnersBase').then(function (d) {\r\n\t\t\t$rootScope.PartnersDB = [];\r\n\r\n\t\t\t// $rootScope.PartnersDB = _.map(d.data, function(i) {\r\n\t\t\t// return { k: i.Key, v: i.Name, url: i.PartnerUrl };\r\n\t\t\t// });\r\n\r\n\t\t\t$rootScope.PartnersDB = d.data;\r\n\r\n\t\t}, function (e) { console.log(e); });\r\n\t}\r\n};\r\n\r\nvar OfferClientDataForOperatorCtrl = function ($rootScope, $scope, $modal, $log, $location, $http, toaster) {\r\n\r\n};\r\n\r\n\r\nvar OfferRequestCtrl = function ($rootScope, $scope, $modal, $log, $location, $http, $timeout, $window, toaster, filterFilter, SystemPanelAdminHelperSrv) {\r\n\r\n\t$scope.Partners = [];\r\n\t$scope.AllStatuses = [{\r\n\t\tname: 'Anulowany',\r\n\t\tvalue: -1\r\n\t}, {\r\n\t\tname: 'Nowy',\r\n\t\tvalue: 0\r\n\t}, {\r\n\t\tname: 'Wysłano link do klienta',\r\n\t\tvalue: 10\r\n\t}, {\r\n\t\tname: 'Otwarty przez klienta',\r\n\t\tvalue: 20\r\n\t}, {\r\n\t\tname: 'Uzupełniony przez klienta',\r\n\t\tvalue: 30\r\n\t}, {\r\n\t\tname: 'Opłata weryfikacyjna do zapłaty',\r\n\t\tvalue: 32\r\n\t}, {\r\n\t\tname: 'Zapłacony przez klienta',\r\n\t\tvalue: 40\r\n\t}, {\r\n\t\tname: 'Ponów płatność 1 PLN',\r\n\t\tvalue: 41\r\n\t}, {\r\n\t\tname: 'Odrzucony przez klienta',\r\n\t\tvalue: 50\r\n\t}, {\r\n\t\tname: 'Prośba o uzupełnienie wymaganych dokumentów finansowych (VAT-owiec)', value: 53\r\n\t}, {\r\n\t\tname: 'Prośba o uzupełnienie wymaganych dokumentów finansowych (nie-VAT-owiec)', value: 54\r\n\t}, {\r\n\t\tname: 'Wstępna decyzja kredytowa',\r\n\t\tvalue: 52\r\n\t}, {\r\n\t\tname: 'Prośba o uzupełnienie wymaganych dokumentów',\r\n\t\tvalue: 55\r\n\t}, {\r\n\t\tname: 'Do weryfikacji BO / Przekaż do Ryzyka',\r\n\t\tvalue: 60\r\n\t}, {\r\n\t\tname: 'Automat scoringowy - oczekiwanie na odpowiedź', value: 61\r\n\t}, {\r\n\t\tname: 'Automat scoringowy - odpowiedź gotowa', value: 62\r\n\t}, {\r\n\t\tname: 'Analiza ryzyka', value: 63\r\n\t}, {\r\n\t\tname: 'Umowa wstepna przygotowana',\r\n\t\tvalue: 70\r\n\t}, {\r\n\t\tname: 'Konieczność opłaty WOL (uzupełnienie danych)',\r\n\t\tvalue: 71\r\n\t}, {\r\n\t\tname: 'WOL opłacony',\r\n\t\tvalue: 72\r\n\t}, {\r\n\t\tname: 'Konieczność opłaty WOL (wybór płatności)',\r\n\t\tvalue: 73\r\n\t}, {\r\n\t\tname: 'Ponów płatność WOL',\r\n\t\tvalue: 74\r\n\t}, {\r\n\t\tname: 'Weryfikacja podpisu kwalifikowanego',\r\n\t\tvalue: 76\r\n\t}, {\r\n\t\tname: 'Akceptacja',\r\n\t\tvalue: 80\r\n\t}, {\r\n\t\tname: 'Akceptacja z warunkami',\r\n\t\tvalue: 90\r\n\t}, {\r\n\t\tname: 'Do zmiany przez operatora',\r\n\t\tvalue: 91\r\n\t}, {\r\n\t\tname: 'Zmiana zamówienia przez Klienta',\r\n\t\tvalue: 95\r\n\t}, {\r\n\t\tname: 'Odrzucenie',\r\n\t\tvalue: 100\r\n\t}, {\r\n\t\tname: 'Akceptacja nowych warunków',\r\n\t\tvalue: 103\r\n\t},{\r\n\t\tname: 'Umowa przygotowana',\r\n\t\tvalue: 105\r\n\t}, {\r\n\t\tname: 'Umowa zawiera niepoprawne dane',\r\n\t\tvalue: 106\r\n\t}, {\r\n\t\tname: 'Umowa jest poprawna',\r\n\t\tvalue: 107\r\n\t}, {\r\n\t\tname: 'Umowa przekazana do klienta',\r\n\t\tvalue: 110\r\n\t}, {\r\n\t\tname: 'Umowa u kuriera',\r\n\t\tvalue: 111\r\n\t}, {\r\n\t\tname: 'Umowa zaakceptowana przez klienta',\r\n\t\tvalue: 120\r\n\t}, {\r\n\t\tname: 'Zapłacone częściowo',\r\n\t\tvalue: 124\r\n\t}, {\r\n\t\tname: 'Płatność do dostawcy',\r\n\t\tvalue: 125\r\n\t}, {\r\n\t\tname: 'EDEN umowa potwierdzona',\r\n\t\tvalue: 127\r\n\t}, {\r\n\t\tname: 'Umowa odrzucona przez klienta',\r\n\t\tvalue: 130\r\n\t}, {\r\n\t\tname: 'Umowa potwierdzona - wyślij towar',\r\n\t\tvalue: 200\r\n\t}, {\r\n\t\tname: 'Towar u kuriera',\r\n\t\tvalue: 210\r\n\t}, {\r\n\t\tname: 'Towar odebrany',\r\n\t\tvalue: 220\r\n\t}, {\r\n\t\tname: 'Towar odebrany przez klienta',\r\n\t\tvalue: 310\r\n\t}, {\r\n\t\tname: 'Oczekiwanie na zamówienie',\r\n\t\tvalue: 398\r\n\t}, {\r\n\t\tname: 'Brak IBAN',\r\n\t\tvalue: 399\r\n\t}, {\r\n\t\tname: 'Przygotowanie wysyłki',\r\n\t\tvalue: 401\r\n\t}, {\r\n\t\tname: 'Przygotowanie płatności',\r\n\t\tvalue: 402\r\n\t}, {\r\n\t\tname: 'Wymaga uzupełnienia danych przez sklep',\r\n\t\tvalue: 500\r\n\t}, {\r\n\t\tname: 'Nie wymaga uzupełnienia danych przez sklep',\r\n\t\tvalue: 505\r\n\t}, {\r\n\t\tname: 'Podpisanie umowy oraz odbiór towaru w punkcie sprzedaży',\r\n\t\tvalue: 507\r\n\t}, {\r\n\t\tname: 'Umowa uzupełniona przez sklep',\r\n\t\tvalue: 510\r\n\t}, {\r\n\t\tname: 'Ostateczne sprawdzenie poprawności',\r\n\t\tvalue: 600\r\n\t}, {\r\n\t\tname: 'Cesja Zaakceptowana',\r\n\t\tvalue: 700\r\n\t}, {\r\n\t\tname: 'Wniosek zakończony',\r\n\t\tvalue: 701\r\n\t}, {\r\n\t\tname: 'Proces zakończony',\r\n\t\tvalue: 1000\r\n\t}]\r\n\r\n\t$scope.MultiselectFilter = function (item) {\r\n\r\n\t\treturn item.value;\r\n\t}\r\n\r\n\r\n\t// pobranie partnerow\r\n\tif ($scope.user !== undefined /*&& $scope.user.Role !== 'PARTNER_OPERATOR'*/) {\r\n\r\n\t\t// $http.get('/api/User').then(function(d) {\r\n\t\t// $scope.Users = [];\r\n\t\t// $scope.Users = _.map(d.data.Result, function(i) {\r\n\t\t// return { k: i.Guid, v: i.Login, url: i.PartnerURL, FN: i.FirstName, LN: i.LastName, e: i.Email, p: i.Partner };\r\n\t\t// });\r\n\t\t// }, function(e) { console.log(e); });\r\n\r\n\t\t$http.get('/offerbusinessdata/getpartnersbase').then(function (d) {\r\n\t\t\t$scope.Partners = d.data;\r\n\t\t\t// $scope.Partners = _.map(d.data, function(i) {\r\n\t\t\t// return { k: i.Key, v: i.Name, url: i.PartnerUrl };\r\n\t\t\t// });\r\n\t\t}, function (e) { console.log(e); });\r\n\t}\r\n\r\n\r\n\t// domyslan strona\r\n\t//$scope.currentPage = \"list\";\r\n\t$scope.data = {\r\n\t};\r\n\t$scope.Request = {\r\n\t\tSaveDataEmail: \"\",\r\n\t\tRequestors: [{}],\r\n\t\tRequestItems: []\r\n\t};\r\n\t$scope.NextSteps = [];\r\n\t$scope.config = {\r\n\t\titemsPerPage: 10,\r\n\t\tmaxPages: 10,\r\n\t\tfillLastPage: 'yes'\r\n\t};\r\n\t$scope.requests = [];\r\n\t$scope.filteredRequests = [];\r\n\t// $scope.search = {\r\n\t// User_Name: \"\",\r\n\t// CustomerExternalDocument: \"\",\r\n\t// AggragatedCalulationId: \"\",\r\n\t// Status: \"\",\r\n\t// Customer: \"\",\r\n\t// Partner: \"\"\r\n\t// };\r\n\r\n\t$scope.$watch('requests', function () {\r\n\t\t$scope.filteredRequests = $scope.requests; //filterFilter($scope.requests, $scope.filterRequest);\r\n\t}, true);\r\n\t// $scope.$watch('search', function () {\r\n\t// $scope.filteredRequests = filterFilter($scope.requests, $scope.filterRequest);\r\n\t// }, true);\r\n\r\n\r\n\t// pobranie danych slownikowych\r\n\t$http.get('/OfferBusinessData/GetCategoryLevels').then(\r\n\t\tfunction (d) {\r\n\t\t\t$scope.categoryDic = d.data;\r\n\t\t},\r\n\t\tfunction (e) {\r\n\t\t\ttoaster.pop('error', \"Pobieranie danych\", \"Pobieranie danych nie przebiegło poprawnie.\");\r\n\t\t});\r\n\r\n\r\n\tif (!$rootScope.filterBuffer) {\r\n\t\t$scope.filterModel = {\r\n\t\t\tOfferGuid: \"\",\r\n\t\t\tClient: \"\",\r\n\t\t\tOperator: \"\",\r\n\t\t\tStatus: [],\r\n\t\t\tPartners: [],\r\n\t\t\tDateFrom: moment().subtract(14, 'days').toISOString(),\r\n\t\t\tPhrase: ''\r\n\t\t};\r\n\t} else {\r\n\t\t$scope.filterModel = $rootScope.filterBuffer;\r\n\t};\r\n\r\n\r\n\tvar timeoutPromise;\r\n\tvar delayInMs = 0;\r\n\t$scope.ResetFilters = function () {\r\n\t\tdelayInMs = 0;\r\n\t\t$scope.filterModel = {\r\n\t\t\tOfferGuid: \"\",\r\n\t\t\tClient: \"\",\r\n\t\t\tOperator: \"\",\r\n\t\t\tStatus: [],\r\n\t\t\tPartners: [],\r\n\t\t\tPhrase: ''\r\n\t\t};\r\n\r\n\t\t$rootScope.$broadcast('multiselect::reset');\r\n\t};\r\n\r\n\t$scope.RefreshFilter = function () {\r\n\t\t$http.get('/api/FilterPreferences/' + $scope.user.Guid).then(\r\n\t\t\tfunction (d) {\r\n\t\t\t\t$scope.user.DefaultStatuses = d.data.Result;\r\n\t\t\t\t//toaster.pop('success', 'Pobieranie danych zakończone pomyślnie');\r\n\t\t\t},\r\n\t\t\tfunction (e) {\r\n\t\t\t\ttoaster.pop('error', 'Odświeżenie filtra nie powiodło się');\r\n\t\t\t});\r\n\t};\r\n\r\n\t$scope.SaveUserFilterPreferences = function () {\r\n\r\n\t\t$http.put(\"/api/FilterPreferences/\" + $scope.user.Guid, $scope.filterModel.Status).then(function (d) {\r\n\t\t\t$scope.RefreshFilter();\r\n\t\t\ttoaster.pop('success', \"Filtr\", \"Filtr statusów zapisany\");\r\n\t\t}, function (e) {\r\n\t\t\tconsole.log(e);\r\n\t\t\ttoaster.pop('error', \"Filtr\", \"Błąd zapisu\");\r\n\t\t});\r\n\t};\r\n\r\n\r\n\t// nasłuchuje zapisu domyślnego filtru statusów z poziomu edycji użytkownika i odświeża\r\n\t$rootScope.$on('update-statuses-filter', function (event, args) {\r\n\t\t$scope.RefreshFilter();\r\n\t});\r\n\r\n\r\n\t$scope.enterPressedOnInput = function (keyEvent) {\r\n\t\tif (keyEvent.which === 13) {\r\n\t\t\tdelayInMs = 0;\r\n\t\t\t$timeout.cancel(timeoutPromise);\r\n\t\t\t$scope.loading = true;\r\n\t\t\tvar filterJson = JSON.stringify($scope.filterModel);\r\n\t\t\t$scope.listRequest(filterJson);\r\n\t\t}\r\n\t};\r\n\r\n\r\n\t$scope.$watch('filterModel', function () {\r\n\t\tif ($scope.currentPage === 'list') {\r\n\t\t\t$timeout.cancel(timeoutPromise); //does nothing, if timeout already done\r\n\t\t\ttimeoutPromise = $timeout(function () { //Set timeout\r\n\t\t\t\t$scope.loading = true;\r\n\t\t\t\tif (typeof $scope.filterModel.Partners === \"string\") {\r\n\t\t\t\t\t$scope.filterModel.Partners = [$scope.filterModel.Partners];\r\n\t\t\t\t}\r\n\t\t\t\t// bufor zapamiętujący stan filtrów (żeby się nie kasowały przy przechodzeniu na sprawę lub inne zakładki i z powrotem)\r\n\t\t\t\t$rootScope.filterBuffer = $scope.filterModel;\r\n\r\n\t\t\t\t// przekazanie do serwisu\r\n\t\t\t\tSystemPanelAdminHelperSrv.setCurrentFilter($scope.filterModel);\r\n\r\n\r\n\t\t\t\t// pobranie danych\r\n\t\t\t\tvar filterJson = JSON.stringify($rootScope.filterBuffer);\r\n\t\t\t\t$scope.listRequest(filterJson);\r\n\r\n\r\n\t\t\t}, delayInMs);\r\n\t\t}\r\n\t}, true);\r\n\r\n\t//lista zamówień\r\n\t$scope.listRequest = function (filterJson) {\r\n\t\tif (!$rootScope.filterBuffer) {\r\n\t\t\tif (!filterJson) {\r\n\t\t\t\t$scope.filterModel = {\r\n\t\t\t\t\tOfferGuid: \"\",\r\n\t\t\t\t\tClient: \"\",\r\n\t\t\t\t\tOperator: \"\",\r\n\t\t\t\t\tStatus: $scope.user.DefaultStatuses || [],\r\n\t\t\t\t\tPartners: [],\r\n\t\t\t\t\tDateFrom: moment().subtract(14, 'days').toISOString(),\r\n\t\t\t\t\tPhrase: ''\r\n\t\t\t\t};\r\n\r\n\t\t\t\tfilterJson = JSON.stringify($scope.filterModel);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$scope.filterModel = $rootScope.filterBuffer;\r\n\t\t\tfilterJson = JSON.stringify($scope.filterModel);\r\n\t\t};\r\n\r\n\t\t// przekazanie do serwisu\r\n\t\tSystemPanelAdminHelperSrv.setCurrentFilter($scope.filterModel);\r\n\r\n\t\t// wyslanie zapytania\r\n\t\t$http.post('/OfferRequest/list', { filterJson: filterJson }).then(\r\n\t\t\tfunction (d) {\r\n\t\t\t\t$scope.requests = d.data;\r\n\t\t\t\t$scope.currentPage = \"list\";\r\n\t\t\t\t$scope.loading = false;\r\n\t\t\t\tdelayInMs = 2000;\r\n\t\t\t},\r\n\t\t\tfunction (e) {\r\n\t\t\t\ttoaster.pop('error', \"Pobieranie danych\", \"Pobieranie danych nie przebiegło poprawnie.\");\r\n\t\t\t});\r\n\t};\r\n\r\n\r\n\t$scope.repinRequest = function () {\r\n\t\tvar modalInstance = $modal.open({\r\n\t\t\tanimation: true,\r\n\t\t\ttemplateUrl: '/WWW/partials/request/repinRequestModal.html',\r\n\t\t\tcontroller: 'RepinRequestModalCtrl',\r\n\t\t\tscope: $scope,\r\n\t\t\tsize: 'lg',\r\n\t\t\tresolve: {}\r\n\t\t});\r\n\t\tmodalInstance.result.then(\r\n\t\t\tfunction () { },\r\n\t\t\tfunction () { }\r\n\t\t);\r\n\r\n\t};\r\n\r\n\t$scope.changeStatus = function () {\r\n\t\tvar modalInstance = $modal.open({\r\n\t\t\tanimation: true,\r\n\t\t\ttemplateUrl: '/WWW/partials/request/changeRequestStatusModal.html',\r\n\t\t\tcontroller: 'ChangeRequestStatusModalCtrl',\r\n\t\t\tscope: $scope,\r\n\t\t\tresolve: {}\r\n\t\t});\r\n\t\tmodalInstance.result.then(\r\n\t\t\tfunction () { },\r\n\t\t\tfunction () { }\r\n\t\t);\r\n\r\n\t};\r\n\r\n\t// filtr do zapytan\r\n\t$scope.filterRequest = function (item) {\r\n\r\n\t\tif ($scope.search.CustomerExternalDocument) {\r\n\t\t\tvar _v0 = ($scope.search.CustomerExternalDocument || \"\").toLowerCase();\r\n\t\t\tvar _v1 = (item.CustomerExternalDocument || \"\").toLowerCase();\r\n\t\t\tvar _v2 = (item.OfferClientResonse_Guid || \"\").toLowerCase();\r\n\t\t\tif (_v1.indexOf(_v0) === -1 && _v2.indexOf(_v0) === -1) return false;\r\n\t\t}\r\n\r\n\t\tif ($scope.search.User_Name) {\r\n\t\t\tvar _v0 = ($scope.search.User_Name || \"\").toLowerCase();\r\n\t\t\tvar _v1 = (item.User_Name || \"\").toLowerCase();\r\n\t\t\tif (_v1.indexOf(_v0) === -1) return false;\r\n\t\t}\r\n\r\n\t\tif ($scope.search.Status) {\r\n\t\t\tvar _v0 = ($scope.search.Status || \"\").toLowerCase();\r\n\t\t\tvar _v1 = (item.Status + \"\" || \"\").toLowerCase();\r\n\t\t\tif (_v1 !== _v0) return false;\r\n\t\t}\r\n\r\n\t\tif ($scope.search.Customer) {\r\n\t\t\tvar _v0 = ($scope.search.Customer || \"\").toLowerCase();\r\n\t\t\tvar _v1 = (item.CustomerFullName + \"\" || \"\").toLowerCase();\r\n\t\t\tvar _v2 = (item.CustomerIdentificationNumber + \"\" || \"\").toLowerCase();\r\n\t\t\tif (_v1.indexOf(_v0) === -1 && _v2.indexOf(_v0) === -1) return false;\r\n\t\t}\r\n\r\n\t\tif ($scope.search.Partner) {\r\n\t\t\tvar _v0 = ($scope.search.Partner || \"\").toLowerCase();\r\n\t\t\tvar _v1 = (item.Partner_Name + \"\" || \"\").toLowerCase();\r\n\t\t\tif (_v1 !== _v0) return false;\r\n\t\t}\r\n\r\n\r\n\t\treturn true;\r\n\t};\r\n\r\n\t// domyslna akcja\r\n\tif ($scope.currentPage === 'list')\r\n\t\t$scope.listRequest();\r\n\r\n\t// nowe zamowienie\r\n\tif ($scope.currentPage === 'form') {\r\n\t\t$scope.Request = {\r\n\t\t\tSaveDataEmail: \"\",\r\n\t\t\tSaveDataPhone: \"\",\r\n\t\t\tTypeOfDelivery: \"\",\r\n\t\t\tCustomerExternalDocument: \"\",\r\n\t\t\tRequestors: [{}],\r\n\t\t\tRequestItems: [{\r\n\t\t\t\tTaxCode: \"23\",\r\n\t\t\t\tTax: 23,\r\n\t\t\t\tQuantity: 1\r\n\t\t\t}]\r\n\t\t};\r\n\t}\r\n\r\n\t$scope.ShowNotesForOffer = function (offerId) {\r\n\t\t$http.get('/api/OfferNotes?offerGuid=' + offerId).then(function (d) {\r\n\t\t\tvar modalInstance = $modal.open({\r\n\t\t\t\tanimation: true,\r\n\t\t\t\ttemplateUrl: '/WWW/partials/notesForOffer.html',\r\n\t\t\t\tcontroller: 'NotesForOfferCtrl',\r\n\t\t\t\tresolve: {\r\n\t\t\t\t\tNotesForOffer: function () {\r\n\t\t\t\t\t\treturn d.data.Result;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tmodalInstance.result.then(\r\n\t\t\t\tfunction () {\r\n\r\n\t\t\t\t},\r\n\t\t\t\tfunction () { }\r\n\t\t\t);\r\n\t\t});\r\n\t};\r\n\r\n\r\n\r\n\r\n\t// pobranie danych\r\n\t$scope.showRequest = function (id) {\r\n\t\t$http.get('/OfferRequest/get/' + id).then(\r\n\t\t\tfunction (d) {\r\n\t\t\t\t$scope.Process = d.data.Process;\r\n\t\t\t\t$scope.data = d.data.Data;\r\n\t\t\t\t$scope.Documents = d.data.Documents;\r\n\r\n\t\t\t\t$scope.checkInBik = new Array($scope.data.Request.Requestors.length);\r\n\r\n\t\t\t\t// przeslanie nowych zapytan do BIK\r\n\t\t\t\t$scope.useProfile2 = new Array($scope.data.Request.Requestors.length);\r\n\t\t\t\t$scope.useProfile2Owner = new Array($scope.data.Request.RequestorOwners.length);\r\n\t\t\t\t$scope.useProfile2Representative = new Array($scope.data.Request.RequestorRepresentatives.length);\r\n\r\n\t\t\t\t$scope.SmsHistory = d.data.SmsHistory;\r\n\t\t\t\t$scope.MailHistory = d.data.MailHistory;\r\n\r\n\t\t\t\t// pobranie danej do sprawdzenia czy użytkowik powinien widzieć \"osobę kontaktową\"\r\n\t\t\t\t$scope.ifShowContactPerson = d.data.PartnerData;\r\n\r\n\t\t\t\t// pobranie kolejnych krokow\r\n\t\t\t\t$scope.getNextSteps(id);\r\n\r\n\t\t\t\t// pobranie wiaodmosci\r\n\t\t\t\t$scope.getTopics(id);\r\n\r\n\t\t\t\t// podglad z podziałem na role\r\n\t\t\t\t$scope.currentPage = \"view\";\r\n\r\n\t\t\t\t//toaster.pop('success', \"Pobieranie danych\", \"Pobieranie danych przebiegło poprawnie.\");\r\n\t\t\t},\r\n\t\t\tfunction (e) {\r\n\t\t\t\ttoaster.pop('error', \"Pobieranie danych\", \"Pobieranie danych nie przebiegło poprawnie.\");\r\n\t\t\t});\r\n\t};\r\n\r\n\t$scope.$on('showRequestBroadcast', function (event, args) {\r\n\t\tif (args.id) $scope.showRequest(args.id);\r\n\t});\r\n\r\n\t// edycja danych do umowy\r\n\t$scope.CurrentRequestData = {};\r\n\t$scope.currentPageMode = \"\";\r\n\t$scope.editAgreementData = function () {\r\n\t\t$scope.CurrentRequestData = $scope.data.Request;\r\n\t\t$scope.currentPageMode = \"editAgreementData\";\r\n\t};\r\n\r\n\t$scope.closeAgreementData = function () {\r\n\t\t$http\r\n\t\t\t.get(\"/system/process/get-data/\" + $scope.CurrentRequestData.AggragatedCalulationId)\r\n\t\t\t.then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\t$scope.CurrentRequestData = d.data.Request;\r\n\t\t\t\t\t$scope.currentPageMode = \"\";\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\ttoaster.pop('error', \"Pobranie danych do umowy\", \"Wystąpił błąd podczas pobierania danych.\");\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t};\r\n\r\n\t$scope.saveAgreementData = function () {\r\n\t\t// zapisanie\r\n\t\t$http.post(\"/system/process/save-request-data-agreement\", $scope.CurrentRequestData).then(function (d) {\r\n\t\t\ttoaster.pop('success', \"Zapisywanie danych\", \"Zapisywanie danych w repozytorium powiodło się\");\r\n\t\t\t$scope.CurrentRequestData = d.data.Request;\r\n\t\t\t$scope.currentPageMode = \"\"\r\n\t\t\t$scope.showRequest($scope.Process.OfferClientResonse_Guid);\r\n\r\n\t\t}, function (e) {\r\n\t\t\ttoaster.pop('error', \"Zapisywanie danych\", \"Zapisywanie danych w repozytorium nie powiodło się\");\r\n\t\t})\r\n\t};\r\n\r\n\r\n\t//Edycja danych produktu\r\n\t$scope.currentProductData = {};\r\n\t$scope.editProductData = function () {\r\n\t\t$scope.currentProductData = $scope.data.Request;\r\n\t\t$scope.currentPageMode = \"editProductData\";\r\n\t};\r\n\t$scope.backProductData = function () {\r\n\t\t$scope.currentPageMode = \"\";\r\n\t};\r\n\t$scope.saveProductData = function () {\r\n\t\t$http.post(\"/system/process/save-request-data-product\", $scope.currentProductData).then(function (d) {\r\n\t\t\ttoaster.pop('success', \"Zapisywanie danych\", \"Zapisywanie danych w repozytorium powiodło się\");\r\n\t\t\t$scope.currentProductData = d.data.Request;\r\n\t\t\t$scope.currentPageMode = \"\";\r\n\t\t}, function (e) {\r\n\t\t\ttoaster.pop('error', \"Zapisywanie danych\", \"Zapisywanie danych w repozytorium nie powiodło się\");\r\n\t\t})\r\n\t};\r\n\r\n\t// dodanie pozycji\r\n\t$scope.addRequestItem = function () {\r\n\t\tvar item = {\r\n\t\t\tTaxCode: \"23\",\r\n\t\t\tTax: \"23\",\r\n\t\t\tQuantity: 1\r\n\t\t};\r\n\t\t$scope.Request.RequestItems.push(item);\r\n\t};\r\n\r\n\t// usuniecie pozycji\r\n\t$scope.deleteRequestItem = function (idx) {\r\n\t\t$scope.Request.RequestItems.splice(idx, 1);\r\n\t};\r\n\r\n\t// rekalkulacja\r\n\t$scope.calculate = function (item) {\r\n\t\tvar pNet = parseFloat(item.NetPrice);\r\n\t\tvar q = parseFloat(item.Quantity);\r\n\t\tvar taxCode = item.TaxCode;\r\n\t\tvar tax = (taxCode == \"zw\" ? 0 : parseFloat(taxCode));\r\n\t\tvar discount = parseFloat(item.Discount || \"0\");\r\n\r\n\t\titem.NetValue = (pNet * q) * (1 - discount / 100);\r\n\t\titem.GrossPrice = (pNet * (1 + tax / 100));\r\n\t\titem.GrossValue = ((item.NetValue) * (1 + tax / 100));\r\n\t\titem.TaxValue = (item.GrossValue - item.NetValue);\r\n\t};\r\n\r\n\t// edycja zapytania klienta\r\n\t$scope.editResponse = function (id) {\r\n\t\t$http\r\n\t\t\t.get(\"/system/process/get-data/\" + id)\r\n\t\t\t.then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\t$scope.Request = d.data.Request;\r\n\t\t\t\t\t$scope.currentPage = \"form\";\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\ttoaster.pop('error', \"Pobranie oferty\", \"Wystąpił błąd podczas pobierania oferty.\");\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t};\r\n\r\n\t// symulowanie\r\n\t$scope.simulateRequest = function () {\r\n\t\t$scope.processRequest(true);\r\n\t};\r\n\r\n\t$scope.sendRequest = function (data) {\r\n\t\tif (confirm(\"Czy na pewno chcesz wysłać ofertę ?\")) {\r\n\t\t\t$scope.processRequest(false, data);\r\n\t\t}\r\n\t};\r\n\r\n\t$scope.sendRecalculate = function (data) {\r\n\t\tif (confirm(\"Czy na pewno chcesz przeliczyć ofertę ?\")) {\r\n\t\t\t$scope.processRequest(false, data, false);\r\n\t\t}\r\n\t};\r\n\r\n\t// wyslanie\r\n\t$scope.processRequest = function (simulate, data, sendProposal) {\r\n\r\n\t\t// jezelie przekazane jako parametr\r\n\t\tif (data)\r\n\t\t\t$scope.Request = data;\r\n\r\n\t\t// czy wyslac oferte\r\n\t\tif (typeof sendProposal === \"undefined\")\r\n\t\t\tsendProposal = ($scope.Request.Simulation === true);\r\n\r\n\t\t//pelne przeliczenie\r\n\t\t$scope.Request.FullRecalculation = true;\r\n\t\t$scope.Request.PartnerUserGuid = $scope.user.Guid;\r\n\t\t$scope.Request.PartnerUserName = $scope.user.LastName + \", \" + $scope.user.FirstName;\r\n\t\t$scope.Request.PartnerName = $scope.user.Partner;\r\n\t\t$scope.Request.SaveInProcess = true;\r\n\t\t$scope.Request.Simulation = simulate;\r\n\r\n\t\t// wsylanie zapytania\r\n\t\t$http\r\n\t\t\t.post(\"/api/OfferForClient?SendProposal=\" + sendProposal, $scope.Request)\r\n\t\t\t.then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\tif (d.data.StatusCode == 200) {\r\n\t\t\t\t\t\t//toaster.pop('success', \"Przygotowanie kalkulacji\", \"Przygotowanie kalkulacji przebiegło poprawnie.\");\r\n\t\t\t\t\t\tvar AggragatedCalulationId = d.data.Result.AggragatedCalulationId;\r\n\t\t\t\t\t\t$scope.Request.AggragatedCalulationId = AggragatedCalulationId;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tvar error = (d && d.data && d.data.Error && d.data.Error.Message) ? (\" \" + d.data.Error.Message + \".\") : d.data.Error;\r\n\t\t\t\t\t\ttoaster.pop('error', \"Przygotowanie kalkulacji\", error);\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\tvar error = (e && e.data && e.data.Error && e.data.Error.Message) ? (\" \" + e.data.Error.Message + \".\") : \"\";\r\n\t\t\t\t\ttoaster.pop('error', \"Przygotowanie kalkulacji\", \"Przygotowanie kalkulacji nie przebiegło poprawnie.\" + error);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t};\r\n\r\n\t// otwarcie oferty\r\n\t$scope.openResponse = function (id) {\r\n\t\twindow.open(\"/process/choose.offer/\" + id);\r\n\t};\r\n\r\n\t// wyslanie oferty do klienta\r\n\t$scope.sendResponse = function (id) {\r\n\t\tif (confirm(\"Czy na pewno chcesz wysłać ofertę ?\")) {\r\n\t\t\t$http\r\n\t\t\t\t.post(\"/system/process/send/\" + id)\r\n\t\t\t\t.then(\r\n\t\t\t\t\tfunction (d) {\r\n\t\t\t\t\t\ttoaster.pop('success', \"Wysłanie oferty\", \"Przesłanie oferty przebiegło poprawnie.\");\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfunction (e) {\r\n\t\t\t\t\t\ttoaster.pop('error', \"Wysłanie oferty\", \"Wystąpił błąd podczas przesyłania oferty.\");\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t}\r\n\t};\r\n\r\n\t// dodawanie dokumentow\r\n\t$scope.$watch(\"Documents\", function () {\r\n\t\tvar _docs = $scope.Documents || [];\r\n\t\t$scope.DocumentCounter = _.where(_docs, {\r\n\t\t\tConfirmed: false\r\n\t\t}).length;\r\n\t});\r\n\r\n\t// dodanie dokumentu\r\n\t$scope.addDocuments = function (id) {\r\n\t\tvar modalInstance = $modal.open({\r\n\t\t\tanimation: true,\r\n\t\t\ttemplateUrl: 'document-upload-form.html',\r\n\t\t\tcontroller: 'FileUploadCtrl',\r\n\t\t\tresolve: {\r\n\t\t\t\tAggragatedCalulationId: function () {\r\n\t\t\t\t\treturn id;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tmodalInstance.result.then(\r\n\t\t\tfunction (item) { },\r\n\t\t\tfunction () {\r\n\t\t\t\t// pokazanie zapytania\r\n\t\t\t\t$scope.showRequest(id);\r\n\t\t\t}\r\n\t\t);\r\n\t};\r\n\r\n\t/* KURIER UPS */\r\n\r\n\t$scope.makeShipmentOrder = function (id) {\r\n\t\tif (confirm(\"Przed zamówieniem kuriera należy upewnić się czy dane adresowe klienta są poprawne.\\nPotwierdzasz poprawność danych?\"))\r\n\t\t\t$http.get(\r\n\t\t\t\t\"/api/GenerateShipmentForOffer/\" + id).then(\r\n\t\t\t\t\tfunction (d) {\r\n\t\t\t\t\t\t//window.open(d.data.Link);\r\n\t\t\t\t\t\ttoaster.pop('success', \"Kurier\", \"Etykieta wysyłki została dodana do listy dokumentów.\");\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfunction (e) {\r\n\t\t\t\t\t\ttoaster.pop('error', \"Kurier\", \"Wystąpił błąd podczas zamawiania kuriera.\");\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t};\r\n\r\n\t$scope.monitorShipment = function (id) {\r\n\t\t$http.get(\r\n\t\t\t\"/api/TrackShipmentByOffer/\" + id).then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\t$scope.shipmentActivity = d.data.Result;\r\n\t\t\t\t\ttoaster.pop('success', \"Monitor wysyłki\", \"Historia przesyłki pobrana poprawnie.\");\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\ttoaster.pop('error', \"Monitor wysyłki\", \"Wystąpił błąd podczas pobierania historii przesyłki.\");\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t};\r\n\r\n\t$scope.voidShipment = function (id) {\r\n\t\tif (confirm(\"Potwierdzasz anulowanie przesyłki?\"))\r\n\t\t\t$http.get(\r\n\t\t\t\t\"/api/VoidShipmentByOffer/\" + id).then(\r\n\t\t\t\t\tfunction (d) {\r\n\t\t\t\t\t\t$scope.shipmentActivity = d.data.Result;\r\n\t\t\t\t\t\ttoaster.pop('success', \"Anulowanie wysyłki\", \"Anulowanie przesyłki poprawne.\");\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfunction (e) {\r\n\t\t\t\t\t\ttoaster.pop('error', \"Anulowanie wysyłki\", \"Wystąpił błąd podczas anulowania przesyłki.\");\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t};\r\n\r\n\t/* KONIEC KURIER UPS */\r\n\r\n\t// weryfikacja G2I\r\n\t$scope.verifyInG2I = function (id) {\r\n\t\t$http.get(\r\n\t\t\t\"/system/process/verify-in-g2i/\" + id).then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\t//window.open(d.data.Link);\r\n\t\t\t\t\ttoaster.pop('success', \"Raport G2I\", \"Wysłano rządanie wygenerowania raportów.\");\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\ttoaster.pop('error', \"Raport G2I\", \"Wystąpił błąd podczas pobierania raportu G2I. Spróbuj za chwilę.\");\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t};\r\n\r\n\t// potwierdzenie dokuemntu\r\n\t$scope.confirmDocument = function (fileId) {\r\n\t\tvar id = $scope.data.AggragatedCalulationId;\r\n\t\tvar fileIds = [];\r\n\t\tfileIds.push(fileId);\r\n\t\tif (confirm(\"Czy na pewno chcesz potwierdzić zapoznanie się z dokumentem?\")) {\r\n\t\t\t$http.post(\"/document/confirm/\" + id, {\r\n\t\t\t\tfileIds: fileIds\r\n\t\t\t}).then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\ttoaster.pop('success', \"Potwierdzanie dokumentu\", \"Dokument potwierdzono poprawnie.\");\r\n\t\t\t\t\t// pokazanie zapytania\r\n\t\t\t\t\t$scope.showRequest(id);\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\ttoaster.pop('error', \"Potwierdzanie dokumentu\", \"Wystąpił błąd podczas potwierdzania dokumentu.\");\r\n\t\t\t\t});\r\n\t\t}\r\n\t};\r\n\r\n\t// potwierdzenie dokuemntu\r\n\t$scope.confirmAllDocuments = function () {\r\n\t\tvar id = $scope.data.AggragatedCalulationId;\r\n\t\tvar fileIds = [];\r\n\t\tangular.forEach($scope.Documents, function (doc) {\r\n\t\t\tif (doc.Confirmed !== true) {\r\n\t\t\t\tfileIds.push(doc.FileId);\r\n\t\t\t}\r\n\t\t});\r\n\t\t//if (confirm(\"Czy na pewno chcesz potwierdzić zapoznanie się z dokumentem?\")) {\r\n\t\t$http.post(\"/document/confirm/\" + id, {\r\n\t\t\tfileIds: fileIds\r\n\t\t}).then(\r\n\t\t\tfunction (d) {\r\n\t\t\t\ttoaster.pop('success', \"Potwierdzanie dokumentu\", \"Dokument potwierdzono poprawnie.\");\r\n\t\t\t\t// pokazanie zapytania\r\n\t\t\t\t$scope.showRequest(id);\r\n\t\t\t},\r\n\t\t\tfunction (e) {\r\n\t\t\t\ttoaster.pop('error', \"Potwierdzanie dokumentu\", \"Wystąpił błąd podczas potwierdzania dokumentu.\");\r\n\t\t\t});\r\n\t\t//}\r\n\t};\r\n\r\n\t// usuwanie dokumentu\r\n\t$scope.deleteDocument = function (fileId) {\r\n\t\tvar id = $scope.data.AggragatedCalulationId;\r\n\t\tif (confirm(\"Czy na pewno chcesz usunąć dokument?\")) {\r\n\t\t\t$http.post(\"/document/delete/\" + id, {\r\n\t\t\t\tfileId: fileId\r\n\t\t\t}).then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\ttoaster.pop('success', \"Usuwanie dokumentu\", \"Dokument usunięto poprawnie.\");\r\n\t\t\t\t\t// pokazanie zapytania\r\n\t\t\t\t\t$scope.showRequest(id);\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\ttoaster.pop('error', \"Usuwanie dokumentu\", \"Wystąpił błąd podczas usuwania dokumentu.\");\r\n\t\t\t\t});\r\n\t\t}\r\n\r\n\t};\r\n\r\n\t// pokazanie dokumentu\r\n\t$scope.showDocument = function (fileId) {\r\n\t\twindow.open(\"/document/show?fileId=\" + fileId);\r\n\t};\r\n\r\n\r\n\t//pobranie krokow procesu\r\n\t$scope.getNextSteps = function (id) {\r\n\t\t$http.get('/OfferRequest/GetProcessStep/' + id).then(\r\n\t\t\tfunction (d) {\r\n\t\t\t\t$scope.NextSteps = d.data.NextSteps;\r\n\t\t\t},\r\n\t\t\tfunction (e) {\r\n\t\t\t\ttoaster.pop('error', \"Pobieranie danych\", \"Pobieranie danych nie przebiegło poprawnie.\");\r\n\t\t\t});\r\n\t};\r\n\r\n\t// ustawienie statusu procesu\r\n\t$scope.setProcessStatus = function (step) {\r\n\t\tif (confirm(\"Czy na pewno chcesz zmienić status ?\")) {\r\n\t\t\tvar id = $scope.Process.OfferClientResonse_Guid;\r\n\t\t\t$http.post('/OfferRequest/SetProcessStep/' + id, {\r\n\t\t\t\tStep: step\r\n\t\t\t}).then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\tif (d.data.Status == \"ERROR\") {\r\n\t\t\t\t\t\ttoaster.pop('error', \"Zmiana statusu\", d.data.Message);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$scope.showRequest(id);\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\ttoaster.pop('error', \"Pobieranie danych\", \"Pobieranie danych nie przebiegło poprawnie.\");\r\n\t\t\t\t});\r\n\t\t}\r\n\t};\r\n\r\n\r\n\t// sprawdzenie przez nip\r\n\t$scope.onRequestorIdentificationNumber1Changed = function () { };\r\n\r\n\t// pobranie topicow\r\n\t$scope.InnerCommunicationTopics = [];\r\n\t$scope.getTopics = function (id) {\r\n\t\t$http.get(\"/Message/getTopics/\" + id).then(\r\n\t\t\tfunction (d) {\r\n\t\t\t\t$scope.InnerCommunicationTopics = d.data.Topics;\r\n\t\t\t\t$scope.UnreadMessages = d.data.UnreadMessages;\r\n\t\t\t},\r\n\t\t\tfunction (e) {\r\n\t\t\t\ttoaster.pop('error', \"Pobieranie tematów\", \"Wystąpił błąd podczas pobierania tematów.\");\r\n\t\t\t}\r\n\t\t);\r\n\t};\r\n\r\n\t// edycja danych komunikacyjnych\r\n\t$scope.editCommunicationData = function () {\r\n\t\t$scope.currentPageMode = 'editCommunicationData';\r\n\t};\r\n\r\n\t// zamkniecie\r\n\t$scope.closeCommunicationData = function () {\r\n\t\t$scope.currentPageMode = '';\r\n\t};\r\n\r\n\t// zapisanie danych komunikacyjnych\r\n\t$scope.saveCommunicationData = function () {\r\n\t\t$http.post('/system/process/save-communication-data/' + $scope.data.Request.AggragatedCalulationId, {\r\n\t\t\tcontactPerson: $scope.data.Request.SaveDataContactPerson,\r\n\t\t\temail: $scope.data.Request.SaveDataEmail,\r\n\t\t\tphone: $scope.data.Request.SaveDataPhone\r\n\t\t})\r\n\t\t\t.then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\t$scope.data = d.data.Response;\r\n\t\t\t\t\t$scope.Process = d.data.Process;\r\n\t\t\t\t\t$scope.Documents = d.data.Documents;\r\n\t\t\t\t\t$scope.currentPageMode = '';\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\ttoaster.pop('error', \"Zapis danych\", \"Wystąpił błąd podczas zapisu danych.\");\r\n\t\t\t\t});\r\n\t};\r\n\r\n\r\n\t// edycja danych koszykowych\r\n\t$scope.editBasketData = function (calculationId) {\r\n\r\n\t\tif (typeof calculationId === \"undefined\") calculationId = \"\";\r\n\t\t$http.get('/OfferBusinessData/GetCategoryLevelsForRequest' + '?calculationId=' + calculationId).then(\r\n\t\t\tfunction (d) {\r\n\t\t\t\t// zmienna przechowująca produkty partnera, na którego jest założona sprawa - pobierane przy edycji koszyka na sprawie\r\n\t\t\t\t$scope.categoryForRequestDic = d.data;\r\n\t\t\t},\r\n\t\t\tfunction (e) {\r\n\t\t\t\ttoaster.pop('error', \"Pobieranie danych\", \"Pobieranie danych nie przebiegło poprawnie.\");\r\n\t\t\t});\r\n\t\t$scope.currentPageMode = 'editBasketData';\r\n\t};\r\n\r\n\t// zmień warunki\r\n\t$scope.changeConditions = function () {\r\n\t\t$http.get('/ChangeConditions/GetConditionsForOffer/' + $scope.data.AggragatedCalulationId + '?packageId=' + $scope.data.PackageId).then(function (d) {\r\n\t\t\t$scope.conditions = d.data;\r\n\t\t\t//console.log(d);\r\n\t\t});\r\n\t\t$scope.currentPageMode = 'changeConditions';\r\n\t};\r\n\r\n\t// aktualizacja warunkow\r\n\t$scope.updateConditions = function () {\r\n\t\tvar _self = this;\r\n\t\t$scope.areYouSure(\r\n\t\t\t{\r\n\t\t\t\tmessage: 'Czy podczas przeliczania chcesz zachować bieżący pakiet kalkulacyjny ?',\r\n\t\t\t\tokLabel: 'Tak',\r\n\t\t\t\tcancelLabel: 'Nie',\r\n\t\t\t\tokProcess: function () { _self.processUpdateConditions(true); },\r\n\t\t\t\tcancelProcess: function () { _self.processUpdateConditions(false); }\r\n\t\t\t}\r\n\t\t).then(function (item) { }, function () { });\r\n\t}\r\n\r\n\t// przeprocesowanie akutalizacji warunkow\r\n\t$scope.processUpdateConditions = function (savePackageId) {\r\n\t\t$http.post('/ChangeConditions/PostConditionsForOffer/' + $scope.data.AggragatedCalulationId, $scope.conditions).then(function (d) {\r\n\t\t\t$http\r\n\t\t\t\t.get(\"/system/process/get-data/\" + $scope.data.AggragatedCalulationId)\r\n\t\t\t\t.then(\r\n\t\t\t\t\tfunction (d) {\r\n\t\t\t\t\t\t$scope.Request = d.data.Request;\r\n\r\n\t\t\t\t\t\t//$scope.simulateRequest();\r\n\r\n\t\t\t\t\t\t//if (data)\r\n\t\t\t\t\t\t// $scope.Request = data;\r\n\r\n\t\t\t\t\t\t//niepelne przeliczenie = uzywamy zapisanych elemento\r\n\t\t\t\t\t\t$scope.Request.FullRecalculation = false;\r\n\t\t\t\t\t\t$scope.Request.PartnerUserGuid = $scope.user.Guid;\r\n\t\t\t\t\t\t$scope.Request.PartnerUserName = $scope.user.LastName + \", \" + $scope.user.FirstName;\r\n\t\t\t\t\t\t$scope.Request.PartnerName = $scope.user.Partner;\r\n\t\t\t\t\t\tif (savePackageId === true) {\r\n\t\t\t\t\t\t\t$scope.Request.RequestedCalculationPackageId = d.data.PackageId;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// $scope.Request.SaveInProcess = false;\r\n\t\t\t\t\t\t// $scope.Request.Simulation = false;\r\n\r\n\t\t\t\t\t\t// wsylanie zapytania\r\n\t\t\t\t\t\t$http\r\n\t\t\t\t\t\t\t.post(\"/api/OfferForClient\", $scope.Request)\r\n\t\t\t\t\t\t\t.then(\r\n\t\t\t\t\t\t\t\tfunction (d) {\r\n\t\t\t\t\t\t\t\t\tif (d.data.StatusCode == 200) {\r\n\t\t\t\t\t\t\t\t\t\t//toaster.pop('success', \"Przygotowanie kalkulacji\", \"Przygotowanie kalkulacji przebiegło poprawnie.\");\r\n\t\t\t\t\t\t\t\t\t\tvar AggragatedCalulationId = d.data.Result.AggragatedCalulationId;\r\n\t\t\t\t\t\t\t\t\t\t$scope.Request.AggragatedCalulationId = AggragatedCalulationId;\r\n\t\t\t\t\t\t\t\t\t\t$scope.currentPageMode = '';\r\n\t\t\t\t\t\t\t\t\t\t$scope.showRequest($scope.Process.OfferClientResonse_Guid);\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\tvar error = (d && d.data && d.data.Error && d.data.Error.Message) ? (\" \" + d.data.Error.Message + \".\") : d.data.Error;\r\n\t\t\t\t\t\t\t\t\t\ttoaster.pop('error', \"Przygotowanie kalkulacji\", error);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\tfunction (e) {\r\n\t\t\t\t\t\t\t\t\tvar error = (e && e.data && e.data.Error && e.data.Error.Message) ? (\" \" + e.data.Error.Message + \".\") : \"\";\r\n\t\t\t\t\t\t\t\t\ttoaster.pop('error', \"Przygotowanie kalkulacji\", \"Przygotowanie kalkulacji nie przebiegło poprawnie.\" + error);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfunction (e) {\r\n\t\t\t\t\t\ttoaster.pop('error', \"Pobranie oferty\", \"Wystąpił błąd podczas pobierania oferty.\");\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t//$scope.simulateRequest();\r\n\t\t});\r\n\t}\r\n\r\n\t$scope.changes = {\r\n\t\twasRequestsListChanged: false\r\n\t};\r\n\r\n\t// zamkniecie\r\n\t$scope.closeBasketData = function () {\r\n\t\tif ($scope.changes.wasRequestsListChanged) {\r\n\t\t\tif (confirm(\"Zmieniłeś przedmioty oferty. Czy chcesz porzucić te zmiany?\")) {\r\n\t\t\t\t$scope.currentPageMode = '';\r\n\t\t\t\t$scope.changes.wasRequestsListChanged = false;\r\n\t\t\t\t$scope.showRequest($scope.Process.OfferClientResonse_Guid);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$scope.currentPageMode = '';\r\n\t\t}\r\n\t};\r\n\r\n\t// zadawanie pytanie\r\n\t$scope.areYouSure = function (options) {\r\n\r\n\r\n\t\tvar modalInstance = $modal.open({\r\n\t\t\tanimation: true,\r\n\t\t\ttemplateUrl: '/WWW/partials/areYouSure.html',\r\n\t\t\tcontroller: ['$scope', '$modalInstance', 'options', function ($scope, $modalInstance, options) {\r\n\t\t\t\t$scope.options = options || {};\r\n\t\t\t\t$scope.message = $scope.options.message || 'Czy na pewno chcesz wykonać akcję ?';\r\n\t\t\t\t$scope.okLabel = $scope.options.okLabel || 'Ok';\r\n\t\t\t\t$scope.cancelLabel = $scope.options.cancelLabel || 'Anuluj';\r\n\t\t\t\t$scope.okProcess = function () {\r\n\t\t\t\t\tif (typeof $scope.options.okProcess === 'function') {\r\n\t\t\t\t\t\t$scope.options.okProcess();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$modalInstance.close();\r\n\t\t\t\t};\r\n\t\t\t\t$scope.cancelProcess = function () {\r\n\t\t\t\t\tif (typeof $scope.options.cancelProcess === 'function') {\r\n\t\t\t\t\t\t$scope.options.cancelProcess();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$modalInstance.dismiss('cancel');\r\n\t\t\t\t}\r\n\t\t\t}],\r\n\t\t\tresolve: {\r\n\t\t\t\toptions: function () {\r\n\t\t\t\t\treturn options;\r\n\t\t\t\t},\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn modalInstance.result;\r\n\r\n\t};\r\n\r\n\r\n\t// zapisanie danych komunikacyjnych\r\n\t$scope.saveBasketData = function () {\r\n\t\t// jeśli nic nie usunęliśmy i nie dodaliśmy\r\n\t\tif (!$scope.changes.wasRequestsListChanged)\r\n\t\t\t$http.post('/system/process/save-basket-data/' + $scope.data.Request.AggragatedCalulationId, { request: $scope.data.Request })\r\n\t\t\t\t.then(\r\n\t\t\t\t\tfunction (d) {\r\n\t\t\t\t\t\t$scope.data = d.data.Response;\r\n\t\t\t\t\t\t$scope.currentPageMode = '';\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfunction (e) {\r\n\t\t\t\t\t\ttoaster.pop('error', \"Zapis danych\", \"Wystąpił błąd podczas zapisu danych.\");\r\n\t\t\t\t\t});\r\n\t\t// jeśli usunęliśmy lub dodaliśmy przedmioty do oferty to powiadamiamy o pełnej rekalkulacji\r\n\t\telse if ($scope.changes.wasRequestsListChanged) {\r\n\r\n\t\t\t// pytanie o wykonanie rekalkulacji\r\n\t\t\t$scope.areYouSure(\r\n\t\t\t\t{\r\n\t\t\t\t\tmessage: 'Przemioty oferty został zmieniony. Czy chcesz zapisać zmiany i wykonać rekalkulację oferty ?',\r\n\t\t\t\t\tokLabel: 'Tak',\r\n\t\t\t\t\tcancelLabel: 'Nie'\r\n\t\t\t\t}\r\n\t\t\t).then(\r\n\t\t\t\tfunction (item) {\r\n\t\t\t\t\t// czy zastąpić parametry oferty\r\n\t\t\t\t\t$scope.areYouSure(\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tmessage: 'Czy zastąpić obecne parametry kalkulacji na domyślne ?',\r\n\t\t\t\t\t\t\tokLabel: 'Tak',\r\n\t\t\t\t\t\t\tcancelLabel: 'Nie',\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t).then(\r\n\t\t\t\t\t\tfunction (item) {\r\n\t\t\t\t\t\t\t// pełna rekalkulacja\r\n\t\t\t\t\t\t\t$scope.data.Request.FullRecalculation = true;\r\n\t\t\t\t\t\t\t$scope.processSaveOfferData();\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tfunction () {\r\n\t\t\t\t\t\t\t// częściowa rekalkulacja\r\n\t\t\t\t\t\t\t$scope.data.Request.FullRecalculation = false;\r\n\t\t\t\t\t\t\t$scope.processSaveOfferData();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t);\r\n\t\t\t\t},\r\n\t\t\t\tfunction () {\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t};\r\n\r\n\t// przeslanie danych do zapisu\r\n\t$scope.processSaveOfferData = function () {\r\n\t\t$http.post('/system/process/save-offer-data/' + $scope.data.Request.AggragatedCalulationId, { request: $scope.data.Request })\r\n\t\t\t.then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\t$scope.data = d.data.Response;\r\n\t\t\t\t\t$scope.currentPageMode = '';\r\n\t\t\t\t\t$scope.changes.wasRequestsListChanged = false;\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\ttoaster.pop('error', \"Zapis danych\", \"Wystąpił błąd podczas zapisu danych.\");\r\n\t\t\t\t});\r\n\t}\r\n\r\n\t// sprawdzenie platnosci\r\n\t$scope.checkPayment = function (payment_id) {\r\n\t\t$http.post('/Payment/CheckPaymentConfirmation/' + $scope.data.Request.AggragatedCalulationId, { dotpayid: payment_id })\r\n\t\t\t.then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\t$scope.data = d.data.Response;\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\ttoaster.pop('error', \"Zapis danych\", \"Wystąpił błąd podczas zapisu danych.\");\r\n\t\t\t\t});\r\n\t}\r\n\r\n\t// edycja danych oferty\r\n\t$scope.packageList = [];\r\n\t$scope.editOfferData = function () {\r\n\t\t$scope.currentPageMode = 'editOfferData';\r\n\r\n\t\t// w przypadku braku wybrania to nalezy pociagnac wyliczony package\r\n\t\t$scope.data.Request.RequestedCalculationPackageId = $scope.data.PackageId;\r\n\r\n\t\t// dociagniecie danych\r\n\t\t$scope.onRequestedCalculationPackageIdChange();\r\n\r\n\r\n\r\n\t\t// pobranie slownika offert\r\n\t\t$http.get(\"/OfferBusinessData/GetCalculationPackages\").then(\r\n\t\t\tfunction (d) {\r\n\t\t\t\t$scope.packageList = d.data;\r\n\t\t\t},\r\n\t\t\tfunction (e) {\r\n\t\t\t\ttoaster.pop('error', \"Pobieranie danych\", \"Wystąpił błąd podczas pobierania danych.\");\r\n\t\t\t});\r\n\t};\r\n\r\n\t// zamkniecie\r\n\t$scope.closeOfferData = function () {\r\n\t\t$scope.currentPageMode = '';\r\n\t};\r\n\r\n\t// zapisanie danych komunikacyjnych\r\n\t$scope.saveOfferData = function () {\r\n\t\t$scope.data.Request.SaveInProcess = false;\r\n\t\t$http.post('/system/process/save-offer-data/' + $scope.data.Request.AggragatedCalulationId, { request: $scope.data.Request })\r\n\t\t\t.then(\r\n\t\t\t\tfunction (d) {\r\n\t\t\t\t\t$scope.data = d.data.Response;\r\n\t\t\t\t\t$scope.currentPageMode = '';\r\n\t\t\t\t\t$scope.showRequest($scope.Process.OfferClientResonse_Guid);\r\n\t\t\t\t},\r\n\t\t\t\tfunction (e) {\r\n\t\t\t\t\ttoaster.pop('error', \"Zapis danych\", \"Wystąpił błąd podczas zapisu danych.\");\r\n\t\t\t\t});\r\n\t};\r\n\r\n\t// zmiana na liscie wbieralnej\r\n\t$scope.onRequestedCalculationPackageIdChange = function () {\r\n\t\t$http.post(\"/OfferBusinessData/GetCalculationPackageForOffer\", {\r\n\t\t\tofferId: $scope.data.AggragatedCalulationId,\r\n\t\t\tpackageId: $scope.data.Request.RequestedCalculationPackageId\r\n\t\t})\r\n\t\t\t.then(function (d) {\r\n\t\t\t\t$scope.data = d.data.Response;\r\n\t\t\t\t$scope.addons2 = d.data.ADDONS2;\r\n\t\t\t\t$scope.addons3 = d.data.ADDONS3;\r\n\t\t\t\t$scope.data.Request.RequestedCalculationPackageId = $scope.data.PackageId;\r\n\t\t\t}, function (e) {\r\n\t\t\t\ttoaster.pop('error', \"Pobieranie danych\", \"Wystąpił błąd podczas pobierania danych.\");\r\n\t\t\t});;\r\n\t}\r\n\r\n\r\n\t// pobranie informacji z zapytania dla\r\n\t$scope.getTermsForItem = function (item) {\r\n\t\tvar fItem = _.find($scope.data.Request.AdditionalProducts, {\r\n\t\t\tProductId: item.ProductId\r\n\t\t}) || {};\r\n\t\treturn fItem;\r\n\t}\r\n\r\n\t// event powrotu na listę zamówień (button)\r\n\t$scope.showOrderList = function () {\r\n\t\t$scope.currentPage = 'list';\r\n\t\t$rootScope.$broadcast('context-request');\r\n\r\n\t};\r\n\r\n\t// powrót na listę zamówień (zakładka)\r\n\t$scope.$on('current-page-list', function (event, args) {\r\n\t\t$scope.currentPage = 'list';\r\n\t});\r\n};\r\n\r\n\r\n/* kontroler systemowy */\r\nvar SystemCtrl = function ($scope, $rootScope, $location, $http, $modal, toaster) {\r\n\r\n\t$scope.adminModeCounter = 0;\r\n\t$scope.adminMode = false;\r\n\r\n\t$scope.enableAdminMode = function () {\r\n\t\t$scope.adminModeCounter++;\r\n\r\n\t\tif ($scope.adminModeCounter > 6) {\r\n\t\t\t$scope.adminMode = true;\r\n\t\t}\r\n\t};\r\n\r\n\t$scope.newRequestByPartner = function () {\r\n\t\t// top.window.location.href=$scope.settings.newRequestUrl;\r\n\t\twindow.open($scope.settings.newRequestUrl);\r\n\t}\r\n\r\n\t$scope.newRequest = function () {\r\n\t\t$scope.currentFunction = 'newRequest';\r\n\t\tconsole.log('systemctrk');\r\n\t};\r\n\r\n\r\n\t$scope.showFunction = function (func) {\r\n\t\t$scope.currentFunction = func;\r\n\t};\r\n\r\n\t$scope.showPartnerFunction = function (func) {\r\n\t\t$scope.currentFunction = func;\r\n\t};\r\n\r\n\t// powrót na liste zamówień (button)\r\n\t$scope.$on('context-request', function (event, args) {\r\n\t\t$scope.showFunction('requests');\r\n\t});\r\n\r\n\t// event powrotu na liste zamowień (zakładka)\r\n\t$scope.showPage = function (func) {\r\n\t\t$rootScope.$broadcast('current-page-' + func);\r\n\t};\r\n\r\n\t// powrot do produktów finansowych (button)\r\n\t$scope.$on('back-to-financial-products', function (event, args) {\r\n\t\t$scope.showFunction('leaselinkProducts');\r\n\t});\r\n\r\n\t// event powrotu do produktów finansowych (zakładka)\r\n\t$scope.showFinancialProductsPage = function (func) {\r\n\t\t$rootScope.$broadcast('current-productFunc-' + func);\r\n\t};\r\n\r\n\t// powrot do partnerow\r\n\t$scope.$on('back-to-partners', function (event, args) {\r\n\t\t$scope.showFunction('leaselinkProducts');\r\n\t});\r\n\r\n\t// zmiana hasła przez admina\r\n\t$scope.changeUserPassword = function () {\r\n\t\t// item.EditMode = false;\r\n\t\tvar modalInstance = $modal.open({\r\n\t\t\tanimation: true,\r\n\t\t\ttemplateUrl: '/WWW/partials/modules/users/changePassword.html',\r\n\t\t\tcontroller: 'UserChangePasswordCtrl'\r\n\t\t});\r\n\r\n\t\tmodalInstance.result.then(function () { }, function () { });\r\n\r\n\t};\r\n\r\n};\r\n\r\n/* haslo uzytkownika */\r\nvar UserChangePasswordCtrl = function ($scope, $modalInstance, $http, toaster) {\r\n\r\n\r\n\t$scope.item = {\r\n\t\tCurrentPassword: \"\",\r\n\t\tPassword: \"\",\r\n\t\tPasswordConfirm: \"\"\r\n\t};\r\n\r\n\t// oddanie danych\r\n\t$scope.saveNewPassword = function () {\r\n\r\n\t\t$http.post(\"/system/password-reset-confirm\", {\r\n\t\t\tCurrentPassword: $scope.CurrentPassword,\r\n\t\t\tPassword: $scope.Password,\r\n\t\t\tPasswordConfirm: $scope.PasswordConfirm,\r\n\t\t\tChangePasswordOnLogon: false\r\n\t\t}).then(function (d) {\r\n\t\t\t$modalInstance.close();\r\n\t\t\ttoaster.pop('success', \"Użytkownicy\", \"Poprawnie zmieniono hasło\")\r\n\t\t}, function (e) {\r\n\t\t\ttoaster.pop('error', \"Użytkownicy\", \"Zmiana hasła nie powiodła się\");\r\n\t\t});\r\n\r\n\t};\r\n\r\n\t// zamkniecie\r\n\t$scope.cancel = function () {\r\n\t\t$modalInstance.dismiss('cancel');\r\n\t};\r\n\r\n}\r\n\r\n/* minitor */\r\nvar MonitorCtrl = function ($rootScope, $scope, $location, $http, $modal, toaster) {\r\n\r\n\t$scope.isCollapsed = true;\r\n\t$scope.MonitorRecord = [];\r\n\r\n\t$scope.Refresh = function () {\r\n\t\t$http.get('/api/Monitor').then(\r\n\t\t\tfunction (d) {\r\n\t\t\t\t$scope.MonitorRecord = d.data.Result;\r\n\t\t\t\t//toaster.pop('success', 'Pobieranie danych zakończone pomyślnie');\r\n\t\t\t},\r\n\t\t\tfunction (e) {\r\n\t\t\t\ttoaster.pop('error', 'Pobieranie danych nie powiodło się');\r\n\t\t\t});\r\n\t};\r\n\r\n\t$scope.Refresh();\r\n\t$scope.Test = function (item) {\r\n\t\t$http.get('/api/Monitor/' + item).then(\r\n\t\t\tfunction (d) {\r\n\t\t\t\t$scope.Refresh();\r\n\t\t\t\ttoaster.pop('success', item, 'Test został wykonany');\r\n\t\t\t},\r\n\t\t\tfunction (e) {\r\n\t\t\t\ttoaster.pop('error', item, 'Próba wykonania testu zakończyła sie niepowodzeniem, spróbuj jeszcze raz');\r\n\t\t\t});\r\n\t};\r\n\r\n\t//metoda dla testu wszystkich\r\n\t$scope.TestAll = function () {\r\n\t\tfor (var i = 0; i < $scope.MonitorRecord.length; i++) {\r\n\t\t\t$scope.Test($scope.MonitorRecord[i].PartitionKey);\r\n\t\t}\r\n\t};\r\n\r\n\t//metoda dla testu wszystkich\r\n\t$scope.GetReport = function (timePeriod) {\r\n\t\tif (!timePeriod)\r\n\t\t\twindow.open('/document/GetReport');\r\n\t\telse\r\n\t\t\twindow.open('/document/GetReport?' + 'dataOd=' + encodeURIComponent(timePeriod.From) + '&dataDo=' + encodeURIComponent(timePeriod.To));\r\n\t};\r\n\r\n\t$scope.OpenReportModal = function () {\r\n\t\tvar modalInstance = $modal.open({\r\n\t\t\tanimation: true,\r\n\t\t\tscope: $scope,\r\n\t\t\ttemplate: '