public async Task <IActionResult> ViewPackingSlip(long id)
        {
            if (id == 0)
            {
                return(View("EnterPackingSlip"));
            }

            var summary = await _vendorCodeService.VerifyPackingSlipAsync(id);

            summary.CanViewDetails = UserHasPermission(Permission.ViewParticipantDetails);

            if (summary.VendorCodes.Count > 0 || summary.VendorCodePackingSlip != null)
            {
                if (summary.VendorCodePackingSlip != null)
                {
                    if (summary.CanViewDetails)
                    {
                        var enteredBy = await _userService
                                        .GetDetailsByPermission(summary.VendorCodePackingSlip.CreatedBy);

                        summary.ReceivedBy = enteredBy.FullName;
                    }
                }
                else
                {
                    var vendorCodeType = await _vendorCodeService
                                         .GetTypeById(summary.VendorCodes.First().VendorCodeTypeId);

                    summary.CanBeReceived = UserHasPermission(Permission.ReceivePackingSlips) ||
                                            UserHasPermission(Permission.ManageVendorCodes);
                    summary.SubmitText = vendorCodeType.AwardPrizeOnPackingSlip
                        ? "Mark as received and award prizes"
                        : "Mark as received";
                }

                var tracking = new HashSet <string>();
                foreach (var tns in summary.VendorCodes.Select(_ => _.TrackingNumber).Distinct())
                {
                    foreach (var tn in tns.Split(','))
                    {
                        tracking.Add(tn.Trim());
                    }
                }

                if (tracking.Count > 0)
                {
                    summary.TrackingNumbers = tracking;
                }

                return(View("ViewPackingSlip", summary));
            }

            ShowAlertDanger($"Could not find packing slip number {id}, please contact your administrator.");
            return(View("EnterPackingSlip", id));
        }