Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Fs 2368 add another data (#148)
Browse files Browse the repository at this point in the history
* Use of a json format now works

* Data type added for component

* AddAnother data is now sent as json object

* revert

* Upgrading version

---------

Co-authored-by: adamdavies1 <[email protected]>
  • Loading branch information
adamdavies1 and adamdavies1 authored Apr 17, 2023
1 parent e267e39 commit edefd56
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dluhc-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
]

env:
VERSION: "0.1.52" # Manually increment this version when pushing to main
VERSION: "0.1.53" # Manually increment this version when pushing to main
IMAGE_NAME_STUB: "digital-form-builder-dluhc-"
DOCKER_REGISTRY: ghcr.io
IMAGE_REPO_PATH: "ghcr.io/${{github.repository_owner}}"
Expand Down
4 changes: 4 additions & 0 deletions model/src/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ export interface SelectFieldComponent extends ListFieldBase {

export interface MultiInputFieldComponent extends TextFieldBase {
type: "MultiInputField";
options: TextFieldBase["options"] & {
textFieldTitle?: string;
numberFieldTitle?: string;
};
}

export type ComponentDef =
Expand Down
2 changes: 1 addition & 1 deletion runner/src/server/forms/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@
"title": "Update form in application store",
"type": "savePerPage",
"outputConfiguration": {
"savePerPageUrl": "https://webhook.site/ba83e49b-cdd1-46e9-9c04-c89cfa651752"
"savePerPageUrl": "True"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,29 @@ import {
} from "../types";
import { FormModel } from "../models";
import { Schema } from "joi";
import { DataType } from "./types";

export class MultiInputField extends FormComponent {
children: ComponentCollection;
dataType = "multiInput" as DataType;

constructor(def: InputFieldsComponentsDef, model: FormModel) {
super(def, model);
const options: any = this.options;

this.children = new ComponentCollection(
[
{
type: "TextField",
name: "type-of-revenue-cost",
title: this.options.textFieldTitle,
title: options.textFieldTitle,
schema: {},
options: {},
},
{
type: "NumberField",
name: "value",
title: this.options.numberFieldTitle,
title: options.numberFieldTitle,
schema: {},
options: {
prefix: "£",
Expand Down
3 changes: 2 additions & 1 deletion runner/src/server/plugins/engine/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,5 @@ export type DataType =
| "monthYear"
| "number"
| "file"
| "freeText";
| "freeText"
| "multiInput";
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function answerFromDetailItem(item) {
if (typeof item.rawValue === "undefined") return "undefined";
const [month, year] = Object.values(item.rawValue);
return format(new Date(`${year}-${month}-1`), "yyyy-MM");
case "multiInput":
return item.rawValue;
default:
return item.value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ export class RepeatingFieldPageController extends PageController {
return partial.length;
}

// This will remain in for a a round for backward compatibility. The string awnsers will convert on a submit
convertMultiInputStringAnswers(answers) {
if (typeof answers === "undefined") {
return answers;
Expand Down

0 comments on commit edefd56

Please sign in to comment.