Commit 78786788 authored by Kostis Trantzas's avatar Kostis Trantzas
Browse files

Merge branch...

Merge branch '8-a-service-order-with-1-order-items-is-not-handling-the-supporting-services-well' into 'develop'

Resolve "A Service Order with >1 order items is not handling the supporting services well"

See merge request !14
parents dae46c54 3d08e81a
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ export class ResourceReservationCalendarComponent implements OnInit {
            this.reservations
            ).map(function(eventEl: Reservation) {
              
              console.info("this is event: " + eventEl.id +" " + eventEl.requestedPeriodStartDateTime  )
              // console.info("this is event: " + eventEl.id +" " + eventEl.requestedPeriodStartDateTime  )
              // var result = new Date(eventEl.startDate);
              // var evd = result.toISOString().replace(/T.*$/, ''); // YYYY-MM-DD of today
              
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ export class ListServiceOrdersComponent implements OnInit {
            this.serviceOrders
            ).map(function(eventEl: ServiceOrder) {
              
              console.info("this is event: " + eventEl.id +" " + eventEl.requestedStartDate )
              // console.info("this is event: " + eventEl.id +" " + eventEl.requestedStartDate )
              // var result = new Date(eventEl.startDate);
              // var evd = result.toISOString().replace(/T.*$/, ''); // YYYY-MM-DD of today
              
+15 −7
Original line number Diff line number Diff line
@@ -58,8 +58,8 @@ export class PreviewServiceOrderComponent implements OnInit {
  serviceOrderNotFound: boolean = false
  finishedLoading: boolean = false

  supportingServices: Service[][] = [[]]

  supportingServices: Service[][] = []
  // supportingServices' first array is Order Item Index and second array is SupportingService index of the respective Order Item
  editMode: boolean = false
  editModeNotes: boolean = false
  isAdminUser: boolean = false
@@ -122,19 +122,27 @@ export class PreviewServiceOrderComponent implements OnInit {
  
          this.checkboxesOrderItemList = []
          this.currentItemRelationshipsUrl = []
          this.serviceOrder.orderItem.forEach((orderItem, index) => {
          
          this.supportingServices = []
          this.serviceOrder.orderItem.forEach((orderItem) => {
            
            //Expands the length of the array for each Service Order Item
            this.supportingServices.push([])

            this.checkboxesOrderItemList.push({orderItem: orderItem, isChecked: false})

            orderItem.service.serviceCharacteristic.sort(this.sortingService.ascStringSortingFunctionByNameProperty())
  
            orderItem.service.supportingService.forEach( (supService, serviceIndex) => {
              this.retrieveServiceInventory(supService.id).pipe(delay(Math.random()*1000)).subscribe(
                data => this.supportingServices[index][serviceIndex] = data
            orderItem.service.supportingService.forEach( (supService) => {
              this.retrieveServiceInventory(supService.id).subscribe(
                data => {
                  const orderItemIndex = this.serviceOrder.orderItem.findIndex(SOI => orderItem.id === SOI.id)
                  const supportingServiceIndex = this.serviceOrder.orderItem[orderItemIndex].service.supportingService.findIndex(SupS => supService.id === SupS.id)
                  this.supportingServices[orderItemIndex][supportingServiceIndex] = data
                }
              )
            })
            
            
            this.currentItemRelationshipsUrl.push( this.orderService.rootUrl + "/serviceOrdering/v4/serviceOrder/" + this.serviceOrder.id + "/item/" + orderItem.id + "/relationship_graph" );
          })

+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ export class ServiceOrdersCalendarComponent implements OnInit {
            this.serviceOrders
            ).map(function(eventEl: ServiceOrder) {
              
              console.info("this is event: " + eventEl.id +" " + eventEl.requestedStartDate )
              // console.info("this is event: " + eventEl.id +" " + eventEl.requestedStartDate )
              // var result = new Date(eventEl.startDate);
              // var evd = result.toISOString().replace(/T.*$/, ''); // YYYY-MM-DD of today