當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ClaimFeatureToggles.isFeatureEnabledOnClaim方法代碼示例

本文整理匯總了TypeScript中utils/claimFeatureToggles.ClaimFeatureToggles.isFeatureEnabledOnClaim方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ClaimFeatureToggles.isFeatureEnabledOnClaim方法的具體用法?TypeScript ClaimFeatureToggles.isFeatureEnabledOnClaim怎麽用?TypeScript ClaimFeatureToggles.isFeatureEnabledOnClaim使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在utils/claimFeatureToggles.ClaimFeatureToggles的用法示例。


在下文中一共展示了ClaimFeatureToggles.isFeatureEnabledOnClaim方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: renderView

    ErrorHandling.apply(async (req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> => {
      const form: Form<DefendantEvidence> = req.body

      if (form.hasErrors()) {
        renderView(form, res)
      } else {
        const claim: Claim = res.locals.claim
        const draft: Draft<ResponseDraft> = res.locals.responseDraft
        const user: User = res.locals.user

        form.model.removeExcessRows()

        if (ClaimFeatureToggles.isFeatureEnabledOnClaim(claim) && draft.document.isResponsePartiallyAdmitted()) {
          draft.document.partialAdmission.evidence = form.model
          await new DraftService().save(draft, user.bearerToken)
          res.redirect(Paths.taskListPage.evaluateUri({ externalId: claim.externalId }))
        } else {
          draft.document.evidence = form.model
          await new DraftService().save(draft, user.bearerToken)

          if (draft.document.isResponseRejected()) {
            res.redirect(Paths.taskListPage.evaluateUri({ externalId: claim.externalId }))
          } else {
            res.redirect(Paths.impactOfDisputePage.evaluateUri({ externalId: claim.externalId }))
          }
        }
      }
    })
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:28,代碼來源:evidence.ts

示例2: buildBeforeYouStartSection

  static buildBeforeYouStartSection (draft: ResponseDraft, claim: Claim, now: moment.Moment): TaskList {
    const tasks: TaskListItem[] = []
    const externalId: string = claim.externalId

    if (!ClaimFeatureToggles.isFeatureEnabledOnClaim(claim)
      && (draft.isResponsePartiallyAdmitted() || draft.isResponseFullyAdmitted())) {
      delete draft.response.type
    }

    tasks.push(
      new TaskListItem(
        'Confirm your details',
        Paths.defendantYourDetailsPage.evaluateUri({ externalId: externalId }),
        YourDetails.isCompleted(draft)
      )
    )

    if (!isPastDeadline(now, claim.responseDeadline)) {
      tasks.push(
        new TaskListItem(
          'Decide if you need more time to respond',
          Paths.moreTimeRequestPage.evaluateUri({ externalId: externalId }),
          MoreTimeNeededTask.isCompleted(draft, claim.moreTimeRequested)
        )
      )
    }

    return new TaskList('Before you start', tasks)
  }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:29,代碼來源:taskListBuilder.ts

示例3: requestHandler

 static requestHandler (req: express.Request, res: express.Response, next: express.NextFunction) {
   const claim: Claim = res.locals.claim
   if (!ClaimFeatureToggles.isFeatureEnabledOnClaim(claim, 'directionsQuestionnaire')) {
     logger.warn('State guard: direction questionnaire feature not found - redirecting to dashboard')
     res.redirect(DashboardPaths.dashboardPage.uri)
   } else {
     next()
   }
 }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:9,代碼來源:directionsQuestionnaireGuard.ts

示例4: renderView

function renderView (res: express.Response): void {
  const user: User = res.locals.user
  const claim: Claim = res.locals.claim

  res.render(Paths.freeMediationPage.associatedView, {
    otherParty: claim.otherPartyName(user),
    defendant: user.id === claim.defendantId,
    mediationPilot: ClaimFeatureToggles.isFeatureEnabledOnClaim(res.locals.claim, 'mediationPilot')
  })
}
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:10,代碼來源:free-mediation.ts

示例5: buildSubmitSection

  static buildSubmitSection (claim: Claim, draft: ResponseDraft, externalId: string, features: string[]): TaskList {
    const tasks: TaskListItem[] = []
    if (!draft.isResponsePopulated()
      || draft.isResponseRejectedFullyWithDispute()
      || TaskListBuilder.isRejectedFullyBecausePaidClaimAmount(claim, draft)
      || (ClaimFeatureToggles.isFeatureEnabledOnClaim(claim) && TaskListBuilder.isRejectedFullyBecausePaidMoreThenClaimAmount(claim, draft))
      || (ClaimFeatureToggles.isFeatureEnabledOnClaim(claim) && TaskListBuilder.isRejectedFullyBecausePaidLessThanClaimAmountAndExplanationGiven(claim, draft))
      || draft.isResponseFullyAdmitted()
      || draft.isResponsePartiallyAdmitted()) {
      tasks.push(
        new TaskListItem(
          'Check and submit your response',
          Paths.checkAndSendPage.evaluateUri({ externalId: externalId }),
          false
        )
      )
      return new TaskList('Submit', tasks)
    }

    return undefined
  }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:21,代碼來源:taskListBuilder.ts

示例6: async

    async (req: express.Request, res: express.Response, next: express.NextFunction) => {
      const draft: Draft<ResponseDraft> = res.locals.responseDraft
      const claim: Claim = res.locals.claim
      let timeline

      if (ClaimFeatureToggles.isFeatureEnabledOnClaim(claim) && draft.document.isResponsePartiallyAdmitted()) {
        timeline = draft.document.partialAdmission.timeline
      } else {
        timeline = draft.document.timeline
      }

      renderView(new Form(timeline), res)
    })
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:13,代碼來源:timeline.ts

示例7: isApplicableFor

 static isApplicableFor (claim: Claim, draft: ResponseDraft): boolean {
   if (!ClaimFeatureToggles.isFeatureEnabledOnClaim(claim)) {
     return false
   }
   if (!draft) {
     throw new Error('Response draft is required')
   }
   const fullAdmissionHasStatementOfMeans = draft.isResponseFullyAdmittedWithPayBySetDate() || draft.isResponseFullyAdmittedWithInstalments()
   const parAdmissionHasStatementOfMeans = draft.isResponsePartiallyAdmittedWithPayBySetDate() || draft.isResponsePartiallyAdmittedWithInstalments()
   return (
       (draft.isResponseFullyAdmitted() && fullAdmissionHasStatementOfMeans)
       || (draft.isResponsePartiallyAdmitted() && parAdmissionHasStatementOfMeans)
     )
     && !draft.defendantDetails.partyDetails.isBusiness()
 }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:15,代碼來源:statementOfMeansFeature.ts

示例8: renderView

function renderView (form: Form<StatementOfTruth>, res: express.Response): void {
  const claim: Claim = res.locals.claim
  const draft: Draft<ResponseDraft> = res.locals.responseDraft
  const mediationDraft: Draft<MediationDraft> = res.locals.mediationDraft

  res.render(Paths.checkAndSendPage.associatedView, {
    claim: claim,
    form: form,
    draft: draft.document,
    signatureType: signatureTypeFor(claim, draft),
    statementOfMeansIsApplicable: StatementOfMeansFeature.isApplicableFor(claim, draft.document),
    admissionsApplicable: ClaimFeatureToggles.isFeatureEnabledOnClaim(claim),
    mediationEnabled: FeatureToggles.isEnabled('mediation'),
    mediationDraft: mediationDraft.document
  })
}
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:16,代碼來源:check-and-send.ts

示例9: FreeMediation

    ErrorHandling.apply(async (req: express.Request, res: express.Response) => {
      const user: User = res.locals.user
      const draft: Draft<MediationDraft> = res.locals.mediationDraft
      draft.document.willYouTryMediation = new FreeMediation(
        req.body.mediationYes ? FreeMediationOption.YES : FreeMediationOption.NO
      )

      await new DraftService().save(draft, user.bearerToken)

      const { externalId } = req.params

      if (ClaimFeatureToggles.isFeatureEnabledOnClaim(res.locals.claim, 'mediationPilot')) {
        res.redirect(Paths.mediationAgreementPage.evaluateUri({ externalId }))
      } else {
        res.redirect(Paths.willYouTryMediation.evaluateUri({ externalId }))
      }
    }))
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:17,代碼來源:how-mediation-works.ts

示例10: renderView

    ErrorHandling.apply(async (req: express.Request, res: express.Response): Promise<void> => {
      const form: Form<HowMuchHaveYouPaid> = req.body

      if (form.hasErrors()) {
        renderView(form, res)
      } else {
        const claim: Claim = res.locals.claim
        const draft: Draft<ResponseDraft> = res.locals.responseDraft
        const user: User = res.locals.user

        draft.document.rejectAllOfClaim.howMuchHaveYouPaid = form.model

        const { externalId } = req.params

        const paidLessThanClaimed = form.model.amount < claim.totalAmountTillToday
        const admissionsEnabled = ClaimFeatureToggles.isFeatureEnabledOnClaim(claim)

        if (!paidLessThanClaimed) {
          delete draft.document.rejectAllOfClaim.whyDoYouDisagree
          delete draft.document.timeline
          delete draft.document.evidence
          delete draft.document.freeMediation
        }

        await new DraftService().save(draft, user.bearerToken)

        if (paidLessThanClaimed) {
          if (admissionsEnabled) {
            res.redirect(FullRejectionPaths.youHavePaidLessPage.evaluateUri({ externalId: externalId }))
          } else {
            res.redirect(Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
          }
        } else if (admissionsEnabled) {
          res.redirect(Paths.taskListPage.evaluateUri({ externalId: externalId }))
        } else {
          res.redirect(Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
        }
      }
    }))
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:39,代碼來源:how-much-have-you-paid.ts


注:本文中的utils/claimFeatureToggles.ClaimFeatureToggles.isFeatureEnabledOnClaim方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。