{"version":3,"file":"importVesselScheduleDirective.js","sourceRoot":"","sources":["../../../../src/modules/directives/logistics/importVesselScheduleDirective.ts"],"names":[],"mappings":"AAAA,IAAO,UAAU,CA8OhB;AA9OD,WAAO,UAAU;IACb,IAAc,WAAW,CA4OxB;IA5OD,WAAc,WAAW;QA+BrB;YAQI,uCACY,cAA0D,EAC1D,MAA2B,EAC3B,uBAAuB,EACvB,qBAAkE,EAClE,QAAoC;gBALhD,iBAQC;gBAPW,mBAAc,GAAd,cAAc,CAA4C;gBAC1D,WAAM,GAAN,MAAM,CAAqB;gBAC3B,4BAAuB,GAAvB,uBAAuB,CAAA;gBACvB,0BAAqB,GAArB,qBAAqB,CAA6C;gBAClE,aAAQ,GAAR,QAAQ,CAA4B;gBAZhD,gBAAW,GAAG,2EAA2E,CAAC;gBAC1F,UAAK,GAAG,EACP,CAAA;gBAeD,SAAI,GAAG,UAAC,MAAsC,EAAE,QAA6B,EAAE,MAAM;oBAGjF,MAAM,CAAC,iBAAiB,GAAG;wBACvB,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC;wBACxB,OAAO,KAAI,CAAC,qBAAqB,CAAC,8BAA8B,EAAE,CAAC,KAAK,CAAC,EACxE,EAAE,UAAC,UAAU;4BACV,MAAM,CAAC,aAAa,GAAG,UAAU,CAAC;4BAElC,IAAI,kBAAkB,GAAG,KAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;4BACvE,IAAI,kBAAkB,EAAC,CAAC;gCAEpB,MAAM,CAAC,cAAc,GAAG,CAAC,kBAAkB,CAAC;gCAC5C,MAAM,CAAC,iBAAiB,EAAE,CAAC;gCAC3B,MAAM,CAAC,4BAA4B,EAAE,CAAC;4BAC1C,CAAC;4BAED,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC;wBAC7B,CAAC,CAAC,CAAC,QAAQ,CAAC;oBAChB,CAAC,CAAA;oBAED,MAAM,CAAC,iBAAiB,GAAG;wBACvB,OAAO,KAAI,CAAC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tC,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC;wBAC7B,CAAC,CAAC,CAAC;oBACP,CAAC,CAAA;oBAED,MAAM,CAAC,SAAS,GAAG,UAAC,MAAU;wBAC1B,MAAM,CAAC,cAAc,EAAE,CAAC;oBAC5B,CAAC,CAAA;oBAED,MAAM,CAAC,QAAQ,GAAG,UAAC,MAAU;wBACzB,MAAM,CAAC,cAAc,EAAE,CAAC;oBAC5B,CAAC,CAAA;oBAED,qCAAqC;gBAEzC,CAAC,CAAA;YAjLD,CAAC;YAmLM,qCAAO,GAAd;gBACI,IAAM,SAAS,GAAG,UAAC,cAAc,EAAE,MAAM,EACrC,uBAAuB,EAAE,qBAAqB,EAAC,QAAQ,IAAK,OAAA,IAAI,6BAA6B,CAAC,cAAc,EAAE,MAAM,EAAE,uBAAuB,EAAE,qBAAqB,EAAC,QAAQ,CAAC,EAAlH,CAAkH,CAAC;gBACnL,SAAS,CAAC,OAAO,GAAG,CAAC,gBAAgB,EAAE,QAAQ,EAAE,yBAAyB,EAAE,uBAAuB,EAAC,UAAU,CAAC,CAAC;gBAEhH,OAAO,SAAS,CAAC;YACrB,CAAC;YACL,oCAAC;QAAD,CAAC,AA1MD,IA0MC;QA1MY,yCAA6B,gCA0MzC,CAAA;QAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,yBAAyB,EAAE,6BAA6B,CAAC,OAAO,EAAE,CAAC,CAAC;IACxG,CAAC,EA5Oa,WAAW,GAAX,sBAAW,KAAX,sBAAW,QA4OxB;AACL,CAAC,EA9OM,UAAU,KAAV,UAAU,QA8OhB","sourcesContent":["module directives {\r\n export module integration {\r\n interface IImportVesselScheduleDirective extends ng.IScope {\r\n importVesselScheduleData: interfaces.logistics.ImportVesselScheduleDashboardView[];\r\n filteredImportVesselScheduleData: interfaces.logistics.ImportVesselScheduleDashboardView[];\r\n importVesselScheduleSummaryData: interfaces.logistics.ImportVesselScheduleDashboardViewSummary[];\r\n isLoading: boolean;\r\n PortTerminals: Array;\r\n LoadImportVesselScheduleData();\r\n loadPortTerminals();\r\n getTerminalUpdate();\r\n refreshSummaryView();\r\n terminalInfo: interfaces.logistics.TerminalInfo;\r\n navigateToVesselSchedule(vshId:number);\r\n navigateToConsignment(conId:number);\r\n getVesselScheduleDetailById(vshId:number): interfaces.logistics.ImportVesselScheduleDashboardView[];\r\n portTerminalId: number;\r\n searchText: string;\r\n searchChanged();\r\n change(model: interfaces.applicationcore.IDropdownModel): void;\r\n replaceAll(str : string, find: string, replace: string):string;\r\n downloadToExcel();\r\n\r\n //HTML5 Drag and Drop Methods\r\n\r\n dragStart($event: any,vesselSchedule:interfaces.logistics.ImportVesselScheduleDashboardView);\r\n dragDrop($event: any,vesselScheduleSummary:interfaces.logistics.ImportVesselScheduleDashboardViewSummary);\r\n dragEnter($event:any);\r\n dragOver($event:any);\r\n\r\n }\r\n\r\n export class importVesselScheduleDirective implements ng.IDirective {\r\n templateUrl = 'templates/modules/applicationmain/logistics/importVesselScheduleView.html';\r\n scope = {\r\n }\r\n\r\n public imporVesselScheduleData: interfaces.logistics.ImportVesselScheduleDashboardView[];\r\n public imporVesselScheduleSummaryData: interfaces.logistics.ImportVesselScheduleDashboardViewSummary[];\r\n\r\n constructor(\r\n private generalService: interfaces.applicationcore.IGeneralService,\r\n private $state: ng.ui.IStateService,\r\n private bsLoadingOverlayService,\r\n private vesselScheduleService: interfaces.logistics.IVesselScheduleService,\r\n private $cookies: ng.cookies.ICookiesService,\r\n ) {\r\n \r\n }\r\n\r\n link = ($scope: IImportVesselScheduleDirective, $element: ng.IAugmentedJQuery, $state) => {\r\n\r\n\r\n $scope.loadPortTerminals = () => {\r\n $scope.isLoading = true;\r\n return this.vesselScheduleService.getGetPortTerminalsForDropDown().query({\r\n }, (resultList) => {\r\n $scope.PortTerminals = resultList;\r\n\r\n var lastPortTerminalId = this.$cookies.get('lastImportPortTerminalId');\r\n if (lastPortTerminalId){\r\n\r\n $scope.portTerminalId = +lastPortTerminalId;\r\n $scope.getTerminalUpdate();\r\n $scope.LoadImportVesselScheduleData();\r\n }\r\n\r\n $scope.isLoading = false;\r\n }).$promise;\r\n }\r\n\r\n $scope.getTerminalUpdate = () => {\r\n return this.vesselScheduleService.GetTerminalUpdate($scope.portTerminalId).query({}, (result) => {\r\n $scope.terminalInfo = result;\r\n });\r\n }\r\n \r\n\r\n $scope.LoadImportVesselScheduleData = () => {\r\n $scope.isLoading = true;\r\n $scope.searchText = \"\";\r\n return this.vesselScheduleService.getImportVesselScheduleDashboardData($scope.portTerminalId).query({\r\n }, (resultList) => {\r\n this.$cookies.put('lastImportPortTerminalId',$scope.portTerminalId.toString());\r\n $scope.importVesselScheduleData = resultList;\r\n $scope.filteredImportVesselScheduleData = resultList;\r\n $scope.importVesselScheduleSummaryData = [];\r\n $scope.getTerminalUpdate();\r\n $scope.refreshSummaryView();\r\n\r\n\r\n $scope.isLoading = false;\r\n }).$promise;\r\n }\r\n\r\n $scope.refreshSummaryView = () => {\r\n $scope.importVesselScheduleSummaryData = [];\r\n angular.forEach( $scope.filteredImportVesselScheduleData.sort((a,b)=> b.vshId-a.vshId), (importVesselSchedule) => {\r\n \r\n var importVesselScheduleSummary = _.find($scope.importVesselScheduleSummaryData, (o) => { return o.vshId === importVesselSchedule.vshId});\r\n \r\n if (!importVesselScheduleSummary){\r\n \r\n importVesselScheduleSummary = {\r\n vshId: importVesselSchedule.vshId,\r\n TerminalId: importVesselSchedule.TerminalId,\r\n VesselId: importVesselSchedule.VesselId,\r\n VisitSequence: importVesselSchedule.VisitSequence,\r\n CallSign: importVesselSchedule.CallSign,\r\n VesselName: importVesselSchedule.VesselName,\r\n TimeofBerthing: importVesselSchedule.TimeofBerthing,\r\n StorageEnd: importVesselSchedule.StorageEnd,\r\n EstimateDateOfArrival: importVesselSchedule.EstimateDateOfArrival,\r\n ArrivalComments: importVesselSchedule.ArrivalComments,\r\n SLA : 0,\r\n IsExpanded: false,\r\n SLAComments: ''\r\n }\r\n \r\n $scope.importVesselScheduleSummaryData.push(importVesselScheduleSummary);\r\n \r\n }\r\n\r\n importVesselScheduleSummary = _.find($scope.importVesselScheduleSummaryData, (o) => { return o.vshId === importVesselSchedule.vshId});\r\n\r\n if (importVesselSchedule.SLA > importVesselScheduleSummary.SLA){\r\n importVesselScheduleSummary.SLA = importVesselSchedule.SLA;\r\n\r\n }\r\n \r\n if (importVesselScheduleSummary.SLA > 0){\r\n importVesselScheduleSummary.IsExpanded = true;\r\n }\r\n\r\n\r\n if (importVesselSchedule.SLAComments !== '')\r\n {\r\n importVesselScheduleSummary.SLAComments = importVesselScheduleSummary.SLAComments + '
' + importVesselSchedule.SLAComments;\r\n }\r\n\r\n });\r\n\r\n \r\n }\r\n\r\n $scope.change = (model) => {\r\n $scope.LoadImportVesselScheduleData();\r\n }\r\n\r\n $scope.navigateToVesselSchedule = (vshId:number) => {\r\n this.$state.go(\"auth.VesselSailingSchedule.Update\", { vshId: vshId });\r\n }\r\n\r\n $scope.navigateToConsignment = (conId:number) => {\r\n this.$state.go(\"auth.ConsignmentImports.Update\", { conId: conId });\r\n }\r\n\r\n\r\n $scope.getVesselScheduleDetailById = (vshId:number) => {\r\n return $scope.filteredImportVesselScheduleData.filter((o) => {return o.vshId === vshId})\r\n }\r\n\r\n\r\n $scope.searchChanged = () =>{\r\n $scope.filteredImportVesselScheduleData = [];\r\n for (var i = 0; i < $scope.importVesselScheduleData.length; i++){ \r\n \r\n if (JSON.stringify($scope.importVesselScheduleData[i]).toLocaleLowerCase().includes($scope.replaceAll($scope.searchText.toLocaleLowerCase(),'/','-')))\r\n {\r\n $scope.filteredImportVesselScheduleData.push($scope.importVesselScheduleData[i]);\r\n }\r\n } \r\n $scope.refreshSummaryView();\r\n }\r\n\r\n $scope.replaceAll = (str, find, replace) => {\r\n return str.replace(new RegExp(find, 'g'), replace);\r\n }\r\n\r\n $scope.loadPortTerminals();\r\n\r\n $scope.downloadToExcel = () => {\r\n this.vesselScheduleService.getImportVesselScheduleDashboardExcel($scope.portTerminalId).then(() => {\r\n }, (data) => {\r\n this.generalService.displayMessageHandler(data.data);\r\n });\r\n }\r\n\r\n\r\n /* Drag and Drop HTML5 methods */\r\n\r\n $scope.dragStart = ($event: any,vesselSchedule:interfaces.logistics.ImportVesselScheduleDashboardView) =>{\r\n $event.dataTransfer.setData('text', vesselSchedule.conId);\r\n }\r\n\r\n $scope.dragDrop = ($event: any,vesselScheduleSummary:interfaces.logistics.ImportVesselScheduleDashboardViewSummary) => {\r\n $event.preventDefault();\r\n \r\n $scope.isLoading = true;\r\n\r\n\r\n this.vesselScheduleService.allocateConsignmentToVesselSchedule(\r\n\r\n $event.dataTransfer.getData('text'),\r\n vesselScheduleSummary.vshId\r\n\r\n ).save( (result) => {\r\n\r\n this.generalService.displayMessageHandler(result);\r\n $scope.LoadImportVesselScheduleData();\r\n\r\n $scope.isLoading = false;\r\n });\r\n }\r\n\r\n $scope.dragEnter = ($event:any) => {\r\n $event.preventDefault();\r\n }\r\n\r\n $scope.dragOver = ($event:any) => {\r\n $event.preventDefault();\r\n } \r\n\r\n /* End Drag and Drop HTML5 methods */\r\n\r\n }\r\n\r\n static factory(): ng.IDirectiveFactory {\r\n const directive = (generalService, $state, \r\n bsLoadingOverlayService, vesselScheduleService,$cookies) => new importVesselScheduleDirective(generalService, $state, bsLoadingOverlayService, vesselScheduleService,$cookies);\r\n directive.$inject = [\"generalService\", \"$state\", \"bsLoadingOverlayService\", \"vesselScheduleService\",'$cookies'];\r\n\r\n return directive;\r\n }\r\n }\r\n\r\n angular.module(\"app\").directive(\"gtsImportVesselSchedule\", importVesselScheduleDirective.factory());\r\n }\r\n}"]}