本文整理汇总了TypeScript中main/app/forms/form.Form类的典型用法代码示例。如果您正苦于以下问题:TypeScript Form类的具体用法?TypeScript Form怎么用?TypeScript Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Form类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: DraftService
ErrorHandling.apply(async (req: express.Request, res: express.Response, next: express.NextFunction) => {
const form: Form<Cohabiting> = req.body
const { externalId } = req.params
if (form.hasErrors()) {
res.render(page.associatedView, { form: form })
} else {
const draft: Draft<ResponseDraft> = res.locals.responseDraft
const user: User = res.locals.user
draft.document.statementOfMeans.cohabiting = form.model
if (form.model.option === CohabitingOption.NO) {
draft.document.statementOfMeans.partnerAge = draft.document.statementOfMeans.partnerDisability =
draft.document.statementOfMeans.partnerSevereDisability = draft.document.statementOfMeans.partnerPension =
undefined
}
await new DraftService().save(draft, user.bearerToken)
if (form.model.option === CohabitingOption.YES) {
res.redirect(StatementOfMeansPaths.partnerAgePage.evaluateUri({ externalId: externalId }))
} else {
res.redirect(StatementOfMeansPaths.dependantsPage.evaluateUri({ externalId: externalId }))
}
}
})
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:25,代码来源:partner.ts
示例2: DraftService
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
示例3: DraftService
ErrorHandling.apply(async (req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> => {
const form: Form<AcceptCourtOffer> = req.body
if (form.hasErrors()) {
renderView(form, res)
} else {
const draft: Draft<DraftClaimantResponse> = res.locals.claimantResponseDraft
const user: User = res.locals.user
const { externalId } = req.params
draft.document.acceptCourtOffer = form.model
if (draft.document.courtDetermination.rejectionReason || draft.document.formaliseRepaymentPlan) {
delete draft.document.courtDetermination.rejectionReason
delete draft.document.formaliseRepaymentPlan
delete draft.document.settlementAgreement
}
await new DraftService().save(draft, user.bearerToken)
if (form.model.accept.option === YesNoOption.YES.option) {
res.redirect(Paths.taskListPage.evaluateUri({ externalId: externalId }))
} else {
res.redirect(Paths.rejectionReasonPage.evaluateUri({ externalId: externalId }))
}
}
}))
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:25,代码来源:court-offered-set-date.ts
示例4: async
async (req: express.Request, res: express.Response): Promise<void> => {
const form: Form<PaymentOption> = req.body
if (form.hasErrors()) {
this.renderView(form, res)
} else {
this.createModelAccessor().patch(res.locals.draft.document, model => model.paymentOption = form.model)
this.deleteRedundantData(res, req)
await this.saveDraft(res.locals)
res.redirect(this.buildPostSubmissionUri(path, req, res))
}
}))
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:14,代码来源:payment-option.ts
示例5: async
async (req: express.Request, res: express.Response): Promise<void> => {
const form: Form<PaidAmount> = req.body
if (form.hasErrors()) {
this.renderView(form, res)
} else {
this.paidAmount().set(res.locals.draft.document, form.model)
const user: User = res.locals.user
await new DraftService().save(res.locals.draft, user.bearerToken)
const { externalId } = req.params
res.redirect(new RoutablePath(path + Paths.paidAmountSummaryPage.uri).evaluateUri({ externalId: externalId }))
}
}))
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:15,代码来源:paid-amount.ts
示例6: DraftService
ErrorHandling.apply(async (req: express.Request, res: express.Response) => {
const form: Form<FreeMediation> = req.body
if (form.hasErrors()) {
this.renderView(form, res)
} else {
const draft: Draft<any> = res.locals.draft
const user: User = res.locals.user
draft.document.freeMediation = form.model
await new DraftService().save(draft, user.bearerToken)
res.redirect(this.buildRedirectUri(req, res))
}
}))
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:15,代码来源:free-mediation.ts
示例7: renderView
ErrorHandling.apply(async (req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> => {
const form: Form<DefendantSettlementResponse> = req.body
if (form.hasErrors()) {
renderView(form, res, next)
} else {
const claim: Claim = res.locals.claim
const user: User = res.locals.user
if (form.model.option === YesNoOption.YES.option) {
await settlementAgreementClient.countersignSettlementAgreement(claim.externalId, user)
} else {
await settlementAgreementClient.rejectSettlementAgreement(claim.externalId, user)
}
res.redirect(Paths.settlementAgreementConfirmation.evaluateUri({ externalId: claim.externalId }))
}
}
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:17,代码来源:sign-settlement-agreement.ts
示例8: DraftService
ErrorHandling.apply(async (req: express.Request, res: express.Response): Promise<void> => {
const form: Form<PartPaymentReceived> = req.body
if (form.hasErrors()) {
renderView(form, res)
} else {
const draft: Draft<DraftClaimantResponse> = res.locals.claimantResponseDraft
draft.document.partPaymentReceived = form.model
if (form.model.received.option === YesNoOption.NO.option) {
draft.document.accepted = undefined
draft.document.rejectionReason = undefined
}
await new DraftService().save(draft, res.locals.user.bearerToken)
res.redirect(Paths.taskListPage.evaluateUri({ externalId: res.locals.claim.externalId }))
}
})
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:18,代码来源:part-payment-received.ts
示例9: DraftService
ErrorHandling.apply(async (req: express.Request, res: express.Response): Promise<void> => {
const form: Form<IntentionToProceed> = req.body
if (form.hasErrors()) {
renderView(form, res)
} else {
const draft: Draft<DraftClaimantResponse> = res.locals.claimantResponseDraft
const mediationDraft: Draft<MediationDraft> = res.locals.mediationDraft
const user: User = res.locals.user
if (form.model.proceed === YesNoOption.NO.option && mediationDraft) {
await new DraftService().delete(mediationDraft.id, user.bearerToken)
}
draft.document.intentionToProceed = form.model
await new DraftService().save(draft, user.bearerToken)
res.redirect(Paths.taskListPage.evaluateUri({ externalId: res.locals.claim.externalId }))
}
})
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:19,代码来源:intention-to-proceed.ts
示例10: renderView
ErrorHandling.apply(async (req: express.Request, res: express.Response) => {
renderView(Form.empty(), req, res)
}))
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:3,代码来源:repayment-plan-summary.ts
注:本文中的main/app/forms/form.Form类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论