Skip to content

Custom Design

Custom Blocks

This project provides two main sections for developers to customize content through JSON: Service Items on the homepage and Application Service Information on the form page.

Service Items

Service items are categorized by type and relevant agencies. Each item has a unique ID, which is used to obtain form fields for the application service information. The full JSON format is as follows:

json
{
  "data": [
    {
      "name": "Complaints", // Service item category
      "icon": "", // Icon path for the category
      "agency": [ // Agencies under the category
        {
          "name": "Department of Transportation", // Agency name
          "options": [ // Services provided by the agency
            {
              "id": "a-1", // Service ID
              "title": "Complaints Handled by the Adjudication Office (Local)", // Service title
              "subtitle": "Complaints handled by the Adjudication Office (adjudication venue is Taipei City Traffic Adjudication Office) - Local cases (no documents or copies required)", // Service subtitle
              "type": "Complaints", // Category
              "agency_type": "Department of Transportation" // Agency
            },
            {
              "id": "a-2",
              "title": "Complaints Handled by the Adjudication Office (Other Counties/Cities)",
              "subtitle": "Complaints handled by the Adjudication Office (adjudication venue is Taipei City Traffic Adjudication Office) - Other counties/cities cases (no documents or copies required)",
              "type": "Complaints",
              "agency_type": "Department of Transportation"
            },
            {
              "id": "a-3",
              "title": "Complaints Handled by the Parking Management Office",
              "subtitle": "Complaints handled by the Parking Management Office (reported by the Taipei City Parking Management Office - parking fee chasing and illegal parking cases)",
              "type": "Complaints",
              "agency_type": "Department of Transportation"
            }
          ]
        },
        {
          "name": "Police Department",
          "options": [
            {
              "id": "b-1",
              "title": "Violation Complaints Handled by the Police Department",
              "subtitle": "Violation complaints handled by the Police Department (reported by various precincts of the Taipei City Police Department)",
              "type": "Complaints",
              "agency_type": "Police Department"
            }
          ]
        }
      ]
    }
  ]
}

Service Items - Data

FieldPurposeExample
nameService item categoryComplaints
iconIcon path for the category (optional)https://www.gov.taipei/images/favicon.ico
agencyAgencies under the categoryRefer to Service Items - Agency

Service Items - Agency

FieldPurposeExample
nameAgency nameDepartment of Transportation
optionsServices provided by the agencyRefer to Service Items - Options

Service Items - Options

FieldPurposeExample
idService ID (must be unique)a-1
titleService titleComplaints Handled by the Adjudication Office (Local)
subtitleService subtitleComplaints handled by the Adjudication Office (adjudication venue is Taipei City Traffic Adjudication Office) - Local cases (no documents or copies required)
typeCategoryComplaints
agency_typeAgencyDepartment of Transportation

Application Service Information

Application service information defines 7 form field components for developers to freely combine:

  1. input text field.

input

  1. select dropdown field.

select

  1. multiple_select multiple selection field.

multiple_select

multiple_select

  1. radio_group radio group field.

radio_group

  1. textarea text area field.

textarea

  1. checkbox_group checkbox group field.

checkbox_group

  1. date_picker date picker field.

date_picker

Each field has a key called field, which defines the value corresponding to the key when the form is submitted. Usually, this matches the backend form definition, so consistency is important.

All fields with options should have label and value.

In the JSON, we also need to define submit_target to let the frontend know the URL, request method, and data type for submitting the form to the backend.

This definition can be tailored to match the API format designed to receive the form. Make sure to confirm these fields with the backend API.

The form submission function can be found in the project under src/views/FormPreview.vue in the onSubmitClick method. Developers can integrate their form submission API according to their requirements.

A complete JSON example is provided below. There is no limit to the number of occurrences of each form field, allowing for free combination.

JSON
{
  "data": {
    "submit_target": {
      "url": "https://www.gov.taipei/", // Backend URL for form submission
      "method": "POST", // Request method for form submission
      "content_type": "application/json" // Data type accepted by the request
    },
    "form_format": [
      {
        "type": "input", // Form field type
        "label": "Name of the Violating Driver", // Form field label
        "required": true, // Whether the form field is required
        "field": "name" // Key corresponding to the form field value
      },
      {
        "type": "select",
        "label": "Handling Agency",
        "required": true,
        "field": "agency",
        "default_option": "Please select an agency", // Default option, no value, acts as a placeholder
        "options": [ // All options
          {
            "label": "Traffic Adjudication Office",
            "value": "Traffic Adjudication Office"
          }
        ]
      },
      {
        "type": "multiple_select",
        "label": "Complaint Items",
        "required": true,
        "field": "apply",
        "options": [
          {
            "label": "Traffic Accident Complaint",
            "value": "Traffic Accident Complaint"
          },
          {
            "label": "Mismatch of Vehicle Type/Color",
            "value": "Mismatch of Vehicle Type/Color"
          }
        ]
      },
      {
        "type": "radio_group",
        "label": "Send by E-MAIL",
        "required": true,
        "field": "send_by_mail",
        "options": [
          {
            "label": "Yes",
            "value": "Y"
          },
          {
            "label": "No",
            "value": "N"
          }
        ]
      },
      {
        "type": "textarea",
        "label": "Complaint Content",
        "required": true,
        "field": "content"
      },
      {
        "type": "checkbox_group",
        "label": "Application Form",
        "required": true,
        "field": "apply_form",
        "options": [
          {
            "label": "On-site Diagram",
            "value": "On-site Diagram"
          },
          {
            "label": "On-site Photos",
            "value": "On-site Photos"
          }
        ]
      },
      {
        "type": "date_picker",
        "label": "Accident Date",
        "required": true,
        "field": "date"
      }
    ]
  }
}

Application Service Information - Data

FieldPurposeExample
submit_targetTarget information for form submissionRefer to Application Service Information - Submit Target
form_formatComposition of custom form componentsRefer to Application Service Information - Form Format

Application Service Information - Submit Target

FieldPurposeExample
urlBackend URL for form submissionhttps://www.gov.taipei/
methodRequest method for form submissionPOST
content_typeData type accepted by the requestapplication/json

Application Service Information - Form Format

  • input
FieldPurposeExample
typeForm field typeinput
labelForm field labelName of the Violating Driver
requiredWhether the form field is requiredtrue
fieldKey corresponding to the form field valuename
  • select
FieldPurposeExample
typeForm field typeselect
labelForm field labelHandling Agency
requiredWhether the form field is requiredtrue
fieldKey corresponding to the form field valueagency
default_optionDefault option, no value, acts as a placeholderPlease select an agency
optionsAll optionsRefer to Application Service Information - Options Format
  • multiple_select
FieldPurposeExample
typeForm field typemultiple_select
labelForm field labelComplaint Items
requiredWhether the form field is requiredtrue
fieldKey corresponding to the form field valuesend_by_mail
optionsAll optionsRefer to Application Service Information - Options Format
  • radio_group
FieldPurposeExample
typeForm field typeradio_group
labelForm field labelSend by E-MAIL
requiredWhether the form field is requiredtrue
fieldKey corresponding to the form field valueapply
optionsAll optionsRefer to Application Service Information - Options Format
  • textarea
FieldPurposeExample
typeForm field typetextarea
labelForm field labelComplaint Content
requiredWhether the form field is requiredtrue
fieldKey corresponding to the form field valuecontent
  • checkbox_group
FieldPurposeExample
typeForm field typecheckbox_group
labelForm field labelApplication Form
requiredWhether the form field is requiredtrue
fieldKey corresponding to the form field valueapply_form
optionsAll optionsRefer to Application Service Information - Options Format
  • date_picker
FieldPurposeExample
typeForm field typedate_picker
labelForm field labelAccident Date
requiredWhether the form field is requiredtrue
fieldKey corresponding to the form field valuedate

Application Service Information - Options Format

FieldPurposeExample
labelOption textYes
valueOption value for backend submissionY