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


TypeScript paths.Paths.taskListPage類代碼示例

本文整理匯總了TypeScript中response/paths.Paths.taskListPage的典型用法代碼示例。如果您正苦於以下問題:TypeScript Paths.taskListPage類的具體用法?TypeScript Paths.taskListPage怎麽用?TypeScript Paths.taskListPage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: context

      context('when service is healthy', () => {
        it('when form is invalid should render page', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId({ totalAmountTillToday: validFormData.amount + 1 })
          draftStoreServiceMock.resolveFind('response:full-rejection')

          await request(app)
            .post(pagePath)
            .set('Cookie', `${cookieName}=ABC`)
            .send({})
            .expect(res => expect(res).to.be.successful.withText(header, 'div class="error-summary"'))
        })

        testValidPost(-1, true,
          FullRejectionPaths.youHavePaidLessPage.evaluateUri({ externalId: externalId }))
        testValidPost(-1, false,
          Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
        testValidPost(0, true,
          Paths.taskListPage.evaluateUri({ externalId: externalId }))
        testValidPost(0, false,
          Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
        testValidPost(1, true,
          Paths.taskListPage.evaluateUri({ externalId: externalId }))
        testValidPost(1, false,
          Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
      })
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:25,代碼來源:how-much-have-you-paid.ts

示例2: 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

示例3: FreeMediation

    ErrorHandling.apply(async (req: express.Request, res: express.Response) => {
      const claim: Claim = res.locals.claim
      const draft: Draft<MediationDraft> = res.locals.mediationDraft
      const user: User = res.locals.user

      if (req.body.accept) {
        draft.document.youCanOnlyUseMediation = new FreeMediation(FreeMediationOption.YES)

        await new DraftService().save(draft, user.bearerToken)
        if (claim.claimData.defendant.isBusiness()) {
          res.redirect(Paths.canWeUseCompanyPage.evaluateUri({ externalId: claim.externalId }))
        } else {
          res.redirect(Paths.canWeUsePage.evaluateUri({ externalId: claim.externalId }))
        }
      } else {
        draft.document.youCanOnlyUseMediation = new FreeMediation(FreeMediationOption.NO)
        draft.document.canWeUse = undefined
        draft.document.canWeUseCompany = undefined

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

        if (!claim.isResponseSubmitted()) {
          res.redirect(ResponsePaths.taskListPage.evaluateUri({ externalId: claim.externalId }))
        } else {
          res.redirect(ClaimantResponsePaths.taskListPage.evaluateUri({ externalId: claim.externalId }))
        }
      }
    }))
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:28,代碼來源:mediation-agreement.ts

示例4: renderView

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

      if (form.hasErrors()) {
        renderView(form, res)
      } else {
        const draft: Draft<MediationDraft> = res.locals.mediationDraft
        const user: User = res.locals.user
        draft.document.canWeUseCompany = form.model

        if (form.model.option === FreeMediationOption.YES) {
          draft.document.canWeUseCompany.mediationContactPerson = undefined
          draft.document.canWeUseCompany.mediationPhoneNumber = undefined
        } else {
          draft.document.canWeUseCompany.mediationPhoneNumberConfirmation = undefined
        }
        await new DraftService().save(draft, user.bearerToken)

        if (!claim.isResponseSubmitted()) {
          res.redirect(ResponsePaths.taskListPage.evaluateUri({ externalId: claim.externalId }))
        } else {
          res.redirect(ClaimantResponsePaths.taskListPage.evaluateUri({ externalId: claim.externalId }))
        }
      }
    })
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:26,代碼來源:can-we-use-company.ts

示例5: renderView

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

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

        draft.document.rejectAllOfClaim = form.model
        await new DraftService().save(draft, user.bearerToken)

        const { externalId } = req.params
        switch (draft.document.rejectAllOfClaim.option) {
          case RejectAllOfClaimOption.COUNTER_CLAIM:
            res.redirect(Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
            break
          case RejectAllOfClaimOption.ALREADY_PAID:
          case RejectAllOfClaimOption.DISPUTE:
            res.redirect(Paths.taskListPage.evaluateUri({ externalId: externalId }))
            break
          default:
            throw new Error(`Unknown rejection option: ${draft.document.rejectAllOfClaim.option}`)
        }
      }
    }))
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:26,代碼來源:reject-all-of-claim.ts

示例6: renderView

    ErrorHandling.apply(async (req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> => {
      const { externalId } = req.params
      const form: Form<Response> = 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.response = form.model

        if (draft.document.response.type === ResponseType.FULL_ADMISSION) {
          if (!draft.document.fullAdmission) {
            draft.document.fullAdmission = new FullAdmission()
          }
          delete draft.document.partialAdmission
          delete draft.document.freeMediation
        } else if (draft.document.response.type === ResponseType.PART_ADMISSION) {
          if (!draft.document.partialAdmission) {
            draft.document.partialAdmission = new PartialAdmission()
          }
          delete draft.document.fullAdmission
          delete draft.document.rejectAllOfClaim
          delete draft.document.freeMediation
        } else {
          delete draft.document.fullAdmission
          delete draft.document.partialAdmission
          delete draft.document.statementOfMeans
        }

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

        switch (draft.document.response.type) {
          case ResponseType.DEFENCE:
            res.redirect(Paths.defenceRejectAllOfClaimPage.evaluateUri({ externalId: externalId }))
            break

          case ResponseType.PART_ADMISSION:
            if (FeatureToggles.hasAnyAuthorisedFeature(claim.features, 'admissions')) {
              res.redirect(PartAdmissionPaths.alreadyPaidPage.evaluateUri({ externalId: externalId }))
            } else {
              res.redirect(Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
            }
            break

          case ResponseType.FULL_ADMISSION:
            if (FeatureToggles.hasAnyAuthorisedFeature(claim.features, 'admissions')) {
              res.redirect(Paths.taskListPage.evaluateUri({ externalId: claim.externalId }))
            } else {
              res.redirect(Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
            }
            break

          default:
            next(new Error(`Unknown response type: ${draft.document.response.type}`))
        }
      }
    }))
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:60,代碼來源:response-type.ts

示例7: renderView

    ErrorHandling.apply(async (req: express.Request, res: express.Response, next: express.NextFunction) => {
      const form: Form<FreeMediation> = req.body
      if (form.hasErrors()) {
        renderView(form, res)
      } else {
        const draft: Draft<MediationDraft> = res.locals.mediationDraft
        const user: User = res.locals.user

        draft.document.willYouTryMediation = form.model

        if (form.model.option === FreeMediationOption.NO) {
          draft.document.youCanOnlyUseMediation = undefined
          draft.document.canWeUse = undefined
          draft.document.canWeUseCompany = undefined
        }

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

        const externalId: string = req.params.externalId
        if (form.model.option === FreeMediationOption.YES) {
          res.redirect(Paths.mediationAgreementPage.evaluateUri({ externalId: externalId }))
        } else {
          const claim: Claim = res.locals.claim
          if (!claim.isResponseSubmitted()) {
            res.redirect(ResponsePaths.taskListPage.evaluateUri({ externalId: externalId }))
          } else {
            res.redirect(ClaimantResponsePaths.taskListPage.evaluateUri({ externalId: externalId }))
          }
        }
      }
    })
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:31,代碼來源:will-you-try-mediation.ts

示例8: DraftService

 ErrorHandling.apply(async (req: express.Request, res: express.Response) => {
   const claim: Claim = res.locals.claim
   const draft: Draft<ResponseDraft> = res.locals.responseDraft
   const user: User = res.locals.user
   draft.document.companyDefendantResponseViewed = true
   await new DraftService().save(draft, user.bearerToken)
   res.redirect(Paths.taskListPage.evaluateUri({ externalId: claim.externalId }))
 })
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:8,代碼來源:send-company-financial-details.ts

示例9:

 .get(Paths.incompleteSubmissionPage.uri, (req: express.Request, res: express.Response) => {
   const claim: Claim = res.locals.claim
   const draft: Draft<ResponseDraft> = res.locals.responseDraft
   const mediationDraft: Draft<MediationDraft> = res.locals.mediationDraft
   res.render(Paths.incompleteSubmissionPage.associatedView,
     {
       taskListUri: Paths.taskListPage.evaluateUri({ externalId: claim.externalId }),
       tasks: TaskListBuilder.buildRemainingTasks(draft.document, claim, mediationDraft.document)
     }
   )
 })
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:11,代碼來源:incomplete-submission.ts

示例10: renderView

    ErrorHandling.apply(async (req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> => {
      const form: Form<Explanation> = req.body
      if (form.hasErrors()) {
        renderView(form, res)
      } else {
        const draft: Draft<ResponseDraft> = res.locals.responseDraft
        const user: User = res.locals.user

        draft.document.statementOfMeans.explanation = form.model
        await new DraftService().save(draft, user.bearerToken)
        const claim: Claim = res.locals.claim

        res.redirect(Paths.taskListPage.evaluateUri({ externalId: claim.externalId }))
      }
    }))
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:15,代碼來源:explanation.ts


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