Compare commits
49
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a536e158c | ||
|
|
6f37064eba | ||
|
|
af5354d19f | ||
|
|
f9f7b777e7 | ||
|
|
3c38da1400 | ||
|
|
1acb84959b | ||
|
|
3566da1989 | ||
|
|
fa4c765799 | ||
|
|
30a7e426af | ||
|
|
7a3671f0a3 | ||
|
|
700d3ac67e | ||
|
|
d94b3b3e5a | ||
|
|
adcff32d73 | ||
|
|
8a512f6c46 | ||
|
|
c43b0db9e7 | ||
|
|
3161e05a3b | ||
|
|
d44a58eb6a | ||
|
|
e10b25857e | ||
|
|
59a37c4823 | ||
|
|
e10692898d | ||
|
|
5204ba80d9 | ||
|
|
ef16ce0a32 | ||
|
|
914c788351 | ||
|
|
ac236339d4 | ||
|
|
8254cbdeb7 | ||
|
|
f13493ac46 | ||
|
|
0083df2209 | ||
|
|
90684b6b42 | ||
|
|
a084b569c9 | ||
|
|
a0f777e6cb | ||
|
|
a1c21fd369 | ||
|
|
441268b026 | ||
|
|
f3fcef69bc | ||
|
|
d55b42a5ab | ||
|
|
367ed19a70 | ||
|
|
75eec56345 | ||
|
|
5288b6dfb5 | ||
|
|
45c43b27bf | ||
|
|
df4e51259b | ||
|
|
b09b15ca1c | ||
|
|
94d2d13fce | ||
|
|
6efc1c4777 | ||
|
|
80ea9a970f | ||
|
|
2af0a7c93e | ||
|
|
e8303a47f6 | ||
|
|
932b953163 | ||
|
|
3b687e5566 | ||
|
|
f0f15b4f6e | ||
|
|
58f468c275 |
@@ -1,176 +0,0 @@
|
||||
# Contributing with AI (Refactor Branch — PEDW FrontEnd)
|
||||
|
||||
## Purpose
|
||||
|
||||
This guide defines how engineers and AI agents should work safely and efficiently in this refactor branch.
|
||||
|
||||
This branch focuses on **safe, behaviour-preserving refactor of the new appeal flow**.
|
||||
|
||||
---
|
||||
|
||||
## Start Here (Required Order)
|
||||
|
||||
1. Read `.clinerules/refactor-branch-rules.md`
|
||||
2. Read `GUARDRAILS.md`
|
||||
3. Read core context:
|
||||
- `context/refactor-branch-charter.md`
|
||||
- `context/newappeal-refactor-guardrails.md`
|
||||
- `context/architecture.md`
|
||||
- `context/domain-flows.md`
|
||||
|
||||
Only read additional files when directly relevant.
|
||||
|
||||
Do **not** load all context, templates, or memory-bank files by default.
|
||||
|
||||
---
|
||||
|
||||
## Core Principle
|
||||
|
||||
This is a **refactor branch**, not a feature branch.
|
||||
|
||||
- Preserve current live S78 behaviour
|
||||
- Do not introduce business-rule changes unless explicitly requested
|
||||
- Prefer small, safe, reversible changes
|
||||
- Focus on structure, not behaviour
|
||||
|
||||
---
|
||||
|
||||
## Standard AI-Assisted Workflow
|
||||
|
||||
### 1. Scope
|
||||
|
||||
- Define requirement
|
||||
- Confirm non-goals
|
||||
- Identify impacted flow areas
|
||||
- Identify risk level
|
||||
|
||||
### 2. Plan
|
||||
|
||||
- Keep plan small and incremental
|
||||
- Identify safe boundaries
|
||||
- Avoid mixing refactor + feature work
|
||||
|
||||
### 3. Implement
|
||||
|
||||
- Make the smallest viable change
|
||||
- Prefer extraction over rewrite
|
||||
- Preserve interfaces and payload shapes
|
||||
|
||||
### 4. Validate
|
||||
|
||||
Minimum required:
|
||||
|
||||
- `npm run lint`
|
||||
- targeted manual checks
|
||||
- EN/CY parity checks (if user-facing)
|
||||
- negative-path checks for sensitive flows
|
||||
|
||||
### 5. Document (only when needed)
|
||||
|
||||
- update `memory-bank/change-log.md` for non-trivial work
|
||||
- record decisions or pitfalls if useful
|
||||
|
||||
---
|
||||
|
||||
## Templates (Use Only When Needed)
|
||||
|
||||
Templates are optional tools, not default context.
|
||||
|
||||
Use **only one** template if needed:
|
||||
|
||||
- feature implementation
|
||||
- bug fix
|
||||
- refactor
|
||||
- debugging
|
||||
- code review
|
||||
|
||||
Do not load all templates.
|
||||
Do not treat templates as baseline context.
|
||||
|
||||
---
|
||||
|
||||
## Context Loading Rule (Critical)
|
||||
|
||||
Always use the **minimum required context**.
|
||||
|
||||
### Default context for this branch:
|
||||
|
||||
- `context/refactor-branch-charter.md`
|
||||
- `context/newappeal-refactor-guardrails.md`
|
||||
- `context/architecture.md`
|
||||
- `context/domain-flows.md`
|
||||
|
||||
### Only load additional files when:
|
||||
|
||||
- working with integrations → `integration-map.md`
|
||||
- reviewing test gaps → `test-coverage-map.md`
|
||||
- performing release work → `runbook.md`
|
||||
- working on specific planned sequence → `context/plans/*`
|
||||
|
||||
Never load:
|
||||
|
||||
- all context files
|
||||
- all templates
|
||||
- onboarding or overview docs
|
||||
|
||||
---
|
||||
|
||||
## Branching Protocol
|
||||
|
||||
This repository currently uses different branch rules depending on the work type.
|
||||
|
||||
### For BAU / normal delivery work
|
||||
|
||||
- create work branches from `SIPS-Development`
|
||||
|
||||
### For new appeal refactor work
|
||||
|
||||
- use the `refactor` branch as the base branch
|
||||
- do refactor implementation either:
|
||||
- directly on `refactor`, if that is the agreed working model, or
|
||||
- on a short-lived feature branch created from `refactor`
|
||||
|
||||
Do not perform refactor implementation directly on `SIPS-Development`.
|
||||
|
||||
If unsure which branch model applies, stop and confirm before making changes.
|
||||
|
||||
---
|
||||
|
||||
## No-Break Rules (Always Enforce)
|
||||
|
||||
- Do not weaken auth/session behaviour
|
||||
- Do not weaken security headers/CSP
|
||||
- Keep EN/CY behaviour aligned
|
||||
- Do not expose secrets or personal data
|
||||
- Protect save/resume/upload/submit journeys
|
||||
|
||||
---
|
||||
|
||||
## PR Minimum (AI-Assisted)
|
||||
|
||||
Every change must include:
|
||||
|
||||
- Scope summary
|
||||
- Files changed
|
||||
- Risk notes (auth/data/i18n/a11y)
|
||||
- Validation evidence
|
||||
- Rollback plan
|
||||
|
||||
---
|
||||
|
||||
## Handling Unknowns
|
||||
|
||||
If unsure:
|
||||
|
||||
1. Choose the safer option
|
||||
2. Do not change behaviour
|
||||
3. call out assumptions clearly
|
||||
4. log open questions if needed
|
||||
|
||||
---
|
||||
|
||||
## Summary Rule
|
||||
|
||||
If in doubt:
|
||||
|
||||
> Preserve behaviour, reduce risk, keep changes small.
|
||||
@@ -1,95 +0,0 @@
|
||||
# Default Rules (Reference Only)
|
||||
|
||||
## Important
|
||||
|
||||
This file is **not the active rule set for this refactor branch**.
|
||||
|
||||
Active working rules are defined in:
|
||||
|
||||
- `.clinerules/refactor-branch-rules.md`
|
||||
- `context/refactor-branch-charter.md`
|
||||
- `context/newappeal-refactor-guardrails.md`
|
||||
|
||||
Do not load this file by default.
|
||||
|
||||
---
|
||||
|
||||
## Purpose
|
||||
|
||||
This file provides general repository-wide guidance and may be referenced when needed for broader context.
|
||||
|
||||
---
|
||||
|
||||
## Repository Mission
|
||||
|
||||
Deliver safe, accessible, bilingual (EN/CY), and reliable public-service functionality without regressing core journeys.
|
||||
|
||||
---
|
||||
|
||||
## General Priorities
|
||||
|
||||
1. Safety and security of user data
|
||||
2. Stability of public-facing journeys
|
||||
3. Accessibility and bilingual parity
|
||||
4. Maintainability of code
|
||||
5. Controlled, safe delivery
|
||||
|
||||
---
|
||||
|
||||
## General Coding Guidance
|
||||
|
||||
- Follow existing repo patterns
|
||||
- Keep page-level logic thin
|
||||
- Move reusable logic into `components/`, `actions/`, or `lib/`
|
||||
- Avoid broad refactors in feature or bugfix work
|
||||
- Prefer small, focused changes
|
||||
|
||||
---
|
||||
|
||||
## Architecture Guardrails (General)
|
||||
|
||||
- Do not bypass auth/session handling
|
||||
- Do not weaken security controls
|
||||
- Preserve relay request integrity
|
||||
- Maintain EN/CY route parity
|
||||
- Keep Redux hydration/persistence stable
|
||||
|
||||
---
|
||||
|
||||
## Validation Expectations (General)
|
||||
|
||||
- linting must pass
|
||||
- user-facing changes must be verified
|
||||
- accessibility and EN/CY checks required
|
||||
- sensitive flows require negative-path checks
|
||||
|
||||
---
|
||||
|
||||
## When To Use This File
|
||||
|
||||
Only reference this file when:
|
||||
|
||||
- broader repository rules are required
|
||||
- behaviour conflicts are unclear
|
||||
- no branch-specific guidance exists
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
This file is background guidance only.
|
||||
|
||||
For this refactor branch:
|
||||
|
||||
- follow branch-specific rules first
|
||||
- prioritise behaviour preservation
|
||||
- keep context minimal and focused
|
||||
|
||||
## Branching Guidance (Reference)
|
||||
|
||||
Branching depends on work type:
|
||||
|
||||
- BAU work typically branches from `SIPS-Development`
|
||||
- refactor-stream work for the new appeal flow uses `refactor` as the base branch
|
||||
|
||||
Follow branch-specific rules first.
|
||||
@@ -1,234 +0,0 @@
|
||||
# Refactor Branch Rules (Active)
|
||||
|
||||
## Purpose
|
||||
|
||||
This file defines the active working rules for the **refactor branch**.
|
||||
|
||||
This branch is focused on **safe, behaviour-preserving refactor of portal journeys**, including:
|
||||
|
||||
- New Appeal Flow (completed baseline)
|
||||
- Representations Flow (active refactor stream)
|
||||
|
||||
---
|
||||
|
||||
## Core Rule (Highest Priority)
|
||||
|
||||
Do not change live behaviour unless explicitly instructed.
|
||||
|
||||
Refactor = improve structure, not behaviour.
|
||||
|
||||
---
|
||||
|
||||
## Primary Objectives
|
||||
|
||||
1. Make core portal journeys easier to understand and maintain
|
||||
2. Reduce risk when making future changes
|
||||
3. Improve separation of concerns (UI, workflow, data, integrations)
|
||||
4. Prepare flows for future extensibility (e.g. multiple appeal types, additional journey types)
|
||||
|
||||
---
|
||||
|
||||
## Active Refactor Streams
|
||||
|
||||
### Completed
|
||||
|
||||
- New Appeal Flow (S78)
|
||||
|
||||
### Active
|
||||
|
||||
- Representations Flow
|
||||
|
||||
Each stream must follow **slice-based, behaviour-preserving refactor discipline**.
|
||||
|
||||
---
|
||||
|
||||
## Non-Negotiable Rules
|
||||
|
||||
- Preserve all current user journeys:
|
||||
|
||||
### Appeals
|
||||
|
||||
- start appeal
|
||||
- save and exit
|
||||
- resume appeal
|
||||
- upload documents
|
||||
- check answers
|
||||
- submit appeal
|
||||
- confirmation
|
||||
|
||||
### Representations
|
||||
|
||||
- start from case summary CTA
|
||||
- select capacity
|
||||
- select representation type
|
||||
- enter content / upload files
|
||||
- check answers
|
||||
- submit representation
|
||||
- completion
|
||||
|
||||
---
|
||||
|
||||
Do not:
|
||||
|
||||
- change payload structures
|
||||
- change validation rules
|
||||
- change business logic
|
||||
- change route/query behaviour
|
||||
- change navigation or side-effect sequencing
|
||||
- introduce EN/CY drift
|
||||
- mix refactor with feature work
|
||||
|
||||
---
|
||||
|
||||
## Refactor Approach
|
||||
|
||||
Always:
|
||||
|
||||
1. Understand current behaviour first
|
||||
2. Identify smallest safe change
|
||||
3. Prefer extraction over rewrite
|
||||
4. Keep public interfaces stable
|
||||
5. Make changes easy to review and revert
|
||||
|
||||
---
|
||||
|
||||
## Change Size Guidance
|
||||
|
||||
- Prefer small PRs (<400 LOC where possible)
|
||||
- Avoid large multi-concern changes
|
||||
- Split work into safe slices
|
||||
- One slice = one branch = one commit
|
||||
|
||||
---
|
||||
|
||||
## Branch Model (Critical)
|
||||
|
||||
### Branch Roles
|
||||
|
||||
- `SIPS-Development`
|
||||
- BAU branch
|
||||
- ongoing feature and bugfix work
|
||||
- must remain stable
|
||||
|
||||
- `refactor`
|
||||
- integration branch for refactor work
|
||||
- all refactor slices merge here first
|
||||
|
||||
- feature branches (short-lived)
|
||||
- created from `refactor`
|
||||
- one per slice
|
||||
- merged back into `refactor`
|
||||
|
||||
---
|
||||
|
||||
### Flow
|
||||
|
||||
SIPS-Development
|
||||
↓
|
||||
refactor
|
||||
↓
|
||||
feature/slice-x
|
||||
↓
|
||||
refactor
|
||||
↓ (when stable & validated)
|
||||
SIPS-Development
|
||||
|
||||
---
|
||||
|
||||
## Context Usage Rules (Critical for Efficiency)
|
||||
|
||||
### Default context (only load these):
|
||||
|
||||
- `context/refactor-branch-charter.md`
|
||||
- `context/architecture.md`
|
||||
- `context/domain-flows.md`
|
||||
|
||||
### Only load when needed:
|
||||
|
||||
- appeal work → `newappeal-refactor-guardrails.md`
|
||||
- representation work → `representations-refactor-guardrails.md`
|
||||
- plans → `context/plans/*`
|
||||
|
||||
### Never load by default:
|
||||
|
||||
- all context files
|
||||
- onboarding docs
|
||||
- all templates
|
||||
|
||||
---
|
||||
|
||||
## Templates Usage
|
||||
|
||||
- Use only ONE template when needed
|
||||
- Do not load all templates
|
||||
- Do not treat templates as baseline context
|
||||
|
||||
---
|
||||
|
||||
## Safety Rules
|
||||
|
||||
- Do not weaken authentication or session logic
|
||||
- Do not weaken security headers or middleware
|
||||
- Do not expose secrets or personal data
|
||||
- Preserve EN/CY parity
|
||||
- Maintain accessibility standards
|
||||
|
||||
---
|
||||
|
||||
## Regression Safety Rule (Critical)
|
||||
|
||||
This is a live system. All refactor work must prove behaviour is unchanged.
|
||||
|
||||
Before completing any slice:
|
||||
|
||||
### Appeals
|
||||
|
||||
- start appeal
|
||||
- save and exit
|
||||
- resume
|
||||
- upload
|
||||
- check answers
|
||||
- submit
|
||||
- confirmation
|
||||
|
||||
### Representations
|
||||
|
||||
- navigate from case summary → make representation
|
||||
- complete full journey
|
||||
- submit successfully
|
||||
- confirmation shown
|
||||
|
||||
Also:
|
||||
|
||||
- verify EN/CY parity
|
||||
- verify no navigation or state regressions
|
||||
|
||||
If regression cannot be ruled out:
|
||||
→ do not proceed
|
||||
|
||||
---
|
||||
|
||||
## When Unsure
|
||||
|
||||
1. Choose the safest option
|
||||
2. Do not change behaviour
|
||||
3. Call out assumptions
|
||||
4. Keep the change minimal
|
||||
|
||||
---
|
||||
|
||||
## Definition of Success
|
||||
|
||||
A successful change:
|
||||
|
||||
- preserves behaviour
|
||||
- reduces complexity
|
||||
- improves clarity
|
||||
- is small and safe to merge
|
||||
- introduces no regression risk
|
||||
|
||||
---
|
||||
|
||||
## One-Line Rule
|
||||
|
||||
> Keep behaviour the same, reduce risk, and make the smallest safe change.
|
||||
@@ -1,15 +0,0 @@
|
||||
# Bugfix Workflow
|
||||
|
||||
1. Clarify the bug symptoms and expected behavior.
|
||||
2. Inspect the relevant files and execution path.
|
||||
3. Identify the most likely root cause.
|
||||
4. Implement the smallest safe fix.
|
||||
5. Check for:
|
||||
- side effects
|
||||
- regression risk
|
||||
- validation gaps
|
||||
- missing error handling
|
||||
6. Summarize:
|
||||
- root cause
|
||||
- fix
|
||||
- preventive improvements worth noting
|
||||
@@ -1,17 +0,0 @@
|
||||
# Code Review Workflow
|
||||
|
||||
Review the relevant code or changes for:
|
||||
- correctness
|
||||
- edge cases
|
||||
- data integrity
|
||||
- security concerns
|
||||
- performance concerns
|
||||
- maintainability
|
||||
- readability
|
||||
- consistency with repo conventions
|
||||
|
||||
Return:
|
||||
1. key findings
|
||||
2. impact / severity where useful
|
||||
3. suggested improvements
|
||||
4. strengths worth preserving
|
||||
@@ -1,18 +0,0 @@
|
||||
# Database Migration Workflow
|
||||
|
||||
1. Understand the desired schema or data change.
|
||||
2. Inspect current data model, queries, and dependent code.
|
||||
3. Identify:
|
||||
- forward migration steps
|
||||
- backward compatibility concerns
|
||||
- rollback considerations
|
||||
4. Implement or propose the minimal safe migration path.
|
||||
5. Review for:
|
||||
- data integrity
|
||||
- ordering issues
|
||||
- application compatibility
|
||||
- deployment timing risk
|
||||
6. Summarize:
|
||||
- schema/data changes
|
||||
- impacted code paths
|
||||
- rollout / rollback notes
|
||||
@@ -1,17 +0,0 @@
|
||||
# Debugging Workflow
|
||||
|
||||
1. Capture the symptom, error, or incorrect behavior.
|
||||
2. Inspect the relevant path and recent changes.
|
||||
3. Form the most likely hypotheses.
|
||||
4. Narrow the cause using the smallest practical evidence checks.
|
||||
5. Propose or implement the minimal safe fix.
|
||||
6. Review for:
|
||||
- hidden assumptions
|
||||
- unhandled states
|
||||
- logging or observability gaps
|
||||
- regression risk
|
||||
7. Summarize:
|
||||
- symptom
|
||||
- cause
|
||||
- fix
|
||||
- prevention ideas
|
||||
@@ -1,10 +0,0 @@
|
||||
# Documentation Update Workflow
|
||||
|
||||
1. Identify what changed in the code or workflow.
|
||||
2. Inspect the affected docs and support files.
|
||||
3. Update only the relevant sections.
|
||||
4. Keep the docs concise, factual, and current.
|
||||
5. Summarize:
|
||||
- what changed
|
||||
- which docs were updated
|
||||
- anything still uncertain
|
||||
@@ -1,16 +0,0 @@
|
||||
# Feature Implementation Workflow
|
||||
|
||||
1. Understand the requirement and desired outcome.
|
||||
2. Inspect the relevant files, patterns, and data flows.
|
||||
3. Propose a short implementation plan for non-trivial work.
|
||||
4. Implement the smallest maintainable change that satisfies the requirement.
|
||||
5. Review for:
|
||||
- correctness
|
||||
- edge cases
|
||||
- error handling
|
||||
- compatibility with existing behavior
|
||||
- maintainability
|
||||
6. Summarize:
|
||||
- what changed
|
||||
- why
|
||||
- any follow-up considerations
|
||||
@@ -1,13 +0,0 @@
|
||||
# Planning Workflow
|
||||
|
||||
1. Clarify the objective.
|
||||
2. Inspect the relevant code areas and constraints.
|
||||
3. Identify implementation options.
|
||||
4. Compare trade-offs.
|
||||
5. Recommend the most practical path.
|
||||
6. Return:
|
||||
- objective summary
|
||||
- proposed plan
|
||||
- risks
|
||||
- dependencies
|
||||
- suggested execution order
|
||||
@@ -1,16 +0,0 @@
|
||||
# PR Review Workflow
|
||||
|
||||
Review the pull request or change set for:
|
||||
- correctness
|
||||
- scope discipline
|
||||
- regression risk
|
||||
- compatibility impact
|
||||
- tests or validation gaps
|
||||
- security and performance concerns
|
||||
- maintainability
|
||||
|
||||
Return:
|
||||
1. summary of change intent
|
||||
2. key risks
|
||||
3. requested changes
|
||||
4. optional improvements
|
||||
@@ -1,16 +0,0 @@
|
||||
# Refactor Workflow
|
||||
|
||||
1. Understand the current behavior that must be preserved.
|
||||
2. Inspect the relevant modules and dependencies.
|
||||
3. Identify safe refactor boundaries.
|
||||
4. Propose a scoped plan.
|
||||
5. Refactor incrementally.
|
||||
6. Review for:
|
||||
- preserved behavior
|
||||
- reduced complexity
|
||||
- improved readability
|
||||
- regression risk
|
||||
7. Summarize:
|
||||
- what was simplified
|
||||
- what was preserved
|
||||
- remaining debt
|
||||
@@ -1,15 +0,0 @@
|
||||
# Release Readiness Workflow
|
||||
|
||||
1. Review the scope of changes.
|
||||
2. Check:
|
||||
- build readiness
|
||||
- environment assumptions
|
||||
- configuration changes
|
||||
- database implications
|
||||
- CI/CD impact
|
||||
- rollback expectations
|
||||
3. Identify release risks and missing checks.
|
||||
4. Summarize:
|
||||
- release blockers
|
||||
- risks
|
||||
- final recommended checks
|
||||
-131
@@ -1,131 +0,0 @@
|
||||
|
||||
|
||||
ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/
|
||||
//ESNR Tenant
|
||||
TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502
|
||||
//WGO Tenant
|
||||
//TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5
|
||||
GRANT_TYPE = "client_credentials"
|
||||
|
||||
HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
||||
NEXT_PUBLIC_HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
||||
|
||||
|
||||
//Dev oauth ESNR
|
||||
CLIENT_ID = e082def0-3453-461f-9a5e-f4ab127dc015
|
||||
CLIENT_SECRET = qW.7Q~TSr3sZmLEnJQJPXEdOckb_yo2t1yJmY
|
||||
RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
|
||||
RELAYURI = "dev-pedw-ns.servicebus.windows.net"
|
||||
RELAYPATH = "dev-pedw-hc"
|
||||
|
||||
|
||||
//Test Oauth ESNR
|
||||
//CLIENT_ID = 6619ad85-c908-490d-811b-de8c93c0f2aa
|
||||
//CLIENT_SECRET = qKo7Q~5QvLEplbwnBbint_I5lXqx_-kDm8Vj-
|
||||
//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
|
||||
//RELAYURI = "test-pedw-ns.servicebus.windows.net"
|
||||
//RELAYPATH = "test-pedw-hc"
|
||||
|
||||
|
||||
//Preprod Oauth WGO
|
||||
//CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
|
||||
//CLIENT_SECRET = Ioo7Q~RJfhWsE45wPsuHm1CzRk1SppnNN3lZF
|
||||
//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
|
||||
//RELAYURI = "pp-pedw-ns.servicebus.windows.net"
|
||||
//RELAYPATH = "pp-pedw-hc"
|
||||
|
||||
|
||||
|
||||
//Prod Oauth WGO
|
||||
//CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc
|
||||
//CLIENT_SECRET = mJN7Q~lFu.xFGa5KCc.zwIm_fJAWxajyQaFo~
|
||||
//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
|
||||
//RELAYURI = "prod-pedw-ns.servicebus.windows.net"
|
||||
//RELAYPATH = "prod-pedw-hc"
|
||||
|
||||
|
||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||
SHOWLOGIN = "true"
|
||||
SHOWREPRESENTATIONS = false
|
||||
SHOWFILEUPLOAD = "false"
|
||||
SHOWMAPS = "true"
|
||||
//BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
||||
|
||||
|
||||
PORT= "3000"
|
||||
DEFAULT_DOMAIN = "localhost"
|
||||
I18N_DOMAIN = "cymru.local"
|
||||
//I18N_DOMAIN ="dev-gwaithcynllunio.gwasanaeth.llyw.cymru"
|
||||
//I18N_DOMAIN ="stage-gwaithcynllunio.gwasanaeth.llyw.cymru"
|
||||
//I18N_DOMAIN ="pp-gwaithcynllunio.gwasanaeth.llyw.cymru"s
|
||||
//I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru"
|
||||
|
||||
|
||||
//gov gateway
|
||||
GG_PROVIDER_CONFIG_ENDPOINT = "https://api.ete.access.service.gov.uk/.well-known/openid-configuration"
|
||||
GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
||||
GG_CLIENT_SECRET = z1PGLAKPxIhjMBegTdzX22AayIORc1GsCbMQZ6mieBn7zChjzzxup5lkIByEmsYS
|
||||
//GG_REDIRECT_URI = "http://localhost:3000"
|
||||
GG_REDIRECT_URI = "https://dev-planningcasework.service.gov.wales"
|
||||
|
||||
NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
||||
NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000"
|
||||
|
||||
API_ROOT = "http://localhost:3000"
|
||||
|
||||
|
||||
GOOGLE_MAP_API_KEY = AIzaSyCzeVrHt544bp_72YCFkw21eDsmI2JEsQo
|
||||
|
||||
|
||||
//EMAIL_SERVER_HOST=smtp.livemail.co.uk
|
||||
//EMAIL_SERVER_PORT=465
|
||||
//EMAIL_SERVER_USER=rob@rdbsolutions.co.uk
|
||||
//EMAIL_SERVER_PASSWORD=R0b3rt72
|
||||
//EMAIL_FROM=rob@rdbsolutions.co.uk
|
||||
|
||||
EMAIL_SERVER_HOST=smtp.sendgrid.net
|
||||
EMAIL_SERVER_PORT=465
|
||||
EMAIL_SERVER_USER=apikey
|
||||
EMAIL_SERVER_PASSWORD=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
|
||||
EMAIL_FROM=rob@rdbsolutions.co.uk
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEXT_PUBLIC_MAGIC_PK=pk_live_674E13244D1BB0A4
|
||||
MAGIC_SK=sk_live_F0E74A9557051A65
|
||||
|
||||
|
||||
|
||||
NEXTAUTH_URL=http://localhost:3000
|
||||
NEXTAUTH_SECRET= # Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
|
||||
|
||||
APPLE_ID=
|
||||
APPLE_TEAM_ID=
|
||||
APPLE_PRIVATE_KEY=
|
||||
APPLE_KEY_ID=
|
||||
|
||||
AUTH0_ID=
|
||||
AUTH0_SECRET=
|
||||
AUTH0_ISSUER=
|
||||
|
||||
FACEBOOK_ID=
|
||||
FACEBOOK_SECRET=
|
||||
|
||||
GITHUB_ID=
|
||||
GITHUB_SECRET=
|
||||
|
||||
GOOGLE_ID=
|
||||
GOOGLE_SECRET=
|
||||
|
||||
TWITTER_ID=
|
||||
TWITTER_SECRET=
|
||||
|
||||
//EMAIL_SERVER=smtp://username:password@smtp.example.com:587
|
||||
//EMAIL_FROM=NextAuth <noreply@example.com>
|
||||
|
||||
//DATABASE_URL=sqlite://localhost/:memory:?synchronize=true
|
||||
DATABASE_URL=mysql://nextAuthAdmin:!Sky9fish1972@77.68.17.157:3306/nextauthDB?synchronise=true
|
||||
|
||||
SECRET=SuperSecret
|
||||
-119
@@ -1,119 +0,0 @@
|
||||
ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/
|
||||
//ESNR Tenant
|
||||
//TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502
|
||||
//WGO Tenant
|
||||
TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5
|
||||
GRANT_TYPE = "client_credentials"
|
||||
|
||||
HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
||||
NEXT_PUBLIC_HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
||||
|
||||
|
||||
//Dev oauth ESNR
|
||||
CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
|
||||
//CLIENT_SECRET = 4Vt8Q~olL1hx7n01B0~tXf-N2YL5DyC_Fk6waagX
|
||||
CLIENT_SECRET = AU88Q~NBOVOXqwb4mBx9y.NMIZ9s1o7boqZoKcSE
|
||||
RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
|
||||
RELAYURI = "dev-pedw-ns.servicebus.windows.net"
|
||||
RELAYPATH = "dev-pedw-hc"
|
||||
|
||||
|
||||
//Test Oauth ESNR
|
||||
//CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
|
||||
//CLIENT_SECRET = IXI8Q~D5oqsC-nrtayHHc~tUAfjQFzNiKVQ~fc2S
|
||||
//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
|
||||
//RELAYURI = "test-pedw-ns.servicebus.windows.net"
|
||||
//RELAYPATH = "test-pedw-hc"
|
||||
|
||||
|
||||
//Preprod Oauth WGO
|
||||
//CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
|
||||
//CLIENT_SECRET = Ioo7Q~RJfhWsE45wPsuHm1CzRk1SppnNN3lZF
|
||||
//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
|
||||
//RELAYURI = "pp-pedw-ns.servicebus.windows.net"
|
||||
//RELAYPATH = "pp-pedw-hc"
|
||||
|
||||
|
||||
|
||||
//Prod Oauth WGO
|
||||
//CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc
|
||||
//CLIENT_SECRET = mJN7Q~lFu.xFGa5KCc.zwIm_fJAWxajyQaFo~
|
||||
//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
|
||||
//RELAYURI = "prod-pedw-ns.servicebus.windows.net"
|
||||
//RELAYPATH = "prod-pedw-hc"
|
||||
|
||||
|
||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||
SHOWLOGIN = "true"
|
||||
SHOWREPRESENTATIONS = true
|
||||
SHOWFILEUPLOAD = "false"
|
||||
SHOWMAPS = "false"
|
||||
//BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
||||
|
||||
|
||||
PORT= "3000"
|
||||
DEFAULT_DOMAIN = "localhost"
|
||||
I18N_DOMAIN = "cymru.local"
|
||||
//I18N_DOMAIN ="dev-gwaithcynllunio.gwasanaeth.llyw.cymru"
|
||||
//I18N_DOMAIN ="stage-gwaithcynllunio.gwasanaeth.llyw.cymru"
|
||||
//I18N_DOMAIN ="pp-gwaithcynllunio.gwasanaeth.llyw.cymru"s
|
||||
//I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru"
|
||||
|
||||
|
||||
//gov gateway
|
||||
GG_PROVIDER_CONFIG_ENDPOINT = "https://api.ete.access.service.gov.uk/.well-known/openid-configuration"
|
||||
GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
||||
GG_CLIENT_SECRET = z1PGLAKPxIhjMBegTdzX22AayIORc1GsCbMQZ6mieBn7zChjzzxup5lkIByEmsYS
|
||||
//GG_REDIRECT_URI = "http://localhost:3000"
|
||||
GG_REDIRECT_URI = "https://dev-planningcasework.service.gov.wales"
|
||||
|
||||
NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
||||
NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000"
|
||||
|
||||
API_ROOT = "http://localhost:3000"
|
||||
|
||||
|
||||
GOOGLE_MAP_API_KEY = AIzaSyCzeVrHt544bp_72YCFkw21eDsmI2JEsQo
|
||||
|
||||
|
||||
|
||||
//Next Auth vars
|
||||
//EMAIL_SERVER_HOST=smtp.sendgrid.net
|
||||
//EMAIL_SERVER_PORT=465
|
||||
//EMAIL_SERVER_USER=apikey
|
||||
//EMAIL_SERVER_PASSWORD=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
|
||||
//EMAIL_FROM=rob@rdbsolutions.co.uk
|
||||
|
||||
|
||||
EMAIL_SERVER_HOST=rdbdigital.com
|
||||
EMAIL_SERVER_PORT=465
|
||||
EMAIL_SERVER_USER=rob@rdbdigital.com
|
||||
EMAIL_SERVER_PASSWORD=!Sky9fish2020
|
||||
EMAIL_FROM=no-reply@rdbdigital.com
|
||||
|
||||
NEXTAUTH_URL=http://localhost:3000
|
||||
NEXTAUTH_URL_INTERNAL=http://localhost:3000
|
||||
//DATABASE_URL=mysql://nextAuthAdmin:!Sky9fish1972@77.68.17.157:3306/nextauthDB?synchronise=true
|
||||
DATABASE_URL = sqlserver://pedw-dev-test-sql-svr.database.windows.net:1433;database=PEDWDev;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
SECRET = SuperSecret
|
||||
|
||||
|
||||
//Azure Storage Account
|
||||
|
||||
AZURE_CLIENT_ID = $CLIENT_ID
|
||||
AZURE_TENANT_ID = $TENANT
|
||||
AZURE_CLIENT_SECRET = $CLIENT_SECRET
|
||||
AZURE_STORAGE_ACCOUNT_NAME= "pedwdev"
|
||||
AZURE_STORAGE_ACCOUNT_KEY = JS3ZIXianhYhB1lZrHB+bXbdzaLlON0alCyKrFAb+jVEwr9iqo2dty92EBxwnufNFM+CSN/fKX2R+AStDn0byg==
|
||||
|
||||
|
||||
AZURE_PEDW_STORAGE_ENDPOINT = https://pedwdev.blob.core.windows.net
|
||||
AZURE_PEDW_CONTAINER = "pedwapplications"
|
||||
AZURE_PEDW_QUEUE_ENDPOINT = https://$AZURE_STORAGE_ACCOUNT_NAME.queue.core.windows.net
|
||||
|
||||
|
||||
|
||||
//gov.notify
|
||||
|
||||
NOTIFY_API_KEY = pedwnextauthkey-90f93710-9dae-423e-aea1-11eccd0dc132-0c9469d9-d671-444d-9e9d-3e5a62001043
|
||||
+51
-256
@@ -1,276 +1,71 @@
|
||||
|
||||
|
||||
ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/
|
||||
TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5
|
||||
TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502
|
||||
//TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5
|
||||
GRANT_TYPE = "client_credentials"
|
||||
|
||||
HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
||||
|
||||
# //CNR oauth CNR
|
||||
# CLIENT_ID = 3125ac03-91ac-46a7-a166-0086f0ed90b3
|
||||
# CLIENT_SECRET = bFq8Q~9VX5Ra3lKnGGIXsB.G6-ZGMx7LqyqXjdr4
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-cnr-uks-01.servicebus.windows.net/ar-hc-lz-pedw-cnr-uks-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-cnr-uks-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-cnr-uks-01"
|
||||
# CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
|
||||
|
||||
# //New Dev oauth ESNR
|
||||
CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
|
||||
CLIENT_SECRET = .Jf8Q~tKMObCJjhh_hy3J5AIctFrBalU4FS~tdxk
|
||||
RELAY_ROOT = https://ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net/ar-hc-lz-pedw-dev-uks-01/
|
||||
RELAYURI = "ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net"
|
||||
RELAYPATH = "ar-hc-lz-pedw-dev-uks-01"
|
||||
CRMURL = "dv-pedw.crm11.dynamics.com"
|
||||
CRMURL_VERSION = "v9.2"
|
||||
|
||||
# //New Test
|
||||
CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
|
||||
CLIENT_SECRET = 6hT8Q~glL~jloWpGmvXw3UY37QFwjUE0r._jobEM
|
||||
RELAY_ROOT = https://ar-ns-lz-pedw-test-uks-01.servicebus.windows.net/ar-hc-lz-pedw-test-uks-01/
|
||||
RELAYURI = "ar-ns-lz-pedw-test-uks-01.servicebus.windows.net"
|
||||
RELAYPATH = "ar-hc-lz-pedw-test-uks-01"
|
||||
# CRMURL = "tscrm2016.llcdt.gov.wales/UATPINS"
|
||||
# CRMURL_VERSION = "v8.2"
|
||||
CRMURL = "ts-pedw.crm11.dynamics.com"
|
||||
CRMURL_VERSION = "v9.2"
|
||||
|
||||
# //New PreProd
|
||||
# CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
|
||||
# CLIENT_SECRET = VWY8Q~9EtRzGXpd8Xs~5OS1fej2IyVJ8JgTMncw3
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-ppe-uks-01.servicebus.windows.net/ar-hc-lz-pedw-ppe-uks-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-ppe-uks-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-ppe-uks-01"
|
||||
# # RELAY_ROOT = https://ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net/ar-hc-lz-pedw-ppe-ukw-01/
|
||||
# # RELAYURI = "ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net"
|
||||
# # RELAYPATH = "ar-hc-lz-pedw-ppe-ukw-01"
|
||||
# # CRMURL = "ppcrm2016.llcdt.gov.wales/PPPINSWales"
|
||||
# # CRMURL_VERSION = "v8.2"
|
||||
# CRMURL = "wg-pp-pedw.crm11.dynamics.com"
|
||||
# CRMURL_VERSION = "v9.2"
|
||||
NEXT_PUBLIC_HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
||||
|
||||
|
||||
# //Prod Oauth WGO
|
||||
# CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc
|
||||
# CLIENT_SECRET = tFk8Q~E.R-HFjROTu1sRKqwb_ONzy05uPYoF6awR
|
||||
# RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
|
||||
# RELAYURI = "prod-pedw-ns.servicebus.windows.net"
|
||||
# RELAYPATH = "prod-pedw-hc"
|
||||
# CRMURL = "crm2016.llc.gov.wales/PEDW"
|
||||
//Dev oauth
|
||||
//CLIENT_ID = e082def0-3453-461f-9a5e-f4ab127dc015
|
||||
//CLIENT_SECRET = qW.7Q~TSr3sZmLEnJQJPXEdOckb_yo2t1yJmY
|
||||
//RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
|
||||
//RELAYURI = "dev-pedw-ns.servicebus.windows.net"
|
||||
//RELAYPATH = "dev-pedw-hc"
|
||||
|
||||
# //New Prod
|
||||
# CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc
|
||||
# CLIENT_SECRET = ULC8Q~fZiXm0.teVLlZ_7LjxBOj2vIsWSApu2bAq
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-prod-uks-01.servicebus.windows.net/ar-hc-lz-pedw-prod-uks-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-prod-uks-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-prod-uks-01"
|
||||
# # RELAY_ROOT = https://ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net/ar-hc-lz-pedw-prod-ukw-01/
|
||||
# # RELAYURI = "ar-ns-lz-pedw-prod-ukw-01.servicebus.windows.net"
|
||||
# # RELAYPATH = "ar-hc-lz-pedw-prod-ukw-01"
|
||||
# CRMURL = "crm2016.llc.gov.wales/PEDW"
|
||||
# CRMURL_VERSION = "v8.2"
|
||||
|
||||
//Test Oauth
|
||||
CLIENT_ID = 6619ad85-c908-490d-811b-de8c93c0f2aa
|
||||
CLIENT_SECRET = qKo7Q~5QvLEplbwnBbint_I5lXqx_-kDm8Vj-
|
||||
RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
|
||||
RELAYURI = "test-pedw-ns.servicebus.windows.net"
|
||||
RELAYPATH = "test-pedw-hc"
|
||||
|
||||
|
||||
//Preprod Oauth
|
||||
//CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
|
||||
//CLIENT_SECRET = Ioo7Q~RJfhWsE45wPsuHm1CzRk1SppnNN3lZF
|
||||
//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
|
||||
//RELAYURI = "pp-pedw-ns.servicebus.windows.net"
|
||||
//RELAYPATH = "pp-pedw-hc"
|
||||
|
||||
|
||||
|
||||
# D365 cnr WGO
|
||||
# CLIENT_ID = 3125ac03-91ac-46a7-a166-0086f0ed90b3
|
||||
# CLIENT_SECRET = bFq8Q~9VX5Ra3lKnGGIXsB.G6-ZGMx7LqyqXjdr4
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-d365cnr-uks-01.servicebus.windows.net/ar-hc-lz-pedw-d365cnr-uks-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-d365cnr-uks-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-d365cnr-uks-01"
|
||||
# CRMURL = "dv-pedw.crm11.dynamics.com"
|
||||
# CRMURL_VERSION = "v9.2"
|
||||
|
||||
# D365 Dev WGO
|
||||
# CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
|
||||
# CLIENT_SECRET = .Jf8Q~tKMObCJjhh_hy3J5AIctFrBalU4FS~tdxk
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-d365dev-uks-01.servicebus.windows.net/ar-hc-lz-pedw-d365dev-uks-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-d365dev-uks-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-d365dev-uks-01"
|
||||
# CRMURL = "dv-pedw.crm11.dynamics.com"
|
||||
# CRMURL_VERSION = "v9.2"
|
||||
|
||||
# D365 Test WGO
|
||||
# CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
|
||||
# CLIENT_SECRET = 6hT8Q~glL~jloWpGmvXw3UY37QFwjUE0r._jobEM
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-d365test-uks-01.servicebus.windows.net/ar-hc-lz-pedw-d365test-uks-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-d365test-uks-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-d365test-uks-01"
|
||||
# CRMURL = "ts-pedw.crm11.dynamics.com"
|
||||
# CRMURL_VERSION = "v9.2"
|
||||
|
||||
# D365 PP WGO
|
||||
# CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
|
||||
# CLIENT_SECRET = V288Q~P1lFMvvX9Xnkx2pLixK~GOREH983Owqc1E
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-d365ppe-uks-01.servicebus.windows.net/ar-hc-lz-pedw-d365ppe-uks-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-d365ppe-uks-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-d365ppe-uks-01"
|
||||
# CRMURL = "wg-pp-pedw.crm11.dynamics.com"
|
||||
# CRMURL_VERSION = "v9.2"
|
||||
|
||||
# D365 Prod WGO
|
||||
# CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc
|
||||
# CLIENT_SECRET = ULC8Q~fZiXm0.teVLlZ_7LjxBOj2vIsWSApu2bAq
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-d365prod-uks-01.servicebus.windows.net/ar-hc-lz-pedw-d365prod-uks-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-d365prod-uks-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-d365prod-uks-01"
|
||||
# CRMURL = "wg-prod-pedw.crm11.dynamics.com"
|
||||
# CRMURL_VERSION = "v9.2"
|
||||
//Prod Oauth
|
||||
//CLIENT_ID = 01904c07-9035-4cf9-a535-3945f6e470d2
|
||||
//CLIENT_SECRET = PRo7Q~GQoKSdARRqF-NOXQDx2Ka8UCINyvagk
|
||||
//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
|
||||
//RELAYURI = "prod-pedw-ns.servicebus.windows.net"
|
||||
//RELAYPATH = "prod-pedw-hc"
|
||||
|
||||
|
||||
//GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||
GOOGLE_TAG_MANAGER = G-GTWW3JT03Z
|
||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||
SHOWLOGIN = "true"
|
||||
SHOWREPRESENTATIONS = "false"
|
||||
BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
||||
|
||||
SHOWLOGIN = true
|
||||
SHOWREPRESENTATIONS = true
|
||||
SHOWFILEUPLOAD = "false"
|
||||
SHOWMAPS = true
|
||||
API_ROOT = "http://localhost:3000"
|
||||
CY_API_ROOT = "http://cymru.local:3000"
|
||||
|
||||
PORT= "3000"
|
||||
DEFAULT_DOMAIN = "localhost"
|
||||
I18N_DOMAIN = "cymru.local"
|
||||
# DOCAPI_OFFLINE = "07:00:00,16:00:00"
|
||||
DOCAPI_OFFLINE = "01:00:00,04:00:00"
|
||||
SHOWFILTERDOCS = true
|
||||
//I18N_DOMAIN ="dev-gwaithcynllunio.gwasanaeth.llyw.cymru"
|
||||
//I18N_DOMAIN ="stage-gwaithcynllunio.gwasanaeth.llyw.cymru"
|
||||
//I18N_DOMAIN ="pp-gwaithcynllunio.gwasanaeth.llyw.cymru"s
|
||||
//I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru"
|
||||
|
||||
|
||||
// Next Auth vars
|
||||
NEXTAUTH_URL = $API_ROOT
|
||||
NEXTAUTH_URL_INTERNAL = $API_ROOT
|
||||
NEXTAUTH_SECRET = SuperSecret
|
||||
//gov gateway
|
||||
GG_PROVIDER_CONFIG_ENDPOINT = "https://api.ete.access.service.gov.uk/.well-known/openid-configuration"
|
||||
GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
||||
GG_CLIENT_SECRET = z1PGLAKPxIhjMBegTdzX22AayIORc1GsCbMQZ6mieBn7zChjzzxup5lkIByEmsYS
|
||||
GG_REDIRECT_URI = "http://localhost:3000"
|
||||
|
||||
// CNR sql server
|
||||
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-cnr-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
||||
NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000"
|
||||
|
||||
// dev test sql server
|
||||
DATABASE_URL = sqlserver://sql-srv-plt-pedw-dev-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
// test sql server
|
||||
DATABASE_URL = sqlserver://sql-srv-plt-pedw-test-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
// Pre prod sql server
|
||||
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-ppe-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustservercertificate=true;hostnameincertificate=*.database.windows.net;logintimeout=30;authentication=SqlPassword
|
||||
|
||||
// Prod sql server
|
||||
# DATABASE_URL = sqlserver://pp-pedw-sql.database.windows.net:1433;database=PEDWPreProd;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
// Prod sql server
|
||||
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-prod-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
// D365 CNR sql server
|
||||
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-d365cnr-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
// D365 Dev sql server
|
||||
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-d365dev-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
// D365 Test sql server
|
||||
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-d365test-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
// D365 PPE sql server
|
||||
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-d365ppe-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
// D365 Prod sql server
|
||||
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-d365prod-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
API_ROOT = "http://localhost:3000"
|
||||
|
||||
|
||||
|
||||
SECRET = SuperSecret
|
||||
|
||||
|
||||
|
||||
//Azure Storage Account
|
||||
AZURE_CLIENT_ID = $CLIENT_ID
|
||||
AZURE_TENANT_ID = $TENANT
|
||||
AZURE_CLIENT_SECRET = $CLIENT_SECRET
|
||||
|
||||
// CNR key
|
||||
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwcnruks"
|
||||
AZURE_STORAGE_ACCOUNT_KEY = hRffHq4IwctpaTKdS/U33Xq6nyTDF1t++WJgIwsw7gzstktZin/rRwbTIAL9KKqesVsK7EHrTTG6+ASt4+7skw==
|
||||
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwcnruks.blob.core.windows.net
|
||||
|
||||
// new dev key
|
||||
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwdevuks"
|
||||
AZURE_STORAGE_ACCOUNT_KEY = MmrsrCjBfop9pI2oImsP/+lJUWU2DrXsAB8nq5bOVROTmPovSGxjCjKw9+TAFr00k8WDUK9r6mVx+AStcMLyAA==
|
||||
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwdevuks.blob.core.windows.net
|
||||
|
||||
// New test key
|
||||
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwtestuks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = 5NdDO9GGlbTFLHFOXZRw8H2C0Ow5bFTvHwUHEbStyzg2mbd1uwHSeBSvM/dkN+HfdwrFzqAkwL5P+AStdO6cig==
|
||||
AZURE_STORAGE_ACCOUNT_KEY = bqJAz5pYQVGee8dnVhlsqW+xHwinNTjgY2AmojNyB+d4uAotMR20WcO4Op13yB+9dFaXAkkjtIA4+AStHT/IYg==
|
||||
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwtestuks.blob.core.windows.net
|
||||
|
||||
// New preprod key
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwppeuks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = B4GRKr+cA9b9mNM/GHFivzhzflJIZltG8bMmooXlYvGYySPAspTTHistAT30sHipnR+hh6dqUc9q+ASttAjPRQ==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwppeuks.blob.core.windows.net
|
||||
|
||||
|
||||
# PROD key
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "pedwprod"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = koZ46STRqapSa2Dod8MLL6aju1eYLhhyJ6DXpCLMTnFLJvbDT6CHUv/jwr5U/Ta8a60MWzwToHQy+AStADO7sg==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://pedwprod.blob.core.windows.net
|
||||
|
||||
# New PROD key
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwproduks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = OfV9MFqXcLLPam9GhEdMWadIOwIzhc5hd5TUqzIuQoswFdtV4ybaemjatSv+Kht0Ny1qQKjLplwY+AStUTZJrg==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwproduks.blob.core.windows.net
|
||||
|
||||
# D365 CNR key
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwd365cnruks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = nEwCp+4FuVf/9a4DOyKuQO2yRRV4Ypigg20ch1YaiL09YmEhWMEO5pNLpYtI3WnQCkIqeu1CUqwM+AStCLW01g==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwd365cnruks.blob.core.windows.net
|
||||
|
||||
# D365 DEV key
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwd365devuks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = XzwQxuZXSwYrVgemDUD2ymTpYTIfWqhypbmEALw1ZEEP0M4D3b3Gh28clSymxwFu7Gu9mhwkW4/V+AStZ6RF8Q==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwd365devuks.blob.core.windows.net
|
||||
|
||||
# D365 TEST key
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwd365testuks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = 5NdDO9GGlbTFLHFOXZRw8H2C0Ow5bFTvHwUHEbStyzg2mbd1uwHSeBSvM/dkN+HfdwrFzqAkwL5P+AStdO6cig==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwd365testuks.blob.core.windows.net
|
||||
|
||||
# D365 PP key
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwd365ppeuks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = xQz4FWDnQDE09uPOCj1t7axRiquvZG9vbxL88ywzVsJnTsAgewrHnuAGkxGPBCp2xGE53ffYOme6+AStSr8OoQ==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwd365ppeuks.blob.core.windows.net
|
||||
|
||||
# D365 Prod key
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwd365produks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = DvKcWhDpFKMFdVXFF2SqDG0sYQ3AkNCmJUBG0cvgzi5NBHS4Ahd2hPAlfA3hGi2EbohUag3vCucK+ASt1IdBhA==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwd365produks.blob.core.windows.net
|
||||
|
||||
|
||||
AZURE_PEDW_CONTAINER = "pedwapplications"
|
||||
AZURE_PEDW_QUEUE_ENDPOINT = https://$AZURE_STORAGE_ACCOUNT_NAME.queue.core.windows.net
|
||||
|
||||
//gov.notify
|
||||
//NOTIFY_API_KEY = pedwnextauthkey-90f93710-9dae-423e-aea1-11eccd0dc132-0c9469d9-d671-444d-9e9d-3e5a62001043
|
||||
NOTIFY_API_KEY = pedwnextauthlivekey-90f93710-9dae-423e-aea1-11eccd0dc132-5c0ed187-754a-4b04-8c99-978e5710c2c1
|
||||
|
||||
SHOW_DEBUG = true
|
||||
|
||||
|
||||
// DEV Connection string
|
||||
NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=4b7568b3-70bd-4591-9dc2-267c0a6501d1;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=447d38b5-5d40-4238-8fb3-0ef4741b3db1
|
||||
|
||||
|
||||
APPLICATIONINSIGHTS_CONNECTIONSTRING = InstrumentationKey=7a06e24a-793c-47bc-8987-ce80f180e035;IngestionEndpoint=https://uksouth-1.in.applicationinsights.azure.com/;LiveEndpoint=https://uksouth.livediagnostics.monitor.azure.com/;ApplicationId=9906b6d0-b791-4add-8d53-c827a534e1d4
|
||||
|
||||
|
||||
// Test Connection string
|
||||
NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=cc60e8e7-5b30-4c2b-a176-8b96b21b12df;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=2a4094be-6fd1-46ab-a67d-5f241692b129
|
||||
|
||||
// Preprod Connection string
|
||||
# NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=7370f0f9-834d-4c7a-b3c4-9951fcad5ad2;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=04362cb7-6dfc-469e-8274-12243e8be851
|
||||
|
||||
# NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=a41b91bf-f7dc-4f44-bb66-a67df4eee435;IngestionEndpoint=https://uksouth-1.in.applicationinsights.azure.com/;LiveEndpoint=https://uksouth.livediagnostics.monitor.azure.com/;ApplicationId=473d0632-16f1-4065-8984-d6bac62402c0
|
||||
|
||||
// Prod Connection string
|
||||
# NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=61f358c2-8075-4164-b897-17bc6dd31fee;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=0c297349-396b-4dc6-8b56-85f5c680adc6
|
||||
|
||||
|
||||
HIDEERRORLOGS = false
|
||||
|
||||
SHOWSIPS = true
|
||||
|
||||
ALLOWED_IPS=::1,203.0.113.42,198.51.100.17
|
||||
UPLOAD_BATCH_COUNT = 5
|
||||
|
||||
NRWDOMAIN = rdbmedia.co.uk
|
||||
@@ -1,34 +1,6 @@
|
||||
{
|
||||
"extends": "next/core-web-vitals",
|
||||
"extends": "next",
|
||||
"rules": {
|
||||
"@next/next/no-img-element": "off",
|
||||
"react/no-unknown-property": "error"
|
||||
|
||||
}//,
|
||||
//...your configuration
|
||||
// "overrides": [
|
||||
// //...your overrides
|
||||
// {
|
||||
// // Force the setting of a swagger description on each api endpoint
|
||||
// "files": ["pages/api/**/*.js"],
|
||||
// "plugins": ["jsdoc"],
|
||||
// "rules": {
|
||||
// "jsdoc/no-missing-syntax": [
|
||||
// "error",
|
||||
// {
|
||||
// "contexts": [
|
||||
// {
|
||||
// "comment": "JsdocBlock:has(JsdocTag[tag=swagger])",
|
||||
// "context": "any",
|
||||
// "message": "@swagger documentation is required on each API. Check this out for syntax info: https://github.com/jellydn/next-swagger-doc"
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
|
||||
"@next/next/no-img-element": "off"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-41
@@ -13,46 +13,7 @@ node_modules/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.yarn
|
||||
|
||||
#lock files
|
||||
# yarn.lock
|
||||
# package-lock.json
|
||||
|
||||
tmp
|
||||
|
||||
*env*.sample
|
||||
docker
|
||||
dockerfile*
|
||||
.dockerignore
|
||||
Makefile
|
||||
docker*.yml
|
||||
|
||||
# Polling
|
||||
|
||||
pages/api/poll-queue.js
|
||||
pages/polling.js
|
||||
|
||||
# dev apis to no include
|
||||
|
||||
pages/api/endpoint/getaccounts_api.js
|
||||
|
||||
# remove swagger api docs
|
||||
|
||||
next-swagger-doc.json
|
||||
pages/api-doc.js
|
||||
public/swagger.json
|
||||
certificates/cert-key.pem
|
||||
certificates/cert.pem
|
||||
gitclean.sh
|
||||
pages/admin/logcheck.js
|
||||
pages/admin/logchecker.js
|
||||
pages/baracuda.html
|
||||
pages/holding-min.html
|
||||
pages/holding.html
|
||||
|
||||
# Cline / AI-assistant governance artifacts (keep local-only)
|
||||
|
||||
ai-prompts/
|
||||
|
||||
pages/baracuda.min.html
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"tabWidth": 4,
|
||||
"useTabs": false,
|
||||
"quoteProps": "preserve",
|
||||
"trailingComma": "none"
|
||||
"quoteProps":"preserve"
|
||||
}
|
||||
Vendored
+3
-9
@@ -4,18 +4,12 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Next.js: debug server-side",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "npm run dev"
|
||||
},
|
||||
{"name": "Launch Chrome against localhost",
|
||||
"type": "chrome",
|
||||
{
|
||||
"type": "pwa-chrome",
|
||||
"request": "launch",
|
||||
"name": "Launch Chrome against localhost",
|
||||
"url": "http://localhost:3000",
|
||||
"webRoot": "${workspaceFolder}"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
# AI Context — PEDW FrontEnd
|
||||
|
||||
## Overview
|
||||
|
||||
PEDW FrontEnd is a Next.js 14 (Pages Router) bilingual (EN/CY) public-service portal for planning case search, case detail/document viewing, and authenticated portal workflows (appeals, representations, watchlists, dashboard views).
|
||||
|
||||
## Architecture
|
||||
|
||||
- Monorepo-style Next.js app with UI routes in `pages/` and API handlers in `pages/api/**`.
|
||||
- Redux (`next-redux-wrapper` + `redux-persist`) for shared client/server state.
|
||||
- `next-auth` for auth/session with Prisma adapter.
|
||||
- Integration-heavy BFF pattern: API routes proxy to relay/CRM and storage/notify services.
|
||||
|
||||
## Key components
|
||||
|
||||
- `components/breadcrumbs.js`: central breadcrumb/back-link behavior.
|
||||
- `components/case/summary.js`: case-detail tabs, representation eligibility logic, watch/email actions.
|
||||
- `actions/index.js`: shared API utilities, token/header/hash helpers, many side-effect wrappers.
|
||||
- `pages/api/endpoint/**`: relay-backed business-data APIs.
|
||||
- `pages/api/file/**`: blob/document/PDF/upload endpoints.
|
||||
|
||||
## Data model boundaries
|
||||
|
||||
- Prisma (`prisma/schema.prisma`) stores auth/session entities only (`User`, `Account`, `Session`, `VerificationToken`) on SQL Server.
|
||||
- Business/case data is external (Dynamics/relay path), not persisted as Prisma domain models here.
|
||||
|
||||
## API/integration patterns
|
||||
|
||||
- Many endpoint handlers compute HMAC hash query params (`hash`) for relay-bound requests.
|
||||
- Token acquisition + OData headers are reused across proxy handlers.
|
||||
- File endpoints often validate request hash for sensitive blob actions.
|
||||
- GOV.UK Notify used for email, including language-specific template selection in some flows.
|
||||
|
||||
## Infrastructure/tooling
|
||||
|
||||
- Scripts: `npm run dev`, `npm run build`, `npm start`, `npm run lint`.
|
||||
- CI/CD artifacts present: `azure-pipelines.yml`, `Jenkinsfile`, `Dockerfile` (active production source-of-truth not explicit in repo).
|
||||
- Security controls: `middleware.js` CSP/runtime headers + `next.config.js` security headers.
|
||||
|
||||
## Development constraints
|
||||
|
||||
- Preserve auth/session behavior in `pages/api/auth/[...nextauth].js`.
|
||||
- Do not weaken CSP/security headers in `middleware.js` or `next.config.js`.
|
||||
- Keep EN/CY parity across routes and locale resources (`i18n.js`, `locales/**`, rewrites).
|
||||
- Treat relay hash behavior as security-sensitive; keep path/hash compatibility stable.
|
||||
- Avoid logging secrets/personal data in auth/email/file/account flows.
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
# Use official Node.js 20 LTS image
|
||||
FROM node:20-alpine
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies first (better caching)
|
||||
COPY package*.json ./
|
||||
RUN npm ci --production
|
||||
|
||||
# Copy source files (including .next build output if pre-built)
|
||||
COPY . .
|
||||
|
||||
# If you want to build inside container, uncomment:
|
||||
# RUN npm run build
|
||||
|
||||
# Use non-root user (optional, but recommended)
|
||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||
USER appuser
|
||||
|
||||
# Expose port your app listens on
|
||||
EXPOSE 3000
|
||||
|
||||
# Start your Next.js app (adjust if using custom server)
|
||||
CMD ["npm", "start"]
|
||||
@@ -1,83 +0,0 @@
|
||||
# PEDW FrontEnd Guardrails
|
||||
|
||||
## Purpose
|
||||
|
||||
This document is a fast pre-flight checklist to reduce regressions in high-risk areas. Use it before coding, before opening a PR, and before merge.
|
||||
|
||||
## Non-Negotiable Guardrails
|
||||
|
||||
1. **Auth/session integrity**
|
||||
- Do not bypass `next-auth` flow in `pages/api/auth/[...nextauth].js`.
|
||||
- Preserve secure redirect behavior and cookie/session settings.
|
||||
2. **Security headers and CSP**
|
||||
- Do not weaken `middleware.js` CSP/header behavior or `next.config.js` security headers without explicit rationale.
|
||||
3. **Data model safety**
|
||||
- Treat `prisma/schema.prisma` as source-of-truth for auth/account persistence.
|
||||
4. **Bilingual parity (EN/CY)**
|
||||
- Any user-facing route/content change must validate both locales.
|
||||
- Keep `i18n.js`, `locales/`, and `next.config.js` rewrites aligned.
|
||||
5. **Public-service reliability**
|
||||
- Avoid breaking core flows: search, case, account, myportal, admin.
|
||||
|
||||
## Sensitive Flow Protection
|
||||
|
||||
Apply extra checks for:
|
||||
|
||||
- `pages/api/auth/**`
|
||||
- `pages/api/file/**`
|
||||
- `pages/api/email/**`
|
||||
- `pages/api/endpoint/*_api.js` handling account/user data
|
||||
|
||||
## Relay Hash Integrity Rules (CRM-bound APIs)
|
||||
|
||||
Apply when changing relay-bound portal endpoints and helpers (notably `pages/api/endpoint/**` and `actions/index.js`):
|
||||
|
||||
1. Keep relay endpoint configuration sourced from `API_ROOT`.
|
||||
2. Preserve path-hash generation behavior:
|
||||
- hash input must be request path/query (excluding domain),
|
||||
- appended hash parameter must remain compatible with relay expectations.
|
||||
3. Do not change hash algorithm/key usage contract without coordinated relay change.
|
||||
4. Treat hash validation failures as security-relevant negative paths; verify graceful rejection handling.
|
||||
5. Never log hash key material or sensitive request payloads.
|
||||
|
||||
Required for sensitive changes:
|
||||
|
||||
- Negative-path validation (unauthorized, invalid input, malformed payload).
|
||||
- Safe logging (no secrets/tokens/personal data in cleartext).
|
||||
- Explicit rollback steps.
|
||||
|
||||
## Relay Policy Change Guardrail (timeouts/retries/logging)
|
||||
|
||||
When changing shared relay forwarding policy (for example in `pages/api/middleware/relayForwarding.js`), treat this as an operationally sensitive change even if endpoint contracts are unchanged.
|
||||
|
||||
Minimum required before merge:
|
||||
|
||||
1. Complete the relay governance gate in `context/runbook.md` (Relay Hardening Rollout Playbook).
|
||||
2. Attach non-prod smoke evidence for:
|
||||
- deterministic non-retry classes (`400`, `401`, `403`, `404`)
|
||||
- transient retry classes (`429`, `503`, timeout/network-transient)
|
||||
3. Confirm structured redacted logging and duplicate-log suppression behavior.
|
||||
4. Provide fast mitigation + rollback path (`RELAY_RETRY_MAX=0` and commit-revert path).
|
||||
|
||||
## Pre-PR Quick Checklist
|
||||
|
||||
- [ ] Ran `npm run lint` (or documented why unavailable)
|
||||
- [ ] Verified changed routes/APIs manually
|
||||
- [ ] Verified EN + CY behavior for impacted user-facing flow
|
||||
- [ ] Performed accessibility smoke checks (keyboard, focus, labels, headings)
|
||||
- [ ] Added risk notes (auth/data/i18n/a11y)
|
||||
- [ ] Updated `memory-bank/change-log.md` for non-trivial changes
|
||||
|
||||
## If Assumptions Are Unclear
|
||||
|
||||
1. Record assumptions in PR notes.
|
||||
2. Add unresolved items to `memory-bank/open-questions.md`.
|
||||
3. Choose the safer behavior and clearly mark as temporary.
|
||||
|
||||
## Related Docs
|
||||
|
||||
- `.clinerules`
|
||||
- `CONTRIBUTING_AI.md`
|
||||
- `context/runbook.md`
|
||||
- `context/integration-map.md`
|
||||
- `memory-bank/README.md`
|
||||
Vendored
-50
@@ -1,50 +0,0 @@
|
||||
pipeline {
|
||||
agent {
|
||||
docker {
|
||||
image 'node:20' // ✅ Node.js 20 with npm included
|
||||
}
|
||||
}
|
||||
|
||||
environment {
|
||||
IMAGE = "pedw-app"
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Install & Build') {
|
||||
steps {
|
||||
sh 'npm ci'
|
||||
sh 'npm run build'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Docker Image') {
|
||||
steps {
|
||||
sh "docker build -t $REGISTRY/$IMAGE:latest ."
|
||||
}
|
||||
}
|
||||
|
||||
stage('Push Docker Image') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'dockerhub-credentials', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
|
||||
sh "echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin"
|
||||
sh "docker push $REGISTRY/$IMAGE:latest"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy to Plesk') {
|
||||
steps {
|
||||
sshagent(['plesk-ssh-key']) {
|
||||
sh """
|
||||
ssh root@your-plesk-domain.com '
|
||||
docker pull $REGISTRY/$IMAGE:latest &&
|
||||
docker stop nextjs-app || true &&
|
||||
docker rm nextjs-app || true &&
|
||||
docker run -d --restart=always --name nextjs-app -p 3000:3000 $REGISTRY/$IMAGE:latest
|
||||
'
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
# Actions Clients
|
||||
|
||||
This folder contains extracted client wrappers from `actions/index.js` as part of the Priority 1 refactor plan.
|
||||
|
||||
Current extracted clients:
|
||||
|
||||
- `relayClient` (shared hash-signing helper used by account/portal/document direct services)
|
||||
- `endpointClient` (shared JSON request helpers for GET and generic axios config requests)
|
||||
|
||||
Current usage includes:
|
||||
|
||||
- relay hash-signing helper reuse across account/portal/document direct services
|
||||
- shared endpoint JSON request helpers reused by admin/notify/integration/reference-data direct services
|
||||
|
||||
Notes:
|
||||
|
||||
- Core helper extraction and compatibility barrel support remain in place.
|
||||
- Additional client extraction (`fileClient`, `notifyClient`) can be layered in incrementally without changing public exports from `actions/index.js`.
|
||||
@@ -1,11 +0,0 @@
|
||||
import axios from "axios";
|
||||
|
||||
export const getJson = async (url, config) => {
|
||||
const response = await axios.get(url, config);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const requestJson = async (config) => {
|
||||
const response = await axios(config);
|
||||
return response.data;
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
import { getJson, requestJson } from "./endpointClient";
|
||||
import { getSignedJson, postSignedJson } from "./signedRequestClient";
|
||||
|
||||
export const getFileJson = (url) => {
|
||||
return getJson(url);
|
||||
};
|
||||
|
||||
export const getSignedFileJson = async (queryUrl) => {
|
||||
return getSignedJson(queryUrl);
|
||||
};
|
||||
|
||||
export const downloadFileBlob = (url) => {
|
||||
return requestJson({
|
||||
method: "get",
|
||||
url,
|
||||
responseType: "blob"
|
||||
});
|
||||
};
|
||||
|
||||
export const postSignedFileJson = async (queryUrl, data, config = {}) => {
|
||||
return postSignedJson(queryUrl, data, config);
|
||||
};
|
||||
@@ -1,37 +0,0 @@
|
||||
const encodeRouteParam = (value) => encodeURIComponent(String(value));
|
||||
|
||||
export const buildFileQuery = (path, params = {}, options = {}) => {
|
||||
const { encode = false } = options;
|
||||
|
||||
const entries = Object.entries(params).filter(([, value]) => {
|
||||
return value !== undefined && value !== null;
|
||||
});
|
||||
|
||||
if (entries.length === 0) {
|
||||
return path;
|
||||
}
|
||||
|
||||
const query = entries
|
||||
.map(([key, value]) => {
|
||||
if (!encode) {
|
||||
return `${key}=${String(value)}`;
|
||||
}
|
||||
|
||||
return `${encodeRouteParam(key)}=${encodeRouteParam(value)}`;
|
||||
})
|
||||
.join("&");
|
||||
|
||||
return `${path}?${query}`;
|
||||
};
|
||||
|
||||
export const withBaseUrl = (baseUrl, route) => {
|
||||
return `${baseUrl}${route}`;
|
||||
};
|
||||
|
||||
export const appendQuerySuffix = (route, suffix = "") => {
|
||||
return `${route}${suffix}`;
|
||||
};
|
||||
|
||||
export const appendHashSuffix = (route, hashBuilder) => {
|
||||
return appendQuerySuffix(route, hashBuilder(route));
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
export * from "./relayClient";
|
||||
export * from "./endpointClient";
|
||||
export * from "./fileClient";
|
||||
export * from "./fileRouteBuilder";
|
||||
export * from "./signedRequestClient";
|
||||
@@ -1,22 +0,0 @@
|
||||
import axios from "axios";
|
||||
import { hashAPIPath } from "../core/hash";
|
||||
|
||||
export const buildHashedQueryUrl = async (queryUrl) => {
|
||||
try {
|
||||
const signRes = await axios.get(
|
||||
"/api/endpoint/gethash_api?path=" + encodeURIComponent(queryUrl)
|
||||
);
|
||||
|
||||
if (!signRes?.data?.hash) {
|
||||
throw new Error("Hash signature unavailable");
|
||||
}
|
||||
|
||||
return queryUrl + signRes.data.hash;
|
||||
} catch (error) {
|
||||
if (typeof window === "undefined" && process.env.HASHKEY) {
|
||||
return queryUrl + hashAPIPath(queryUrl);
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
import { requestJson } from "./endpointClient";
|
||||
import { buildHashedQueryUrl } from "./relayClient";
|
||||
|
||||
export const buildSignedUrl = async (queryUrl, config = {}) => {
|
||||
const { baseUrl = "" } = config;
|
||||
|
||||
return `${baseUrl}${await buildHashedQueryUrl(queryUrl)}`;
|
||||
};
|
||||
|
||||
const signedRequestJson = async ({ method, queryUrl, data, config = {} }) => {
|
||||
const { baseUrl, ...requestConfig } = config;
|
||||
const signedUrl = await buildSignedUrl(queryUrl, { baseUrl });
|
||||
|
||||
return requestJson({
|
||||
method,
|
||||
url: signedUrl,
|
||||
data,
|
||||
...requestConfig
|
||||
});
|
||||
};
|
||||
|
||||
export const getSignedJson = (queryUrl, config = {}) => {
|
||||
return signedRequestJson({
|
||||
method: "get",
|
||||
queryUrl,
|
||||
config
|
||||
});
|
||||
};
|
||||
|
||||
export const postSignedJson = (queryUrl, data, config = {}) => {
|
||||
return signedRequestJson({
|
||||
method: "post",
|
||||
queryUrl,
|
||||
data,
|
||||
config
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteSignedJson = (queryUrl, config = {}) => {
|
||||
return signedRequestJson({
|
||||
method: "delete",
|
||||
queryUrl,
|
||||
config
|
||||
});
|
||||
};
|
||||
@@ -1,15 +0,0 @@
|
||||
const port = parseInt(process.env.PORT, 10) || 3000;
|
||||
|
||||
export const BASE_URL =
|
||||
typeof window !== "undefined"
|
||||
? window.apiRoot
|
||||
: process.env.API_ROOT || `http://localhost:${port}`;
|
||||
|
||||
export const API_PATH = "/api/data/v8.2/";
|
||||
|
||||
export const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
export const ACCESS_TOKEN_ENDPOINT = process.env.ACCESS_TOKEN_ENDPOINT;
|
||||
export const TENANT_ID = process.env.TENANT;
|
||||
@@ -1,11 +0,0 @@
|
||||
export const isNonEmptyString = (value) => {
|
||||
return typeof value === "string" && value.trim().length > 0;
|
||||
};
|
||||
|
||||
export const sanitizeString = (value) => {
|
||||
return typeof value === "string" ? value.trim() : "";
|
||||
};
|
||||
|
||||
export const escapeODataString = (value) => {
|
||||
return sanitizeString(value).replace(/'/g, "''");
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
import CryptoJS from "crypto-js";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
export const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export const hashString = (stringToHash) => {
|
||||
let hashedStr = CryptoJS.AES.encrypt(stringToHash, "pedw");
|
||||
return hashedStr.toString();
|
||||
};
|
||||
|
||||
export const dehashString = (stringToDeHash) => {
|
||||
let dehashedStr = CryptoJS.AES.decrypt(decodeURI(stringToDeHash), "pedw");
|
||||
return dehashedStr.toString(CryptoJS.enc.Utf8);
|
||||
};
|
||||
@@ -1,50 +0,0 @@
|
||||
export const azureHeaders = (access_token) => {
|
||||
return {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json;odata.metadata=none",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + access_token
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const azureHeadersNoOdata = (access_token) => {
|
||||
return {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + access_token
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const azureHeadersPaged = (access_token) => {
|
||||
return {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json;odata.metadata=none",
|
||||
"Prefer":
|
||||
'odata.include-annotations="*",return=representation, odata.maxpagesize=10',
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + access_token
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const azureHeadersPagedCustom = (access_token, showNumberOfRecords) => {
|
||||
return {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json;odata.metadata=none",
|
||||
"Prefer":
|
||||
'odata.include-annotations="*",return=representation, odata.maxpagesize=' +
|
||||
showNumberOfRecords,
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + access_token
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -1,106 +0,0 @@
|
||||
import _ from "lodash";
|
||||
|
||||
const MASK = "[REDACTED]";
|
||||
|
||||
const redactString = (value) => {
|
||||
if (typeof value !== "string") return value;
|
||||
|
||||
return value
|
||||
.replace(
|
||||
/([a-zA-Z0-9._%+-]{1,})@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g,
|
||||
`${MASK}@${MASK}`
|
||||
)
|
||||
.replace(/Bearer\s+[A-Za-z0-9._\-]+/gi, `Bearer ${MASK}`)
|
||||
.replace(/("client_secret"\s*:\s*")[^"]+("?)/gi, `$1${MASK}$2`)
|
||||
.replace(/("access_token"\s*:\s*")[^"]+("?)/gi, `$1${MASK}$2`);
|
||||
};
|
||||
|
||||
export const redactSensitive = (value) => {
|
||||
if (value == null) return value;
|
||||
|
||||
if (typeof value === "string") {
|
||||
return redactString(value);
|
||||
}
|
||||
|
||||
try {
|
||||
const json = JSON.stringify(value);
|
||||
return redactString(json);
|
||||
} catch (_error) {
|
||||
return MASK;
|
||||
}
|
||||
};
|
||||
|
||||
export const getIP = (req) => {
|
||||
const forwarded = req.headers["x-forwarded-for"];
|
||||
|
||||
const ip =
|
||||
typeof forwarded === "string"
|
||||
? forwarded.split(/, /)[0]
|
||||
: req.socket.remoteAddress;
|
||||
|
||||
console.info(
|
||||
"\n====================\n Client IP address: " + ip,
|
||||
"\n=====================\n"
|
||||
);
|
||||
};
|
||||
|
||||
export const consoleLogger = (err) => {
|
||||
console.log(
|
||||
"\n\n/////////////////////////////////////////////////\nRaw Error " +
|
||||
redactSensitive(err) +
|
||||
"\n\n/////////////////////////////////////////////////\n"
|
||||
);
|
||||
var errStr =
|
||||
"\n\n/////////////////////////////////////////////////\nServer Error " +
|
||||
"\n" +
|
||||
(_.has(err, "name") ? "Name: " + err.name + "\n" : "") +
|
||||
(_.has(err, "code") ? "Code: " + err.code + "\n" : "") +
|
||||
(_.has(err, "query") ? "Query: " + err.query + "\n" : "") +
|
||||
(_.has(err, "message") ? "Message: " + err.message + "\n" : "") +
|
||||
(_.has(err, "request.url")
|
||||
? "request.url: " + err.request.url + "\n"
|
||||
: "") +
|
||||
(_.has(err, "response.status") ? "Status: " + err.code + "\n" : "") +
|
||||
(_.has(err, "response.statusText")
|
||||
? "\nStatusText: " + err.response.status + "\n"
|
||||
: "") +
|
||||
(_.has(err, "response.request.socket.remoteAddress")
|
||||
? "\nRequest IP: " +
|
||||
err.response.request.socket.remoteAddress +
|
||||
"\n"
|
||||
: "") +
|
||||
(_.has(err, "response.data.error.message")
|
||||
? "\nMessage: " +
|
||||
redactSensitive(err.response.data.error.message) +
|
||||
"\n"
|
||||
: "") +
|
||||
(_.has(err, "response.config.url")
|
||||
? "\nRequest URL: " + redactSensitive(err.config.url) + "\n"
|
||||
: "") +
|
||||
(_.has(err, "response.headers.date")
|
||||
? "\nRequest Time: " + err.response.headers.date + "\n"
|
||||
: "") +
|
||||
(_.has(err, "config.url")
|
||||
? "\nAxios config url: " + redactSensitive(err.config.url) + "\n"
|
||||
: "") +
|
||||
(_.has(err, "config.url")
|
||||
? "\nAxios message url: " + redactSensitive(err.message) + "\n"
|
||||
: "") +
|
||||
(_.has(err, "config.data")
|
||||
? "\nRequest payload: " + redactSensitive(err.config.data) + "\n"
|
||||
: "") +
|
||||
"\n/////////////////////////////////////////////////\n";
|
||||
|
||||
console.log(errStr);
|
||||
};
|
||||
|
||||
export const conLog = (err) => {
|
||||
var errStr =
|
||||
"\n\n/////////////////////////////////////////////////\nResponse: " +
|
||||
"\n" +
|
||||
err +
|
||||
"\n/////////////////////////////////////////////////\n\n";
|
||||
|
||||
console.log(errStr);
|
||||
return errStr;
|
||||
};
|
||||
@@ -1,41 +0,0 @@
|
||||
import { requestJson } from "../clients/endpointClient";
|
||||
import { ACCESS_TOKEN_ENDPOINT, TENANT_ID } from "./env";
|
||||
import { consoleLogger } from "./logger";
|
||||
|
||||
const cache = {};
|
||||
|
||||
const tokenBody =
|
||||
"grant_type=" +
|
||||
process.env.GRANT_TYPE +
|
||||
"&client_id=" +
|
||||
process.env.CLIENT_ID +
|
||||
"&client_secret=" +
|
||||
process.env.CLIENT_SECRET +
|
||||
"&scope=" +
|
||||
"https://" +
|
||||
process.env.RELAYURI +
|
||||
"/.default";
|
||||
|
||||
const tokenConfig = {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Cache-Control": "no-cache"
|
||||
}
|
||||
};
|
||||
|
||||
export const getToken = async () => {
|
||||
try {
|
||||
const data = await requestJson({
|
||||
method: "post",
|
||||
url: `${ACCESS_TOKEN_ENDPOINT}${TENANT_ID}/oauth2/v2.0/token`,
|
||||
data: tokenBody,
|
||||
...tokenConfig
|
||||
});
|
||||
|
||||
cache.tokenResponse = data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return error;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,191 @@
|
||||
import axios from "axios";
|
||||
import { hashAPIPath } from "./";
|
||||
|
||||
const configEndpoint = process.env.GG_PROVIDER_CONFIG_ENDPOINT;
|
||||
const ggClientID = process.env.GG_CLIENT_ID;
|
||||
const ggClientSecret = process.env.GG_CLIENT_SECRET;
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
export const getProviderConfig = () => {
|
||||
return axios
|
||||
.get(configEndpoint)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("error :", error.response);
|
||||
// return error;
|
||||
});
|
||||
};
|
||||
|
||||
export const getGGToken = (tokenURL, authCode, redirectUri) => {
|
||||
const tokenBody =
|
||||
"grant_type=authorization_code" +
|
||||
"&code=" +
|
||||
authCode +
|
||||
"&redirect_uri=" +
|
||||
redirectUri;
|
||||
|
||||
const basicAuthBase64 = (ggClientID + ":" + ggClientSecret).toString();
|
||||
//console.log("base64 " + Base64.encode(basicAuthBase64));
|
||||
|
||||
const tokenConfig = {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Authorization": "Basic " + Base64.encode(basicAuthBase64),
|
||||
},
|
||||
};
|
||||
|
||||
return axios
|
||||
.post(tokenURL, tokenBody, tokenConfig)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
// if (error.response) {
|
||||
// console.log(error.response.data);
|
||||
// console.log(error.response.status);
|
||||
// console.log(error.response.headers);
|
||||
// }
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
|
||||
export const getUserInfo = (userInfoURL, authToken) => {
|
||||
const tokenConfig = {
|
||||
headers: {
|
||||
"Authorization": "Bearer " + authToken,
|
||||
},
|
||||
};
|
||||
|
||||
return axios
|
||||
.get(userInfoURL, tokenConfig)
|
||||
.then((res) => res)
|
||||
.catch((error) => {
|
||||
//console.log(`Error: ${err?.response?.data}`);
|
||||
//return error;
|
||||
});
|
||||
};
|
||||
|
||||
export const getPortalLogin = (emailAddress, token) => {
|
||||
var queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
});
|
||||
};
|
||||
|
||||
const azureHeaders = (access_token) => {
|
||||
return {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json;odata.metadata=none",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + access_token,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
var Base64 = {
|
||||
_keyStr:
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
||||
encode: function (e) {
|
||||
var t = "";
|
||||
var n, r, i, s, o, u, a;
|
||||
var f = 0;
|
||||
e = Base64._utf8_encode(e);
|
||||
while (f < e.length) {
|
||||
n = e.charCodeAt(f++);
|
||||
r = e.charCodeAt(f++);
|
||||
i = e.charCodeAt(f++);
|
||||
s = n >> 2;
|
||||
o = ((n & 3) << 4) | (r >> 4);
|
||||
u = ((r & 15) << 2) | (i >> 6);
|
||||
a = i & 63;
|
||||
if (isNaN(r)) {
|
||||
u = a = 64;
|
||||
} else if (isNaN(i)) {
|
||||
a = 64;
|
||||
}
|
||||
t =
|
||||
t +
|
||||
this._keyStr.charAt(s) +
|
||||
this._keyStr.charAt(o) +
|
||||
this._keyStr.charAt(u) +
|
||||
this._keyStr.charAt(a);
|
||||
}
|
||||
return t;
|
||||
},
|
||||
decode: function (e) {
|
||||
var t = "";
|
||||
var n, r, i;
|
||||
var s, o, u, a;
|
||||
var f = 0;
|
||||
//e = e.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
while (f < e.length) {
|
||||
s = this._keyStr.indexOf(e.charAt(f++));
|
||||
o = this._keyStr.indexOf(e.charAt(f++));
|
||||
u = this._keyStr.indexOf(e.charAt(f++));
|
||||
a = this._keyStr.indexOf(e.charAt(f++));
|
||||
n = (s << 2) | (o >> 4);
|
||||
r = ((o & 15) << 4) | (u >> 2);
|
||||
i = ((u & 3) << 6) | a;
|
||||
t = t + String.fromCharCode(n);
|
||||
if (u != 64) {
|
||||
t = t + String.fromCharCode(r);
|
||||
}
|
||||
if (a != 64) {
|
||||
t = t + String.fromCharCode(i);
|
||||
}
|
||||
}
|
||||
t = Base64._utf8_decode(t);
|
||||
return t;
|
||||
},
|
||||
_utf8_encode: function (e) {
|
||||
e = e.replace(/\r\n/g, "\n");
|
||||
var t = "";
|
||||
for (var n = 0; n < e.length; n++) {
|
||||
var r = e.charCodeAt(n);
|
||||
if (r < 128) {
|
||||
t += String.fromCharCode(r);
|
||||
} else if (r > 127 && r < 2048) {
|
||||
t += String.fromCharCode((r >> 6) | 192);
|
||||
t += String.fromCharCode((r & 63) | 128);
|
||||
} else {
|
||||
t += String.fromCharCode((r >> 12) | 224);
|
||||
t += String.fromCharCode(((r >> 6) & 63) | 128);
|
||||
t += String.fromCharCode((r & 63) | 128);
|
||||
}
|
||||
}
|
||||
return t;
|
||||
},
|
||||
_utf8_decode: function (e) {
|
||||
var t = "";
|
||||
var n = 0;
|
||||
var r = (c1 = c2 = 0);
|
||||
while (n < e.length) {
|
||||
r = e.charCodeAt(n);
|
||||
if (r < 128) {
|
||||
t += String.fromCharCode(r);
|
||||
n++;
|
||||
} else if (r > 191 && r < 224) {
|
||||
c2 = e.charCodeAt(n + 1);
|
||||
t += String.fromCharCode(((r & 31) << 6) | (c2 & 63));
|
||||
n += 2;
|
||||
} else {
|
||||
c2 = e.charCodeAt(n + 1);
|
||||
c3 = e.charCodeAt(n + 2);
|
||||
t += String.fromCharCode(
|
||||
((r & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)
|
||||
);
|
||||
n += 3;
|
||||
}
|
||||
}
|
||||
return t;
|
||||
},
|
||||
};
|
||||
+776
-8
@@ -1,9 +1,777 @@
|
||||
export * from "./core/env";
|
||||
export * from "./core/logger";
|
||||
export * from "./core/hash";
|
||||
export * from "./core/token";
|
||||
export * from "./core/headers";
|
||||
export * from "./core/guards";
|
||||
import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import HmacSHA256 from "crypto-js/hmac-sha256";
|
||||
|
||||
export * from "./clients";
|
||||
export * from "./services";
|
||||
let BASE_URL;
|
||||
const port = parseInt(process.env.PORT, 10) || 3000;
|
||||
|
||||
if (process.browser) {
|
||||
BASE_URL = window.apiRoot;
|
||||
} else {
|
||||
BASE_URL = process.env.API_ROOT || `http://localhost:${port}`;
|
||||
}
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const cache = {};
|
||||
const API_PATH = "/api/data/v8.2/";
|
||||
|
||||
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
|
||||
const tenantId = process.env.TENANT;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const agent = new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
});
|
||||
|
||||
export const getToken = () => {
|
||||
return axios
|
||||
.post(
|
||||
`${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`,
|
||||
tokenBody,
|
||||
tokenConfig
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.then((data) => {
|
||||
cache.tokenResponse = data;
|
||||
return data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("error :", error.response);
|
||||
// return error;
|
||||
});
|
||||
};
|
||||
|
||||
const tokenBody =
|
||||
"grant_type=" +
|
||||
process.env.GRANT_TYPE +
|
||||
"&client_id=" +
|
||||
process.env.CLIENT_ID +
|
||||
"&client_secret=" +
|
||||
process.env.CLIENT_SECRET +
|
||||
"&scope=" +
|
||||
"https://" +
|
||||
process.env.RELAYURI +
|
||||
"/.default";
|
||||
|
||||
const tokenConfig = {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Cache-Control": "no-cache",
|
||||
},
|
||||
};
|
||||
|
||||
export const azureHeaders = (access_token) => {
|
||||
return {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json;odata.metadata=none",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + access_token,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const azureHeadersPaged = (access_token) => {
|
||||
return {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json;odata.metadata=none",
|
||||
"Prefer":
|
||||
'odata.include-annotations="*",return=representation, odata.maxpagesize=10',
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + access_token,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export const hashString = (stringToHash) => {
|
||||
console.log("string to hash", stringToHash);
|
||||
let hashedStr = CryptoJS.AES.encrypt(stringToHash, "pedw");
|
||||
console.log("hashed String", hashedStr.toString());
|
||||
return hashedStr.toString();
|
||||
};
|
||||
|
||||
export const dehashString = (stringToDeHash) => {
|
||||
console.log("string to dehash", stringToDeHash);
|
||||
let dehashedStr = CryptoJS.AES.decrypt(decodeURI(stringToDeHash), "pedw");
|
||||
console.log("dehshed string:", dehashedStr.toString(CryptoJS.enc.Utf8));
|
||||
return dehashedStr.toString(CryptoJS.enc.Utf8);
|
||||
};
|
||||
|
||||
export const getBasicSearch = (searchString) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getbasicsearch_api?searchString=" +
|
||||
searchString
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
|
||||
export const getBasicSearchPaged = (searchString, pageNumber) => {
|
||||
//console.log(queryUrl);
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getbasicsearchpaged_api?searchString=" +
|
||||
searchString +
|
||||
"&pageNumber=" +
|
||||
pageNumber
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
|
||||
export const getBasicDNSSearch = (searchString) => {
|
||||
return axios
|
||||
.get(BASE_URL + "/api/endpoint/getbasicdnssearch_api")
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
|
||||
export const getBasicDNSSearchPaged = (pageNumber) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getbasicdnssearchpaged_api?pageNumber=" + pageNumber
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
|
||||
export const getAdvancedSearch = (searchString) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getadvancedsearch_api?searchstring=" +
|
||||
JSON.stringify(searchString)
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
errorMsg: error.response.statusText,
|
||||
};
|
||||
|
||||
return ErrResponse;
|
||||
});
|
||||
};
|
||||
|
||||
export const getAdvancedSearchPaged = (searchString, pageNumber) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getadvancedsearchpaged_api?searchstring=" +
|
||||
JSON.stringify(searchString) +
|
||||
"&pageNumber=" +
|
||||
pageNumber
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
errorMsg: error.response.statusText,
|
||||
};
|
||||
|
||||
return ErrResponse;
|
||||
});
|
||||
};
|
||||
|
||||
export const getBasicSearchDetails = (
|
||||
appealTypeName,
|
||||
caseReference,
|
||||
primaryIdAttribute,
|
||||
incidentID
|
||||
) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getbasicsearchdetails_api?appealTypeName=" +
|
||||
appealTypeName +
|
||||
"&primaryIdAttribute=" +
|
||||
primaryIdAttribute +
|
||||
"&incidentID=" +
|
||||
incidentID
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("this error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getBasicSearchDetailsPaged = (
|
||||
appealTypeName,
|
||||
caseReference,
|
||||
primaryIdAttribute,
|
||||
incidentID
|
||||
) => {
|
||||
//console.log("check appealtype:", appealType, caseReference);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=" +
|
||||
appealTypeName +
|
||||
"&primaryIdAttribute=" +
|
||||
primaryIdAttribute +
|
||||
"&incidentID=" +
|
||||
incidentID
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("this error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getSearchDocumentDetails = (incidentID) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getsearchdocumentdetails_api?incidentid=" +
|
||||
incidentID
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getSearchDocumentDetailsPaged = (incidentID, pageNumber) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getsearchdocumentdetailspaged_api?incidentid=" +
|
||||
incidentID +
|
||||
"&pageNumber=" +
|
||||
pageNumber
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getSearchDocumentHistory = (documentID) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getsearchdocumenthistory_api?documentid=" +
|
||||
documentID
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getsearchdocumenthistorypaged_api?documentid=" +
|
||||
documentID +
|
||||
"&pageNumber=" +
|
||||
pageNumber
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getLinkedCases = (parentIncidentid) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getlinkedcases_api?parentincidentid=" +
|
||||
parentIncidentid
|
||||
)
|
||||
.then((res) => {
|
||||
//console.log(" linked date", res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAppealsTypes = () => {
|
||||
return axios
|
||||
.get(BASE_URL + "/api/endpoint/getappealtypes_api")
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
errorMsg: error.response.statusText,
|
||||
};
|
||||
|
||||
return ErrResponse;
|
||||
});
|
||||
};
|
||||
|
||||
export const getLPA = () => {
|
||||
return axios
|
||||
.get(BASE_URL + "/api/endpoint/getlpa_api")
|
||||
.then((res) => {
|
||||
//console.log(res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
errorMsg: error.response.statusText,
|
||||
};
|
||||
|
||||
return ErrResponse;
|
||||
});
|
||||
};
|
||||
|
||||
// iteration 2 methods
|
||||
|
||||
export const getFormData = (whichForm) => {
|
||||
return axios
|
||||
.get(BASE_URL + "/api/endpoint/getformdata_api?whichForm=" + whichForm)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMandatoryFields = (whichForm) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getmandatoryfields_api?whichForm=" +
|
||||
whichForm
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPickLists = (whichForm) => {
|
||||
return axios
|
||||
.get(BASE_URL + "/api/endpoint/getpicklists_api?whichForm=" + whichForm)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPersonalAccount = (contactid) => {
|
||||
console.log(contactid);
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getpersonalaccount_api?contactid=" +
|
||||
contactid
|
||||
)
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("returned:", error);
|
||||
// let ErrResponse = {
|
||||
// value: [],
|
||||
// errorCode: error.response.status,
|
||||
// errorMsg: error.response.statusText,
|
||||
// };
|
||||
|
||||
// return ErrResponse;
|
||||
});
|
||||
};
|
||||
|
||||
export const getAppealID = (
|
||||
caseReference,
|
||||
updateFormCollection,
|
||||
primaryAttribute
|
||||
) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getappealid_api?updateFormCollection=" +
|
||||
updateFormCollection +
|
||||
"&primaryAttribute=" +
|
||||
primaryAttribute +
|
||||
"&caseReference=" +
|
||||
caseReference
|
||||
)
|
||||
.then((res) => {
|
||||
var appealID = res.data.value[0][primaryAttribute];
|
||||
return appealID;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getLogin = (emailAddress, pwd) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getlogin_api?emailAddress=" +
|
||||
emailAddress +
|
||||
"&pwd=" +
|
||||
pwd
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const createCase = (appealTypeId, lpaID, contactid) => {
|
||||
appealTypeId = parseInt(appealTypeId);
|
||||
|
||||
var queryUrl =
|
||||
"/api/endpoint/createcase_api?appealTypeId=" +
|
||||
appealTypeId +
|
||||
"&lpaID=" +
|
||||
lpaID +
|
||||
"&contactid=" +
|
||||
contactid;
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
url: BASE_URL + queryUrl,
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMyCases = (loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getmycases_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMyRepresentations = (loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getmyrepresentations_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMyRepresentationsProxy = (loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getmyrepresentationsproxy_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getRepresentations = (incidentID) => {
|
||||
return axios
|
||||
.get("/api/endpoint/getrepresentations_api?incidentID=" + incidentID)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getRepresentationsProxy = (incidentID) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getrepresentationsproxy_api?incidentID=" +
|
||||
incidentID
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getWatchedCases = (loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getwatchedcases_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getWatchedCasesProxy = (loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getwatchedcasesproxy_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAwaitingSubmission = () => {
|
||||
return axios
|
||||
.get(BASE_URL + "/api/lookups/awaitingSubmission", {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
})
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPortalModuleDetails = (appealType, caseReference) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getportalmoduledetails_api?appealType=" +
|
||||
appealType +
|
||||
"&caseReference=" +
|
||||
caseReference
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPortalModuleDetailsProxy = (appealType, caseReference) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getportalmoduledetailsproxy_api?appealType=" +
|
||||
appealType +
|
||||
"&caseReference=" +
|
||||
caseReference
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getEmailAccountCheck = (emailAddress) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getemailaccountcheck_api?emailAddress=" +
|
||||
emailAddress
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
//uses more than get methods
|
||||
|
||||
export const updatePassword = (contactId, newpassword) => {
|
||||
var queryUrl = "/api/endpoint/updateaccount_api?contactId=" + contactId;
|
||||
var data = { "pinswg_custom_password": newpassword };
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data,
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const updateAccount = async (contactId, updateBody) => {
|
||||
var queryUrl = "/api/endpoint/updateaccount_api?contactId=" + contactId;
|
||||
var data = updateBody;
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data,
|
||||
};
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("this error:", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const createWatchedCases = (formValues) => {
|
||||
var data = formValues;
|
||||
var queryUrl = window.apiRoot + "/api/endpoint/createwatchedcases_api";
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data,
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const updateCase = async (
|
||||
incidentId,
|
||||
updateBody,
|
||||
updateFormCollection,
|
||||
primaryAttribute,
|
||||
caseReference
|
||||
) => {
|
||||
var data = JSON.stringify(updateBody);
|
||||
|
||||
var appealObj = await getAppealID(
|
||||
caseReference,
|
||||
updateFormCollection,
|
||||
primaryAttribute
|
||||
);
|
||||
|
||||
var queryUrl =
|
||||
"/api/endpoint/updatecase_api?updateFormCollection=" +
|
||||
updateFormCollection +
|
||||
"&appealObj=" +
|
||||
appealObj;
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl + hashAPIPath(queryUrl),
|
||||
data: data,
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteMyRepresentations = (myRepresentationsID) => {
|
||||
var queryUrl =
|
||||
"/api/endpoint/deletemyrepresentations_api?myRepresentationsID=" +
|
||||
myRepresentationsID;
|
||||
|
||||
var config = {
|
||||
method: "delete",
|
||||
url: queryUrl + hashAPIPath(queryUrl),
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json;odata.metadata=none",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
};
|
||||
// console.log(config);
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
//console.log("deleted ", res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteWatchedCases = (watchedCaseID) => {
|
||||
var queryUrl =
|
||||
"/api/endpoint/deletewatchedcases_api?watchedCaseID=" + watchedCaseID;
|
||||
var config = {
|
||||
method: "delete",
|
||||
url: queryUrl,
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
//console.log("deleted ", res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const createAccount = (formValues) => {
|
||||
var data = formValues;
|
||||
var queryUrl = "/api/endpoint/createaccount_api";
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data,
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
// console.log("posted ", res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
+17
-58
@@ -1,88 +1,47 @@
|
||||
export const getSelectQuery = (appealTypeName) => {
|
||||
switch (appealTypeName) {
|
||||
case "pinswg_advertses":
|
||||
return "&$select=pinswg_detailedeiascreeningrequired,pinswg_speacialistcaseprocess,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_procedure,pinswg_questionnaireduedate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent,pinswg_startdate,pinswg_otherpartiesstatement,pinswg_finalcommentsduedate,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_speacialistcaseprocess,pinswg_statementduedate";
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_procedure,pinswg_questionnaireduedate,statuscode";
|
||||
break;
|
||||
case "pinswg_callinss77s":
|
||||
return "&$select=pinswg_eiarequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_startdate,statuscode,pinswg_dateexportedtoiss,pinswg_startdateofevent,pinswg_typeofevent,pinswg_statementsduedate,pinswg_otherpartiesstatement";
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_startdate,statuscode";
|
||||
break;
|
||||
case "pinswg_commonlands":
|
||||
return "&$select=pinswg_detailedeiascreeningrequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_starttimeoftheevent,pinswg_typeofevent,pinswg_statementsduedate";
|
||||
break;
|
||||
case "pinswg_environmentalpermittings":
|
||||
return "&$select=pinswg_detailedeiascreeningrequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
break;
|
||||
case "pinswg_hedgeshedgerowstreepreservationreplacems":
|
||||
return "&$select=pinswg_detailedeiascreening,pinswg_specialistcaseprocess,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent,pinswg_statementduedate,pinswg_specialistcaseprocess";
|
||||
break;
|
||||
case "pinswg_miscellaneouscaseworks":
|
||||
return "&$select=pinswg_eiarequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent,pinswg_statementduedate";
|
||||
break;
|
||||
case "pinswg_wayleaves":
|
||||
return "&$select=pinswg_detailedeiascreening,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent,pinswg_statementduedate";
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode";
|
||||
break;
|
||||
case "pinswg_communityinfrastructurelevys117118119s":
|
||||
return "&$select=pinswg_detailedeiascreeningrequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_startdate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent,pinswg_questionnaireduedate,pinswg_statementduedate";
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_startdate,statuscode";
|
||||
break;
|
||||
case "pinswg_compulsorypurchaseorderses":
|
||||
return "&$select=pinswg_detailedeiascreening,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent,pinswg_statementduedate";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode";
|
||||
case "pinswg_dnses":
|
||||
return "&$select=pinswg_eiarequired,pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_casestage,_pinswg_dnsids_value,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectdescription,pinswg_projectlocation,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode";
|
||||
case "pinswg_electricityacts":
|
||||
return "&$select=pinswg_eiarequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
break;
|
||||
case "pinswg_harbourrevisionorders":
|
||||
return "&$select=pinswg_eiarequired,pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdiscription,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdate,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_casestage,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode";
|
||||
case "pinswg_householderappealhases":
|
||||
return "&$select=pinswg_eiarequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstmt,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_otherpartiesstatement,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||
case "pinswg_enforcementnoticeappeals174s":
|
||||
return "&$select=pinswg_eiarequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||
case "pinswg_enforcementlistedbuildingconservationaps":
|
||||
return "&$select=pinswg_detailedeiascreeningrequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdates,pinswg_statementduedate,statuscode,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdates,pinswg_statementduedate,statuscode";
|
||||
case "pinswg_maintenanceoflands217s":
|
||||
return "&$select=pinswg_detailedeiascreeningrequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdates,pinswg_statementduedate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdates,pinswg_statementduedate,statuscode";
|
||||
case "pinswg_lawfuldevelopmentcertificates":
|
||||
return "&$select=pinswg_detailedeiascreeningrequiered,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||
case "pinswg_listedbuildingandconservationareaconsens":
|
||||
return "&$select=pinswg_detailedeiascreeningrequiered,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_sitepostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_starttimeofevent,pinswg_typeofevent";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_sitepostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||
case "pinswg_planningappeals78s":
|
||||
//console.log(
|
||||
// "///////////////\n path:",
|
||||
// process.env.RELAYPATH == "test-pedw-hc"
|
||||
// );
|
||||
return process.env.RELAYPATH == "dev-pedw-hc"
|
||||
? "&$select=pinswg_eiarequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_siteaddresscounty,_pinswg_localplanningauthority_value,pinswg_casedecisiondate,pinswg_dicision,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdatetimeiftheevent,pinswg_representation_period_end_date,pinswg_extend_representation_date,pinswg_typeofevent"
|
||||
: "&$select=pinswg_eiarequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_siteaddresscounty,_pinswg_localplanningauthority_value,pinswg_casedecisiondate,pinswg_dicision,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdatetimeiftheevent,pinswg_typeofevent,pinswg_developmentdescription,pinswg_whyisinspectorneededonsite,pinswg_outlinehealthandsafetyissuesonsite,pinswg_additionalappealsmadedetails,pinswg_chosenprocedureexplanation,pinswg_dateofapplication,pinswg_lpaapplicationreference,pinswg_caseworkreason,pinswg_dateoflpadecision,pinswg_areaofsiteinhectaresdec,pinswg_floorspaceinsquaremeters,pinswg_ownershipcertificate,pinswg_siteviewablefromroad,pinswg_costappliedforindicator,pinswg_s106unilateralsubmitted";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||
case "pinswg_planningconditionss73s79s":
|
||||
return "&$select=pinswg_detailedeiascreeningrequiered,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||
case "pinswg_planningobligationappeals106s":
|
||||
return "&$select=pinswg_detailedeiascreeningrequired,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
||||
break;
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||
case "pinswg_rows":
|
||||
return "&$select=pinswg_detailedeiascreeningrequired,pinswg_specialistcaseprocess,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent,pinswg_statementduedate,pinswg_specialistcaseprocess";
|
||||
break;
|
||||
case "pinswg_ldps":
|
||||
return "&$select=modifiedon,pinswg_name";
|
||||
break;
|
||||
case "pinswg_nonvalidations":
|
||||
return "&$select=modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,statuscode";
|
||||
break;
|
||||
case "pinswg_transportandworkacts":
|
||||
return "&$select=pinswg_eiarequired,pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdate,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_casestage,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
case "pinswg_sipses":
|
||||
// return "&$select=pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_casestage,_pinswg_dnsids_value,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
return "&$select=pinswg_casedeadline,_pinswg_projecttype_value,pinswg_eiarequired,pinswg_anticipatedgridrefeasting,pinswg_anticipatedgridrefnorthing,_pinswg_appellant_value,pinswg_name,_pinswg_associatedlpa_value,pinswg_choiceofprocedure,pinswg_decision,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,statuscode,pinswg_casestage,_pinswg_sipscase_value,pinswg_writtenacceptanceofnotification,pinswg_validnoticeofintentiontosubmit,pinswg_deadlineforsubmissionofapplication,pinswg_screeningstartdate,pinswg_eiatargetdate,pinswg_targetextended,pinswg_directionissueddate,pinswg_eiarequired,pinswg_scopingstartdate,pinswg_scopingtargetdate,pinswg_scopingtargetextended,pinswg_scopingoutcomeissueddate,pinswg_essubmitted,pinswg_deemedmarinelicenseappliedfor,pinswg_validationdeadlineextension,pinswg_consultationopen,pinswg_consultationclose,pinswg_reportissuedtowelshministers,pinswg_decisionissuedtoapplicant,pinswg_decisionoutcome,pinswg_redetermination,pinswg_redeterminationconsultationdeadline";
|
||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode";
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
import { BASE_URL } from "../core/env";
|
||||
import { consoleLogger } from "../core/logger";
|
||||
import { getJson, requestJson } from "../clients/endpointClient";
|
||||
import { getSignedJson } from "../clients/signedRequestClient";
|
||||
|
||||
export const getPersonalAccount = (contactid) => {
|
||||
return getJson(
|
||||
BASE_URL + "/api/endpoint/getpersonalaccount_api?contactid=" + contactid
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getLogin = (emailAddress, pwd) => {
|
||||
return getJson(
|
||||
"/api/endpoint/getlogin_api?emailAddress=" +
|
||||
emailAddress +
|
||||
"&pwd=" +
|
||||
pwd
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const updatePassword = (contactId, newpassword) => {
|
||||
var queryUrl = "/api/endpoint/updateaccount_api?contactId=" + contactId;
|
||||
var data = { "pinswg_custom_password": newpassword };
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data
|
||||
};
|
||||
|
||||
return requestJson(config).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const updateAccount = async (contactId, updateBody, ssr) => {
|
||||
var queryUrl =
|
||||
(ssr ? BASE_URL : "") +
|
||||
"/api/endpoint/updateaccount_api?contactId=" +
|
||||
contactId;
|
||||
var data = updateBody;
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data
|
||||
};
|
||||
return requestJson(config).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const createAccount = (formValues) => {
|
||||
var data = formValues;
|
||||
var queryUrl = "/api/endpoint/createaccount_api";
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data
|
||||
};
|
||||
|
||||
return requestJson(config).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getEmailAccountCheck = (emailAddress) => {
|
||||
return getJson(
|
||||
"/api/endpoint/getemailaccountcheck_api?emailAddress=" + emailAddress
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPortalLogin = async (emailAddress) => {
|
||||
var queryUrl =
|
||||
"/api/endpoint/getportallogin_api?emailAddress=" + emailAddress;
|
||||
|
||||
return getSignedJson(queryUrl, { baseUrl: BASE_URL }).catch((error) => {
|
||||
consoleLogger(error);
|
||||
|
||||
return JSON.stringify(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPortalLoginProxy = async (emailAddress) => {
|
||||
var queryUrl =
|
||||
"/api/endpoint/getportalloginproxy_api?emailAddress=" + emailAddress;
|
||||
|
||||
return getJson(queryUrl).catch((error) => {
|
||||
consoleLogger(error);
|
||||
|
||||
return JSON.stringify(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPreferredLanguage = async (email) => {
|
||||
return getJson(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getpreferredlanguage_api?emailAddress=" +
|
||||
email
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
import {
|
||||
getPersonalAccount,
|
||||
getLogin,
|
||||
updatePassword,
|
||||
updateAccount,
|
||||
createAccount,
|
||||
getEmailAccountCheck,
|
||||
getPortalLogin,
|
||||
getPortalLoginProxy,
|
||||
getPreferredLanguage
|
||||
} from "./accountDirectService";
|
||||
|
||||
export {
|
||||
getPersonalAccount,
|
||||
getLogin,
|
||||
updatePassword,
|
||||
updateAccount,
|
||||
createAccount,
|
||||
getEmailAccountCheck,
|
||||
getPortalLogin,
|
||||
getPortalLoginProxy,
|
||||
getPreferredLanguage
|
||||
};
|
||||
@@ -1,67 +0,0 @@
|
||||
import { BASE_URL } from "../core/env";
|
||||
import { logAndReturnResponse } from "./httpServiceUtils";
|
||||
import { getJson } from "../clients/endpointClient";
|
||||
|
||||
export const getNewAppeals = async (searchString) => {
|
||||
try {
|
||||
return await getJson(BASE_URL + "/api/admin/getnewappeals_api");
|
||||
} catch (error) {
|
||||
return logAndReturnResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const getNewAppealsPage = async (
|
||||
searchString,
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
showNumberOfRecords
|
||||
) => {
|
||||
try {
|
||||
return await getJson(
|
||||
"/api/admin/getnewappeals_api?searchString=" +
|
||||
searchString +
|
||||
"&pageNumber=" +
|
||||
pageNumber +
|
||||
"&orderby=" +
|
||||
orderBy +
|
||||
"&fieldSort=" +
|
||||
fieldSort +
|
||||
"&showNumberOfRecords=" +
|
||||
showNumberOfRecords
|
||||
);
|
||||
} catch (error) {
|
||||
return logAndReturnResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const getNewDocumentsPaged = async (
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
showNumberOfRecords,
|
||||
documentType,
|
||||
documentOrigin,
|
||||
selectedWeeks
|
||||
) => {
|
||||
try {
|
||||
return await getJson(
|
||||
"/api/admin/getlatestdocuments_api?pageNumber=" +
|
||||
pageNumber +
|
||||
"&orderby=" +
|
||||
orderBy +
|
||||
"&fieldSort=" +
|
||||
fieldSort +
|
||||
"&showNumberOfRecords=" +
|
||||
showNumberOfRecords +
|
||||
"&documentType=" +
|
||||
documentType +
|
||||
"&numberWeeks=" +
|
||||
selectedWeeks +
|
||||
"&documentOrigin=" +
|
||||
documentOrigin
|
||||
);
|
||||
} catch (error) {
|
||||
return logAndReturnResponse(error);
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
import {
|
||||
getNewAppeals,
|
||||
getNewAppealsPage,
|
||||
getNewDocumentsPaged
|
||||
} from "./adminDirectService";
|
||||
|
||||
export { getNewAppeals, getNewAppealsPage, getNewDocumentsPaged };
|
||||
@@ -1,284 +0,0 @@
|
||||
import { BASE_URL } from "../core/env";
|
||||
import { consoleLogger } from "../core/logger";
|
||||
import { logAndReturnResponse } from "./httpServiceUtils";
|
||||
import { getJson, requestJson } from "../clients/endpointClient";
|
||||
import { buildFileQuery, withBaseUrl } from "../clients/fileRouteBuilder";
|
||||
|
||||
export const getCaseMessage = (searchString) => {
|
||||
const route = buildFileQuery("/api/endpoint/getcasemessage_api", {
|
||||
id: searchString
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch(logAndReturnResponse);
|
||||
};
|
||||
|
||||
export const getIncidentbyID = (searchString) => {
|
||||
const route = buildFileQuery("/api/endpoint/getincidentbyid_api", {
|
||||
searchString
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch(logAndReturnResponse);
|
||||
};
|
||||
|
||||
export const getIsPublishedbyID = (searchString) => {
|
||||
const route = buildFileQuery("/api/endpoint/getispublishedbyid_api", {
|
||||
searchString
|
||||
});
|
||||
|
||||
return getJson(route).catch(logAndReturnResponse);
|
||||
};
|
||||
|
||||
export const getPartSavedAppeal = (searchString) => {
|
||||
const route = buildFileQuery("/api/endpoint/getpartsavedappeal_api", {
|
||||
searchString
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch(logAndReturnResponse);
|
||||
};
|
||||
|
||||
export const getSIPSEvents = async (caseid) => {
|
||||
const route = buildFileQuery("/api/endpoint/getsipsevents_api", {
|
||||
caseid
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch(logAndReturnResponse);
|
||||
};
|
||||
|
||||
export const getSIPSMedia = async (caseid) => {
|
||||
const route = buildFileQuery("/api/endpoint/getsipsmedia_api", {
|
||||
caseid
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch(logAndReturnResponse);
|
||||
};
|
||||
|
||||
export const getAppealID = (
|
||||
caseReference,
|
||||
updateFormCollection,
|
||||
primaryAttribute
|
||||
) => {
|
||||
const route = buildFileQuery("/api/endpoint/getappealid_api", {
|
||||
updateFormCollection,
|
||||
primaryAttribute,
|
||||
caseReference
|
||||
});
|
||||
|
||||
return getJson(route)
|
||||
.then((data) => {
|
||||
const result = Object.entries(data.value[0]).filter(
|
||||
([key]) => !key.startsWith("_")
|
||||
)[0][1];
|
||||
var appealID = result;
|
||||
return appealID;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const createNewCase = (
|
||||
appealTypeId,
|
||||
lpaID,
|
||||
contactid,
|
||||
createBody,
|
||||
containerName
|
||||
) => {
|
||||
appealTypeId = parseInt(appealTypeId);
|
||||
|
||||
var data = createBody;
|
||||
|
||||
var queryUrl = buildFileQuery("/api/endpoint/createcase_api", {
|
||||
appealTypeId,
|
||||
lpaID,
|
||||
contactid,
|
||||
containername: containerName
|
||||
});
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
url: withBaseUrl(BASE_URL, queryUrl),
|
||||
data: data
|
||||
};
|
||||
|
||||
return requestJson(config).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const createNewCaseBlob = (
|
||||
appealTypeId,
|
||||
lpaID,
|
||||
contactid,
|
||||
createBody,
|
||||
containerName,
|
||||
lpaName
|
||||
) => {
|
||||
appealTypeId = parseInt(appealTypeId);
|
||||
|
||||
var data = createBody;
|
||||
|
||||
data.pinswg_lpaname = lpaName;
|
||||
data.createdon = new Date();
|
||||
|
||||
var queryUrl = buildFileQuery("/api/file/createcase_api", {
|
||||
appealTypeId,
|
||||
lpaID,
|
||||
contactid,
|
||||
containername: containerName
|
||||
});
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data
|
||||
};
|
||||
|
||||
return requestJson(config).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const updateCase = async (
|
||||
incidentId,
|
||||
updateBody,
|
||||
updateFormCollection,
|
||||
primaryAttribute,
|
||||
caseReference
|
||||
) => {
|
||||
var data = updateBody;
|
||||
|
||||
var appealObj = await getAppealID(
|
||||
caseReference,
|
||||
updateFormCollection,
|
||||
primaryAttribute
|
||||
);
|
||||
|
||||
var queryUrl = buildFileQuery("/api/endpoint/updatecase_api", {
|
||||
updateFormCollection,
|
||||
appealObj
|
||||
});
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: updateBody
|
||||
};
|
||||
|
||||
return requestJson(config).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const updateCaseBlob = async (
|
||||
incidentId,
|
||||
updateBody,
|
||||
updateFormCollection,
|
||||
primaryAttribute,
|
||||
caseReference
|
||||
) => {
|
||||
var data = updateBody;
|
||||
|
||||
var appealObj = await getAppealID(
|
||||
caseReference,
|
||||
updateFormCollection,
|
||||
primaryAttribute
|
||||
);
|
||||
|
||||
var queryUrl = buildFileQuery("/api/file/updatecase_api", {
|
||||
updateFormCollection,
|
||||
appealObj
|
||||
});
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: updateBody
|
||||
};
|
||||
|
||||
return requestJson(config).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const patchCase = async (incidentid) => {
|
||||
var queryUrl = buildFileQuery("/api/endpoint/patchcase_api", {
|
||||
incidentid
|
||||
});
|
||||
return getJson(queryUrl).catch((error) => {
|
||||
//console.log("this error:", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getCase = (incidentID) => {
|
||||
const route = buildFileQuery("/api/endpoint/getcase_api", {
|
||||
incidentID
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getCaseByID = (incidentID) => {
|
||||
const route = buildFileQuery("/api/endpoint/getcasebyid_api", {
|
||||
incidentID
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAppealPDFDocs = (incidentID) => {
|
||||
const route = buildFileQuery("/api/endpoint/getappealpdfdocuments_api", {
|
||||
incidentid: incidentID
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAppealPDFDocument = async (incidentid) => {
|
||||
const route = buildFileQuery("/api/endpoint/getappealpdfdocuments_api", {
|
||||
incidentid
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
|
||||
export const getPortalModuleDetails = async (appealType, caseReference) => {
|
||||
const route = buildFileQuery("/api/endpoint/getportalmoduledetails_api", {
|
||||
appealType,
|
||||
caseReference: encodeURI(caseReference)
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPortalModuleDetailsProxy = (appealType, caseReference) => {
|
||||
const route = buildFileQuery(
|
||||
"/api/endpoint/getportalmoduledetailsproxy_api",
|
||||
{
|
||||
appealType,
|
||||
caseReference: caseReference.replace(/\'/g, "''")
|
||||
}
|
||||
);
|
||||
|
||||
return getJson(route).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getCaseStatus = async (appealType, caseReference) => {
|
||||
const route = buildFileQuery("/api/endpoint/getStatusCounts_api", {});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
import {
|
||||
getCaseMessage,
|
||||
getIncidentbyID,
|
||||
getSIPSEvents,
|
||||
getSIPSMedia,
|
||||
getAppealID,
|
||||
createNewCase,
|
||||
createNewCaseBlob,
|
||||
updateCase,
|
||||
updateCaseBlob,
|
||||
patchCase,
|
||||
getCase,
|
||||
getCaseByID,
|
||||
getAppealPDFDocs,
|
||||
getAppealPDFDocument,
|
||||
getPartSavedAppeal,
|
||||
getIsPublishedbyID,
|
||||
getPortalModuleDetails,
|
||||
getPortalModuleDetailsProxy,
|
||||
getCaseStatus
|
||||
} from "./caseDirectService";
|
||||
|
||||
export {
|
||||
getCaseMessage,
|
||||
getIncidentbyID,
|
||||
getSIPSEvents,
|
||||
getSIPSMedia,
|
||||
getAppealID,
|
||||
createNewCase,
|
||||
createNewCaseBlob,
|
||||
updateCase,
|
||||
updateCaseBlob,
|
||||
patchCase,
|
||||
getCase,
|
||||
getCaseByID,
|
||||
getAppealPDFDocs,
|
||||
getAppealPDFDocument,
|
||||
getPartSavedAppeal,
|
||||
getIsPublishedbyID,
|
||||
getPortalModuleDetails,
|
||||
getPortalModuleDetailsProxy,
|
||||
getCaseStatus
|
||||
};
|
||||
@@ -1,394 +0,0 @@
|
||||
import { BASE_URL } from "../core/env";
|
||||
import { consoleLogger } from "../core/logger";
|
||||
import { hashAPIPath } from "../core/hash";
|
||||
import {
|
||||
buildFileQuery,
|
||||
withBaseUrl,
|
||||
appendQuerySuffix,
|
||||
appendHashSuffix
|
||||
} from "../clients/fileRouteBuilder";
|
||||
import {
|
||||
getFileJson,
|
||||
getSignedFileJson,
|
||||
downloadFileBlob,
|
||||
postSignedFileJson
|
||||
} from "../clients/fileClient";
|
||||
|
||||
const MAX_FILES_PER_UPLOAD_BATCH = 10;
|
||||
|
||||
export const getAwaitingSubmissionFromBlob = (containerName) => {
|
||||
const route = buildFileQuery("/api/file/getawaitingsubmissionfromblob", {
|
||||
container: containerName
|
||||
});
|
||||
|
||||
return getFileJson(
|
||||
withBaseUrl(BASE_URL, appendHashSuffix(route, hashAPIPath))
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getRepsFromBlob = (containerName) => {
|
||||
const route = buildFileQuery("/api/file/getrepsblob", {
|
||||
container: containerName
|
||||
});
|
||||
|
||||
return getFileJson(
|
||||
withBaseUrl(BASE_URL, appendHashSuffix(route, hashAPIPath))
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getRepsFromBlobProxy = async (containerName) => {
|
||||
const route = buildFileQuery("/api/file/getrepsblobproxy", {
|
||||
container: containerName
|
||||
});
|
||||
|
||||
return getFileJson(route).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAwaitingSubmissionFromBlobProxy = async (containerName) => {
|
||||
const route = buildFileQuery(
|
||||
"/api/file/getawaitingsubmissionfromblobproxy",
|
||||
{
|
||||
container: containerName
|
||||
}
|
||||
);
|
||||
|
||||
return getFileJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getFilesFromBlobproxy = (containerName, casefolderID) => {
|
||||
const route = buildFileQuery("/api/file/getbloblistproxy", {
|
||||
container: containerName,
|
||||
casefolderID
|
||||
});
|
||||
|
||||
return getFileJson(route).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteAwaitingSubmissionsFromBlob = (
|
||||
containerID,
|
||||
casefolderID
|
||||
) => {
|
||||
var queryUrl = buildFileQuery("/api/file/deleteblobcase", {
|
||||
container: containerID,
|
||||
casefolderID
|
||||
});
|
||||
|
||||
return getSignedFileJson(queryUrl).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteMyRepresentationsFromBlob = (
|
||||
containerID,
|
||||
casefolderID,
|
||||
repfile
|
||||
) => {
|
||||
var queryUrl = buildFileQuery("/api/file/deleteblobrep", {
|
||||
container: containerID,
|
||||
casefolderID,
|
||||
repfile
|
||||
});
|
||||
|
||||
return getSignedFileJson(queryUrl).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const uploadFiles = async (
|
||||
formValues,
|
||||
filesObj,
|
||||
containerID,
|
||||
casefolderID
|
||||
) => {
|
||||
let files = filesObj;
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append("appealData", JSON.stringify(formValues));
|
||||
formData.append("containerID", containerID);
|
||||
formData.append("casefolderID", casefolderID);
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
for (let j = 0; j < files[i].length; j++) {
|
||||
formData.append(files[i][j].name, files[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
var queryUrl = "/api/file/upload";
|
||||
|
||||
try {
|
||||
return await postSignedFileJson(queryUrl, formData);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const uploadSingleFile = async (
|
||||
filesObj,
|
||||
containerID,
|
||||
casefolderID,
|
||||
options = {}
|
||||
) => {
|
||||
let files = filesObj;
|
||||
try {
|
||||
const queryUrl = "/api/file/uploadsinglefile";
|
||||
const uploadResponse = {
|
||||
data: [],
|
||||
invalidFiles: []
|
||||
};
|
||||
let cumulativeUploaded = 0;
|
||||
let cumulativeInvalid = 0;
|
||||
const totalFiles = files.length;
|
||||
const totalChunks = Math.ceil(totalFiles / MAX_FILES_PER_UPLOAD_BATCH);
|
||||
|
||||
for (
|
||||
let index = 0;
|
||||
index < files.length;
|
||||
index += MAX_FILES_PER_UPLOAD_BATCH
|
||||
) {
|
||||
const chunkIndex =
|
||||
Math.floor(index / MAX_FILES_PER_UPLOAD_BATCH) + 1;
|
||||
const fileChunk = files.slice(
|
||||
index,
|
||||
index + MAX_FILES_PER_UPLOAD_BATCH
|
||||
);
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append("containerID", containerID);
|
||||
formData.append("casefolderID", casefolderID);
|
||||
|
||||
for (let i = 0; i < fileChunk.length; i++) {
|
||||
formData.append(fileChunk[i].name, fileChunk[i]);
|
||||
}
|
||||
|
||||
const chunkResult = await postSignedFileJson(queryUrl, formData);
|
||||
|
||||
if (Array.isArray(chunkResult?.data)) {
|
||||
uploadResponse.data.push(...chunkResult.data);
|
||||
cumulativeUploaded += chunkResult.data.length;
|
||||
}
|
||||
|
||||
if (Array.isArray(chunkResult?.invalidFiles)) {
|
||||
uploadResponse.invalidFiles.push(...chunkResult.invalidFiles);
|
||||
cumulativeInvalid += chunkResult.invalidFiles.length;
|
||||
}
|
||||
|
||||
if (typeof options.onChunkComplete === "function") {
|
||||
options.onChunkComplete({
|
||||
chunkIndex,
|
||||
totalChunks,
|
||||
totalFiles,
|
||||
cumulativeUploaded,
|
||||
cumulativeInvalid,
|
||||
processedFiles: cumulativeUploaded + cumulativeInvalid
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return uploadResponse;
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const uploadRepFiles = async (
|
||||
formValues,
|
||||
filesObj,
|
||||
containerID,
|
||||
casefolderID
|
||||
) => {
|
||||
var formData = new FormData();
|
||||
formData.append("appealData", JSON.stringify(formValues));
|
||||
formData.append("containerID", containerID);
|
||||
formData.append("casefolderID", casefolderID);
|
||||
formData.append("repOrAppeal", true);
|
||||
|
||||
var queryUrl = "/api/file/upload";
|
||||
|
||||
try {
|
||||
return await postSignedFileJson(queryUrl, formData);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const generateRepPDF = async (
|
||||
formValues,
|
||||
containerID,
|
||||
casefolderID,
|
||||
options = {}
|
||||
) => {
|
||||
var queryUrl =
|
||||
"/api/file/generatepdf" + (options.download ? "?download=true" : "");
|
||||
|
||||
formValues.containerID = containerID;
|
||||
try {
|
||||
return await postSignedFileJson(queryUrl, formValues, {
|
||||
...(options.download ? { responseType: "blob" } : {})
|
||||
});
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const generateAppealPDF = async (
|
||||
formValues,
|
||||
containerID,
|
||||
casefolderID,
|
||||
appealType,
|
||||
fileList,
|
||||
options = {}
|
||||
) => {
|
||||
Object.assign(formValues, {
|
||||
"filesList": fileList
|
||||
});
|
||||
|
||||
var queryUrl =
|
||||
"/api/file/generateappealpdf?appealType=" +
|
||||
appealType +
|
||||
(options.download ? "&download=true" : "");
|
||||
|
||||
try {
|
||||
return await postSignedFileJson(queryUrl, formValues, {
|
||||
...(options.download ? { responseType: "blob" } : {})
|
||||
});
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const getFilesFromBlob = (containerName, casefolderID) => {
|
||||
const route = buildFileQuery("/api/file/getbloblist", {
|
||||
container: containerName,
|
||||
casefolderID
|
||||
});
|
||||
|
||||
return getFileJson(
|
||||
withBaseUrl(BASE_URL, appendHashSuffix(route, hashAPIPath))
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getFilesFromBlobHashed = (
|
||||
containerName,
|
||||
getblobshash,
|
||||
casefolderID
|
||||
) => {
|
||||
const route = buildFileQuery("/api/file/getbloblist", {
|
||||
container: containerName,
|
||||
casefolderID
|
||||
});
|
||||
|
||||
return getFileJson(appendQuerySuffix(route, getblobshash)).catch(
|
||||
(error) => {
|
||||
consoleLogger(error);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export const deleteBlob = async (
|
||||
containerName,
|
||||
blobName,
|
||||
deleteblobhash,
|
||||
casefolderID
|
||||
) => {
|
||||
const route = buildFileQuery(
|
||||
"/api/file/deleteblob",
|
||||
{
|
||||
container: containerName,
|
||||
casefolderID,
|
||||
blobname: blobName
|
||||
},
|
||||
{
|
||||
encode: true
|
||||
}
|
||||
);
|
||||
|
||||
return getFileJson(appendQuerySuffix(route, deleteblobhash)).catch(
|
||||
(error) => {
|
||||
consoleLogger(error);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export const deleteRepBlob = async (
|
||||
containerName,
|
||||
blobName,
|
||||
deleteblobhash,
|
||||
casefolderID,
|
||||
filenamePrefix
|
||||
) => {
|
||||
const route = buildFileQuery(
|
||||
"/api/file/deleteblob",
|
||||
{
|
||||
container: containerName,
|
||||
casefolderID: casefolderID + "/" + filenamePrefix,
|
||||
blobname: blobName
|
||||
},
|
||||
{
|
||||
encode: true
|
||||
}
|
||||
);
|
||||
|
||||
return getFileJson(appendQuerySuffix(route, deleteblobhash)).catch(
|
||||
(error) => {
|
||||
consoleLogger(error);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export const downloadBlob = (containerName, blobName) => {
|
||||
const queryUrl = withBaseUrl(
|
||||
BASE_URL,
|
||||
buildFileQuery("/api/file/downloadblob", {
|
||||
container: containerName.toLowerCase(),
|
||||
blobname: blobName
|
||||
})
|
||||
);
|
||||
|
||||
return downloadFileBlob(queryUrl).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getProgressFromBlob = async (containerName, casereference) => {
|
||||
const route = buildFileQuery(
|
||||
"/api/file/getprogressobjblob",
|
||||
{
|
||||
container: containerName,
|
||||
casefolderID: casereference
|
||||
},
|
||||
{
|
||||
encode: true
|
||||
}
|
||||
);
|
||||
|
||||
return getFileJson(
|
||||
withBaseUrl(BASE_URL, appendHashSuffix(route, hashAPIPath))
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const createContainerProxy = (containerName) => {
|
||||
var route = buildFileQuery("/api/file/setupcontainer", {
|
||||
ident: containerName
|
||||
});
|
||||
var queryUrl = appendHashSuffix(route, hashAPIPath);
|
||||
|
||||
return getFileJson(withBaseUrl(BASE_URL, queryUrl)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
|
||||
return JSON.stringify(error);
|
||||
});
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
import {
|
||||
getAwaitingSubmissionFromBlob,
|
||||
getRepsFromBlob,
|
||||
getRepsFromBlobProxy,
|
||||
getAwaitingSubmissionFromBlobProxy,
|
||||
deleteAwaitingSubmissionsFromBlob,
|
||||
deleteMyRepresentationsFromBlob,
|
||||
uploadFiles,
|
||||
uploadSingleFile,
|
||||
uploadRepFiles,
|
||||
generateRepPDF,
|
||||
generateAppealPDF,
|
||||
getFilesFromBlob,
|
||||
getFilesFromBlobproxy,
|
||||
getFilesFromBlobHashed,
|
||||
deleteBlob,
|
||||
deleteRepBlob,
|
||||
downloadBlob,
|
||||
getProgressFromBlob,
|
||||
createContainerProxy
|
||||
} from "./documentDirectService";
|
||||
|
||||
export {
|
||||
getAwaitingSubmissionFromBlob,
|
||||
getRepsFromBlob,
|
||||
getRepsFromBlobProxy,
|
||||
getAwaitingSubmissionFromBlobProxy,
|
||||
deleteAwaitingSubmissionsFromBlob,
|
||||
deleteMyRepresentationsFromBlob,
|
||||
uploadFiles,
|
||||
uploadSingleFile,
|
||||
uploadRepFiles,
|
||||
generateRepPDF,
|
||||
generateAppealPDF,
|
||||
getFilesFromBlob,
|
||||
getFilesFromBlobproxy,
|
||||
getFilesFromBlobHashed,
|
||||
deleteBlob,
|
||||
deleteRepBlob,
|
||||
downloadBlob,
|
||||
getProgressFromBlob,
|
||||
createContainerProxy
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
import { consoleLogger } from "../core/logger";
|
||||
|
||||
export const buildEmptyValueErrorResponse = (error) => {
|
||||
return {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
errorMsg: error.response.statusText
|
||||
};
|
||||
};
|
||||
|
||||
export const logAndReturnResponse = (error) => {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
};
|
||||
|
||||
export const logAndReturnEmptyValueErrorResponse = (error) => {
|
||||
consoleLogger(error);
|
||||
return buildEmptyValueErrorResponse(error);
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
export * from "./searchService";
|
||||
export * from "./caseService";
|
||||
export * from "./accountService";
|
||||
export * from "./portalService";
|
||||
export * from "./documentService";
|
||||
export * from "./referenceDataService";
|
||||
export * from "./notifyService";
|
||||
export * from "./adminService";
|
||||
export * from "./integrationService";
|
||||
@@ -1,19 +0,0 @@
|
||||
import { consoleLogger } from "../core/logger";
|
||||
import { requestJson } from "../clients/endpointClient";
|
||||
|
||||
export const createCRMTask = async (formValues) => {
|
||||
var queryUrl = "/api/endpoint/createcrmtask_api";
|
||||
|
||||
var data = formValues;
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data
|
||||
};
|
||||
|
||||
try {
|
||||
return await requestJson(config);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
@@ -1,3 +0,0 @@
|
||||
import { createCRMTask } from "./integrationDirectService";
|
||||
|
||||
export { createCRMTask };
|
||||
@@ -1,27 +0,0 @@
|
||||
import { consoleLogger } from "../core/logger";
|
||||
import { requestJson } from "../clients/endpointClient";
|
||||
|
||||
export const sendEmail = async (
|
||||
templateId,
|
||||
emailAddress,
|
||||
personalisation,
|
||||
reference
|
||||
) => {
|
||||
var mailData = {
|
||||
"templateId": templateId,
|
||||
"emailAddress": emailAddress,
|
||||
"reference": reference,
|
||||
"personalisation": personalisation
|
||||
};
|
||||
|
||||
try {
|
||||
return await requestJson({
|
||||
method: "post",
|
||||
url: "/api/email/notify",
|
||||
data: mailData
|
||||
});
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
@@ -1,3 +0,0 @@
|
||||
import { sendEmail } from "./notifyDirectService";
|
||||
|
||||
export { sendEmail };
|
||||
@@ -1,313 +0,0 @@
|
||||
import { BASE_URL } from "../core/env";
|
||||
import { consoleLogger } from "../core/logger";
|
||||
import { getJson, requestJson } from "../clients/endpointClient";
|
||||
import {
|
||||
deleteSignedJson,
|
||||
buildSignedUrl
|
||||
} from "../clients/signedRequestClient";
|
||||
import {
|
||||
buildFileQuery,
|
||||
withBaseUrl,
|
||||
appendQuerySuffix
|
||||
} from "../clients/fileRouteBuilder";
|
||||
|
||||
export const getMyCases = (loggedInUserId) => {
|
||||
const route = buildFileQuery("/api/endpoint/getmycases_api", {
|
||||
loggedInUserId
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMyInvolvements = async (loggedInUserId) => {
|
||||
const route = buildFileQuery("/api/endpoint/getmyinvolvements_api", {
|
||||
loggedInUserId
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMyLPACases = (lpaid) => {
|
||||
const route = buildFileQuery("/api/endpoint/getmylpacases_api", {
|
||||
lpaid
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMyRepresentations = (loggedInUserId) => {
|
||||
const route = buildFileQuery("/api/endpoint/getmyrepresentations_api", {
|
||||
loggedInUserId
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMyRepresentationsProxy = (loggedInUserId) => {
|
||||
const route = buildFileQuery(
|
||||
"/api/endpoint/getmyrepresentationsproxy_api",
|
||||
{
|
||||
loggedInUserId
|
||||
}
|
||||
);
|
||||
|
||||
return getJson(route).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getRepresentations = (incidentID) => {
|
||||
const route = buildFileQuery("/api/endpoint/getrepresentations_api", {
|
||||
incidentID
|
||||
});
|
||||
|
||||
return getJson(route).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getRepresentationsProxy = (incidentID) => {
|
||||
const route = buildFileQuery("/api/endpoint/getrepresentationsproxy_api", {
|
||||
incidentID
|
||||
});
|
||||
|
||||
return getJson(route).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getWatchedCases = (loggedInUserId) => {
|
||||
const route = buildFileQuery("/api/endpoint/getwatchedcases_api", {
|
||||
loggedInUserId
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getWatchedCasesProxy = (loggedInUserId) => {
|
||||
const route = buildFileQuery("/api/endpoint/getwatchedcasesproxy_api", {
|
||||
loggedInUserId
|
||||
});
|
||||
|
||||
return getJson(route).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAwaitingSubmissionProxy = (loggedInUserId) => {
|
||||
const route = buildFileQuery(
|
||||
"/api/endpoint/getawaitingsubmissionproxy_api",
|
||||
{
|
||||
loggedInUserId
|
||||
}
|
||||
);
|
||||
|
||||
return getJson(route).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAwaitingSubmission = (loggedInUserId) => {
|
||||
const route = buildFileQuery("/api/endpoint/getawaitingsubmission_api", {
|
||||
loggedInUserId
|
||||
});
|
||||
|
||||
return getJson(withBaseUrl(BASE_URL, route)).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const createWatchedCases = async (formValues) => {
|
||||
var data = formValues;
|
||||
var queryUrl = buildFileQuery("/api/endpoint/createwatchedcases_api");
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data
|
||||
};
|
||||
|
||||
try {
|
||||
return await requestJson(config);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const deleteMyRepresentations = (myRepresentationsID) => {
|
||||
var queryUrl = buildFileQuery("/api/endpoint/deletemyrepresentations_api", {
|
||||
myRepresentationsID
|
||||
});
|
||||
|
||||
return deleteSignedJson(queryUrl, {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json;odata.metadata=none",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteAwaitingSubmissions = (incidentID) => {
|
||||
var queryUrl = buildFileQuery(
|
||||
"/api/endpoint/deleteawaitingsubmissions_api",
|
||||
{
|
||||
incidentID
|
||||
}
|
||||
);
|
||||
|
||||
var config = {
|
||||
method: "delete",
|
||||
url: queryUrl
|
||||
};
|
||||
|
||||
return requestJson(config).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteWatchedCases = async (watchedCaseID) => {
|
||||
var queryUrl = buildFileQuery("/api/endpoint/deletewatchedcases_api", {
|
||||
watchedCaseID
|
||||
});
|
||||
|
||||
return deleteSignedJson(queryUrl).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const sendCaseCompleteMessage = async (
|
||||
containerID,
|
||||
caseReference,
|
||||
inv
|
||||
) => {
|
||||
var hashQueryPath = buildFileQuery(
|
||||
"/api/file/createappealcompletemessage_api",
|
||||
{
|
||||
container: containerID,
|
||||
tempcaseref: caseReference
|
||||
}
|
||||
);
|
||||
|
||||
var queryUrl = buildFileQuery("/api/file/createappealcompletemessage_api", {
|
||||
container: containerID,
|
||||
tempcaseref: caseReference,
|
||||
inv
|
||||
});
|
||||
|
||||
var signedQueryUrl = await buildSignedUrl(hashQueryPath);
|
||||
|
||||
queryUrl = appendQuerySuffix(
|
||||
queryUrl,
|
||||
signedQueryUrl.replace(hashQueryPath, "")
|
||||
);
|
||||
|
||||
var config = {
|
||||
method: "get",
|
||||
url: queryUrl
|
||||
};
|
||||
|
||||
return requestJson(config).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const sendCaseCompleteMessageProxy = async (
|
||||
containerID,
|
||||
caseReference
|
||||
) => {
|
||||
var queryUrl = buildFileQuery(
|
||||
"/api/file/createappealcompletemessageproxy_api",
|
||||
{
|
||||
container: containerID,
|
||||
tempcaseref: caseReference
|
||||
}
|
||||
);
|
||||
|
||||
var config = {
|
||||
method: "get",
|
||||
url: queryUrl
|
||||
};
|
||||
|
||||
return requestJson(config).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const sendRepCompleteMessage = async (
|
||||
containerID,
|
||||
caseReference,
|
||||
fileName
|
||||
) => {
|
||||
var hashQueryPath = buildFileQuery(
|
||||
"/api/file/createrepcompletemessage_api",
|
||||
{
|
||||
container: containerID,
|
||||
tempcaseref: caseReference,
|
||||
repid: fileName
|
||||
}
|
||||
);
|
||||
|
||||
var queryUrl = await buildSignedUrl(hashQueryPath);
|
||||
|
||||
var config = {
|
||||
method: "get",
|
||||
url: queryUrl
|
||||
};
|
||||
|
||||
return requestJson(config).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const setRepInvolvment = async (caseid, contactid, involvement) => {
|
||||
var queryUrl = buildFileQuery("/api/file/createrepinvolvement_api");
|
||||
|
||||
var data = {
|
||||
"incidentid": caseid,
|
||||
"contactid": contactid,
|
||||
"involvement": involvement
|
||||
};
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data
|
||||
};
|
||||
|
||||
try {
|
||||
return await requestJson(config);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const setCaseInvolvment = async (caseid, contactid) => {
|
||||
var queryUrl = buildFileQuery("/api/file/createrepinvolvement_api");
|
||||
|
||||
var data = { "incidentid": caseid, "contactid": contactid };
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl,
|
||||
data: data
|
||||
};
|
||||
|
||||
try {
|
||||
return await requestJson(config);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
import {
|
||||
getMyCases,
|
||||
getMyInvolvements,
|
||||
getMyLPACases,
|
||||
getMyRepresentations,
|
||||
getMyRepresentationsProxy,
|
||||
getRepresentations,
|
||||
getRepresentationsProxy,
|
||||
getWatchedCases,
|
||||
getWatchedCasesProxy,
|
||||
getAwaitingSubmission,
|
||||
getAwaitingSubmissionProxy,
|
||||
createWatchedCases,
|
||||
deleteWatchedCases,
|
||||
deleteMyRepresentations,
|
||||
deleteAwaitingSubmissions,
|
||||
sendCaseCompleteMessage,
|
||||
sendCaseCompleteMessageProxy,
|
||||
sendRepCompleteMessage,
|
||||
setRepInvolvment,
|
||||
setCaseInvolvment
|
||||
} from "./portalDirectService";
|
||||
|
||||
export {
|
||||
getMyCases,
|
||||
getMyInvolvements,
|
||||
getMyLPACases,
|
||||
getMyRepresentations,
|
||||
getMyRepresentationsProxy,
|
||||
getRepresentations,
|
||||
getRepresentationsProxy,
|
||||
getWatchedCases,
|
||||
getWatchedCasesProxy,
|
||||
getAwaitingSubmission,
|
||||
getAwaitingSubmissionProxy,
|
||||
createWatchedCases,
|
||||
deleteWatchedCases,
|
||||
deleteMyRepresentations,
|
||||
deleteAwaitingSubmissions,
|
||||
sendCaseCompleteMessage,
|
||||
sendCaseCompleteMessageProxy,
|
||||
sendRepCompleteMessage,
|
||||
setRepInvolvment,
|
||||
setCaseInvolvment
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
import { BASE_URL } from "../core/env";
|
||||
import { consoleLogger } from "../core/logger";
|
||||
import { logAndReturnEmptyValueErrorResponse } from "./httpServiceUtils";
|
||||
import { getJson } from "../clients/endpointClient";
|
||||
|
||||
export const getAppealsTypes = () => {
|
||||
return getJson(BASE_URL + "/api/endpoint/getappealtypes_api").catch(
|
||||
logAndReturnEmptyValueErrorResponse
|
||||
);
|
||||
};
|
||||
|
||||
export const getProjectTypes = () => {
|
||||
return getJson(BASE_URL + "/api/endpoint/getprojecttypes_api").catch(
|
||||
logAndReturnEmptyValueErrorResponse
|
||||
);
|
||||
};
|
||||
|
||||
export const getAppealsTypesForNewAppeal = () => {
|
||||
return getJson(
|
||||
BASE_URL + "/api/endpoint/getappealtypesfornewappeal_api"
|
||||
).catch(logAndReturnEmptyValueErrorResponse);
|
||||
};
|
||||
|
||||
export const getLPA = () => {
|
||||
return getJson(BASE_URL + "/api/endpoint/getlpa_api").catch(
|
||||
logAndReturnEmptyValueErrorResponse
|
||||
);
|
||||
};
|
||||
|
||||
export const getFormData = (whichForm) => {
|
||||
return getJson(
|
||||
BASE_URL + "/api/endpoint/getformdata_api?whichForm=" + whichForm
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMandatoryFields = (whichForm) => {
|
||||
return getJson(
|
||||
BASE_URL + "/api/endpoint/getmandatoryfields_api?whichForm=" + whichForm
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPickLists = (whichForm) => {
|
||||
return getJson(
|
||||
BASE_URL + "/api/endpoint/getpicklists_api?whichForm=" + whichForm
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getNotice = () => {
|
||||
return getJson(BASE_URL + "/api/notices").catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
@@ -1,21 +0,0 @@
|
||||
import {
|
||||
getAppealsTypes,
|
||||
getProjectTypes,
|
||||
getAppealsTypesForNewAppeal,
|
||||
getLPA,
|
||||
getFormData,
|
||||
getMandatoryFields,
|
||||
getPickLists,
|
||||
getNotice
|
||||
} from "./referenceDataDirectService";
|
||||
|
||||
export {
|
||||
getAppealsTypes,
|
||||
getProjectTypes,
|
||||
getAppealsTypesForNewAppeal,
|
||||
getLPA,
|
||||
getFormData,
|
||||
getMandatoryFields,
|
||||
getPickLists,
|
||||
getNotice
|
||||
};
|
||||
@@ -1,261 +0,0 @@
|
||||
import { BASE_URL } from "../core/env";
|
||||
import { consoleLogger } from "../core/logger";
|
||||
import { getJson } from "../clients/endpointClient";
|
||||
import {
|
||||
logAndReturnResponse,
|
||||
logAndReturnEmptyValueErrorResponse
|
||||
} from "./httpServiceUtils";
|
||||
|
||||
export const getBasicSearch = (searchString) => {
|
||||
return getJson(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getbasicsearch_api?searchString=" +
|
||||
searchString
|
||||
).catch(logAndReturnResponse);
|
||||
};
|
||||
|
||||
export const getBasicDNSURLSearch = (searchString) => {
|
||||
return getJson(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getbasicdnsurlsearch_api?searchString=" +
|
||||
searchString
|
||||
).catch(logAndReturnResponse);
|
||||
};
|
||||
|
||||
export const getAddressSearchPaged = (
|
||||
searchString,
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
showNumberOfRecords
|
||||
) => {
|
||||
return getJson(
|
||||
"/api/endpoint/getbasicsearch_by_address_paged_api?searchString=" +
|
||||
searchString +
|
||||
"&pageNumber=" +
|
||||
pageNumber +
|
||||
"&orderby=" +
|
||||
orderBy +
|
||||
"&fieldSort=" +
|
||||
fieldSort +
|
||||
"&showNumberOfRecords=" +
|
||||
showNumberOfRecords
|
||||
).catch(logAndReturnResponse);
|
||||
};
|
||||
|
||||
export const getBasicSearchPaged = (
|
||||
searchString,
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
showNumberOfRecords
|
||||
) => {
|
||||
return getJson(
|
||||
"/api/endpoint/getbasicsearchpaged_api?searchString=" +
|
||||
searchString +
|
||||
"&pageNumber=" +
|
||||
pageNumber +
|
||||
"&orderby=" +
|
||||
orderBy +
|
||||
"&fieldSort=" +
|
||||
fieldSort +
|
||||
"&showNumberOfRecords=" +
|
||||
showNumberOfRecords
|
||||
).catch(logAndReturnResponse);
|
||||
};
|
||||
|
||||
export const getDNSCoords = () => {
|
||||
return getJson(BASE_URL + "/api/endpoint/getdnscoords_api").catch(
|
||||
logAndReturnEmptyValueErrorResponse
|
||||
);
|
||||
};
|
||||
|
||||
export const getDNSList = (searchString) => {
|
||||
return getJson(BASE_URL + "/api/endpoint/getdnslist_api").catch(
|
||||
logAndReturnResponse
|
||||
);
|
||||
};
|
||||
|
||||
export const getBasicDNSSearch = (searchString) => {
|
||||
return getJson(BASE_URL + "/api/endpoint/getbasicdnssearch_api").catch(
|
||||
logAndReturnResponse
|
||||
);
|
||||
};
|
||||
|
||||
export const getBasicDNSSearchPaged = (
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
showNumberOfRecords
|
||||
) => {
|
||||
return getJson(
|
||||
"/api/endpoint/getbasicdnssearchpaged_api?pageNumber=" +
|
||||
pageNumber +
|
||||
"&orderby=" +
|
||||
orderBy +
|
||||
"&fieldSort=" +
|
||||
fieldSort +
|
||||
"&showNumberOfRecords=" +
|
||||
showNumberOfRecords
|
||||
).catch(logAndReturnResponse);
|
||||
};
|
||||
|
||||
export const getAdvancedSearch = (searchString) => {
|
||||
return getJson(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getadvancedsearch_api?searchstring=" +
|
||||
JSON.stringify(searchString)
|
||||
).catch(logAndReturnEmptyValueErrorResponse);
|
||||
};
|
||||
|
||||
export const getAdvancedSearchPaged = (
|
||||
searchString,
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
showNumberOfRecords
|
||||
) => {
|
||||
return getJson(
|
||||
"/api/endpoint/getadvancedsearchpaged_api?searchstring=" +
|
||||
JSON.stringify(searchString) +
|
||||
"&pageNumber=" +
|
||||
pageNumber +
|
||||
"&orderby=" +
|
||||
orderBy +
|
||||
"&fieldSort=" +
|
||||
fieldSort +
|
||||
"&showNumberOfRecords=" +
|
||||
showNumberOfRecords
|
||||
).catch(logAndReturnEmptyValueErrorResponse);
|
||||
};
|
||||
|
||||
export const getBasicSearchDetails = async (
|
||||
appealTypeName,
|
||||
caseReference,
|
||||
primaryIdAttribute,
|
||||
incidentID
|
||||
) => {
|
||||
return getJson(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getbasicsearchdetails_api?appealTypeName=" +
|
||||
appealTypeName +
|
||||
"&primaryIdAttribute=" +
|
||||
primaryIdAttribute +
|
||||
"&incidentID=" +
|
||||
incidentID
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getBasicPartSavedDetails = (
|
||||
appealTypeName,
|
||||
caseReference,
|
||||
primaryIdAttribute,
|
||||
incidentID
|
||||
) => {
|
||||
return getJson(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getbasicpartsaveddetails_api?appealTypeName=" +
|
||||
appealTypeName +
|
||||
"&primaryIdAttribute=" +
|
||||
primaryIdAttribute +
|
||||
"&incidentID=" +
|
||||
incidentID
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getBasicSearchDetailsPaged = async (
|
||||
appealTypeName,
|
||||
caseReference,
|
||||
primaryIdAttribute,
|
||||
incidentIDs
|
||||
) => {
|
||||
if (!incidentIDs || incidentIDs.length === 0) return [];
|
||||
|
||||
const filter = incidentIDs
|
||||
.map((id) => {
|
||||
const suffix =
|
||||
primaryIdAttribute === "pinswg_sipscase"
|
||||
? `_${primaryIdAttribute}_value`
|
||||
: `_${primaryIdAttribute}s_value`;
|
||||
|
||||
return `${suffix} eq ${id}`;
|
||||
})
|
||||
.join(" or ");
|
||||
|
||||
const url = `/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=${appealTypeName}&primaryIdAttribute=${primaryIdAttribute}&incidentID=${encodeURIComponent(
|
||||
filter
|
||||
)}`;
|
||||
|
||||
try {
|
||||
const data = await getJson(url);
|
||||
return data.value || [];
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export const getSearchDocumentDetails = (incidentID) => {
|
||||
return getJson(
|
||||
"/api/endpoint/getsearchdocumentdetails_api?incidentid=" + incidentID
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
throw error;
|
||||
});
|
||||
};
|
||||
|
||||
export const getSearchDocumentTypes = (incidentID) => {
|
||||
return getJson(
|
||||
"/api/endpoint/getsearchdocumentTypes_api?incidentid=" + incidentID
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getSearchDocumentDetailsPaged = (
|
||||
incidentID,
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
showNumberOfRecords,
|
||||
documentType
|
||||
) => {
|
||||
return getJson(
|
||||
"/api/endpoint/getsearchdocumentdetailspaged_api?incidentid=" +
|
||||
incidentID +
|
||||
"&pageNumber=" +
|
||||
pageNumber +
|
||||
"&orderby=" +
|
||||
orderBy +
|
||||
"&fieldSort=" +
|
||||
fieldSort +
|
||||
"&showNumberOfRecords=" +
|
||||
showNumberOfRecords +
|
||||
"&documentType=" +
|
||||
documentType
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getLinkedCases = (parentIncidentid) => {
|
||||
return getJson(
|
||||
"/api/endpoint/getlinkedcases_api?parentincidentid=" + parentIncidentid
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAddressSearch = async (searchString) => {
|
||||
const params = new URLSearchParams(searchString);
|
||||
const str = params.toString();
|
||||
|
||||
var queryUrl =
|
||||
BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str;
|
||||
|
||||
return getJson(queryUrl).catch(logAndReturnEmptyValueErrorResponse);
|
||||
};
|
||||
@@ -1,41 +0,0 @@
|
||||
import {
|
||||
getBasicSearch,
|
||||
getAddressSearch,
|
||||
getAddressSearchPaged,
|
||||
getBasicSearchPaged,
|
||||
getAdvancedSearch,
|
||||
getAdvancedSearchPaged,
|
||||
getBasicDNSURLSearch,
|
||||
getBasicDNSSearch,
|
||||
getBasicDNSSearchPaged,
|
||||
getDNSCoords,
|
||||
getDNSList,
|
||||
getBasicSearchDetails,
|
||||
getBasicSearchDetailsPaged,
|
||||
getBasicPartSavedDetails,
|
||||
getSearchDocumentDetails,
|
||||
getSearchDocumentTypes,
|
||||
getSearchDocumentDetailsPaged,
|
||||
getLinkedCases
|
||||
} from "./searchDirectService";
|
||||
|
||||
export {
|
||||
getBasicSearch,
|
||||
getAddressSearch,
|
||||
getAddressSearchPaged,
|
||||
getBasicSearchPaged,
|
||||
getAdvancedSearch,
|
||||
getAdvancedSearchPaged,
|
||||
getBasicDNSURLSearch,
|
||||
getBasicDNSSearch,
|
||||
getBasicDNSSearchPaged,
|
||||
getDNSCoords,
|
||||
getDNSList,
|
||||
getBasicSearchDetails,
|
||||
getBasicSearchDetailsPaged,
|
||||
getBasicPartSavedDetails,
|
||||
getSearchDocumentDetails,
|
||||
getSearchDocumentTypes,
|
||||
getSearchDocumentDetailsPaged,
|
||||
getLinkedCases
|
||||
};
|
||||
@@ -1,57 +0,0 @@
|
||||
# Refactor Session Handoff (Usable Prompt)
|
||||
|
||||
## Purpose
|
||||
|
||||
Copy/paste this directly into a new chat session to continue the current PEDW refactor stream with the right context and next-step planning.
|
||||
|
||||
## Copy/Paste Prompt
|
||||
|
||||
```
|
||||
You are continuing an in-flight refactor stream in the PEDW FrontEnd repository.
|
||||
|
||||
Before any analysis or code changes:
|
||||
1) Ask for the Azure DevOps work item ID (required).
|
||||
2) Create a new branch from `origin/SIPS-Development` prefixed with that ID (e.g. `US12345-progress-update` or `TASK67890-progress-update`).
|
||||
3) Confirm branch name, then continue.
|
||||
|
||||
Follow this order before implementing:
|
||||
1) Read `.clinerules/default-rules.md` and `.clinerules/CONTRIBUTING_AI.md`
|
||||
2) Read `GUARDRAILS.md`
|
||||
3) Read current-state docs:
|
||||
- `context/architecture.md`
|
||||
- `context/current-state-scorecard.md`
|
||||
- `context/next-work-plan-sequence-b.md`
|
||||
- `context/test-coverage-map.md`
|
||||
4) Read memory context:
|
||||
- `memory-bank/change-log.md` (latest entries)
|
||||
- `memory-bank/debt-list.md`
|
||||
- `memory-bank/architect-review.md`
|
||||
- `memory-bank/decisions.md`
|
||||
- `memory-bank/open-questions.md`
|
||||
|
||||
Then provide (based on what you read):
|
||||
1. Current state summary (what is done, what remains)
|
||||
2. Recommended next slice from this exact shortlist (pick one):
|
||||
- Slice B1.1: create shared signed-request helper(s) in `actions/clients/` and migrate one pilot path in `actions/services/portalDirectService.js`
|
||||
- Slice B1.2: migrate remaining signed flows in `actions/services/documentDirectService.js` to the shared signed helper(s)
|
||||
- Slice B2.1: auth logging hardening in `pages/api/auth/[...nextauth].js` (redacted structured logs, no behavior change)
|
||||
- Slice B2.2: file/email logging hardening in selected `pages/api/file/**` and `pages/api/email/**`
|
||||
3. Exact files to change
|
||||
4. Validation plan (lint + targeted tests + EN/CY parity + negative-path checks)
|
||||
5. Rollback plan
|
||||
|
||||
Constraints:
|
||||
- Preserve behavior unless explicitly requested otherwise
|
||||
- Do not weaken auth/session/CSP/security flows
|
||||
- Keep EN/CY parity
|
||||
- Keep scope to one bounded slice per commit
|
||||
- Update `memory-bank/change-log.md` for non-trivial changes
|
||||
|
||||
After proposing the slice, wait for approval before editing files.
|
||||
```
|
||||
|
||||
## Best use
|
||||
|
||||
- Start-of-day continuation
|
||||
- Branch handover between engineers/agents
|
||||
- Recovery after interrupted context window
|
||||
@@ -1,183 +0,0 @@
|
||||
# Refactor Slice Execution (Usable Prompts)
|
||||
|
||||
## Purpose
|
||||
|
||||
Copy/paste one of these prompts directly to execute a specific next slice (not just a template).
|
||||
|
||||
## Prompt A — Slice B1.1 (signed-request helper + pilot migration)
|
||||
|
||||
```
|
||||
Act as a senior architect + senior software engineer working in PEDW FrontEnd.
|
||||
|
||||
Before any analysis or code changes:
|
||||
1) Ask for the Azure DevOps work item ID (required).
|
||||
2) Create a new branch from `origin/SIPS-Development` prefixed with that ID (e.g. `US12345-signed-helper-pilot`).
|
||||
3) Confirm branch name and only then proceed.
|
||||
|
||||
Goal:
|
||||
Implement Slice B1.1 only: introduce shared signed-request helper(s) and migrate one pilot signed path in portal service.
|
||||
|
||||
Exact scope:
|
||||
- Add shared signed-request helper(s) in `actions/clients/` for signed GET/POST/DELETE execution.
|
||||
- Migrate one pilot signed flow in `actions/services/portalDirectService.js` to use the helper.
|
||||
- Do not migrate additional modules in this slice.
|
||||
|
||||
Mandatory context to read before coding:
|
||||
- `.clinerules/default-rules.md`
|
||||
- `GUARDRAILS.md`
|
||||
- `context/architecture.md`
|
||||
- `context/current-state-scorecard.md`
|
||||
- `context/next-work-plan-sequence-b.md`
|
||||
- `memory-bank/debt-list.md`
|
||||
- latest relevant `memory-bank/change-log.md` entries
|
||||
|
||||
Required output before edits:
|
||||
1. Scope and non-goals
|
||||
2. Risks and how they are contained
|
||||
3. Files to touch
|
||||
4. Acceptance criteria
|
||||
5. Validation checklist
|
||||
|
||||
Implementation constraints:
|
||||
- Smallest viable diff
|
||||
- Preserve API/route/public behavior
|
||||
- Preserve auth/session/security and EN/CY parity
|
||||
- No dependency churn unless required by scope
|
||||
- No unrelated cleanup
|
||||
|
||||
Validation minimum:
|
||||
- `npm run lint`
|
||||
- `node tests/phase22/index.test.cjs`
|
||||
- `node tests/phase7/service-behaviour.test.cjs`
|
||||
- explicit negative-path verification for sensitive flows
|
||||
|
||||
Completion output:
|
||||
1. Files changed
|
||||
2. Behavior parity statement
|
||||
3. Validation evidence (commands + pass/fail)
|
||||
4. Rollback steps
|
||||
5. `memory-bank/change-log.md` entry content
|
||||
```
|
||||
|
||||
## Prompt B — Slice B1.2 (document signed-flow migration)
|
||||
|
||||
```
|
||||
Act as a senior architect + senior software engineer working in PEDW FrontEnd.
|
||||
|
||||
Before any analysis or code changes:
|
||||
1) Ask for the Azure DevOps work item ID (required).
|
||||
2) Create a new branch from `origin/SIPS-Development` prefixed with that ID (e.g. `TASK67890-document-signed-migration`).
|
||||
3) Confirm branch name and only then proceed.
|
||||
|
||||
Goal:
|
||||
Implement Slice B1.2 only: migrate remaining signed flows in `documentDirectService` to shared signed-request helper(s) with no behavior change.
|
||||
|
||||
Exact scope:
|
||||
- Update `actions/services/documentDirectService.js` signed GET/POST/DELETE paths to use shared signed helper(s).
|
||||
- Preserve hash generation, headers, methods, and catch-path behavior.
|
||||
- Do not modify unrelated services.
|
||||
|
||||
Mandatory context to read before coding:
|
||||
- `.clinerules/default-rules.md`
|
||||
- `GUARDRAILS.md`
|
||||
- `context/architecture.md`
|
||||
- `context/current-state-scorecard.md`
|
||||
- `context/next-work-plan-sequence-b.md`
|
||||
- `context/test-coverage-map.md`
|
||||
- latest relevant `memory-bank/change-log.md` entries
|
||||
|
||||
Required output before edits:
|
||||
1. Scope and non-goals
|
||||
2. Risks and containment
|
||||
3. Files to touch
|
||||
4. Acceptance criteria
|
||||
5. Validation checklist
|
||||
|
||||
Validation minimum:
|
||||
- `npm run lint`
|
||||
- `node tests/phase22/index.test.cjs`
|
||||
- `node tests/phase7/service-behaviour.test.cjs`
|
||||
|
||||
Completion output:
|
||||
1. Files changed
|
||||
2. Behavior parity statement
|
||||
3. Validation evidence
|
||||
4. Rollback steps
|
||||
5. `memory-bank/change-log.md` entry
|
||||
```
|
||||
|
||||
## Prompt C — Slice B2.1 (auth logging hardening)
|
||||
|
||||
```
|
||||
Act as a senior architect + senior software engineer working in PEDW FrontEnd.
|
||||
|
||||
Before any analysis or code changes:
|
||||
1) Ask for the Azure DevOps work item ID (required).
|
||||
2) Create a new branch from `origin/SIPS-Development` prefixed with that ID (e.g. `US12345-auth-logging-hardening`).
|
||||
3) Confirm branch name and only then proceed.
|
||||
|
||||
Goal:
|
||||
Implement Slice B2.1 only: harden logging in `pages/api/auth/[...nextauth].js` using redacted structured logging with no behavior change.
|
||||
|
||||
Exact scope:
|
||||
- Replace sensitive/verbose direct logs in auth route with structured logger usage.
|
||||
- Do not alter auth/session/redirect functional behavior.
|
||||
|
||||
Mandatory context to read before coding:
|
||||
- `.clinerules/default-rules.md`
|
||||
- `GUARDRAILS.md`
|
||||
- `context/architecture.md`
|
||||
- `context/next-work-plan-sequence-b.md`
|
||||
- `memory-bank/open-questions.md` (Q-001)
|
||||
|
||||
Validation minimum:
|
||||
- `npm run lint`
|
||||
- `node tests/phase22/auth-redirect-safety.test.cjs`
|
||||
- targeted manual negative-path check for auth error logging paths
|
||||
|
||||
Completion output must include:
|
||||
1. Redaction policy applied (fields excluded)
|
||||
2. Files changed
|
||||
3. Behavior parity statement
|
||||
4. Validation evidence
|
||||
5. Rollback plan
|
||||
6. `memory-bank/change-log.md` update text
|
||||
```
|
||||
|
||||
## Prompt D — Slice B2.2 (file/email logging hardening cluster)
|
||||
|
||||
```
|
||||
Act as a senior architect + senior software engineer working in PEDW FrontEnd.
|
||||
|
||||
Before any analysis or code changes:
|
||||
1) Ask for the Azure DevOps work item ID (required).
|
||||
2) Create a new branch from `origin/SIPS-Development` prefixed with that ID (e.g. `TASK67890-file-email-logging-hardening`).
|
||||
3) Confirm branch name and only then proceed.
|
||||
|
||||
Goal:
|
||||
Implement Slice B2.2 only: harden logging in one bounded file/email route cluster using redacted structured logs.
|
||||
|
||||
Exact scope:
|
||||
- Choose a small cluster in `pages/api/file/**` and/or `pages/api/email/**`.
|
||||
- Replace risky direct logs with structured redacted logging.
|
||||
- Preserve endpoint contracts and negative-path semantics.
|
||||
|
||||
Validation minimum:
|
||||
- `npm run lint`
|
||||
- targeted tests for changed handlers
|
||||
- explicit negative-path check(s) for unauthorized/invalid input behavior
|
||||
|
||||
Completion output:
|
||||
1. Cluster chosen and why
|
||||
2. Files changed
|
||||
3. Redaction fields/policy applied
|
||||
4. Validation evidence
|
||||
5. Rollback steps
|
||||
6. `memory-bank/change-log.md` update text
|
||||
```
|
||||
|
||||
## Best use
|
||||
|
||||
- Run Sequence B slices as independent, reviewable commits
|
||||
- Start a fresh chat and execute one prompt at a time
|
||||
- Keep each slice bounded with explicit rollback
|
||||
@@ -0,0 +1,2 @@
|
||||
{"@odata.context":"https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/$metadata#contacts(address1_addressid,address1_addresstypecode,address1_city,address1_country,address1_county,address1_fax,firstname,lastname)",value:[0:{@odata.etag:"W/"509484"",address1_addressid:"6c267cf9-1ba2-4e38-9f48-2b94a341e392",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname: null ,lastname:"Trembath",contactid:"9d481bc3-7c64-eb11-aaba-00224800be9c"},1:{@odata.etag:"W/"509501"",address1_addressid:"9a546d64-b7b5-42bf-bafd-b547e718fddd",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname: null ,lastname:"Jones",contactid:"1e2e0e6f-7e64-eb11-aaba-00224800be9c"},2:{@odata.etag:"W/"509506"",address1_addressid:"214e5b63-9bc8-478a-90e2-39417d9e096b",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname: null ,lastname:"Thomas",contactid:"d1658f77-7e64-eb11-aaba-00224800be9c"},3:{@odata.etag:"W/"694902"",address1_addressid:"6258fd0c-2d18-41dd-b629-123c880f16a1",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"James",lastname:"Hollowhead",contactid:"755e07ea-82ad-eb11-aac3-00224800be9c"},4:{@odata.etag:"W/"694906"",address1_addressid:"436104d2-5ee0-4494-b0f8-3059f738e9cf",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"T",lastname:"Gillbert",contactid:"b8022d00-83ad-eb11-aac3-00224800be9c"},5:{@odata.etag:"W/"694910"",address1_addressid:"36e9cccc-ac84-4023-ae92-d6b9556d8ddf",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Mike",lastname:"Parker",contactid:"99b3220f-83ad-eb11-aac3-00224800be9c"},6:{@odata.etag:"W/"694914"",address1_addressid:"83169722-1283-4a4c-b346-28f50cd208cd",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Lloyd",lastname:"Evans",contactid:"5bee9821-83ad-eb11-aac3-00224800be9c"},7:{@odata.etag:"W/"694918"",address1_addressid:"a164b5d8-f9d2-46d4-b97b-b59327173f0a",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Mr",lastname:"Bartlett",contactid:"c2be7d2e-83ad-eb11-aac3-00224800be9c"},8:{@odata.etag:"W/"709237"",address1_addressid:"b75d552e-3896-46a7-bd65-a743f457f119",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Zoe",lastname:"Dawson",contactid:"003eef05-29ba-eb11-aac4-00224800be9c"},9:{@odata.etag:"W/"750707"",address1_addressid:"34bbd453-7d23-4c17-806e-1edf2e981cc8",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Appellant Contact",lastname:"Gary Trembath",contactid:"985cc5f8-1dd8-eb11-aac5-00224800be9c"},10:{@odata.etag:"W/"750703"",address1_addressid:"20ce70a9-571c-4a81-b410-f521d64d3dcb",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Agent Contact",lastname:"Gary Trembath",contactid:"9eb124a5-1ed8-eb11-aac5-00224800be9c"},11:{@odata.etag:"W/"750860"",address1_addressid:"a6a4641c-0875-4d5e-8360-99355eb73ee4",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
0:{@odata.context:"https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/$metadata#accounts(name)",value:[0:{@odata.etag:"W/"547952"",name:"Bridgend CBC",accountid:"56e7ef63-7e64-eb11-aaba-00224800be9c"},1:{@odata.etag:"W/"694923"",name:"Bishop Landaff High School",accountid:"c9389617-82ad-eb11-aac3-00224800be9c"},2:{@odata.etag:"W/"694925"",name:"Stanwell High school",accountid:"24537624-82ad-eb11-aac3-00224800be9c"},3:{@odata.etag:"W/"694927"",name:"Barry Boys High School",accountid:"80d99a34-82ad-eb11-aac3-00224800be9c"},4:{@odata.etag:"W/"694929"",name:"St Sirus High School",accountid:"6d337b5a-82ad-eb11-aac3-00224800be9c"},5:{@odata.etag:"W/"694931"",name:"Fitzalan High School",accountid:"984d0e75-82ad-eb11-aac3-00224800be9c"},6:{@odata.etag:"W/"709453"",name:"Zoe",accountid:"41fead24-29ba-eb11-aac4-00224800be9c"},7:{@odata.etag:"W/"755017"",name:"Blaenau Gwent County Borough Council",accountid:"744c69f4-48da-eb11-aac5-00224800be9c"},8:{@odata.etag:"W/"755020"",name:"Caerphilly County Borough Council",accountid:"243c0009-49da-eb11-aac5-00224800be9c"},9:{@odata.etag:"W/"755026"",name:"Bridgend County Borough Council",accountid:"c35f6f84-49da-eb11-aabd-00224800d1bd"},10:{@odata.etag:"W/"755029"",name:"Cardiff Council",accountid:"c75f6f84-49da-eb11-aabd-00224800d1bd"},11:{@odata.etag:"W/"755032"",name:"Carmarthenshire County Council",accountid:"c95f6f84-49da-eb11-aabd-00224800d1bd"},12:{@odata.etag:"W/"755035"",name:"Ceredigion County Council",accountid:"cb5f6f84-49da-eb11-aabd-00224800d1bd"},13:{@odata.etag:"W/"755038"",name:"Conwy County Borough Council",accountid:"cd5f6f84-49da-eb11-aabd-00224800d1bd"},14:{@odata.etag:"W/"755041"",name:"Denbighshire County Council",accountid:"cf5f6f84-49da-eb11-aabd-00224800d1bd"},15:{@odata.etag:"W/"755044"",name:"Flintshire County Council",accountid:"d15f6f84-49da-eb11-aabd-00224800d1bd"},16:{@odata.etag:"W/"755047"",name:"Gwynedd Council",accountid:"d35f6f84-49da-eb11-aabd-00224800d1bd"},17:{@odata.etag:"W/"755050"",name:"Isle of Anglesey County Council",accountid:"d55f6f84-49da-eb11-aabd-00224800d1bd"},18:{@odata.etag:"W/"755053"",name:"Merthyr Tydfil County Borough Council",accountid:"d75f6f84-49da-eb11-aabd-00224800d1bd"},19:{@odata.etag:"W/"755056"",name:"Monmouthshire County Council",accountid:"d95f6f84-49da-eb11-aabd-00224800d1bd"},20:{@odata.etag:"W/"755059"",name:"Neath Port Talbot County Borough Council",accountid:"db5f6f84-49da-eb11-aabd-00224800d1bd"},21:{@odata.etag:"W/"755062"",name:"Newport City Council",accountid:"dd5f6f84-49da-eb11-aabd-00224800d1bd"},22:{@odata.etag:"W/"755065"",name:"Pembrokeshire County Council",accountid:"df5f6f84-49da-eb11-aabd-00224800d1bd"},23:{@odata.etag:"W/"755068"",name:"Powys County Council",accountid:"e15f6f84-49da-eb11-aabd-00224800d1bd"},24:{@odata.etag:"W/"755071"",name:"Rhondda Cynon Taf County Borough Council",accountid:"e35f6f84-49da-eb11-aabd-00224800d1bd"},25:{@odata.etag:"W/"755074"",name:"Swansea Council",accountid:"e55f6f84-49da-eb11-aabd-00224800d1bd"},26:{@odata.etag:"W/"755077"",name:"Torfaen County Borough Council",accountid:"e75f6f84-49da-eb11-aabd-00224800d1bd"},27:{@odata.etag:"W/"755080"",name:"Vale of Glamorgan Council",accountid:"e95f6f84-49da-eb11-aabd-00224800d1bd"},28:{@odata.etag:"W/"755083"",name:"Wrexham County Borough Council",accountid:"eb5f6f84-49da-eb11-aabd-00224800d1bd"}]}
|
||||
@@ -1,94 +0,0 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { parseCookies, setCookie } from "nookies";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
const COOKIE_NAME = "pedwAiPolicyNoticeHidden";
|
||||
const COOKIE_DAYS = 7;
|
||||
|
||||
export default function AIPolicyNotice() {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const [hasCheckedCookie, setHasCheckedCookie] = useState(false);
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const dismissButtonRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
const cookies = parseCookies();
|
||||
const isHidden = cookies[COOKIE_NAME] === "true";
|
||||
|
||||
setIsOpen(!isHidden);
|
||||
setHasCheckedCookie(true);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen && dismissButtonRef.current) {
|
||||
dismissButtonRef.current.focus();
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
||||
const dismissNotice = () => {
|
||||
const now = new Date();
|
||||
const expDate = new Date(now);
|
||||
|
||||
expDate.setDate(now.getDate() + COOKIE_DAYS);
|
||||
|
||||
setCookie(null, COOKIE_NAME, "true", {
|
||||
path: "/",
|
||||
expires: expDate
|
||||
});
|
||||
|
||||
setIsOpen(false);
|
||||
};
|
||||
|
||||
if (!hasCheckedCookie || !isOpen) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="modal aiModal fade show"
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
padding: "1rem"
|
||||
}}
|
||||
aria-hidden={false}
|
||||
>
|
||||
<div className="modal-dialog" style={{ margin: 0 }}>
|
||||
<div
|
||||
className="modal-content govuk-!-padding-6"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="ai-policy-notice-title"
|
||||
>
|
||||
<h2
|
||||
id="ai-policy-notice-title"
|
||||
className="govuk-heading-m govuk-!-margin-bottom-3"
|
||||
>
|
||||
{t("home:ai-policy-notice-title")}
|
||||
</h2>
|
||||
<p className="govuk-body">
|
||||
{t("home:ai-policy-notice-paragraph-one")}
|
||||
</p>
|
||||
<p className="govuk-body govuk-!-margin-bottom-4">
|
||||
{t("home:ai-policy-notice-paragraph-two")}
|
||||
</p>
|
||||
<button
|
||||
ref={dismissButtonRef}
|
||||
type="button"
|
||||
className="govuk-button govuk-!-margin-bottom-0"
|
||||
data-module="govuk-button"
|
||||
onClick={dismissNotice}
|
||||
>
|
||||
{t("home:ai-policy-notice-dismiss-button")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="modal-backdrop fade show"
|
||||
style={{ opacity: 0.2 }}
|
||||
></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import AccessibilityCY from "./footerDocs/accessibility_cy";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import AccessibilityEN from "./footerDocs/accessibility_en";
|
||||
import AccessibilityCY from "./footerDocs/accessibility_cy";
|
||||
|
||||
const AccessibilityStatement = (props) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import _ from "lodash";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Field, formValueSelector, reduxForm } from "redux-form";
|
||||
import { updatePassword } from "../../actions/services/accountService";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import {
|
||||
Field,
|
||||
reduxForm,
|
||||
formValueSelector,
|
||||
getFormSubmitErrors,
|
||||
} from "redux-form";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { updatePassword } from "../../actions";
|
||||
|
||||
const RenderTextfield = ({
|
||||
id,
|
||||
@@ -60,7 +66,7 @@ const ChangePassword = (props) => {
|
||||
handleSubmit,
|
||||
value,
|
||||
setPasswordUpdated,
|
||||
passwordUpdated
|
||||
passwordUpdated,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -127,9 +133,8 @@ const ChangePassword = (props) => {
|
||||
"/myportal?q=" +
|
||||
props.accountDetails.loggedinUserId
|
||||
}
|
||||
className="govuk-link"
|
||||
>
|
||||
Cancel
|
||||
<a className="govuk-link">Cancel</a>
|
||||
</Link>
|
||||
</div>
|
||||
</form>
|
||||
@@ -141,9 +146,8 @@ const ChangePassword = (props) => {
|
||||
"/myportal?q=" +
|
||||
props.accountDetails.loggedinUserId
|
||||
}
|
||||
className="govuk-link"
|
||||
>
|
||||
Go to My Portal
|
||||
<a className="govuk-link">Go to My Portal</a>
|
||||
</Link>
|
||||
</p>
|
||||
</>
|
||||
@@ -158,7 +162,7 @@ const mapStateToProps = (state) => {
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
accountDetails: state.accountDetails
|
||||
accountDetails: state.accountDetails,
|
||||
//form: state.form,
|
||||
};
|
||||
};
|
||||
@@ -167,7 +171,7 @@ const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentSection: (currentSection) => {
|
||||
dispatch(setCurrentSection(currentSection));
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -179,6 +183,6 @@ export default connect(
|
||||
)(
|
||||
reduxForm({
|
||||
form: "changepasswordForm",
|
||||
destroyOnUnmount: false
|
||||
destroyOnUnmount: false,
|
||||
})(ChangePassword)
|
||||
);
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import _ from "lodash";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Field, formValueSelector, reduxForm } from "redux-form";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import {
|
||||
Field,
|
||||
reduxForm,
|
||||
formValueSelector,
|
||||
getFormSubmitErrors,
|
||||
} from "redux-form";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
|
||||
import BuildCheckPersonalDetails from "./personaldetailsCheck";
|
||||
import PersonalDetailsComplete from "./personaldetailsComplete";
|
||||
@@ -51,148 +57,12 @@ const RenderTextfield = ({
|
||||
id={id}
|
||||
type={type}
|
||||
disabled={disabled ? true : false}
|
||||
maxLength="50"
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const RenderRadioList = ({
|
||||
datafieldname,
|
||||
name,
|
||||
label,
|
||||
id,
|
||||
errorMsg,
|
||||
options,
|
||||
input: { onChange, value },
|
||||
meta: { touched, error },
|
||||
...custom
|
||||
}) => {
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={
|
||||
touched && error
|
||||
? "govuk-form-group govuk-form-group--error"
|
||||
: "govuk-form-group "
|
||||
}
|
||||
>
|
||||
<fieldset
|
||||
className="govuk-fieldset"
|
||||
aria-describedby={name + "-hint"}
|
||||
>
|
||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--s govuk-!-font-weight-regular">
|
||||
<label
|
||||
className="govuk-fieldset__heading govuk-body-m"
|
||||
id={id + "_label"}
|
||||
>
|
||||
{label}
|
||||
</label>
|
||||
</legend>
|
||||
{touched && error && (
|
||||
<span
|
||||
id={id + "-error"}
|
||||
className="govuk-error-message"
|
||||
>
|
||||
<span className="govuk-visually-hidden">
|
||||
Error:
|
||||
</span>{" "}
|
||||
{errorMsg}
|
||||
</span>
|
||||
)}
|
||||
<div className="govuk-radios govuk-radios--small govuk-radios--inline">
|
||||
{Object.keys(options).map((key, index) => (
|
||||
<div
|
||||
className="govuk-radios__item"
|
||||
data-children-count={key}
|
||||
key={key}
|
||||
>
|
||||
<Field
|
||||
id={id + "_" + index}
|
||||
name={id}
|
||||
component="input"
|
||||
type="radio"
|
||||
className="govuk-radios__input"
|
||||
value={options[key]}
|
||||
/>
|
||||
<label
|
||||
className="govuk-label govuk-radios__label"
|
||||
htmlFor={id + "_" + index}
|
||||
>
|
||||
{options[key]}
|
||||
</label>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const RenderPickList = ({
|
||||
datafieldname,
|
||||
name,
|
||||
label,
|
||||
input,
|
||||
optionsArr,
|
||||
meta: { touched, error },
|
||||
errorMsg
|
||||
}) => {
|
||||
let { t, lang } = useTranslation();
|
||||
optionsArr = [
|
||||
t("account:account-preferred-language-english") + ":846040001",
|
||||
t("account:account-preferred-language-welsh") + ":846040000"
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={
|
||||
touched && error
|
||||
? "govuk-form-group govuk-form-group--error"
|
||||
: "govuk-form-group "
|
||||
}
|
||||
>
|
||||
<label className="govuk-label" htmlFor={datafieldname}>
|
||||
{label}
|
||||
</label>
|
||||
{touched && error && (
|
||||
<span id={name + "-error"} className="govuk-error-message">
|
||||
<span className="govuk-visually-hidden">Error:</span>{" "}
|
||||
{errorMsg}
|
||||
</span>
|
||||
)}
|
||||
|
||||
<div>
|
||||
<select
|
||||
{...input}
|
||||
className="govuk-select "
|
||||
id={datafieldname}
|
||||
name={datafieldname}
|
||||
>
|
||||
<option value="" disabled defaultValue>
|
||||
{t("common:drop-down-select")}
|
||||
</option>
|
||||
{Object.keys(optionsArr).map((key, index) => {
|
||||
return (
|
||||
<option
|
||||
key={key}
|
||||
value={optionsArr[key].split(":")[1]}
|
||||
>
|
||||
{optionsArr[key].split(":")[0]}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
let PersonalDetails = (props) => {
|
||||
const {
|
||||
handleSubmit,
|
||||
@@ -202,7 +72,7 @@ let PersonalDetails = (props) => {
|
||||
load,
|
||||
pristine,
|
||||
reset,
|
||||
submitting
|
||||
submitting,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -211,31 +81,18 @@ let PersonalDetails = (props) => {
|
||||
|
||||
let errorsobj = {};
|
||||
|
||||
const required = (value) =>
|
||||
value
|
||||
? undefined
|
||||
: t("account:register-new-account-postcode-label-errormsg");
|
||||
const required = (value) => (value ? undefined : "Is required");
|
||||
const emailRegex =
|
||||
/(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi;
|
||||
|
||||
const email = (value) =>
|
||||
value && !emailRegex.test(value)
|
||||
? t("account:invalid-phone-number-errormsg")
|
||||
: undefined;
|
||||
value && !emailRegex.test(value) ? "Invalid email address" : undefined;
|
||||
const phoneNumber = (value) =>
|
||||
value &&
|
||||
!/^(?:(?:\(?(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?(?:\(?0\)?[\s-]?)?)|(?:\(?0))(?:(?:\d{5}\)?[\s-]?\d{4,5})|(?:\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3}))|(?:\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4})|(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}))(?:[\s-]?(?:x|ext\.?|\#)\d{3,4})?$/i.test(
|
||||
value
|
||||
)
|
||||
? t("account:invalid-phone-number-errormsg")
|
||||
: undefined;
|
||||
|
||||
const postcode = (value) =>
|
||||
value &&
|
||||
!/^([A-Z][A-HJ-Y]?[0-9][A-Z0-9]? ?[0-9][A-Z]{2}|GIR ?0A{2})$/i.test(
|
||||
value
|
||||
)
|
||||
? t("account:register-new-account-postcode-invalid-label-errormsg")
|
||||
? "Invalid phone number"
|
||||
: undefined;
|
||||
|
||||
const [hasErrors, setHasErrors] = useState("");
|
||||
@@ -246,194 +103,156 @@ let PersonalDetails = (props) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="govuk-form-group">
|
||||
{props.accountUpdatedComplete == false ? (
|
||||
props.personalDetailsComplete == false ? (
|
||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||
<fieldset className="govuk-fieldset">
|
||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
||||
<h2 className="govuk-fieldset__heading">
|
||||
{t("account:account-about-you-label")}
|
||||
</h2>
|
||||
</legend>
|
||||
<div className="govuk-form-group ">
|
||||
<span className="govuk-label ">
|
||||
{t("account:account-role-label")}:{" "}
|
||||
{
|
||||
props.props.accountDetails
|
||||
.accountDetails[
|
||||
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
<Field
|
||||
name="pinswg_preferredlanguage"
|
||||
component={RenderPickList}
|
||||
datafieldname={"pinswg_preferredlanguage"}
|
||||
optionsArr={["English", "Welsh"]}
|
||||
className="govuk-input govuk-input--width-20 govuk-radios--inline"
|
||||
validate={[required]}
|
||||
label={t(
|
||||
"account:account-preferred-language-label"
|
||||
)}
|
||||
errorMsg={t("account:is-required-label")}
|
||||
/>
|
||||
|
||||
<Field
|
||||
name="firstname"
|
||||
id="firstname"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required]}
|
||||
label={t(
|
||||
"account:account-first-name-label"
|
||||
)}
|
||||
errorMsg={t("account:is-required-label")}
|
||||
/>
|
||||
<Field
|
||||
name="lastname"
|
||||
id="lastname"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required]}
|
||||
label={t("account:account-last-name-label")}
|
||||
errorMsg={t("account:is-required-label")}
|
||||
/>
|
||||
<Field
|
||||
name="emailaddress1"
|
||||
id="emailaddress1"
|
||||
component={RenderTextfield}
|
||||
type="email"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required, email]}
|
||||
label={t(
|
||||
"account:account-email-address-label"
|
||||
)}
|
||||
disabled
|
||||
/>
|
||||
<Field
|
||||
name="telephone1"
|
||||
id="telephone1"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required, phoneNumber]}
|
||||
label={t("account:account-telephone-label")}
|
||||
/>
|
||||
<Field
|
||||
name="pinswg_companyname"
|
||||
id="pinswg_companyname"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label={t(
|
||||
"account:account-company-group-label"
|
||||
)}
|
||||
errorMsg={t("account:is-required-label")}
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset className="govuk-fieldset">
|
||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
||||
<h2 className="govuk-fieldset__heading">
|
||||
{t(
|
||||
"account:account-your-address-label"
|
||||
)}
|
||||
</h2>
|
||||
</legend>
|
||||
|
||||
<Field
|
||||
name="address1_line1"
|
||||
id="address1_line1"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label={t(
|
||||
"account:account-address-line-1-label"
|
||||
)}
|
||||
validate={[required]}
|
||||
errorMsg={t("account:is-required-label")}
|
||||
/>
|
||||
<Field
|
||||
name="address1_line2"
|
||||
id="address1_line2"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label={t(
|
||||
"account:account-address-line-2-label"
|
||||
)}
|
||||
errorMsg={t("account:is-required-label")}
|
||||
/>
|
||||
<Field
|
||||
name="address1_city"
|
||||
id="address1_city"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-10"
|
||||
label={t("account:account-town-city-label")}
|
||||
validate={[required]}
|
||||
errorMsg={t("account:is-required-label")}
|
||||
/>
|
||||
<Field
|
||||
name="address1_county"
|
||||
id="address1_county"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-10"
|
||||
label={t("account:account-county-label")}
|
||||
validate={[required]}
|
||||
errorMsg={t("account:is-required-label")}
|
||||
/>
|
||||
<Field
|
||||
name="address1_postalcode"
|
||||
id="address1_postalcode"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-5"
|
||||
label={t("account:account-postcode-label")}
|
||||
validate={[required, postcode]}
|
||||
/>
|
||||
</fieldset>
|
||||
<div className="govuk-button-group">
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
>
|
||||
{t("common:continue-button")}
|
||||
</button>
|
||||
<Link
|
||||
href={
|
||||
"/myportal?q=" +
|
||||
props.props.accountDetails
|
||||
.loggedinUserId
|
||||
}
|
||||
className="govuk-link"
|
||||
>
|
||||
{t("common:cancel-link")}
|
||||
</Link>
|
||||
</div>
|
||||
</form>
|
||||
) : (
|
||||
<>
|
||||
<BuildCheckPersonalDetails
|
||||
props={props}
|
||||
setPersonalDetailsComplete={
|
||||
setPersonalDetailsComplete
|
||||
}
|
||||
setAccountUpdatedComplete={
|
||||
setAccountUpdatedComplete
|
||||
}
|
||||
{props.accountUpdatedComplete == false ? (
|
||||
props.personalDetailsComplete == false ? (
|
||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||
<fieldset className="govuk-fieldset">
|
||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
||||
<h2 className="govuk-fieldset__heading">
|
||||
About you
|
||||
</h2>
|
||||
</legend>
|
||||
<Field
|
||||
name="firstname"
|
||||
id="firstname"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required]}
|
||||
label="First name"
|
||||
errorMsg="Is required"
|
||||
/>
|
||||
</>
|
||||
)
|
||||
<Field
|
||||
name="lastname"
|
||||
id="lastname"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required]}
|
||||
label="Last name"
|
||||
errorMsg="Is required"
|
||||
/>
|
||||
<Field
|
||||
name="emailaddress1"
|
||||
id="emailaddress1"
|
||||
component={RenderTextfield}
|
||||
type="email"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required, email]}
|
||||
label="Email address"
|
||||
disabled
|
||||
/>
|
||||
<Field
|
||||
name="telephone1"
|
||||
id="telephone1"
|
||||
component={RenderTextfield}
|
||||
type="number"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required, phoneNumber]}
|
||||
label="Telephone"
|
||||
/>
|
||||
|
||||
<Field
|
||||
name="company"
|
||||
id="company"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label="Company/Group"
|
||||
errorMsg="Is required"
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset className="govuk-fieldset">
|
||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
||||
<h2 className="govuk-fieldset__heading">
|
||||
What is your address?
|
||||
</h2>
|
||||
</legend>
|
||||
|
||||
<Field
|
||||
name="address1_line1"
|
||||
id="address1_line1"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label="Address line 1"
|
||||
validate={[required]}
|
||||
errorMsg="Is required"
|
||||
/>
|
||||
<Field
|
||||
name="address1_line2"
|
||||
id="address1_line2"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label="Address line 2"
|
||||
errorMsg="Is required"
|
||||
/>
|
||||
<Field
|
||||
name="address1_city"
|
||||
id="address1_city"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-10"
|
||||
label="Town/City"
|
||||
validate={[required]}
|
||||
errorMsg="Is required"
|
||||
/>
|
||||
<Field
|
||||
name="address1_county"
|
||||
id="address1_county"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-10"
|
||||
label="County"
|
||||
validate={[required]}
|
||||
errorMsg="Is required"
|
||||
/>
|
||||
<Field
|
||||
name="address1_postalcode"
|
||||
id="address1_postalcode"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-5"
|
||||
label="Postcode"
|
||||
validate={[required]}
|
||||
errorMsg="Is required"
|
||||
/>
|
||||
</fieldset>
|
||||
<div className="govuk-button-group">
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
>
|
||||
Continue
|
||||
</button>
|
||||
<Link
|
||||
href={
|
||||
"/myportal?q=" +
|
||||
props.props.accountDetails.loggedinUserId
|
||||
}
|
||||
>
|
||||
<a className="govuk-link">Cancel</a>
|
||||
</Link>
|
||||
</div>
|
||||
</form>
|
||||
) : (
|
||||
<PersonalDetailsComplete props={props} />
|
||||
)}
|
||||
</div>
|
||||
<>
|
||||
<BuildCheckPersonalDetails
|
||||
props={props}
|
||||
setPersonalDetailsComplete={
|
||||
setPersonalDetailsComplete
|
||||
}
|
||||
setAccountUpdatedComplete={
|
||||
setAccountUpdatedComplete
|
||||
}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
) : (
|
||||
<PersonalDetailsComplete props={props} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -444,7 +263,7 @@ const mapStateToProps = (state) => {
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
accountDetails: state.accountDetails
|
||||
accountDetails: state.accountDetails,
|
||||
//form: state.form,
|
||||
};
|
||||
};
|
||||
@@ -453,7 +272,7 @@ const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentSection: (currentSection) => {
|
||||
dispatch(setCurrentSection(currentSection));
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -484,12 +303,12 @@ const selector = formValueSelector("personalDetailsForm"); // <-- same as form n
|
||||
PersonalDetails = reduxForm({
|
||||
form: "personalDetailsForm",
|
||||
enableReinitialize: true, // this is needed!!
|
||||
destroyOnUnmount: false
|
||||
destroyOnUnmount: false,
|
||||
})(PersonalDetails);
|
||||
|
||||
// You have to connect() to any reducers that you wish to connect to yourself
|
||||
PersonalDetails = connect((state) => ({
|
||||
initialValues: state.accountDetails.accountDetails // pull initial values from account reducer
|
||||
initialValues: state.accountDetails.accountDetails, // pull initial values from account reducer
|
||||
}))(PersonalDetails);
|
||||
|
||||
export default PersonalDetails;
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import _ from "lodash";
|
||||
import Link from "next/link";
|
||||
import React, { useState } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import {
|
||||
Field,
|
||||
reduxForm,
|
||||
formValueSelector,
|
||||
getFormSubmitErrors,
|
||||
} from "redux-form";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
|
||||
const BuildCheckPersonalDetails = (props) => {
|
||||
const {
|
||||
@@ -11,29 +18,19 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
handleSubmit,
|
||||
value,
|
||||
setPersonalDetailsComplete,
|
||||
setAccountUpdatedComplete
|
||||
setAccountUpdatedComplete,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
const getPreferredLanguageLabel = (id) => {
|
||||
return id == 846040001
|
||||
? t("account:account-preferred-language-english")
|
||||
: t("account:account-preferred-language-welsh");
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<h2 className="govuk-heading-m">
|
||||
{t("account:account-about-you-label")}
|
||||
</h2>
|
||||
<h2 className="govuk-heading-m">About you</h2>
|
||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9">
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{t("account:account-first-name-label")}
|
||||
</dt>
|
||||
<dt className="govuk-summary-list__key">First name</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.props.form.personalDetailsForm.values
|
||||
@@ -48,18 +45,15 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
setPersonalDetailsComplete(false);
|
||||
}}
|
||||
>
|
||||
{t("common:change-link-label")}
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{t("account:account-first-name-label")}{" "}
|
||||
first name
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{" "}
|
||||
{t("account:account-last-name-label")}
|
||||
</dt>
|
||||
<dt className="govuk-summary-list__key">Last name</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.props.form.personalDetailsForm.values
|
||||
@@ -74,19 +68,16 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
setPersonalDetailsComplete(false);
|
||||
}}
|
||||
>
|
||||
{t("common:change-link-label")}
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
{t("account:account-last-name-label")}
|
||||
last name
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{" "}
|
||||
{t("account:account-email-address-label")}
|
||||
</dt>
|
||||
<dt className="govuk-summary-list__key">Email address</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.props.form.personalDetailsForm.values
|
||||
@@ -101,18 +92,16 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
setPersonalDetailsComplete(false);
|
||||
}}
|
||||
>
|
||||
{t("common:change-link-label")}
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
{t("account:account-email-address-label")}
|
||||
email address
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{t("account:account-telephone-label")}
|
||||
</dt>
|
||||
<dt className="govuk-summary-list__key">Telephone</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.props.form.personalDetailsForm.values
|
||||
@@ -127,22 +116,19 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
setPersonalDetailsComplete(false);
|
||||
}}
|
||||
>
|
||||
{t("common:change-link-label")}
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{t("account:account-telephone-label")}
|
||||
telephone
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{" "}
|
||||
{t("account:account-company-group-label")}
|
||||
</dt>
|
||||
<dt className="govuk-summary-list__key">Company/Group</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.props.form.personalDetailsForm.values
|
||||
.pinswg_companyname
|
||||
.company
|
||||
}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__actions">
|
||||
@@ -153,50 +139,20 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
setPersonalDetailsComplete(false);
|
||||
}}
|
||||
>
|
||||
{t("common:change-link-label")}
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
{t("account:account-company-group-label")}
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{t("account:account-preferred-language-label")}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{getPreferredLanguageLabel(
|
||||
props.props.props.form.personalDetailsForm.values
|
||||
.pinswg_preferredlanguage
|
||||
)}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__actions">
|
||||
<a
|
||||
className="govuk-link"
|
||||
href="#company"
|
||||
onClick={() => {
|
||||
setPersonalDetailsComplete(false);
|
||||
}}
|
||||
>
|
||||
{t("common:change-link-label")}
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
{t("account:account-preferred-language-label")}
|
||||
company/group
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<h2 className="govuk-heading-m">
|
||||
{" "}
|
||||
{t("account:account-your-address-label")}
|
||||
</h2>
|
||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9">
|
||||
<h2 className="govuk-heading-m">Your address</h2>
|
||||
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{t("account:account-address-line-1-label")}
|
||||
</dt>
|
||||
<dt className="govuk-summary-list__key">Address Line 1</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.props.form.personalDetailsForm.values
|
||||
@@ -211,18 +167,16 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
setPersonalDetailsComplete(false);
|
||||
}}
|
||||
>
|
||||
{t("common:change-link-label")}
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
{t("account:account-address-line-1-label")}
|
||||
address line 1
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{t("account:account-address-line-2-label")}
|
||||
</dt>
|
||||
<dt className="govuk-summary-list__key">Address line 2</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.props.form.personalDetailsForm.values
|
||||
@@ -237,18 +191,16 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
setPersonalDetailsComplete(false);
|
||||
}}
|
||||
>
|
||||
{t("common:change-link-label")}
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
{t("account:account-address-line-2-label")}
|
||||
address line 2
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{t("account:account-town-city-label")}
|
||||
</dt>
|
||||
<dt className="govuk-summary-list__key">Town/City</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.props.form.personalDetailsForm.values
|
||||
@@ -263,19 +215,16 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
setPersonalDetailsComplete(false);
|
||||
}}
|
||||
>
|
||||
{t("common:change-link-label")}
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
{t("account:account-town-city-label")}
|
||||
town/city
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{" "}
|
||||
{t("account:account-county-label")}
|
||||
</dt>
|
||||
<dt className="govuk-summary-list__key">County</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.props.form.personalDetailsForm.values
|
||||
@@ -290,19 +239,16 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
setPersonalDetailsComplete(false);
|
||||
}}
|
||||
>
|
||||
{t("common:change-link-label")}
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
{t("account:account-county-label")}
|
||||
county
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{" "}
|
||||
{t("account:account-postcode-label")}
|
||||
</dt>
|
||||
<dt className="govuk-summary-list__key">Postcode</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.props.form.personalDetailsForm.values
|
||||
@@ -317,10 +263,10 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
setPersonalDetailsComplete(false);
|
||||
}}
|
||||
>
|
||||
{t("common:change-link-label")}
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
{t("account:account-postcode-label")}
|
||||
postcode
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
@@ -335,13 +281,12 @@ const BuildCheckPersonalDetails = (props) => {
|
||||
setAccountUpdatedComplete(true);
|
||||
}}
|
||||
>
|
||||
{t("common:continue-button")}
|
||||
Continue
|
||||
</button>
|
||||
<Link
|
||||
href={"/myportal?q=" + props.accountDetails.loggedinUserId}
|
||||
className="govuk-link"
|
||||
>
|
||||
{t("common:back-link")}
|
||||
<a className="govuk-link">Cancel</a>
|
||||
</Link>
|
||||
</div>
|
||||
</>
|
||||
@@ -354,7 +299,7 @@ const mapStateToProps = (state) => {
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
accountDetails: state.accountDetails
|
||||
accountDetails: state.accountDetails,
|
||||
//form: state.form,
|
||||
};
|
||||
};
|
||||
@@ -363,7 +308,7 @@ const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentSection: (currentSection) => {
|
||||
dispatch(setCurrentSection(currentSection));
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,71 +1,60 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import _ from "lodash";
|
||||
import Link from "next/link";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import React, { useEffect } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { updateAccount } from "../../actions/services/accountService";
|
||||
import { setCookie } from "nookies";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import {
|
||||
Field,
|
||||
reduxForm,
|
||||
formValueSelector,
|
||||
getFormSubmitErrors,
|
||||
} from "redux-form";
|
||||
import {
|
||||
useDispatch,
|
||||
useSelector,
|
||||
shallowEqual,
|
||||
connect,
|
||||
setRegisterFormComplete,
|
||||
setAccountCreatedComplete,
|
||||
} from "react-redux";
|
||||
import { updateAccount } from "../../actions";
|
||||
|
||||
const PersonalDetailsComplete = (props) => {
|
||||
const {
|
||||
handleSubmit,
|
||||
value,
|
||||
setRegisterFormComplete,
|
||||
setAccountCreatedComplete
|
||||
setAccountCreatedComplete,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
// let contactid = props.accountDetails.loggedinUserId;
|
||||
// let updateBody = props.props.props.form.personalDetailsForm.values;
|
||||
// let prefLang =
|
||||
// props.props.props.form.personalDetailsForm.values
|
||||
// .pinswg_preferredlanguage;
|
||||
|
||||
const { loggedinUserId } = props.accountDetails || {};
|
||||
const formValues = props.props?.props?.form?.personalDetailsForm?.values;
|
||||
const prefLang = formValues?.pinswg_preferredlanguage;
|
||||
|
||||
const userLang = prefLang === "846040000" ? "cy" : "en"; // Move this outside useEffect
|
||||
|
||||
useEffect(() => {
|
||||
// let contactid = props.accountDetails.loggedinUserId;
|
||||
// let updateBody = props.props.props.form.personalDetailsForm.values;
|
||||
// let prefLang =
|
||||
// props.props.props.form.personalDetailsForm.values
|
||||
// .pinswg_preferredlanguage;
|
||||
if (!loggedinUserId || !formValues) return;
|
||||
|
||||
console.log("=============== pref lang", prefLang);
|
||||
setCookie(null, "pedw_locale", userLang, {
|
||||
path: "/"
|
||||
});
|
||||
|
||||
console.log("Set cookie to:", userLang);
|
||||
|
||||
async function doUpdate() {
|
||||
const response = await updateAccount(loggedinUserId, formValues);
|
||||
}
|
||||
|
||||
doUpdate();
|
||||
}, [loggedinUserId, formValues, prefLang, userLang]);
|
||||
let contactid = props.accountDetails.loggedinUserId;
|
||||
let updateBody = props.props.props.form.personalDetailsForm.values;
|
||||
updateAccount(contactid, updateBody);
|
||||
}, [
|
||||
props.accountDetails.loggedinUserId,
|
||||
props.props.props.form.personalDetailsForm.values,
|
||||
]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<p className="govuk-body">{t("account:account-complete-para-1")}</p>
|
||||
<p className="govuk-body">Your details have been updated</p>
|
||||
|
||||
{/* <p className="govuk-body">{t("account:account-complete-para-2")}</p> */}
|
||||
<p className="govuk-body">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi a
|
||||
metus non quam mollis egestas. Integer ac leo cursus, laoreet
|
||||
nulla sed, tempus tellus. Mauris condimentum erat arcu.
|
||||
</p>
|
||||
|
||||
<p className="govuk-body">
|
||||
<Link
|
||||
locale={userLang}
|
||||
href={userLang === "cy" ? "/cy/fymhorth" : "/myportal"}
|
||||
className="govuk-link"
|
||||
href={"/myportal?q=" + props.accountDetails.loggedinUserId}
|
||||
>
|
||||
{" "}
|
||||
{t("account:account-complete-return-to-portal-link")}
|
||||
<a className="govuk-link">Return to My Portal</a>
|
||||
</Link>
|
||||
</p>
|
||||
</>
|
||||
@@ -78,7 +67,7 @@ const mapStateToProps = (state) => {
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
accountDetails: state.accountDetails
|
||||
accountDetails: state.accountDetails,
|
||||
//form: state.form,
|
||||
};
|
||||
};
|
||||
@@ -87,7 +76,7 @@ const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentSection: (currentSection) => {
|
||||
dispatch(setCurrentSection(currentSection));
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import _ from "lodash";
|
||||
import React, { useState } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import {
|
||||
Field,
|
||||
reduxForm,
|
||||
formValueSelector,
|
||||
getFormSubmitErrors,
|
||||
} from "redux-form";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { setAccCr } from "../../store/accountDetails/action";
|
||||
|
||||
const RegisterFormCheck = (props) => {
|
||||
@@ -137,6 +144,30 @@ const RegisterFormCheck = (props) => {
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
{/* <div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">Company/Group</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.props.form.accountRegisterForm.values
|
||||
.companygroup
|
||||
}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__actions">
|
||||
<a
|
||||
className="govuk-link"
|
||||
href="#"
|
||||
onClick={() => {
|
||||
setRegisterFormComplete(false);
|
||||
}}
|
||||
>
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
company/group
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div> */}
|
||||
</dl>
|
||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9">
|
||||
<h2 className="govuk-heading-m">
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
import _ from "lodash";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import jsonpath from "jsonpath";
|
||||
import {
|
||||
Field,
|
||||
reduxForm,
|
||||
formValueSelector,
|
||||
getFormSubmitErrors,
|
||||
} from "redux-form";
|
||||
import {
|
||||
useDispatch,
|
||||
useSelector,
|
||||
shallowEqual,
|
||||
connect,
|
||||
setRegisterFormComplete,
|
||||
setAccountCreatedComplete,
|
||||
} from "react-redux";
|
||||
|
||||
import { setAccCr, setLogout } from "../../store/accountDetails/action";
|
||||
|
||||
import {
|
||||
createAccount,
|
||||
getEmailAccountCheck
|
||||
} from "../../actions/services/accountService";
|
||||
import { getEmailAccountCheck, createAccount } from "../../actions";
|
||||
|
||||
const RegisterComplete = (props) => {
|
||||
const {
|
||||
@@ -21,7 +32,7 @@ const RegisterComplete = (props) => {
|
||||
value,
|
||||
setRegisterFormComplete,
|
||||
setAccountCreatedComplete,
|
||||
setAccCr
|
||||
setAccCr,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -34,17 +45,14 @@ const RegisterComplete = (props) => {
|
||||
let accountBody = props.props.props.form.accountRegisterForm.values;
|
||||
let emailAddress =
|
||||
props.props.props.form.accountRegisterForm.values.emailaddress1;
|
||||
|
||||
// was an appellant "pinswg_typeofinvolvement": 846040001,
|
||||
Object.assign(accountBody, {
|
||||
"pinswg_typeofinvolvement": 846040061
|
||||
"pinswg_typeofinvolvement": 846040001,
|
||||
});
|
||||
|
||||
accountBody = _.omit(accountBody, ["custom_password_check"]);
|
||||
|
||||
let checkEmailObj = {};
|
||||
|
||||
console.log("props.accountDetails.accCr :", props.accountDetails.accCr);
|
||||
switch (props.accountDetails.accCr) {
|
||||
case "created":
|
||||
case "exists":
|
||||
@@ -58,6 +66,7 @@ const RegisterComplete = (props) => {
|
||||
? setAccCr("exists")
|
||||
: (checkEmailObj = createAccount(accountBody).then(
|
||||
(data) => {
|
||||
//console.log(data);
|
||||
setAccCr("created");
|
||||
}
|
||||
));
|
||||
@@ -86,12 +95,17 @@ const RegisterComplete = (props) => {
|
||||
</p>
|
||||
|
||||
<p className="govuk-body">
|
||||
{t("account:register-new-account-paragraph-thanks")}
|
||||
</p>
|
||||
|
||||
<p className="govuk-body">
|
||||
<Link href="/" className="govuk-link">
|
||||
{t("account:register-new-account-my-portal-link")}
|
||||
<Link href="/">
|
||||
<a
|
||||
className="govuk-link"
|
||||
onClick={() => {
|
||||
setLogout(), window.localStorage.clear();
|
||||
}}
|
||||
>
|
||||
{t(
|
||||
"account:register-new-account-my-portal-link"
|
||||
)}
|
||||
</a>
|
||||
</Link>
|
||||
</p>
|
||||
</>
|
||||
@@ -108,9 +122,9 @@ const RegisterComplete = (props) => {
|
||||
<p className="govuk-body">
|
||||
<a
|
||||
onClick={() => {
|
||||
(setRegisterFormComplete(false),
|
||||
setRegisterFormComplete(false),
|
||||
setAccountCreatedComplete(false),
|
||||
setAccCr(false));
|
||||
setAccCr(false);
|
||||
}}
|
||||
className="govuk-link"
|
||||
>
|
||||
@@ -133,7 +147,7 @@ const mapStateToProps = (state) => {
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
accountDetails: state.accountDetails
|
||||
accountDetails: state.accountDetails,
|
||||
//form: state.form,
|
||||
};
|
||||
};
|
||||
@@ -145,7 +159,7 @@ const mapDispatchToProps = (dispatch) => {
|
||||
},
|
||||
setLogout: () => {
|
||||
dispatch(setLogout());
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+195
-177
@@ -1,8 +1,14 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
import _ from "lodash";
|
||||
import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Field, formValueSelector, reduxForm } from "redux-form";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import {
|
||||
Field,
|
||||
reduxForm,
|
||||
formValueSelector,
|
||||
getFormSubmitErrors,
|
||||
} from "redux-form";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
|
||||
import RegisterFormCheck from "./registerCheck";
|
||||
import RegisterComplete from "./registerComplete";
|
||||
@@ -66,7 +72,7 @@ const RegisterForm = (props) => {
|
||||
setRegisterFormComplete,
|
||||
setAccountCreatedComplete,
|
||||
loggedInUserEmail,
|
||||
emailaddress1
|
||||
emailaddress1,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -78,10 +84,7 @@ const RegisterForm = (props) => {
|
||||
const emailRegex =
|
||||
/(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi;
|
||||
|
||||
const required = (value) =>
|
||||
value
|
||||
? undefined
|
||||
: t("account:register-new-account-postcode-label-errormsg");
|
||||
const required = (value) => (value ? undefined : "Is required");
|
||||
const email = (value) =>
|
||||
value && !emailRegex.test(value) ? "Invalid email address" : undefined;
|
||||
const phoneNumber = (value) =>
|
||||
@@ -103,20 +106,14 @@ const RegisterForm = (props) => {
|
||||
: undefined;
|
||||
const minLength5 = minLength(5);
|
||||
|
||||
const postcode = (value) =>
|
||||
value &&
|
||||
!/^([A-Z][A-HJ-Y]?[0-9][A-Z0-9]? ?[0-9][A-Z]{2}|GIR ?0A{2})$/i.test(
|
||||
value
|
||||
)
|
||||
? t("account:register-new-account-postcode-invalid-label-errormsg")
|
||||
: undefined;
|
||||
|
||||
const [hasErrors, setHasErrors] = useState("");
|
||||
|
||||
const onHandleSubmit = (values) => {
|
||||
//console.log(values);
|
||||
setRegisterFormComplete(true);
|
||||
};
|
||||
|
||||
//console.log(pristine);
|
||||
return (
|
||||
<>
|
||||
{!pristine && !valid && (
|
||||
@@ -137,164 +134,185 @@ const RegisterForm = (props) => {
|
||||
{props.accountCreatedComplete != true ? (
|
||||
props.registerFormComplete == false ? (
|
||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||
<div className="card" id="personalDetailsCard">
|
||||
<div className="card-body">
|
||||
<fieldset className="govuk-fieldset">
|
||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
||||
<h2 className="govuk-fieldset__heading">
|
||||
{t(
|
||||
"account:register-new-account-sub-heading-1"
|
||||
)}{" "}
|
||||
{loggedInUserEmail}
|
||||
</h2>
|
||||
</legend>
|
||||
<Field
|
||||
name="firstname"
|
||||
id="firstname"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required]}
|
||||
label={t(
|
||||
"account:register-new-account-first-name-label"
|
||||
)}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-first-name-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="lastname"
|
||||
id="lastname"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required]}
|
||||
label={t(
|
||||
"account:register-new-account-last-name-label"
|
||||
)}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-last-name-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="emailaddress1"
|
||||
id="emailaddress1"
|
||||
component={RenderTextfield}
|
||||
type="email"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required, email]}
|
||||
label={t(
|
||||
"account:register-new-account-email-address-label"
|
||||
)}
|
||||
disabled
|
||||
/>
|
||||
<Field
|
||||
name="telephone1"
|
||||
id="telephone1"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required, phoneNumber]}
|
||||
label={t(
|
||||
"account:register-new-account-phone-label"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="company"
|
||||
id="company"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required]}
|
||||
label={t(
|
||||
"account:register-new-account-company-label"
|
||||
)}
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset className="govuk-fieldset">
|
||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
||||
<h2 className="govuk-fieldset__heading">
|
||||
{t(
|
||||
"account:register-new-account-sub-heading-2"
|
||||
)}
|
||||
</h2>
|
||||
</legend>
|
||||
<fieldset className="govuk-fieldset">
|
||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
||||
<h2 className="govuk-fieldset__heading">
|
||||
{t(
|
||||
"account:register-new-account-sub-heading-1"
|
||||
)}{" "}
|
||||
{loggedInUserEmail}
|
||||
</h2>
|
||||
</legend>
|
||||
<Field
|
||||
name="firstname"
|
||||
id="firstname"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required]}
|
||||
label={t(
|
||||
"account:register-new-account-first-name-label"
|
||||
)}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-first-name-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="lastname"
|
||||
id="lastname"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required]}
|
||||
label={t(
|
||||
"account:register-new-account-last-name-label"
|
||||
)}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-last-name-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="emailaddress1"
|
||||
id="emailaddress1"
|
||||
component={RenderTextfield}
|
||||
type="email"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required, email]}
|
||||
label={t(
|
||||
"account:register-new-account-email-address-label"
|
||||
)}
|
||||
disabled
|
||||
/>
|
||||
<Field
|
||||
name="telephone1"
|
||||
id="telephone1"
|
||||
component={RenderTextfield}
|
||||
type="number"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required, phoneNumber]}
|
||||
label={t(
|
||||
"account:register-new-account-phone-label"
|
||||
)}
|
||||
/>
|
||||
|
||||
<Field
|
||||
name="address1_line1"
|
||||
id="address1_line1"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label={t(
|
||||
"account:register-new-account-address-line-1-label"
|
||||
)}
|
||||
validate={[required]}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-address-line-1-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="address1_line2"
|
||||
id="address1_line2"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label={t(
|
||||
"account:register-new-account-address-line-2-label"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="address1_city"
|
||||
id="address1_city"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-10"
|
||||
label={t(
|
||||
"account:register-new-account-town-label"
|
||||
)}
|
||||
validate={[required]}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-town-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="address1_county"
|
||||
id="address1_county"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-10"
|
||||
label={t(
|
||||
"account:register-new-account-county-label"
|
||||
)}
|
||||
validate={[required]}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-county-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="address1_postalcode"
|
||||
id="address1_postalcode"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-5"
|
||||
label={t(
|
||||
"account:register-new-account-postcode-label"
|
||||
)}
|
||||
validate={[required, postcode]}
|
||||
/>
|
||||
</fieldset>
|
||||
<Field
|
||||
name="pinswg_custom_password"
|
||||
id="pinswg_custom_password"
|
||||
component={RenderTextfield}
|
||||
type="password"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label={t(
|
||||
"account:register-new-account-password-label"
|
||||
)}
|
||||
validate={[required, minLength5]}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-password-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="custom_password_check"
|
||||
id="custom_password_check"
|
||||
component={RenderTextfield}
|
||||
type="password"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label={t(
|
||||
"account:register-new-account-confirm-password-label"
|
||||
)}
|
||||
validate={[
|
||||
required,
|
||||
passwordsMatch,
|
||||
minLength5,
|
||||
]}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-confirm-password-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset className="govuk-fieldset">
|
||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
||||
<h2 className="govuk-fieldset__heading">
|
||||
{t(
|
||||
"account:register-new-account-sub-heading-2"
|
||||
)}
|
||||
</h2>
|
||||
</legend>
|
||||
|
||||
<div className="govuk-button-group">
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
>
|
||||
{t("common:continue-button")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<Field
|
||||
name="address1_line1"
|
||||
id="address1_line1"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label={t(
|
||||
"account:register-new-account-address-line-1-label"
|
||||
)}
|
||||
validate={[required]}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-address-line-1-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="address1_line2"
|
||||
id="address1_line2"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
label={t(
|
||||
"account:register-new-account-address-line-2-label"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="address1_city"
|
||||
id="address1_city"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-10"
|
||||
label={t(
|
||||
"account:register-new-account-town-label"
|
||||
)}
|
||||
validate={[required]}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-town-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="address1_county"
|
||||
id="address1_county"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-10"
|
||||
label={t(
|
||||
"account:register-new-account-county-label"
|
||||
)}
|
||||
validate={[required]}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-county-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
<Field
|
||||
name="address1_postalcode"
|
||||
id="address1_postalcode"
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-5"
|
||||
label={t(
|
||||
"account:register-new-account-postcode-label"
|
||||
)}
|
||||
validate={[required]}
|
||||
errorMsg={t(
|
||||
"account:register-new-account-postcode-label-errormsg"
|
||||
)}
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<div className="govuk-button-group">
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
>
|
||||
{t("common:continue-button")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
) : (
|
||||
@@ -323,8 +341,8 @@ const mapStateToProps = (state, props) => {
|
||||
appealType: state.appealType,
|
||||
//form: state.form,
|
||||
initialValues: {
|
||||
emailaddress1: props.loggedInUserEmail
|
||||
}
|
||||
emailaddress1: props.loggedInUserEmail,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -332,7 +350,7 @@ const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentSection: (currentSection) => {
|
||||
dispatch(setCurrentSection(currentSection));
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -345,6 +363,6 @@ export default connect(
|
||||
reduxForm({
|
||||
form: "accountRegisterForm",
|
||||
enableReinitialize: true,
|
||||
destroyOnUnmount: false
|
||||
destroyOnUnmount: false,
|
||||
})(RegisterForm)
|
||||
);
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
import AddressSearch from "./search/addresssearch";
|
||||
|
||||
export default function Search(props) {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
//console.log("props here:", props.myportal || false);
|
||||
|
||||
return (
|
||||
<main
|
||||
className="govuk-main-wrapper govuk-main-wrapper--auto-spacing"
|
||||
id="main-content"
|
||||
role="main"
|
||||
>
|
||||
<AddressSearch myportal={props.myportal || false} />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import CRMError from "./crmError";
|
||||
import SearchResults from "./search/addresssearchresults";
|
||||
|
||||
export default function Search(props) {
|
||||
const {
|
||||
searchString,
|
||||
searchResultsObj,
|
||||
advancedSearch,
|
||||
myportal,
|
||||
watchedCases,
|
||||
isLinkedCase,
|
||||
showLoginCheck,
|
||||
} = props;
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
var hasError = _.has(searchResultsObj.searchResultsObj, "errorCode")
|
||||
? true
|
||||
: false;
|
||||
|
||||
//console.log("has an error", hasError);
|
||||
|
||||
return (
|
||||
<main
|
||||
className="govuk-main-wrapper govuk-main-wrapper--auto-spacing"
|
||||
id="main-content"
|
||||
role="main"
|
||||
>
|
||||
{hasError ? (
|
||||
<CRMError props={props} />
|
||||
) : (
|
||||
<>
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<SearchResults
|
||||
advancedSearch={advancedSearch}
|
||||
searchString={searchString}
|
||||
searchResultsObj={
|
||||
searchResultsObj.searchResultsObj
|
||||
}
|
||||
searchDetailsObj={
|
||||
searchResultsObj.searchDetailsObj
|
||||
}
|
||||
myportal={myportal}
|
||||
watchedCases={watchedCases}
|
||||
isLinkedCase={isLinkedCase}
|
||||
showLoginCheck={showLoginCheck}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="govuk-button-group">
|
||||
<Link
|
||||
href="/addresssearch"
|
||||
className="govuk-button"
|
||||
>
|
||||
{t("common:breadcrumb-address-search")}
|
||||
</Link>
|
||||
{/* <a
|
||||
onClick={() => router.back()}
|
||||
className="govuk-button govuk-button--secondary"
|
||||
>
|
||||
{t("search:searchresults-new-search-button-label")}
|
||||
</a> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// components/admin/tabs/AccountsTab.js
|
||||
import Link from "next/link";
|
||||
|
||||
export default function AccountsTab({ userData }) {
|
||||
return (
|
||||
<div>
|
||||
<h1>User Accounts</h1>
|
||||
<p>Number of accounts created: {userData.length}</p>
|
||||
|
||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
||||
<div className="govuk-summary-list__row results-headings">
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
Name
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
Last accessed
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
{userData.map((user) => (
|
||||
<div key={user.id} className="govuk-summary-list__row">
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||
<Link
|
||||
target="_blank"
|
||||
href={`/auth/signin2?email=${user.email}`}
|
||||
>
|
||||
{user.email}
|
||||
</Link>
|
||||
<br />
|
||||
{user.id}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||
Last accessed: {user.created}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,571 +0,0 @@
|
||||
// components/admin/tabs/AppealsTab.js
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useCallback, useState, useEffect } from "react";
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import PaginationControl from "../../../components/search/pagination";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails
|
||||
} from "../../../store/searchOutput/action";
|
||||
|
||||
import { getDetailsProxy, getSearchDetailsPaged } from "../../utils";
|
||||
import { getAdvancedSearchPaged } from "../../../actions/services/searchService";
|
||||
import { getNewAppealsPage } from "../../../actions/services/adminService";
|
||||
import {
|
||||
setCurrentPage,
|
||||
setCurrentReference
|
||||
} from "../../../store/currentView/action";
|
||||
|
||||
function AppealsTab(props) {
|
||||
const [searchLoaded, setSearchLoaded] = useState(false);
|
||||
const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||
const [selectedOption, setSelectedOption] = useState(10);
|
||||
const [orderByState, setOrderbyState] = useState("createdon");
|
||||
const [fieldSortState, setfieldSortState] = useState("desc");
|
||||
const [loginToWatch, setLoginToWatch] = useState("true");
|
||||
|
||||
const {
|
||||
searchResultsObj: searchResultsState,
|
||||
setSearchResults,
|
||||
setSearchDetails
|
||||
} = props;
|
||||
|
||||
const searchDetailsObj = searchResultsState.searchDetailsObj || {};
|
||||
const resultsArr = searchResultsState.searchResultsObj.value || [];
|
||||
const searchResultsObj = searchResultsState.searchResultsObj;
|
||||
|
||||
const { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
const myportal = false;
|
||||
const advancedSearch = false;
|
||||
const searchString = "";
|
||||
|
||||
const spinnerState = () => {
|
||||
setShowSpinnerState((prev) => !prev);
|
||||
};
|
||||
|
||||
const pagesCount = Math.ceil(searchResultsObj["@odata.count"] / 10);
|
||||
|
||||
let currentPage = 0;
|
||||
try {
|
||||
currentPage = decodeURI(searchResultsObj["@odata.nextLink"]).split(
|
||||
"skiptoken="
|
||||
)[1];
|
||||
currentPage =
|
||||
typeof currentPage !== "undefined"
|
||||
? parseInt(
|
||||
decodeURI(currentPage)
|
||||
.split('pagenumber="')[1]
|
||||
.slice(
|
||||
0,
|
||||
decodeURI(currentPage)
|
||||
.split('pagenumber="')[1]
|
||||
.indexOf('"')
|
||||
) - 1
|
||||
)
|
||||
: pagesCount;
|
||||
} catch (e) {
|
||||
currentPage = pagesCount;
|
||||
}
|
||||
|
||||
const getSearchPageResults = useCallback(
|
||||
(pageNumber, orderBy, fieldSort) => {
|
||||
getNewAppealsPage(
|
||||
searchString,
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
selectedOption
|
||||
).then((data) => {
|
||||
setSearchResults(data);
|
||||
return getSearchDetailsPaged(data).then((details) => {
|
||||
setSearchDetails(details);
|
||||
setShowSpinnerState(false);
|
||||
});
|
||||
});
|
||||
},
|
||||
[selectedOption, setSearchDetails, setSearchResults]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (searchLoaded) {
|
||||
if (selectedOption) {
|
||||
setShowSpinnerState(true);
|
||||
getSearchPageResults(1, orderByState, fieldSortState);
|
||||
}
|
||||
} else {
|
||||
setSearchLoaded(true);
|
||||
}
|
||||
}, [
|
||||
selectedOption,
|
||||
fieldSortState,
|
||||
orderByState,
|
||||
searchLoaded,
|
||||
getSearchPageResults,
|
||||
router.query
|
||||
]);
|
||||
|
||||
const ResultsView = (resultsArr) => {
|
||||
return (
|
||||
<>
|
||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
||||
<div className="govuk-summary-list__row results-headings">
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16 results_wider ">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => sortDataBy("title")}
|
||||
className={
|
||||
orderByState == "title"
|
||||
? fieldSortState == "asc"
|
||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
||||
}
|
||||
>
|
||||
{t("search:searchresults-case-reference-label")}
|
||||
</button>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
{t("search:searchresults-site-address-label")}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => sortDataBy("_customerid_value")}
|
||||
className={
|
||||
orderByState == "_customerid_value"
|
||||
? fieldSortState == "asc"
|
||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
||||
}
|
||||
>
|
||||
{t("search:searchresults-applicant-label")}
|
||||
</button>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
sortDataBy("_pinswg_associatedlpa_value")
|
||||
}
|
||||
className={
|
||||
orderByState ==
|
||||
"_pinswg_associatedlpa_value"
|
||||
? fieldSortState == "asc"
|
||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
||||
}
|
||||
>
|
||||
{t("search:searchresults-authority-label")}
|
||||
</button>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
sortDataBy("pinswg_appealcasetype")
|
||||
}
|
||||
className={
|
||||
orderByState == "pinswg_appealcasetype"
|
||||
? fieldSortState == "asc"
|
||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
||||
}
|
||||
>
|
||||
{t("search:searchresults-case-type-label")}
|
||||
</button>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
{/* {t("search:searchresults-status-label")} */}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => sortDataBy("statuscode")}
|
||||
className={
|
||||
orderByState == "statuscode"
|
||||
? fieldSortState == "asc"
|
||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
||||
}
|
||||
>
|
||||
{t("search:searchresults-status-label")}
|
||||
</button>
|
||||
</dd>
|
||||
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16 govuk-summary-list__action">
|
||||
Origin
|
||||
</dd>
|
||||
</div>
|
||||
{showSpinnerState == true ? (
|
||||
<div className="govuk-summary-list__row">
|
||||
<div className="govuk-!-margin-top-9 govuk-!-margin-bottom-9 govuk-!-font-weight-bold govuk-!-font-size-20 ">
|
||||
{t("common:spinner-fetching-data")}
|
||||
<img
|
||||
className="data-loading-icon"
|
||||
src="/assets/images/loading.gif"
|
||||
alt={
|
||||
router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Fetching data"
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
resultsArr.map((item, key) => {
|
||||
let detailsObj = jsonpath({
|
||||
path:
|
||||
'$..[?(@ && @.ticketnumber=="' +
|
||||
item.ticketnumber +
|
||||
'")]',
|
||||
json: searchDetailsObj,
|
||||
eval: true
|
||||
});
|
||||
|
||||
detailsObj = detailsObj[0] || {};
|
||||
return (
|
||||
<div
|
||||
className="govuk-summary-list__row"
|
||||
key={key}
|
||||
>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||
<div></div>
|
||||
{item.pinswg_publishtoweb == true ? (
|
||||
<Link
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
href={
|
||||
(router.locale == "cy"
|
||||
? myportal == true
|
||||
? "/fymhorth/achos"
|
||||
: "/achos"
|
||||
: myportal == true
|
||||
? "/myportal/case"
|
||||
: "/case") +
|
||||
"/" +
|
||||
item.ticketnumber
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
setCurrentReference({
|
||||
"statuscode":
|
||||
item.statuscode,
|
||||
"ticketnumber":
|
||||
item.ticketnumber,
|
||||
"currentReference":
|
||||
item.title,
|
||||
"currentType":
|
||||
"searchResultsObj",
|
||||
"incidentid":
|
||||
item.incidentid,
|
||||
"appealType":
|
||||
item.pinswg_appealcasetype,
|
||||
"showLoginCheck":
|
||||
props.showLoginCheck,
|
||||
"specialistProcess":
|
||||
detailsObj.hasOwnProperty(
|
||||
"pinswg_speacialistcaseprocess"
|
||||
)
|
||||
? detailsObj.pinswg_speacialistcaseprocess
|
||||
: detailsObj.hasOwnProperty(
|
||||
"pinswg_specialistcaseprocess"
|
||||
)
|
||||
? detailsObj.pinswg_specialistcaseprocess
|
||||
: ""
|
||||
});
|
||||
}}
|
||||
>
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"search:searchresults-case-reference-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{item.title}
|
||||
</Link>
|
||||
) : (
|
||||
item.title
|
||||
)}
|
||||
|
||||
<br />
|
||||
{new Date(
|
||||
item.createdon
|
||||
).toLocaleString()}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"search:searchresults-site-address-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_projectlocation"
|
||||
)
|
||||
? detailsObj.pinswg_projectlocation !=
|
||||
null
|
||||
? detailsObj.pinswg_projectlocation.indexOf(
|
||||
";"
|
||||
) < 0
|
||||
? detailsObj.pinswg_projectlocation
|
||||
: router.locale == "cy"
|
||||
? detailsObj.pinswg_projectlocation.split(
|
||||
";"
|
||||
)[1]
|
||||
: detailsObj.pinswg_projectlocation.split(
|
||||
";"
|
||||
)[0]
|
||||
: ""
|
||||
: ""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddressline1
|
||||
: ""}
|
||||
|
||||
{/* {detailsObj.pinswg_siteaddressline1 !=
|
||||
null && <br />} */}
|
||||
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddressline1 !=
|
||||
null && <br />}
|
||||
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddressline2
|
||||
: ""}
|
||||
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline2"
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddressline2 !=
|
||||
null && <br />}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresstown"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddresstown
|
||||
: ""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresstown"
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddresstown !=
|
||||
null && <br />}
|
||||
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresscounty"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddresscounty
|
||||
: ""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresscounty"
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddresscounty !=
|
||||
null && <br />}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresspostcode"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddresspostcode
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"search:searchresults-applicant-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{item.pinswg_appellantagent == 846040001
|
||||
? item.pinswg_appellantfirstname +
|
||||
" " +
|
||||
item.pinswg_appellantlastname
|
||||
: _.has(detailsObj, [
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
])
|
||||
? detailsObj[
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"search:searchresults-authority-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{_.has(item, [
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
])
|
||||
? router.locale == "cy"
|
||||
? jsonpath({
|
||||
path:
|
||||
'$..[?(@ && @.value=="' +
|
||||
item[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
eval: true
|
||||
})
|
||||
: item[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"search:searchresults-case-type-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{router.locale == "cy"
|
||||
? jsonpath({
|
||||
path:
|
||||
'$..[?(@ && @.value=="' +
|
||||
item[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
eval: true
|
||||
})
|
||||
: item[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"search:searchresults-status-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
|
||||
{router.locale == "cy"
|
||||
? jsonpath({
|
||||
path:
|
||||
'$..[?(@ && @.value=="' +
|
||||
item[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
eval: true
|
||||
})
|
||||
: item[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
{item[
|
||||
"caseorigincode@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</dl>
|
||||
<PaginationControl
|
||||
showNoOfRecords={selectedOption}
|
||||
currentPage={currentPage}
|
||||
searchResultsObj={props.searchResultsObj.searchResultsObj}
|
||||
orderBy={orderByState}
|
||||
fieldSort={fieldSortState}
|
||||
spinnerState={spinnerState}
|
||||
getSearchPageResults={getSearchPageResults}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Appeals</h1>
|
||||
{searchResultsObj["@odata.count"] > 5 && (
|
||||
<div id="recordCountSelect" className="">
|
||||
<div className="govuk-form-group">
|
||||
<label
|
||||
className="govuk-label-s "
|
||||
htmlFor="showNumberOfRecords"
|
||||
>
|
||||
{t("search:searchresults-show-records-label-a")}
|
||||
<select
|
||||
onChange={(e) => {
|
||||
setSelectedOption(e.target.value);
|
||||
props.setCurrentPage(1);
|
||||
}}
|
||||
value={selectedOption}
|
||||
className="govuk-select"
|
||||
id="showNumberOfRecords"
|
||||
name="showNumberOfRecords"
|
||||
>
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="20">20</option>
|
||||
<option value="30">30</option>
|
||||
<option value="50">50</option>
|
||||
</select>{" "}
|
||||
{t("search:searchresults-show-records-label-b")}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{resultsArr.length > 0 ? (
|
||||
ResultsView(resultsArr)
|
||||
) : (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds">
|
||||
<h3>{t("search:searchresults-no-records-label")}</h3>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentReference: (currentReference) => {
|
||||
dispatch(setCurrentReference(currentReference));
|
||||
},
|
||||
setSearchResults: (searchResultsObj) => {
|
||||
dispatch(setSearchResults(searchResultsObj));
|
||||
},
|
||||
setSearchDetails: (searchDetailsObj) => {
|
||||
dispatch(setSearchDetails(searchDetailsObj));
|
||||
},
|
||||
setCurrentPage: (currentPage) => {
|
||||
dispatch(setCurrentPage(currentPage));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
searchResultsObj: state.searchResultsObj
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(AppealsTab);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,266 +0,0 @@
|
||||
// components/admin/tabs/StorageTab.js
|
||||
import { useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { bytesToSize } from "../../../components/utils";
|
||||
import {
|
||||
deleteMyRepresentationsFromBlob,
|
||||
deleteAwaitingSubmissionsFromBlob
|
||||
} from "../../../actions/services/documentService";
|
||||
import { sendRepCompleteMessage } from "../../../actions/services/portalService";
|
||||
|
||||
import { formatBlobDates } from "../utils/adminHelper";
|
||||
|
||||
export default function StorageTab({ data, repCompleteCount }) {
|
||||
const [showRepJson, setShowRepJson] = useState(true);
|
||||
const [showTmpFile, setShowTmpFile] = useState(true);
|
||||
const [listData, setListData] = useState(data);
|
||||
|
||||
const toggleAll = () => {
|
||||
const newState = !(showRepJson || showTmpFile);
|
||||
setShowRepJson(newState);
|
||||
setShowTmpFile(newState);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Storage Account Contents</h1>
|
||||
{repCompleteCount > 0 && (
|
||||
<p>Number of Orphaned Reps: {repCompleteCount}</p>
|
||||
)}
|
||||
|
||||
{/* Toggle buttons */}
|
||||
<div style={{ marginBottom: "0.2rem" }}>
|
||||
<button
|
||||
className="govuk-button govuk-button--secondary"
|
||||
onClick={() => setShowRepJson(!showRepJson)}
|
||||
>
|
||||
{showRepJson ? "Hide Reps" : "Show Reps"}
|
||||
</button>
|
||||
<button
|
||||
className="govuk-button govuk-button--secondary"
|
||||
onClick={() => setShowTmpFile(!showTmpFile)}
|
||||
style={{ marginLeft: "0.5rem" }}
|
||||
>
|
||||
{showTmpFile ? "Hide Temp Appeal" : "Show Temp Appeal"}
|
||||
</button>
|
||||
<button
|
||||
className="govuk-button govuk-button--secondary"
|
||||
onClick={toggleAll}
|
||||
style={{ marginLeft: "0.5rem" }}
|
||||
>
|
||||
Show/Hide All
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Render users & containers */}
|
||||
{listData.map((user) => (
|
||||
<div key={user.id} className="govuk-grid-row">
|
||||
{user.containers.map((c) => (
|
||||
<div key={c.container} className="card">
|
||||
<div className="card-body">
|
||||
<h3>
|
||||
{c.container} -{" "}
|
||||
<Link
|
||||
href={`/auth/signin2?email=${user.email}`}
|
||||
>
|
||||
{user.email}
|
||||
</Link>
|
||||
</h3>
|
||||
{/* folders */}
|
||||
{c.folders.map((folder) => (
|
||||
<div
|
||||
key={folder.folderPath}
|
||||
style={
|
||||
showRepJson && folder.hasRepJson
|
||||
? { display: "block" }
|
||||
: showTmpFile &&
|
||||
folder.hasTmpFile
|
||||
? { display: "block" }
|
||||
: { display: "none" }
|
||||
}
|
||||
>
|
||||
<h4>{folder.folderPath || "Root"}</h4>
|
||||
|
||||
{/* Buttons for TMP + Rep actions go here (same logic as before) */}
|
||||
|
||||
{folder.hasTmpFile && (
|
||||
<>
|
||||
<button
|
||||
onClick={() => {
|
||||
confirm(
|
||||
"Do you want to remove this unsubmitted appeal " +
|
||||
folder.folderPath +
|
||||
"?\n"
|
||||
) &&
|
||||
(deleteCaseItem(
|
||||
c.container,
|
||||
folder.folderPath,
|
||||
setData
|
||||
),
|
||||
alert(
|
||||
"Temp case Deleted!"
|
||||
));
|
||||
}}
|
||||
>
|
||||
Delete this TMP appeal
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
{folder.hasRepJson && (
|
||||
<div>
|
||||
{" "}
|
||||
<button
|
||||
title={
|
||||
"Do you want to delete rep"
|
||||
}
|
||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
||||
onClick={() => {
|
||||
confirm(
|
||||
"Do you want tyo delete rep " +
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[0] +
|
||||
"?\n"
|
||||
) &&
|
||||
(deleteRepItem(
|
||||
c.container,
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[0],
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[1]
|
||||
),
|
||||
alert(
|
||||
"Rep Deleted!"
|
||||
),
|
||||
window.location.reload());
|
||||
}}
|
||||
>
|
||||
Delete Rep
|
||||
</button>
|
||||
{folder.repComplete && (
|
||||
<button
|
||||
onClick={async () => {
|
||||
const response =
|
||||
await fetch(
|
||||
"/api/file/editRepJson",
|
||||
{
|
||||
method: "POST",
|
||||
headers:
|
||||
{
|
||||
"Content-Type":
|
||||
"application/json"
|
||||
},
|
||||
body: JSON.stringify(
|
||||
{
|
||||
container:
|
||||
c.container,
|
||||
blobName:
|
||||
folder
|
||||
.repJsonBlob
|
||||
.name
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
const result =
|
||||
await response.json();
|
||||
if (response.ok) {
|
||||
(alert(
|
||||
"repComplete removed!"
|
||||
),
|
||||
window.location.reload());
|
||||
// Optionally refresh the page or update UI state here
|
||||
} else {
|
||||
alert(
|
||||
"Error: " +
|
||||
result.error
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Remove repComplete
|
||||
</button>
|
||||
)}
|
||||
{folder.repComplete && (
|
||||
<button
|
||||
onClick={async () => {
|
||||
confirm(
|
||||
"Do you want resend the rep queue message " +
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[0] +
|
||||
" --- " +
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[1]
|
||||
) &&
|
||||
(sendRepCompleteMessage(
|
||||
c.container,
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[0],
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[1]
|
||||
),
|
||||
alert(
|
||||
"rep queue message sent!"
|
||||
),
|
||||
window.location.reload());
|
||||
}}
|
||||
>
|
||||
Recreate Queue Message
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<ul>
|
||||
{folder.blobs.map((blob) => (
|
||||
<li key={blob.name}>
|
||||
<Link
|
||||
scroll={false}
|
||||
href={`/api/file/downloadblob?container=${
|
||||
c.container
|
||||
}&casefolderID=${
|
||||
folder.folderPath
|
||||
}&blobname=${blob.name.substring(
|
||||
blob.name.lastIndexOf(
|
||||
"/"
|
||||
) + 1
|
||||
)}&hash=${
|
||||
blob.hashedfilepath
|
||||
}`}
|
||||
className="govuk-body govuk-!-font-size-14 govuk-link"
|
||||
>
|
||||
{blob.name} (
|
||||
{bytesToSize(
|
||||
blob.contentLength ||
|
||||
blob.size
|
||||
)}
|
||||
)
|
||||
</Link>{" "}
|
||||
{blob.lastModified && (
|
||||
<span className="govuk-!-font-size-14">
|
||||
{/* {
|
||||
blob.displayDate
|
||||
} */}
|
||||
{formatBlobDates(
|
||||
blob
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
// components/admin/utils/adminStorage.js
|
||||
|
||||
/**
|
||||
* Get the folder path up to the last slash.
|
||||
* Used for grouping blobs by "case folder".
|
||||
*/
|
||||
export function getUpToLastSlash(url) {
|
||||
let lastSlash = url.lastIndexOf("/");
|
||||
|
||||
url = url.substring(0, lastSlash);
|
||||
|
||||
url =
|
||||
url.lastIndexOf("/files") > 0
|
||||
? url.substring(0, url.lastIndexOf("/files"))
|
||||
: url;
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a stream (Azure blob download) to a string.
|
||||
*/
|
||||
export async function streamToString(readableStream) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const chunks = [];
|
||||
readableStream.on("data", (data) => {
|
||||
chunks.push(data.toString());
|
||||
});
|
||||
readableStream.on("end", () => {
|
||||
resolve(chunks.join(""));
|
||||
});
|
||||
readableStream.on("error", reject);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Format how long ago a date occurred.
|
||||
*/
|
||||
export function formatTimeSince(date) {
|
||||
if (!date) return "Unknown date";
|
||||
|
||||
const now = new Date();
|
||||
const diffMs = now - date;
|
||||
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
||||
|
||||
if (diffDays < 7) {
|
||||
return `${diffDays} day${diffDays !== 1 ? "s" : ""} ago`;
|
||||
} else {
|
||||
const diffWeeks = Math.floor(diffDays / 7);
|
||||
return `${diffWeeks} week${diffWeeks !== 1 ? "s" : ""} ago`;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format Azure blob created/modified dates into a readable string.
|
||||
*/
|
||||
export function formatBlobDates(blob) {
|
||||
const created = blob.createdOn ? new Date(blob.createdOn) : null;
|
||||
const modified = blob.lastModified ? new Date(blob.lastModified) : null;
|
||||
|
||||
if (!created && !modified) return "Unknown";
|
||||
|
||||
// If both exist and are the same
|
||||
if (created && modified && created.getTime() === modified.getTime()) {
|
||||
return `${created.toLocaleString("en-GB")} (${formatTimeSince(
|
||||
created
|
||||
)})`;
|
||||
}
|
||||
|
||||
// If modified exists and is newer than created
|
||||
if (created && modified && modified.getTime() > created.getTime()) {
|
||||
return `Created: ${created.toLocaleString("en-GB")} (${formatTimeSince(
|
||||
created
|
||||
)}), Modified: ${modified.toLocaleString("en-GB")} (${formatTimeSince(
|
||||
modified
|
||||
)})`;
|
||||
}
|
||||
|
||||
// Only one date exists
|
||||
const date = modified || created;
|
||||
return `${date.toLocaleString("en-GB")} (${formatTimeSince(date)})`;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// lib/prisma.js
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
const globalForPrisma = globalThis;
|
||||
|
||||
export const prisma =
|
||||
globalForPrisma.prisma ||
|
||||
new PrismaClient({
|
||||
log: ["query", "error", "warn"],
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
globalForPrisma.prisma = prisma;
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
// components/admin/utils/serverStorage.js
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
import { BlobServiceClient } from "@azure/storage-blob";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getUpToLastSlash, streamToString } from "../utils/adminHelper";
|
||||
import { listContainersForUser } from "../../../actions/azurestorage";
|
||||
import pLimit from "p-limit";
|
||||
const prisma = global.prisma || new PrismaClient();
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
/**
|
||||
* Generate HMAC hash for blob API link.
|
||||
*/
|
||||
function hashAPIPath(queryPath, WORDKEY) {
|
||||
let hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
return hashlink.toString(CryptoJS.enc.Hex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch blob structure + users for admin storage page.
|
||||
*/
|
||||
export async function fetchAdminStorageData() {
|
||||
const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME;
|
||||
const creds = new DefaultAzureCredential();
|
||||
const blobServiceClient = new BlobServiceClient(
|
||||
`https://${accountName}.blob.core.windows.net`,
|
||||
creds
|
||||
);
|
||||
|
||||
const prisma = global.prisma || new PrismaClient();
|
||||
|
||||
const users = await prisma.user.findMany();
|
||||
|
||||
const limit = pLimit(5);
|
||||
let data = await Promise.all(
|
||||
users.map(async (user) => {
|
||||
limit(async () => {
|
||||
const containers = await listContainersForUser(
|
||||
blobServiceClient,
|
||||
`${user.id}`,
|
||||
user.email
|
||||
);
|
||||
|
||||
const containersWithHashes = await Promise.all(
|
||||
containers.map(async (container) => {
|
||||
const groupedByFolder = await container.blobs.reduce(
|
||||
async (accP, blob) => {
|
||||
const acc = await accP;
|
||||
const folderPath =
|
||||
getUpToLastSlash(blob.name.trim()) || "";
|
||||
|
||||
const hashedfilepath = hashAPIPath(
|
||||
`/api/file/downloadblob?container=${
|
||||
container.container
|
||||
}&casefolderID=${folderPath}&blobname=${blob.name
|
||||
.substring(
|
||||
blob.name.lastIndexOf("/") + 1
|
||||
)
|
||||
.trim()}`,
|
||||
process.env.HASHKEY
|
||||
);
|
||||
|
||||
const fileNameOnly = blob.name.substring(
|
||||
blob.name.lastIndexOf("/") + 1
|
||||
);
|
||||
const isTmpFile =
|
||||
fileNameOnly.startsWith("TMP-");
|
||||
|
||||
const blobWithHash = {
|
||||
...blob,
|
||||
hashedfilepath,
|
||||
isTmpFile
|
||||
};
|
||||
|
||||
let folderGroup = acc.find(
|
||||
(f) => f.folderPath === folderPath
|
||||
);
|
||||
if (!folderGroup) {
|
||||
folderGroup = {
|
||||
folderPath,
|
||||
blobs: [],
|
||||
hasRepJson: false,
|
||||
repJsonBlob: null,
|
||||
repComplete: false,
|
||||
hasTmpFile: false
|
||||
};
|
||||
acc.push(folderGroup);
|
||||
}
|
||||
|
||||
folderGroup.blobs.push(blobWithHash);
|
||||
|
||||
if (isTmpFile) {
|
||||
folderGroup.hasTmpFile = true;
|
||||
}
|
||||
|
||||
// rep.json handling
|
||||
if (
|
||||
blob.name.toLowerCase().endsWith("rep.json")
|
||||
) {
|
||||
folderGroup.hasRepJson = true;
|
||||
folderGroup.repJsonBlob = blobWithHash;
|
||||
|
||||
const containerClient =
|
||||
blobServiceClient.getContainerClient(
|
||||
container.container
|
||||
);
|
||||
const blockBlobClient =
|
||||
containerClient.getBlockBlobClient(
|
||||
blob.name
|
||||
);
|
||||
|
||||
try {
|
||||
const downloadResponse =
|
||||
await blockBlobClient.download(0);
|
||||
const downloaded = await streamToString(
|
||||
downloadResponse.readableStreamBody
|
||||
);
|
||||
const json = JSON.parse(downloaded);
|
||||
folderGroup.repComplete = Boolean(
|
||||
json.repComplete
|
||||
);
|
||||
} catch (err) {
|
||||
console.error(
|
||||
"Error reading rep.json",
|
||||
err
|
||||
);
|
||||
folderGroup.repComplete = false;
|
||||
}
|
||||
}
|
||||
|
||||
return acc;
|
||||
},
|
||||
Promise.resolve([])
|
||||
);
|
||||
|
||||
return { ...container, folders: groupedByFolder };
|
||||
})
|
||||
);
|
||||
|
||||
return containersWithHashes.length > 0
|
||||
? {
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
containers: containersWithHashes
|
||||
}
|
||||
: null;
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
data = data.filter(Boolean);
|
||||
|
||||
let userData = users
|
||||
.filter((user) => user.email && user.email.trim() !== "")
|
||||
.map((user) => ({
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
created: user.emailVerified?.toLocaleString("en-GB") || ""
|
||||
}));
|
||||
|
||||
let repCompleteCount = 0;
|
||||
data.forEach((user) => {
|
||||
user.containers.forEach((container) => {
|
||||
container.folders.forEach((folder) => {
|
||||
if (folder.repComplete === true) repCompleteCount++;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return { data, userData, repCompleteCount };
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
import React from "react";
|
||||
import { ApplicationInsights } from "@microsoft/applicationinsights-web";
|
||||
import {
|
||||
ReactPlugin,
|
||||
withAITracking,
|
||||
AppInsightsContext,
|
||||
} from "@microsoft/applicationinsights-react-js";
|
||||
|
||||
let reactPlugin = new ReactPlugin();
|
||||
let appInsights = new ApplicationInsights({
|
||||
config: {
|
||||
connectionString:
|
||||
process.env.APPLICATIONINSIGHTS_CONNECTIONSTRING ||
|
||||
process.env.NEXT_PUBLIC_APP_INSIGHT,
|
||||
enableAutoRouteTracking: true,
|
||||
enableCorsCorrelation: true,
|
||||
enableRequestHeaderTracking: true,
|
||||
enableResponseHeaderTracking: true,
|
||||
enableAjaxPerfTracking: true,
|
||||
isBrowserLinkTrackingEnabled: true,
|
||||
extensions: [reactPlugin],
|
||||
},
|
||||
});
|
||||
|
||||
appInsights.loadAppInsights();
|
||||
|
||||
const AzureAppInsights = ({ children }) => {
|
||||
return (
|
||||
<AppInsightsContext.Provider value={reactPlugin}>
|
||||
{children}
|
||||
</AppInsightsContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export default withAITracking(reactPlugin, AzureAppInsights);
|
||||
@@ -1,3 +1,4 @@
|
||||
import Link from "next/link";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
|
||||
export default function Banner() {
|
||||
|
||||
+655
-316
@@ -1,340 +1,679 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import jsonpath from "jsonpath";
|
||||
import _ from "lodash";
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import { useSession } from "next-auth/react";
|
||||
import { setCurrentView } from "../store/currentView/action";
|
||||
import { change } from "redux-form";
|
||||
|
||||
import { setCurrentSection } from "../store/appealType/action";
|
||||
import {
|
||||
setRepresentationCapacity,
|
||||
setRepresentationSubmit
|
||||
} from "../store/currentView/action";
|
||||
import { resolveCaseBreadcrumbState } from "../lib/routing/routeState";
|
||||
import {
|
||||
buildBreadcrumbRendererMaps,
|
||||
resolveMappedRouteRenderer as resolveMappedRouteRendererByMaps
|
||||
} from "../lib/routing/breadcrumbRouteMaps";
|
||||
import { createMappedRouteRendererGroups } from "../lib/routing/breadcrumbRendererFactories";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import LoadingOverlay from "react-loading-overlay";
|
||||
|
||||
const Breadcrumbs = (props) => {
|
||||
const {
|
||||
currentView,
|
||||
setCurrentSection,
|
||||
setRepresentationSubmit,
|
||||
appealType,
|
||||
showQuestionnaireSection,
|
||||
setShowQuestionnaireSection
|
||||
} = props;
|
||||
const { courseContent, slug, currentView } = props;
|
||||
const router = useRouter();
|
||||
const { appealType, section } = router.query;
|
||||
|
||||
let { t } = useTranslation();
|
||||
|
||||
const { data: session } = useSession();
|
||||
function Breadcrumb() {
|
||||
if (slug) {
|
||||
var coursePageURL = appealType + "/" + slug;
|
||||
if (_.isEmpty(courseContent)) {
|
||||
return null;
|
||||
} else {
|
||||
var sectionObj = jsonpath.query(
|
||||
courseContent,
|
||||
'$..sections[?(@.path=="/' + coursePageURL + '")]'
|
||||
);
|
||||
var breadcrumb = sectionObj[0].chapter.title; //sectionObj[0].chapter
|
||||
return (
|
||||
<li
|
||||
className="govuk-breadcrumbs__list-item"
|
||||
aria-current="page"
|
||||
>
|
||||
{breadcrumb}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const nestedProps = props?.props || {};
|
||||
const nestedSearchString = nestedProps?.search?.searchString || "";
|
||||
const nestedCurrentReference =
|
||||
nestedProps?.currentView?.caseReference?.currentReference || "";
|
||||
|
||||
const isWelsh = router.locale === "cy";
|
||||
const localisedPath = (englishPath, welshSuffixPath) =>
|
||||
isWelsh ? `/${router.locale}${welshSuffixPath}` : englishPath;
|
||||
|
||||
const currentReference =
|
||||
currentView?.caseReference?.currentReference || nestedCurrentReference;
|
||||
const fallbackSearchTitle =
|
||||
props?.searchResultsObj?.searchResultsObj?.value?.[0]?.title || "";
|
||||
const caseReferenceDisplay = currentReference || fallbackSearchTitle;
|
||||
|
||||
const myPortalHref = localisedPath("/myportal", "/fymhorth");
|
||||
const cyMyPortalHref = myPortalHref;
|
||||
const pathname = router.pathname;
|
||||
const isPath = (path) => pathname === path;
|
||||
const caseReference = currentView?.caseReference || {};
|
||||
const currentViewState = currentView?.currentView || {};
|
||||
const repDetails = caseReference?.repDetails;
|
||||
const hasRepDetails = Object.prototype.hasOwnProperty.call(
|
||||
caseReference,
|
||||
"repDetails"
|
||||
);
|
||||
|
||||
const qcount =
|
||||
caseReference.appealType === 846040000 ||
|
||||
caseReference.appealType === 846040001 ||
|
||||
caseReference.appealType === 846040025 ||
|
||||
caseReference.appealType === 846040004 ||
|
||||
caseReference.appealType === 846040018 ||
|
||||
caseReference.appealType === 846040003 ||
|
||||
caseReference.appealType === 846040009 ||
|
||||
caseReference.appealType === 846040008
|
||||
? 7
|
||||
: caseReference.appealType === 846040005 ||
|
||||
caseReference.appealType === 846040006 ||
|
||||
caseReference.appealType === 846040007
|
||||
? 9
|
||||
: "";
|
||||
|
||||
const hideServiceNamePaths = [
|
||||
"/myportal/[appealtypes]",
|
||||
"/newappeal",
|
||||
"/newappeal/[appealtypes]",
|
||||
"/myportal/representation"
|
||||
];
|
||||
const shouldShowServiceName = !hideServiceNamePaths.includes(pathname);
|
||||
|
||||
const getViewAllLabel = (viewKey) => {
|
||||
const labelsByKey = {
|
||||
awaitingSubmissionDetails: () =>
|
||||
t("myportal:awatitingsubmission-card-title"),
|
||||
watchedCases: () => t("myportal:watchedcases-card-title"),
|
||||
myCases: () => t("myportal:mycases-card-title"),
|
||||
myRepresentations: () => t("myportal:myrepresentations-card-title"),
|
||||
mySubmittedReps: "Submitted representations"
|
||||
};
|
||||
|
||||
const viewAllLabelResolver = labelsByKey[viewKey];
|
||||
return typeof viewAllLabelResolver === "function"
|
||||
? viewAllLabelResolver()
|
||||
: viewAllLabelResolver || null;
|
||||
};
|
||||
|
||||
const getStaticTextCrumbLabel = (path) => {
|
||||
const staticTextCrumbByPath = {
|
||||
"/account/register": () =>
|
||||
t("account:register-new-account-heading"),
|
||||
"/dns": () => t("dnsCommon:service-name"),
|
||||
"/dns/application-process": () => "Guidance",
|
||||
"/dns/help": () => "Help",
|
||||
"/dns/contact-us": () => t("common:footer-contact-us-link-label"),
|
||||
"/dns/applications": () => t("dnsApplications:page-title"),
|
||||
"/help/cookies": () => t("cookies:cookie-breadcrumb"),
|
||||
"/privacy": () => t("common:footer-privacy-link-label"),
|
||||
"/accessibility": () => t("common:footer-accessibility-link-label"),
|
||||
"/details-about-cookies": () =>
|
||||
t("cookies:cookie-policy-title-heading"),
|
||||
"/auth/signin": () => t("auth:auth-page-title"),
|
||||
"/auth/verify-request": () => t("auth:auth-check-email-page-title"),
|
||||
"/auth/error": () => t("auth:auth-error-signin-error-title")
|
||||
};
|
||||
|
||||
const staticTextCrumbResolver = staticTextCrumbByPath[path];
|
||||
return staticTextCrumbResolver ? staticTextCrumbResolver() : null;
|
||||
};
|
||||
|
||||
const renderMyPortalCrumb = () => (
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link href={myPortalHref} className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
|
||||
const renderMyPortalSectionCrumbs = (sectionLabel) => (
|
||||
<>
|
||||
{renderMyPortalCrumb()}
|
||||
{renderTextCrumb(sectionLabel)}
|
||||
</>
|
||||
);
|
||||
|
||||
const renderCaseReferenceCrumb = (referenceValue) => (
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}: {referenceValue}
|
||||
</li>
|
||||
);
|
||||
|
||||
const renderTextCrumb = (label) => (
|
||||
<li className="govuk-breadcrumbs__list-item">{label}</li>
|
||||
);
|
||||
|
||||
const renderLinkCrumb = (href, label, onClick) => (
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={href}
|
||||
onClick={onClick}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{label}
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
|
||||
const renderAnchorCrumb = (
|
||||
href,
|
||||
label,
|
||||
onClick,
|
||||
listItemClass = "govuk-breadcrumbs__list-item"
|
||||
) => (
|
||||
<li className={listItemClass}>
|
||||
<a
|
||||
className="govuk-breadcrumbs__link"
|
||||
href={href}
|
||||
onClick={onClick}
|
||||
>
|
||||
{label}
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
|
||||
const renderBackCrumb = (
|
||||
onClick,
|
||||
listItemClass = "govuk-breadcrumbs__list-item backChevron"
|
||||
) => renderAnchorCrumb("#", t("common:back-link"), onClick, listItemClass);
|
||||
|
||||
const renderDnsCaseReferenceCrumbs = (referenceValue) => (
|
||||
<>
|
||||
{renderLinkCrumb(
|
||||
isWelsh
|
||||
? `${router.locale}/dnsapplications`
|
||||
: "/dnsapplications",
|
||||
t("dnsCommon:service-name")
|
||||
)}
|
||||
{renderCaseReferenceCrumb(referenceValue)}
|
||||
</>
|
||||
);
|
||||
|
||||
const resolveMappedRouteRenderer = (path) => {
|
||||
return resolveMappedRouteRendererByMaps(path, mappedRouteRendererMaps);
|
||||
};
|
||||
|
||||
const renderMappedRoute = (path, resolver = resolveMappedRouteRenderer) => {
|
||||
const routeRenderer = resolver(path);
|
||||
return routeRenderer ? routeRenderer() : null;
|
||||
};
|
||||
|
||||
const { breadcrumbHref, caseResultsHref, breadcrumbLabel } =
|
||||
resolveCaseBreadcrumbState({
|
||||
query: router.query,
|
||||
hasSession: Boolean(session),
|
||||
getViewAllLabel,
|
||||
advancedLabel: t("common:breadcrumb-advanced-search-results"),
|
||||
addressLabel: t("common:breadcrumb-address-search-results"),
|
||||
defaultLabel: t("common:breadcrumb-search-results")
|
||||
});
|
||||
|
||||
const {
|
||||
simpleRouteRenderersByPath,
|
||||
simpleLinkTextPairRenderersByPath,
|
||||
simpleMyPortalRouteRenderersByPath,
|
||||
newAppealRouteRenderersByPath,
|
||||
callbackRouteRenderersByPath,
|
||||
stepBackRouteRenderersByPath,
|
||||
representationRouteRenderersByPath,
|
||||
caseDetailRouteRenderersByPath,
|
||||
detailAndAccountRouteRenderersByPath
|
||||
} = createMappedRouteRendererGroups({
|
||||
t,
|
||||
router,
|
||||
isWelsh,
|
||||
myPortalHref,
|
||||
cyMyPortalHref,
|
||||
currentViewState,
|
||||
getViewAllLabel,
|
||||
caseResultsHref,
|
||||
breadcrumbLabel,
|
||||
fallbackSearchTitle,
|
||||
currentReference,
|
||||
nestedSearchString,
|
||||
caseReferenceDisplay,
|
||||
onBack: () => {
|
||||
router.back();
|
||||
},
|
||||
currentSection: appealType.currentSection,
|
||||
onStepBack: () => {
|
||||
setCurrentSection(appealType.currentSection - 1);
|
||||
},
|
||||
onStepBackWithInlineClass: () => {
|
||||
setCurrentSection(appealType.currentSection - 1);
|
||||
},
|
||||
currentView,
|
||||
hasRepDetails,
|
||||
repDetails,
|
||||
showQuestionnaireSection,
|
||||
onRepresentationSubmitBackFromConfirmation: () => {
|
||||
setRepresentationSubmit(qcount);
|
||||
},
|
||||
onRepresentationSubmitBackToDetails: () => {
|
||||
setRepresentationSubmit(false);
|
||||
},
|
||||
onRepresentationQuestionnaireBack: () => {
|
||||
setShowQuestionnaireSection(showQuestionnaireSection - 1);
|
||||
setRepresentationSubmit(false);
|
||||
},
|
||||
renderAnchorCrumb,
|
||||
renderLinkCrumb,
|
||||
renderTextCrumb,
|
||||
renderCaseReferenceCrumb,
|
||||
renderMyPortalCrumb,
|
||||
renderMyPortalSectionCrumbs,
|
||||
renderDnsCaseReferenceCrumbs,
|
||||
renderBackCrumb
|
||||
});
|
||||
|
||||
const mappedRouteRendererMaps = buildBreadcrumbRendererMaps({
|
||||
simpleRouteRenderersByPath,
|
||||
simpleLinkTextPairRenderersByPath,
|
||||
simpleMyPortalRouteRenderersByPath,
|
||||
newAppealRouteRenderersByPath,
|
||||
callbackRouteRenderersByPath,
|
||||
stepBackRouteRenderersByPath,
|
||||
representationRouteRenderersByPath,
|
||||
caseDetailRouteRenderersByPath,
|
||||
detailAndAccountRouteRenderersByPath
|
||||
});
|
||||
|
||||
const staticTextCrumbLabel = getStaticTextCrumbLabel(pathname);
|
||||
// const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||
|
||||
// let spinnerState = () => {
|
||||
// showSpinnerState == true
|
||||
// ? setShowSpinnerState(false)
|
||||
// : setShowSpinnerState(true);
|
||||
// };
|
||||
return (
|
||||
<>
|
||||
<nav
|
||||
aria-label={"Breadcrumb for PEDW"}
|
||||
aria-label={
|
||||
"Breadcrumb for " + _.startCase(_.toLower(appealType))
|
||||
}
|
||||
role="navigation"
|
||||
data-module="track-click"
|
||||
>
|
||||
<div className="govuk-breadcrumbs ">
|
||||
<ol className="govuk-breadcrumbs__list">
|
||||
{shouldShowServiceName &&
|
||||
renderLinkCrumb(
|
||||
"/",
|
||||
t("common:service-name-breadcrumb")
|
||||
)}
|
||||
{/* <li className="govuk-breadcrumbs__list-item">
|
||||
<Link href={t("common:gov-wales-link")}>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:gov-wales-label")}
|
||||
</a>
|
||||
</Link>
|
||||
</li> */}
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.pathname.includes("/dns/")
|
||||
? "/dns"
|
||||
: "/"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{router.pathname.includes("/dns/")
|
||||
? t("dnsCommon:service-name")
|
||||
: t("common:service-name-breadcrumb")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
{router.pathname == "/myportal" ? (
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("myportal:page-title")}
|
||||
</li>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/myportal/searchresults" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-search-results")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/searchresults" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-search-results")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/advancedsearch" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-advanced-search")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/myportal/advancedsearch" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-advanced-search")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/advancedsearchresults" ? (
|
||||
<>
|
||||
{" "}
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale +
|
||||
"/advancedsearch"
|
||||
: "/advancedsearch"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t(
|
||||
"common:breadcrumb-advanced-search"
|
||||
)}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t(
|
||||
"common:breadcrumb-advanced-search-results"
|
||||
)}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname ==
|
||||
"/myportal/advancedsearchresults" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale +
|
||||
"/myportal/advancedsearch"
|
||||
: "/myportal/advancedsearch"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t(
|
||||
"common:breadcrumb-advanced-search"
|
||||
)}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t(
|
||||
"common:breadcrumb-advanced-search-results"
|
||||
)}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/newappeal" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("newappeal:parent-page-title")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("newappeal:page-title")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/newappeal/selectappeal" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("newappeal:parent-page-title")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("newappeal:page-title")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Select Appeal
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/viewall" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Your cases
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/myportal/viewall" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{currentView.viewName}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/myportal/case" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/viewall"
|
||||
: "/viewall"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
Your cases{" "}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/case" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale +
|
||||
"/searchresults?q=" +
|
||||
props.props.search
|
||||
.searchString
|
||||
: "/searchresults?q=" +
|
||||
props.props.search
|
||||
.searchString
|
||||
}
|
||||
>
|
||||
<a
|
||||
onClick={() => {
|
||||
// spinnerState();
|
||||
router.back();
|
||||
}}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t(
|
||||
"common:breadcrumb-search-results"
|
||||
)}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/myportal/representation" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Make representation for:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/account/personaldetails" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Your account
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/account/register" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("account:register-new-account-heading")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/account/changepassword" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Update your password
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/dns" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/dns"
|
||||
: "/dns"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("dnsCommon:service-name")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/dnsapplications" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("dnsCommon:service-name")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/dnsdetails" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale == "en"
|
||||
? router.locale +
|
||||
"/dnsapplications"
|
||||
: "/dnsapplications"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("dnsCommon:service-name")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/dns/application-process" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Guidance
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/dns/help" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Help
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/dns/contact-us" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Contact us
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/dns/applications" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("dnsApplications:page-title")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/dns/application-view" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale +
|
||||
"/dns/applications"
|
||||
: "/dns/applications"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t(
|
||||
"dnsApplicationView:page-parent-title"
|
||||
)}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
TWA - Morlais Demonstration Zone
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/help/cookies" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("cookies:cookie-breadcrumb")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/privacy" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:footer-privacy-link-label")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/accessibility" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t(
|
||||
"common:footer-accessibility-link-label"
|
||||
)}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/details-about-cookies" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("cookies:cookie-policy-title-heading")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{!_.isEmpty(slug) ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? router.locale + "/apêlnewydd"
|
||||
: "/newappeal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
{t("common:breadcrumb-new-appeal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{props.formTitle}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
{renderMappedRoute(pathname)}
|
||||
|
||||
{staticTextCrumbLabel &&
|
||||
renderTextCrumb(staticTextCrumbLabel)}
|
||||
<Breadcrumb />
|
||||
</ol>
|
||||
</div>
|
||||
</nav>
|
||||
{/* <LoadingOverlay
|
||||
active={showSpinnerState}
|
||||
spinner
|
||||
text={t("common:spinner-searching")}
|
||||
/> */}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
currentView: state.currentView,
|
||||
appealType: state.appealType,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
search: state.search
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
updateField: (form, field, newValue) =>
|
||||
dispatch(change(form, field, newValue)),
|
||||
setRepresentationCapacity: (representationCapacity) => {
|
||||
dispatch(setRepresentationCapacity(representationCapacity));
|
||||
},
|
||||
setRepresentationSubmit: (representationSubmit) => {
|
||||
dispatch(setRepresentationSubmit(representationSubmit));
|
||||
},
|
||||
setCurrentView: (currentView) => {
|
||||
dispatch(setCurrentView(currentView));
|
||||
},
|
||||
setCurrentSection: (currentSection) => {
|
||||
dispatch(setCurrentSection(currentSection));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Breadcrumbs);
|
||||
export default Breadcrumbs;
|
||||
|
||||
+14
-14
@@ -1,8 +1,10 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import { useContext } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Summary from "./case/summary";
|
||||
import Documents from "./case/documents";
|
||||
import RepresentationList from "./case/representationList";
|
||||
import Summary from "./case/summary";
|
||||
|
||||
const Case = (props) => {
|
||||
const { showRepresentations } = props;
|
||||
@@ -27,30 +29,28 @@ const Case = (props) => {
|
||||
watchedCasesDetails={props.watchedCasesDetails}
|
||||
awaitingSubmission={props.awaitingSubmission}
|
||||
caseReference={props.caseReference}
|
||||
ticketnumber={props.ticketnumber}
|
||||
currentType={props.currentType}
|
||||
appealTypeID={props.appealTypeID}
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
directSearchResultsObj={props.directSearchResultsObj}
|
||||
searchDetailsObj={props.searchDetailsObj}
|
||||
searchString={props.searchString}
|
||||
incidentid={props.incidentid}
|
||||
showMap={props.showMaps}
|
||||
currentView={props.currentView}
|
||||
messagesObj={props.messagesObj}
|
||||
docsOffline={props.props.docsOffline}
|
||||
documentDetailsObj={props.documentDetailsObj}
|
||||
showFilteredDocs={props.showFilteredDocs}
|
||||
showLoginCheck={props.showLoginCheck}
|
||||
eventsObj={props.eventsObj}
|
||||
mediaObj={props.mediaObj}
|
||||
/>
|
||||
{showRepresentations == true && (
|
||||
<Documents
|
||||
incidentid={props.incidentid}
|
||||
caseReference={props.caseReference}
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
searchDetailsObj={props.searchDetailsObj}
|
||||
documentDetailsObj={props.documentDetailsObj}
|
||||
documentHistoryObj={props.documentHistoryObj}
|
||||
/>
|
||||
{showRepresentations == "true" && (
|
||||
<RepresentationList
|
||||
incidentid={props.incidentid}
|
||||
caseReference={props.caseReference}
|
||||
representationsObj={props.representationsObj}
|
||||
documentDetailsObj={props.documentDetailsObj}
|
||||
documentHistoryObj={props.documentHistoryObj}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
import cookie from "cookie-cutter";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
import { formatDates } from "../utils";
|
||||
export default function CaseNoticeBanner(props) {
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const { messagesObj } = props;
|
||||
const router = useRouter();
|
||||
|
||||
const noticeContent = messagesObj.value[0].description;
|
||||
const noticeTitle = messagesObj.value[0].subject.split("Banner ")[1];
|
||||
|
||||
const bannerOpenCookie = typeof cookie.get("pedwNotice") == "undefined";
|
||||
let messagesObjArr = messagesObj.value;
|
||||
|
||||
let todaysDate = new Date();
|
||||
|
||||
return (
|
||||
<>
|
||||
{messagesObjArr.map((message, index) => (
|
||||
<div key={index}>
|
||||
{todaysDate.toISOString() >= message.scheduledstart &&
|
||||
todaysDate.toISOString() <= message.scheduledend && (
|
||||
<div
|
||||
className="govuk-warning-text noticebanner"
|
||||
key={index}
|
||||
>
|
||||
<strong className="govuk-warning-text__text">
|
||||
<span className="govuk-visually-hidden">
|
||||
{t("case:notice-label")}
|
||||
</span>
|
||||
</strong>
|
||||
<div>
|
||||
<div className=" govuk-body-s">
|
||||
<h2 className="govuk-heading-s">
|
||||
{(
|
||||
message.subject.match(
|
||||
new RegExp(">>>", "g")
|
||||
) || []
|
||||
).length > 0
|
||||
? router.locale == "cy"
|
||||
? message.subject
|
||||
.split("Banner ")[1]
|
||||
.split(">>>")[1]
|
||||
: message.subject
|
||||
.split("Banner ")[1]
|
||||
.split(">>>")[0]
|
||||
: (
|
||||
message.subject.match(
|
||||
new RegExp(";", "g")
|
||||
) || []
|
||||
).length > 0
|
||||
? router.locale == "cy"
|
||||
? message.subject
|
||||
.split("Banner ")[1]
|
||||
.split(";")[1]
|
||||
: message.subject
|
||||
.split("Banner ")[1]
|
||||
.split(";")[0]
|
||||
: message.subject.split(
|
||||
"Banner "
|
||||
)[1]}
|
||||
</h2>
|
||||
</div>
|
||||
<div className="govuk-body-s">
|
||||
{(
|
||||
message.description.match(
|
||||
new RegExp(">>>", "g")
|
||||
) || []
|
||||
).length > 0
|
||||
? router.locale == "cy"
|
||||
? message.description.split(
|
||||
">>>"
|
||||
)[1]
|
||||
: message.description.split(
|
||||
">>>"
|
||||
)[0]
|
||||
: (
|
||||
message.description.match(
|
||||
new RegExp(";", "g")
|
||||
) || []
|
||||
).length > 0
|
||||
? router.locale == "cy"
|
||||
? message.description.split(
|
||||
";"
|
||||
)[1]
|
||||
: message.description.split(
|
||||
";"
|
||||
)[0]
|
||||
: message.description}
|
||||
</div>
|
||||
<div className="govuk-body-xs govuk-!-margin-bottom-0 ">
|
||||
{t("case:date-raised")}:{" "}
|
||||
{formatDates(message.createdon)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
+238
-921
File diff suppressed because it is too large
Load Diff
@@ -1,221 +0,0 @@
|
||||
import { setEventDetails } from "../../store/searchOutput/action";
|
||||
import { setCurrentPage } from "../../store/currentView/action";
|
||||
import { connect } from "react-redux";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { formatDates } from "../utils";
|
||||
|
||||
const EIADetails = (props) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const EventView = (eventsArr) => {
|
||||
eventsArr = eventsArr.value;
|
||||
|
||||
return eventsArr.map((item, key) => {
|
||||
<div>{item.pinswg_name}</div>;
|
||||
});
|
||||
};
|
||||
|
||||
const eventsArr = props.eventsObj?.value || [];
|
||||
|
||||
// event publishiing flag set to true displa
|
||||
|
||||
function hasOwnPropertyAndNotNull(obj, property) {
|
||||
return obj.hasOwnProperty(property) && obj[property] !== null;
|
||||
}
|
||||
|
||||
//console.log(eventsArr.length > 0);
|
||||
|
||||
return (
|
||||
eventsArr.length > 0 && (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<h2 className="govuk-heading-m ">
|
||||
{t("case:event-title")}
|
||||
</h2>
|
||||
{eventsArr.map(
|
||||
(item, key) =>
|
||||
item.pinswg_eventpublishflag && (
|
||||
<>
|
||||
{" "}
|
||||
<div className="eventContainer">
|
||||
<div className="eventColumn">
|
||||
<div>
|
||||
<b>
|
||||
{" "}
|
||||
{t(
|
||||
"case:event-name-label"
|
||||
)}
|
||||
</b>
|
||||
: {item.pinswg_name}
|
||||
</div>
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventname"
|
||||
) && (
|
||||
<div>
|
||||
<b>
|
||||
{t(
|
||||
"case:event-event-name-label"
|
||||
)}
|
||||
</b>
|
||||
:{" "}
|
||||
{item.pinswg_eventname}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="eventColumn">
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventaddressline1"
|
||||
) && (
|
||||
<>
|
||||
<div>
|
||||
<b>
|
||||
{t(
|
||||
"case:event-address-label"
|
||||
)}
|
||||
</b>
|
||||
:
|
||||
</div>
|
||||
<div>
|
||||
{
|
||||
item.pinswg_eventaddressline1
|
||||
}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventaddressline2"
|
||||
) && (
|
||||
<div>
|
||||
{
|
||||
item.pinswg_eventaddressline2
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventaddresstown"
|
||||
) && (
|
||||
<div>
|
||||
{
|
||||
item.pinswg_eventaddresstown
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventaddresscounty"
|
||||
) && (
|
||||
<div>
|
||||
{
|
||||
item.pinswg_eventaddresscounty
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventaddresscounty"
|
||||
) && (
|
||||
<div>
|
||||
{
|
||||
item.pinswg_eventaddresspostcode
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{/* type of event
|
||||
start date date of event - end date of event
|
||||
|
||||
if virtual event no address showNoOfRecords
|
||||
show event address */}
|
||||
<div className="eventColumn">
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_dateeventrequested"
|
||||
) && (
|
||||
<div>
|
||||
<b>
|
||||
{t(
|
||||
"case:event-start-date-label"
|
||||
)}
|
||||
</b>
|
||||
:{" "}
|
||||
{formatDates(
|
||||
item.pinswg_dateeventrequested
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_enddateoftheevent"
|
||||
) && (
|
||||
<div>
|
||||
<b>
|
||||
{t(
|
||||
"case:event-end-date-label"
|
||||
)}
|
||||
</b>
|
||||
:{" "}
|
||||
{item.pinswg_enddateoftheevent !=
|
||||
null &&
|
||||
formatDates(
|
||||
item.pinswg_enddateoftheevent
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="eventColumn">
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
[
|
||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue",
|
||||
]
|
||||
) && (
|
||||
<div>
|
||||
<b>
|
||||
{t(
|
||||
"case:event-type-of-event-label"
|
||||
)}
|
||||
</b>
|
||||
:{" "}
|
||||
{
|
||||
item[
|
||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
)}{" "}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
...state,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setEventDetails: (eventsObj) => {
|
||||
dispatch(setEventDetails(eventsObj));
|
||||
},
|
||||
setCurrentPage: (currentPage) => {
|
||||
dispatch(setCurrentPage(currentPage));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(EIADetails);
|
||||
@@ -1,264 +0,0 @@
|
||||
import { setEventDetails } from "../../store/searchOutput/action";
|
||||
import { setCurrentPage } from "../../store/currentView/action";
|
||||
import { connect } from "react-redux";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { formatDates } from "../utils";
|
||||
import {
|
||||
getLivePublishedEvent,
|
||||
isEventLiveNow
|
||||
} from "./summary/utils/liveEvent";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
const EventsDetails = (props) => {
|
||||
let { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
const EventView = (eventsArr) => {
|
||||
eventsArr = eventsArr.value;
|
||||
|
||||
return eventsArr.map((item, key) => {
|
||||
<div>{item.pinswg_name}</div>;
|
||||
});
|
||||
};
|
||||
|
||||
const eventsArr = props.eventsObj?.value || [];
|
||||
|
||||
// event publishiing flag set to true displa
|
||||
|
||||
function hasOwnPropertyAndNotNull(obj, property) {
|
||||
return obj.hasOwnProperty(property) && obj[property] !== null;
|
||||
}
|
||||
|
||||
return (
|
||||
eventsArr.length > 0 && (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<h2 className="govuk-heading-m ">
|
||||
{t("case:event-title")}
|
||||
</h2>
|
||||
{eventsArr.map(
|
||||
(item, key) =>
|
||||
item.pinswg_eventpublishflag && (
|
||||
<>
|
||||
{" "}
|
||||
<div className="eventContainer">
|
||||
<div className="eventColumn">
|
||||
<div>
|
||||
<b>
|
||||
{" "}
|
||||
{t(
|
||||
"case:event-name-label"
|
||||
)}
|
||||
</b>
|
||||
: {item.pinswg_name}
|
||||
</div>
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventname"
|
||||
) && (
|
||||
<div>
|
||||
<b>
|
||||
{t(
|
||||
"case:event-event-name-label"
|
||||
)}
|
||||
</b>
|
||||
:{" "}
|
||||
{item.pinswg_eventname}
|
||||
</div>
|
||||
)}
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
[
|
||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
) && (
|
||||
<div>
|
||||
<b>
|
||||
{t(
|
||||
"case:event-type-of-event-label"
|
||||
)}
|
||||
</b>
|
||||
:{" "}
|
||||
{
|
||||
item[
|
||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_dateeventrequested"
|
||||
) && (
|
||||
<div>
|
||||
<b>
|
||||
{t(
|
||||
"case:event-start-date-label"
|
||||
)}
|
||||
</b>
|
||||
:{" "}
|
||||
{formatDates(
|
||||
item.pinswg_dateeventrequested
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_enddateoftheevent"
|
||||
) && (
|
||||
<div>
|
||||
<b>
|
||||
{t(
|
||||
"case:event-end-date-label"
|
||||
)}
|
||||
</b>
|
||||
:{" "}
|
||||
{item.pinswg_enddateoftheevent !=
|
||||
null &&
|
||||
formatDates(
|
||||
item.pinswg_enddateoftheevent
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="eventColumn">
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventaddressline1"
|
||||
) && (
|
||||
<>
|
||||
<div
|
||||
style={{
|
||||
display: "flex"
|
||||
}}
|
||||
>
|
||||
<b>
|
||||
{t(
|
||||
"case:event-address-label"
|
||||
)}
|
||||
</b>
|
||||
:
|
||||
<div
|
||||
style={{
|
||||
display:
|
||||
"flex",
|
||||
marginLeft:
|
||||
"10px",
|
||||
flexDirection:
|
||||
"column"
|
||||
}}
|
||||
>
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventaddressline1"
|
||||
) && (
|
||||
<span>
|
||||
{
|
||||
item.pinswg_eventaddressline1
|
||||
}
|
||||
</span>
|
||||
)}
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventaddressline2"
|
||||
) && (
|
||||
<span>
|
||||
{
|
||||
item.pinswg_eventaddressline2
|
||||
}
|
||||
</span>
|
||||
)}
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventaddresstown"
|
||||
) && (
|
||||
<span>
|
||||
{
|
||||
item.pinswg_eventaddresstown
|
||||
}
|
||||
</span>
|
||||
)}
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventaddresscounty"
|
||||
) && (
|
||||
<span>
|
||||
{
|
||||
item.pinswg_eventaddresscounty
|
||||
}
|
||||
</span>
|
||||
)}
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_eventaddresscounty"
|
||||
) && (
|
||||
<span>
|
||||
{
|
||||
item.pinswg_eventaddresspostcode
|
||||
}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{/* type of event
|
||||
start date date of event - end date of event
|
||||
|
||||
if virtual event no address showNoOfRecords
|
||||
show event address */}
|
||||
|
||||
{hasOwnPropertyAndNotNull(
|
||||
item,
|
||||
"pinswg_linktotheevent"
|
||||
) &&
|
||||
isEventLiveNow(item) && (
|
||||
<div className="eventColumn">
|
||||
<a
|
||||
href={
|
||||
locale === "en"
|
||||
? item.pinswg_linktotheevent
|
||||
: item.pinswg_linktotheeventstreamwelsh
|
||||
}
|
||||
className="govuk-link"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{t(
|
||||
"case:live-event-link"
|
||||
)}
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
)}{" "}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
...state
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setEventDetails: (eventsObj) => {
|
||||
dispatch(setEventDetails(eventsObj));
|
||||
},
|
||||
setCurrentPage: (currentPage) => {
|
||||
dispatch(setCurrentPage(currentPage));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(EventsDetails);
|
||||
@@ -1,646 +0,0 @@
|
||||
// // import { setEventDetails } from "../../store/searchOutput/action";
|
||||
// // import { setCurrentPage } from "../../store/currentView/action";
|
||||
// // import { connect } from "react-redux";
|
||||
// // import useTranslation from "next-translate/useTranslation";
|
||||
// // import { formatDates } from "../utils";
|
||||
|
||||
// // const MediaDetails = (props) => {
|
||||
// // let { t } = useTranslation();
|
||||
|
||||
// // const MediaView = (mediaArr) => {
|
||||
// // mediaArr = mediaArr.value;
|
||||
|
||||
// // return mediaArr.map((item, key) => {
|
||||
// // <div>{item.pinswg_name}</div>;
|
||||
// // });
|
||||
// // };
|
||||
|
||||
// // const mediaArr = props.mediaObj?.value || [];
|
||||
|
||||
// // // event publishiing flag set to true displa
|
||||
|
||||
// // function hasOwnPropertyAndNotNull(obj, property) {
|
||||
// // return obj.hasOwnProperty(property) && obj[property] !== null;
|
||||
// // }
|
||||
|
||||
// // //console.log(eventsArr.length > 0);
|
||||
|
||||
// // return (
|
||||
// // mediaArr.length > 0 && (
|
||||
// // <div className="govuk-grid-row">
|
||||
// // <div className="card">
|
||||
// // <div className="card-body">
|
||||
// // <h2 className="govuk-heading-m ">
|
||||
// // {t("case:event-title")}Media
|
||||
// // </h2>
|
||||
// // {mediaArr.map(
|
||||
// // (item, key) =>
|
||||
// // item.pinswg_publishtoweb && (
|
||||
// // <>
|
||||
// // {" "}
|
||||
// // <div className="">
|
||||
// // <div className="">
|
||||
// // <div>
|
||||
// // <b>
|
||||
// // {" "}
|
||||
// // {t(
|
||||
// // "case:event-name-label",
|
||||
// // )}
|
||||
// // </b>
|
||||
// // : {item.pinswg_name}
|
||||
// // </div>
|
||||
// // {hasOwnPropertyAndNotNull(
|
||||
// // item,
|
||||
// // "pinswg_description",
|
||||
// // ) && (
|
||||
// // <div>
|
||||
// // <b>
|
||||
// // {t(
|
||||
// // "case:event-event-name-label",
|
||||
// // )}
|
||||
// // </b>
|
||||
// // :{" "}
|
||||
// // {
|
||||
// // item.pinswg_description
|
||||
// // }
|
||||
// // </div>
|
||||
// // )}
|
||||
// // </div>
|
||||
// // </div>
|
||||
// // </>
|
||||
// // ),
|
||||
// // )}{" "}
|
||||
// // </div>
|
||||
// // </div>
|
||||
// // </div>
|
||||
// // )
|
||||
// // );
|
||||
// // };
|
||||
|
||||
// // const mapStateToProps = (state) => {
|
||||
// // return {
|
||||
// // ...state,
|
||||
// // };
|
||||
// // };
|
||||
|
||||
// // const mapDispatchToProps = (dispatch) => {
|
||||
// // return {
|
||||
// // setEventDetails: (mediaObj) => {
|
||||
// // dispatch(setEventDetails(mediaObj));
|
||||
// // },
|
||||
// // setCurrentPage: (currentPage) => {
|
||||
// // dispatch(setCurrentPage(currentPage));
|
||||
// // },
|
||||
// // };
|
||||
// // };
|
||||
|
||||
// // export default connect(mapStateToProps, mapDispatchToProps)(MediaDetails);
|
||||
// import { useEffect, useMemo, useState } from "react";
|
||||
// import { connect } from "react-redux";
|
||||
// import useTranslation from "next-translate/useTranslation";
|
||||
// import { useRouter } from "next/router";
|
||||
|
||||
// const extractYouTubeId = (input) => {
|
||||
// if (!input) return null;
|
||||
// if (/^[a-zA-Z0-9_-]{11}$/.test(input)) return input;
|
||||
|
||||
// try {
|
||||
// const url = new URL(input);
|
||||
// if (url.hostname.includes("youtu.be"))
|
||||
// return url.pathname.slice(1) || null;
|
||||
|
||||
// const v = url.searchParams.get("v");
|
||||
// if (v) return v;
|
||||
|
||||
// const embedMatch = url.pathname.match(/\/embed\/([^/]+)/);
|
||||
// if (embedMatch?.[1]) return embedMatch[1];
|
||||
|
||||
// const shortsMatch = url.pathname.match(/\/shorts\/([^/]+)/);
|
||||
// if (shortsMatch?.[1]) return shortsMatch[1];
|
||||
|
||||
// return null;
|
||||
// } catch {
|
||||
// return null;
|
||||
// }
|
||||
// };
|
||||
|
||||
// export default function MediaDetails({ mediaObj, whichTab }) {
|
||||
// const router = useRouter();
|
||||
// const mediaArr = mediaObj?.value || [];
|
||||
|
||||
// const videoItems = useMemo(() => {
|
||||
// const isWelsh = router.locale === "cy";
|
||||
|
||||
// return (mediaArr || [])
|
||||
// .filter((x) => x?.pinswg_publishtoweb)
|
||||
// .map((item) => {
|
||||
// const url = isWelsh
|
||||
// ? item.pinswg_mediaLinkCY
|
||||
// : item.pinswg_mediaLinkEN;
|
||||
// const videoId = extractYouTubeId(url);
|
||||
// if (!videoId) return null;
|
||||
|
||||
// return {
|
||||
// key:
|
||||
// item.pinswg_documentid ||
|
||||
// `${item.pinswg_name}-${videoId}`,
|
||||
// videoId,
|
||||
// name: item.pinswg_name || "Video",
|
||||
// description: item.pinswg_description || "",
|
||||
// thumbnail: `https://img.youtube.com/vi/${videoId}/hqdefault.jpg`,
|
||||
// };
|
||||
// })
|
||||
// .filter(Boolean);
|
||||
// }, [mediaArr, router.locale]);
|
||||
|
||||
// const [watchedIds, setWatchedIds] = useState(new Set());
|
||||
// const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
|
||||
// // Forces a fresh iframe instance whenever we need to hard-stop playback
|
||||
// const [playerInstance, setPlayerInstance] = useState(0);
|
||||
|
||||
// const isActive = whichTab === "case-media";
|
||||
// const selected = videoItems[selectedIndex] || null;
|
||||
|
||||
// // When leaving the media tab, hard-stop playback by unmounting (and bumping instance)
|
||||
// useEffect(() => {
|
||||
// if (!isActive) {
|
||||
// setPlayerInstance((n) => n + 1);
|
||||
// }
|
||||
// }, [isActive]);
|
||||
|
||||
// // When list/locale changes, reset to first (no autoplay)
|
||||
// useEffect(() => {
|
||||
// setSelectedIndex(0);
|
||||
// setPlayerInstance((n) => n + 1);
|
||||
// }, [videoItems.length, router.locale]);
|
||||
|
||||
// if (!videoItems.length) return null;
|
||||
|
||||
// const embedBase = "https://www.youtube-nocookie.com/embed";
|
||||
|
||||
// // IMPORTANT:
|
||||
// // - autoplay=0 for initial load
|
||||
// // - autoplay=1 only when user clicks an item
|
||||
// const [autoplay, setAutoplay] = useState(false);
|
||||
|
||||
// useEffect(() => {
|
||||
// // whenever we leave tab or reset player, don't autoplay next time
|
||||
// if (!isActive) setAutoplay(false);
|
||||
// }, [isActive]);
|
||||
|
||||
// const embedSrc = selected
|
||||
// ? `${embedBase}/${selected.videoId}?rel=0&modestbranding=1&playsinline=1&autoplay=${autoplay ? "1" : "0"}`
|
||||
// : "";
|
||||
|
||||
// return (
|
||||
// <div className="govuk-grid-row">
|
||||
// <div className="card">
|
||||
// <div className="card-body">
|
||||
// <h2 className="govuk-heading-m">Media</h2>
|
||||
|
||||
// {/* Player: only render when tab is active */}
|
||||
// {isActive && (
|
||||
// <div className="videoWrapper govuk-!-margin-bottom-4">
|
||||
// <iframe
|
||||
// key={`${selected?.videoId}-${playerInstance}`}
|
||||
// src={embedSrc}
|
||||
// title={selected?.name || "YouTube video"}
|
||||
// frameBorder="0"
|
||||
// allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
// allowFullScreen
|
||||
// />
|
||||
// </div>
|
||||
// )}
|
||||
|
||||
// <h3 className="govuk-heading-s">Videos</h3>
|
||||
// <ul className="govuk-list govuk-list--spaced">
|
||||
// {videoItems.map((v, idx) => {
|
||||
// const isSelected = idx === selectedIndex;
|
||||
// return (
|
||||
// <li key={v.key}>
|
||||
// <button
|
||||
// type="button"
|
||||
// className={`videoTabButton ${isSelected ? "active" : ""}`}
|
||||
// onClick={() => {
|
||||
// setSelectedIndex(idx);
|
||||
// setAutoplay(true); // play only on user action
|
||||
// setPlayerInstance((n) => n + 1); // ensure clean switch / stop previous
|
||||
// setWatchedIds((prev) =>
|
||||
// new Set(prev).add(v.videoId),
|
||||
// );
|
||||
// }}
|
||||
// >
|
||||
// <div className="videoTabContent">
|
||||
// <div className="thumbnailWrapper">
|
||||
// <img
|
||||
// src={v.thumbnail}
|
||||
// alt=""
|
||||
// className="videoThumbnail"
|
||||
// loading="lazy"
|
||||
// />
|
||||
// <span
|
||||
// className="playIcon"
|
||||
// aria-hidden="true"
|
||||
// >
|
||||
// ▶
|
||||
// </span>
|
||||
|
||||
// {/* Duration badge (see section 2) */}
|
||||
// {v.duration && (
|
||||
// <span className="durationBadge">
|
||||
// {v.duration}
|
||||
// </span>
|
||||
// )}
|
||||
|
||||
// {/* Watched indicator (see section 3) */}
|
||||
// {watchedIds.has(v.videoId) && (
|
||||
// <span className="watchedBadge">
|
||||
// Watched
|
||||
// </span>
|
||||
// )}
|
||||
// </div>
|
||||
|
||||
// <span className="videoTitle">
|
||||
// {v.name}
|
||||
// </span>
|
||||
// </div>
|
||||
// </button>
|
||||
// </li>
|
||||
// );
|
||||
// })}
|
||||
// </ul>
|
||||
// </div>
|
||||
// </div>
|
||||
|
||||
// <style jsx>{`
|
||||
// .videoWrapper {
|
||||
// position: relative;
|
||||
// padding-bottom: 56.25%;
|
||||
// height: 0;
|
||||
// overflow: hidden;
|
||||
// border: 1px solid #b1b4b6;
|
||||
// border-radius: 4px;
|
||||
// }
|
||||
// .videoWrapper iframe {
|
||||
// position: absolute;
|
||||
// top: 0;
|
||||
// left: 0;
|
||||
// width: 100%;
|
||||
// height: 100%;
|
||||
// }
|
||||
// .videoTabButton {
|
||||
// width: 100%;
|
||||
// text-align: left;
|
||||
// background: transparent;
|
||||
// border: 1px solid #b1b4b6;
|
||||
// border-radius: 4px;
|
||||
// padding: 10px 12px;
|
||||
// cursor: pointer;
|
||||
// }
|
||||
// .videoTabButton:hover {
|
||||
// background: #f3f2f1;
|
||||
// }
|
||||
// .videoTabButton.active {
|
||||
// border-color: #1d70b8;
|
||||
// box-shadow: inset 0 0 0 1px #1d70b8;
|
||||
// background: #eef4ff;
|
||||
// }
|
||||
// .videoTabContent {
|
||||
// display: flex;
|
||||
// gap: 12px;
|
||||
// align-items: center;
|
||||
// }
|
||||
|
||||
// .videoThumbnail {
|
||||
// width: 120px;
|
||||
// aspect-ratio: 16 / 9;
|
||||
// object-fit: cover;
|
||||
// border-radius: 4px;
|
||||
// border: 1px solid #b1b4b6;
|
||||
// background: #000;
|
||||
// }
|
||||
|
||||
// .videoTitle {
|
||||
// font-weight: 600;
|
||||
// }
|
||||
|
||||
// @media (max-width: 40.0625em) {
|
||||
// .videoThumbnail {
|
||||
// width: 90px;
|
||||
// }
|
||||
// }
|
||||
// .thumbnailWrapper {
|
||||
// position: relative;
|
||||
// width: 120px;
|
||||
// flex-shrink: 0;
|
||||
// }
|
||||
|
||||
// .videoThumbnail {
|
||||
// width: 100%;
|
||||
// aspect-ratio: 16 / 9;
|
||||
// object-fit: cover;
|
||||
// border-radius: 4px;
|
||||
// border: 1px solid #b1b4b6;
|
||||
// background: #000;
|
||||
// }
|
||||
|
||||
// /* ▶ Play icon */
|
||||
// .playIcon {
|
||||
// position: absolute;
|
||||
// inset: 0;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// justify-content: center;
|
||||
// font-size: 32px;
|
||||
// color: white;
|
||||
// text-shadow: 0 0 6px rgba(0, 0, 0, 0.7);
|
||||
// pointer-events: none;
|
||||
// }
|
||||
|
||||
// /* ⏱ Duration badge */
|
||||
// .durationBadge {
|
||||
// position: absolute;
|
||||
// bottom: 6px;
|
||||
// right: 6px;
|
||||
// background: rgba(0, 0, 0, 0.8);
|
||||
// color: white;
|
||||
// font-size: 12px;
|
||||
// padding: 2px 6px;
|
||||
// border-radius: 3px;
|
||||
// }
|
||||
|
||||
// /* 👁 Watched badge */
|
||||
// .watchedBadge {
|
||||
// position: absolute;
|
||||
// top: 6px;
|
||||
// left: 6px;
|
||||
// background: #00703c; /* GOV green */
|
||||
// color: white;
|
||||
// font-size: 11px;
|
||||
// padding: 2px 6px;
|
||||
// border-radius: 3px;
|
||||
// }
|
||||
|
||||
// .videoTabContent {
|
||||
// display: flex;
|
||||
// gap: 12px;
|
||||
// align-items: center;
|
||||
// }
|
||||
|
||||
// .videoTitle {
|
||||
// font-weight: 600;
|
||||
// }
|
||||
// `}</style>
|
||||
// </div>
|
||||
// );
|
||||
// }
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
/**
|
||||
* MediaDetails
|
||||
* - Renders a YouTube player + a list of videos from mediaObj.value
|
||||
* - Loads first item by default (no autoplay)
|
||||
* - Plays only when user selects an item
|
||||
* - Stops playback when leaving the "case-media" parent tab (pass whichTab)
|
||||
* - Shows thumbnail with play overlay
|
||||
* - Optional duration badge (if you supply v.duration)
|
||||
* - "Watched" badge once a video has been played (session only)
|
||||
*/
|
||||
|
||||
const extractYouTubeId = (input) => {
|
||||
if (!input) return null;
|
||||
|
||||
// Already looks like a YouTube ID?
|
||||
if (/^[a-zA-Z0-9_-]{11}$/.test(input)) return input;
|
||||
|
||||
try {
|
||||
const url = new URL(input);
|
||||
|
||||
// youtu.be/<id>
|
||||
if (url.hostname.includes("youtu.be")) {
|
||||
return url.pathname.replace("/", "") || null;
|
||||
}
|
||||
|
||||
// youtube.com/watch?v=<id>
|
||||
const v = url.searchParams.get("v");
|
||||
if (v) return v;
|
||||
|
||||
// youtube.com/embed/<id>
|
||||
const embedMatch = url.pathname.match(/\/embed\/([^/]+)/);
|
||||
if (embedMatch?.[1]) return embedMatch[1];
|
||||
|
||||
// youtube.com/shorts/<id>
|
||||
const shortsMatch = url.pathname.match(/\/shorts\/([^/]+)/);
|
||||
if (shortsMatch?.[1]) return shortsMatch[1];
|
||||
|
||||
return null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const MediaDetails = ({ mediaObj, whichTab, title, useNoCookie = true }) => {
|
||||
const { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
|
||||
const sourceMedia = mediaObj?.value;
|
||||
const isActive = whichTab ? whichTab === "case-media" : true;
|
||||
|
||||
// Build list of playable items (publishable only)
|
||||
const videoItems = useMemo(() => {
|
||||
const isWelsh = router.locale === "cy";
|
||||
|
||||
return (sourceMedia || [])
|
||||
.filter((x) => x?.pinswg_publishtoweb)
|
||||
.map((item) => {
|
||||
const link = isWelsh
|
||||
? item.pinswg_videoplatformurlwelsh
|
||||
: item.pinswg_videoplatformurl;
|
||||
|
||||
const videoId = extractYouTubeId(link);
|
||||
if (!videoId) return null;
|
||||
|
||||
return {
|
||||
key:
|
||||
item.pinswg_documentid ||
|
||||
item.pinswg_mediaid ||
|
||||
`${item.pinswg_eventrecordingid}-${videoId}`,
|
||||
videoId,
|
||||
name: item.pinswg_eventrecordingname || "Video",
|
||||
description: item.pinswg_description || "",
|
||||
// If you later store duration in CRM, map it here (e.g. "03:42")
|
||||
duration: item.pinswg_duration || null,
|
||||
thumbnailHQ: `https://img.youtube.com/vi/${videoId}/hqdefault.jpg`,
|
||||
thumbnailMax: `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`,
|
||||
raw: item
|
||||
};
|
||||
})
|
||||
.filter(Boolean);
|
||||
}, [sourceMedia, router.locale]);
|
||||
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
|
||||
// Default false so first item loads but does not play.
|
||||
const [autoplay, setAutoplay] = useState(false);
|
||||
|
||||
// Bump this to force iframe remount (hard stop playback).
|
||||
const [playerInstance, setPlayerInstance] = useState(0);
|
||||
|
||||
// Track which videos have been played (session only).
|
||||
const [watchedIds, setWatchedIds] = useState(() => new Set());
|
||||
|
||||
// When list or locale changes: reset selection and do not autoplay
|
||||
useEffect(() => {
|
||||
setSelectedIndex(0);
|
||||
setAutoplay(false);
|
||||
setPlayerInstance((n) => n + 1);
|
||||
}, [videoItems.length, router.locale]);
|
||||
|
||||
// When leaving the media tab: hard stop playback
|
||||
useEffect(() => {
|
||||
if (!isActive) {
|
||||
setAutoplay(false);
|
||||
setPlayerInstance((n) => n + 1);
|
||||
}
|
||||
}, [isActive]);
|
||||
|
||||
const selected = videoItems[selectedIndex] || null;
|
||||
|
||||
const domain = useNoCookie
|
||||
? "https://www.youtube-nocookie.com"
|
||||
: "https://www.youtube.com";
|
||||
|
||||
const embedSrc = selected
|
||||
? `${domain}/embed/${selected.videoId}?rel=0&modestbranding=1&playsinline=1&autoplay=${
|
||||
autoplay ? "1" : "0"
|
||||
}`
|
||||
: "";
|
||||
|
||||
if (!videoItems.length) return null;
|
||||
|
||||
return (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<h2 className="govuk-heading-m">{t("case:media-title")}</h2>
|
||||
|
||||
{/* Player: unmount when not active (guarantees playback stops) */}
|
||||
{isActive && (
|
||||
<div className="videoWrapper govuk-!-margin-bottom-4">
|
||||
<iframe
|
||||
key={`${selected?.videoId}-${playerInstance}`}
|
||||
src={embedSrc}
|
||||
title={selected?.name || "YouTube video"}
|
||||
frameBorder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowFullScreen
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Selected info */}
|
||||
{selected && (
|
||||
<div className="govuk-!-margin-bottom-4">
|
||||
<div className="govuk-body">
|
||||
<b>{t("case:event-name-label")}</b>:{" "}
|
||||
{selected.name}
|
||||
</div>
|
||||
|
||||
{!!selected.description && (
|
||||
<div className="govuk-body">
|
||||
<b>{t("case:event-event-name-label")}</b>:{" "}
|
||||
{selected.description}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Video list */}
|
||||
<h3 className="govuk-heading-s">
|
||||
{t("case:video-heading")}
|
||||
</h3>
|
||||
|
||||
<ul className="govuk-list govuk-list--spaced">
|
||||
{videoItems.map((v, idx) => {
|
||||
const isSelected = idx === selectedIndex;
|
||||
|
||||
return (
|
||||
<li key={v.key}>
|
||||
<button
|
||||
type="button"
|
||||
className={`videoTabButton ${
|
||||
isSelected ? "active" : ""
|
||||
}`}
|
||||
aria-current={
|
||||
isSelected ? "true" : undefined
|
||||
}
|
||||
onClick={() => {
|
||||
setSelectedIndex(idx);
|
||||
|
||||
// Start playback only when user selects
|
||||
setAutoplay(true);
|
||||
|
||||
// Force remount to stop previous + start clean
|
||||
setPlayerInstance((n) => n + 1);
|
||||
|
||||
// Mark watched
|
||||
setWatchedIds((prev) => {
|
||||
const next = new Set(prev);
|
||||
next.add(v.videoId);
|
||||
return next;
|
||||
});
|
||||
}}
|
||||
>
|
||||
<div className="videoTabContent">
|
||||
<div className="thumbnailWrapper">
|
||||
<img
|
||||
src={v.thumbnailMax}
|
||||
onError={(e) => {
|
||||
// fallback for videos without maxres
|
||||
e.currentTarget.src =
|
||||
v.thumbnailHQ;
|
||||
}}
|
||||
alt=""
|
||||
className="videoThumbnail"
|
||||
loading="lazy"
|
||||
/>
|
||||
<span
|
||||
className="playIcon"
|
||||
aria-hidden="true"
|
||||
>
|
||||
▶
|
||||
</span>
|
||||
|
||||
{!!v.duration && (
|
||||
<span className="durationBadge">
|
||||
{v.duration}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{watchedIds.has(v.videoId) && (
|
||||
<span className="watchedBadge">
|
||||
Watched
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<span className="videoTitle">
|
||||
{v.name}
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default MediaDetails;
|
||||
@@ -1,51 +1,44 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { setCurrentPage } from "../../store/currentView/action";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
|
||||
const PaginationControl = (props) => {
|
||||
const {
|
||||
showNoOfRecords,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
searchString,
|
||||
searchResultsObj,
|
||||
currentPage,
|
||||
spinnerState,
|
||||
getDocumentResults,
|
||||
setCurrentPage
|
||||
} = props;
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
const pagesCount = Math.ceil(
|
||||
searchResultsObj["@odata.count"] / showNoOfRecords
|
||||
);
|
||||
const pagesCount = Math.ceil(searchResultsObj["@odata.count"] / 10);
|
||||
|
||||
const getRange = (start, end) => {
|
||||
//console.log(start, end);
|
||||
return Array(end - start + 1)
|
||||
.fill()
|
||||
.map((v, i) => i + start);
|
||||
};
|
||||
|
||||
const paginationNumbers = (currentPage, pageCount) => {
|
||||
//console.log(currentPage);
|
||||
let delta;
|
||||
|
||||
if (pageCount <= 7) {
|
||||
if (pageCount <= 10) {
|
||||
// delta === 7: [1 2 3 4 5 6 7]
|
||||
delta = 7;
|
||||
delta = 10;
|
||||
} else {
|
||||
// delta === 2: [1 ... 4 5 6 ... 10]
|
||||
// delta === 4: [1 2 3 4 5 ... 10]
|
||||
//delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4;
|
||||
delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4;
|
||||
delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 6;
|
||||
}
|
||||
|
||||
const range = {
|
||||
start: Math.round(currentPage - delta / 2),
|
||||
end: Math.round(currentPage + delta / 2)
|
||||
end: Math.round(currentPage + delta / 2),
|
||||
};
|
||||
|
||||
if (range.start - 1 === 1 || range.end + 1 === pageCount) {
|
||||
@@ -72,34 +65,24 @@ const PaginationControl = (props) => {
|
||||
pages = pages.concat(withDots(pageCount, ["...", pageCount]));
|
||||
}
|
||||
|
||||
//console.log(pages);
|
||||
return pages;
|
||||
};
|
||||
|
||||
const paginationArray = paginationNumbers(
|
||||
props.currentView.currentPage,
|
||||
pagesCount
|
||||
);
|
||||
const paginationArray = paginationNumbers(currentPage, pagesCount);
|
||||
|
||||
return (
|
||||
<>
|
||||
{pagesCount > 1 && (
|
||||
{pagesCount > 1 ? (
|
||||
<div className="govuk-!-margin-bottom-7 ">
|
||||
<div className="govuk-grid-row paginationWrapper">
|
||||
<div className="govuk-grid-column-one-quarter paginationPrevious">
|
||||
{props.currentView.currentPage != 1 ? (
|
||||
{currentPage != 1 ? (
|
||||
<span
|
||||
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem leftTextButton"
|
||||
onClick={() => {
|
||||
(spinnerState(),
|
||||
setCurrentPage(
|
||||
props.currentView.currentPage -
|
||||
1
|
||||
),
|
||||
getDocumentResults(
|
||||
props.currentView.currentPage -
|
||||
1,
|
||||
orderBy,
|
||||
fieldSort
|
||||
));
|
||||
// spinnerState(),
|
||||
getDocumentResults(currentPage - 1);
|
||||
}}
|
||||
>
|
||||
{t("common:previous-link-button")}
|
||||
@@ -112,7 +95,7 @@ const PaginationControl = (props) => {
|
||||
</div>
|
||||
<div className="govuk-grid-column-one-half paginationContainer">
|
||||
{paginationArray.map((e, i) =>
|
||||
props.currentView.currentPage == e ? (
|
||||
currentPage == i + 1 ? (
|
||||
<span
|
||||
key={i}
|
||||
className=" govuk-body govuk-!-padding-2 govuk-!-font-weight-bold "
|
||||
@@ -131,13 +114,9 @@ const PaginationControl = (props) => {
|
||||
className="govuk-body govuk-link govuk-!-padding-2 govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem"
|
||||
key={i}
|
||||
onClick={() => {
|
||||
spinnerState();
|
||||
(setCurrentPage(e),
|
||||
getDocumentResults(
|
||||
e,
|
||||
orderBy,
|
||||
fieldSort
|
||||
));
|
||||
// spinnerState();
|
||||
console.log(i + 1);
|
||||
getDocumentResults(i + 1);
|
||||
}}
|
||||
>
|
||||
{e}
|
||||
@@ -146,21 +125,12 @@ const PaginationControl = (props) => {
|
||||
)}
|
||||
</div>
|
||||
<div className="govuk-grid-column-one-quarter paginationNext">
|
||||
{props.currentView.currentPage < pagesCount ? (
|
||||
{currentPage != pagesCount ? (
|
||||
<span
|
||||
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem rightTextButton"
|
||||
onClick={() => {
|
||||
(spinnerState(),
|
||||
setCurrentPage(
|
||||
props.currentView.currentPage +
|
||||
1
|
||||
),
|
||||
getDocumentResults(
|
||||
props.currentView.currentPage +
|
||||
1,
|
||||
orderBy,
|
||||
fieldSort
|
||||
));
|
||||
// spinnerState(),
|
||||
getDocumentResults(currentPage + 1);
|
||||
}}
|
||||
>
|
||||
{t("common:next-link-button")}
|
||||
@@ -174,28 +144,15 @@ const PaginationControl = (props) => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="govuk-body-s mobilePageCount">
|
||||
{t("common:pages-label")}{" "}
|
||||
{props.currentView.currentPage} {t("common:of-label")}{" "}
|
||||
{pagesCount}
|
||||
{t("common:pages-label")} {currentPage}{" "}
|
||||
{t("common:of-label")} {pagesCount}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
currentView: state.currentView
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentPage: (currentPage) => {
|
||||
dispatch(setCurrentPage(currentPage));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(PaginationControl);
|
||||
export default PaginationControl;
|
||||
|
||||
@@ -1,355 +0,0 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { Field, change, reduxForm } from "redux-form";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { bytesToSize, getThumbnailIconByExtension } from "../../utils";
|
||||
import {
|
||||
FileUploadField,
|
||||
RenderCondtionalRadioList,
|
||||
RenderRichMultiline,
|
||||
shouldDisableButton
|
||||
} from "./representationElements";
|
||||
import RepresentationTypeSelectorBlock from "./elements/RepresentationTypeSelectorBlock";
|
||||
|
||||
import { useDropzone } from "react-dropzone";
|
||||
import {
|
||||
setRepresentationCapacity,
|
||||
setRepresentationSubmit,
|
||||
setFilesForRepresentations
|
||||
} from "../../../store/currentView/action";
|
||||
|
||||
const ConsultationAgent = (props) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const {
|
||||
formObj,
|
||||
appellantApplicantRepresentationArr,
|
||||
setRepresentationCapacity,
|
||||
setRepresentationSubmit,
|
||||
currentView,
|
||||
setRepFileName,
|
||||
updateRepresentation,
|
||||
setSavingStatus,
|
||||
savingStatus,
|
||||
setFilesForRepresentations,
|
||||
onRepresentationTypeChange,
|
||||
onTypeSelectionConfirmed
|
||||
} = props;
|
||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||
|
||||
const persistedRepresentationType =
|
||||
currentView?.caseReference?.repDetails?.representationType;
|
||||
const [typeSelectionConfirmed, setTypeSelectionConfirmed] = useState(
|
||||
!!persistedRepresentationType
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (persistedRepresentationType) {
|
||||
setTypeSelectionConfirmed(true);
|
||||
}
|
||||
}, [persistedRepresentationType]);
|
||||
|
||||
if (JSON.stringify(formObj) != "{}") {
|
||||
setRepFileName(formObj.representationForm.values);
|
||||
|
||||
let filterFilesList = props.currentView.caseReference.hasOwnProperty(
|
||||
"repDetails"
|
||||
)
|
||||
? props.currentView.caseReference.repDetails.hasOwnProperty(
|
||||
"filesList"
|
||||
)
|
||||
? props.currentView.caseReference.repDetails.filesList.filter(
|
||||
function (el) {
|
||||
return el != null;
|
||||
}
|
||||
)
|
||||
: []
|
||||
: [];
|
||||
|
||||
const files = acceptedFiles.map((file) => (
|
||||
<li key={file.path}>
|
||||
{file.path} - {file.size} bytes
|
||||
</li>
|
||||
));
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
|
||||
const selectedRepresentationType =
|
||||
formObj?.representationForm?.values?.representationType ||
|
||||
props.representationType;
|
||||
|
||||
const isTypeConfirmed =
|
||||
!!selectedRepresentationType && typeSelectionConfirmed;
|
||||
|
||||
const selectedRepresentationTypeDisplay =
|
||||
router.locale == "cy"
|
||||
? selectedRepresentationType == "Questionnaire"
|
||||
? "Holiadur"
|
||||
: selectedRepresentationType == "Statement"
|
||||
? "Datganiad"
|
||||
: selectedRepresentationType == "Final comments"
|
||||
? "Sylwadau terfynol"
|
||||
: selectedRepresentationType
|
||||
: selectedRepresentationType;
|
||||
|
||||
return (
|
||||
<>
|
||||
<RepresentationTypeSelectorBlock
|
||||
t={t}
|
||||
headingText={t(
|
||||
"myrepresentations:consultation-from-an-agent-heading"
|
||||
)}
|
||||
kindLabelText={t(
|
||||
"myrepresentations:kind-of-consultation-label"
|
||||
)}
|
||||
isTypeSelected={isTypeConfirmed}
|
||||
selectedTypeDisplay={selectedRepresentationTypeDisplay}
|
||||
representationType={selectedRepresentationType}
|
||||
setTypeSelectionConfirmed={setTypeSelectionConfirmed}
|
||||
onRepresentationTypeChange={onRepresentationTypeChange}
|
||||
onTypeSelectionConfirmed={onTypeSelectionConfirmed}
|
||||
optionsArr={appellantApplicantRepresentationArr}
|
||||
/>
|
||||
{isTypeConfirmed && (
|
||||
<>
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-form-group">
|
||||
<Field
|
||||
name="representationOnBehalfOf"
|
||||
datafieldname="representationOnBehalfOf"
|
||||
// label={t("myrepresentations:capacity-select-what-capacity-label")}
|
||||
options={["Yes", "No"]}
|
||||
id="representationOnBehalfOf"
|
||||
className="govuk-radios__input"
|
||||
errorMsg={t(
|
||||
"myrepresentations:select-an-option-label"
|
||||
)}
|
||||
component={RenderCondtionalRadioList}
|
||||
validate={[required]}
|
||||
legend={t("case:representation-onbehalfof")}
|
||||
hint={t(
|
||||
"myrepresentations:representation-onbehalfof-hint"
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-form-group">
|
||||
<p className="govuk-body">
|
||||
{selectedRepresentationType ==
|
||||
"Consultation Response"
|
||||
? t(
|
||||
"myrepresentations:enter-comment-label"
|
||||
)
|
||||
: t(
|
||||
"myrepresentations:consultation-comment-label"
|
||||
)}
|
||||
</p>
|
||||
<fieldset
|
||||
className="govuk-fieldset"
|
||||
aria-describedby="commentBox-hint"
|
||||
>
|
||||
{selectedRepresentationType ==
|
||||
"Consultation Response" && (
|
||||
<div className="govuk-form-group">
|
||||
<Field
|
||||
name="representationComments"
|
||||
id="representationComments"
|
||||
component={RenderRichMultiline}
|
||||
type="text"
|
||||
rows="5"
|
||||
className="govuk-textarea govuk-input--width-30"
|
||||
aria-describedby={
|
||||
props.name + "-hint"
|
||||
}
|
||||
/>
|
||||
{formObj.representationForm.values
|
||||
.appealType == "846040004" ? (
|
||||
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label"
|
||||
)}{" "}
|
||||
<a
|
||||
href={t(
|
||||
"myrepresentations:publish-policy-link"
|
||||
)}
|
||||
>
|
||||
{t(
|
||||
"myrepresentations:publish-policy-link-label"
|
||||
)}
|
||||
</a>{" "}
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label-two"
|
||||
)}
|
||||
</p>
|
||||
) : (
|
||||
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label"
|
||||
)}{" "}
|
||||
<a
|
||||
href={t(
|
||||
"myrepresentations:publish-policy-link"
|
||||
)}
|
||||
>
|
||||
{t(
|
||||
"myrepresentations:publish-policy-link-label"
|
||||
)}
|
||||
</a>{" "}
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label-two"
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
||||
<FileUploadField
|
||||
name={"representationDocuments"}
|
||||
id={"representationDocuments"}
|
||||
label={t(
|
||||
"myrepresentations:add-files-label"
|
||||
)}
|
||||
ticketnumber={
|
||||
props.props.caseReference
|
||||
}
|
||||
hint={"sdsd"}
|
||||
fileList={
|
||||
props.currentView.fileList
|
||||
|
||||
// props.currentView.caseReference.hasOwnProperty(
|
||||
// "repDetails"
|
||||
// )
|
||||
// ? props.currentView.caseReference.repDetails.hasOwnProperty(
|
||||
// "filesList"
|
||||
// ) &&
|
||||
// props.currentView
|
||||
// .caseReference
|
||||
// .repDetails.filesList
|
||||
// .length > 0
|
||||
// ? props.currentView
|
||||
// .caseReference
|
||||
// .repDetails
|
||||
// .filesList
|
||||
// : []
|
||||
// : []
|
||||
}
|
||||
setFilesForRepresentations={
|
||||
setFilesForRepresentations
|
||||
}
|
||||
containerID={
|
||||
props.props.props.accountDetails
|
||||
.containerID
|
||||
}
|
||||
filenamePrefix={props.formObj}
|
||||
props={props.props.props}
|
||||
setCurrentReference={
|
||||
props.setCurrentReference
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>{" "}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{isTypeConfirmed && (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-button-group">
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
disabled={shouldDisableButton({
|
||||
props,
|
||||
formObj
|
||||
})}
|
||||
>
|
||||
{t("common:continue-button")}
|
||||
</button>
|
||||
{/* {router.query.state != "edit" && (
|
||||
<a
|
||||
onClick={() => {
|
||||
setRepresentationCapacity();
|
||||
props.updateField(
|
||||
"representationForm",
|
||||
"representationCapacity",
|
||||
""
|
||||
);
|
||||
}}
|
||||
className="govuk-link"
|
||||
>
|
||||
{t("common:back-link")}
|
||||
</a>
|
||||
)} */}
|
||||
{savingStatus ? (
|
||||
<span className=" progress-save-active">
|
||||
{router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"}
|
||||
<img
|
||||
className="data-loading-icon"
|
||||
src="/assets/images/loading.gif"
|
||||
alt={
|
||||
router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"
|
||||
}
|
||||
/>
|
||||
</span>
|
||||
) : (
|
||||
<button
|
||||
className="govuk-button progress-save "
|
||||
onClick={() => {
|
||||
let valuesObj =
|
||||
props.props.props.form[props.form]
|
||||
.values || {};
|
||||
|
||||
//console.log("valuesobj:", valuesObj);
|
||||
|
||||
delete valuesObj[
|
||||
"_pinswg_appellant_value"
|
||||
];
|
||||
|
||||
//console.log("on save:", valuesObj);
|
||||
updateRepresentation(
|
||||
valuesObj,
|
||||
false,
|
||||
true
|
||||
);
|
||||
}}
|
||||
>
|
||||
{t("common:save-exit-button")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
updateField: (form, field, newValue) =>
|
||||
dispatch(change(form, field, newValue)),
|
||||
|
||||
setFilesForRepresentations: (fileList) => {
|
||||
dispatch(setFilesForRepresentations(fileList));
|
||||
}
|
||||
});
|
||||
|
||||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps
|
||||
)(
|
||||
reduxForm({
|
||||
form: "representationForm",
|
||||
enableReinitialize: true,
|
||||
destroyOnUnmount: false
|
||||
})(ConsultationAgent)
|
||||
);
|
||||
@@ -1,329 +0,0 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { Field, change, reduxForm } from "redux-form";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { bytesToSize, getThumbnailIconByExtension } from "../../utils";
|
||||
import {
|
||||
FileUploadField,
|
||||
RenderRichMultiline,
|
||||
shouldDisableButton
|
||||
} from "./representationElements";
|
||||
import RepresentationTypeSelectorBlock from "./elements/RepresentationTypeSelectorBlock";
|
||||
|
||||
import { useDropzone } from "react-dropzone";
|
||||
import {
|
||||
setRepresentationCapacity,
|
||||
setRepresentationSubmit,
|
||||
setFilesForRepresentations
|
||||
} from "../../../store/currentView/action";
|
||||
|
||||
const ConsultationAppellant = (props) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const {
|
||||
formObj,
|
||||
appellantApplicantRepresentationArr,
|
||||
setRepresentationCapacity,
|
||||
setRepresentationSubmit,
|
||||
currentView,
|
||||
setRepFileName,
|
||||
updateRepresentation,
|
||||
setSavingStatus,
|
||||
savingStatus,
|
||||
setFilesForRepresentations,
|
||||
onRepresentationTypeChange,
|
||||
onTypeSelectionConfirmed
|
||||
} = props;
|
||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||
|
||||
const persistedRepresentationType =
|
||||
currentView?.caseReference?.repDetails?.representationType;
|
||||
const [typeSelectionConfirmed, setTypeSelectionConfirmed] = useState(
|
||||
!!persistedRepresentationType
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (persistedRepresentationType) {
|
||||
setTypeSelectionConfirmed(true);
|
||||
}
|
||||
}, [persistedRepresentationType]);
|
||||
|
||||
console.log(JSON.stringify(formObj) == "{}" ? "empty" : "value");
|
||||
|
||||
if (JSON.stringify(formObj) != "{}") {
|
||||
setRepFileName(formObj.representationForm.values);
|
||||
|
||||
let filterFilesList = props.currentView.caseReference.hasOwnProperty(
|
||||
"repDetails"
|
||||
)
|
||||
? props.currentView.caseReference.repDetails.hasOwnProperty(
|
||||
"filesList"
|
||||
)
|
||||
? props.currentView.caseReference.repDetails.filesList.filter(
|
||||
function (el) {
|
||||
return el != null;
|
||||
}
|
||||
)
|
||||
: []
|
||||
: [];
|
||||
|
||||
filterFilesList = filterFilesList.filter(
|
||||
(value, index, self) =>
|
||||
index === self.findIndex((t) => t.name === value.name)
|
||||
);
|
||||
|
||||
const selectedRepresentationType =
|
||||
formObj?.representationForm?.values?.representationType ||
|
||||
props.representationType;
|
||||
|
||||
const isTypeConfirmed =
|
||||
!!selectedRepresentationType && typeSelectionConfirmed;
|
||||
|
||||
const selectedRepresentationTypeDisplay =
|
||||
router.locale == "cy"
|
||||
? selectedRepresentationType == "Questionnaire"
|
||||
? "Holiadur"
|
||||
: selectedRepresentationType == "Statement"
|
||||
? "Datganiad"
|
||||
: selectedRepresentationType == "Final comments"
|
||||
? "Sylwadau terfynol"
|
||||
: selectedRepresentationType
|
||||
: selectedRepresentationType;
|
||||
|
||||
return (
|
||||
<>
|
||||
<RepresentationTypeSelectorBlock
|
||||
t={t}
|
||||
headingText={t(
|
||||
"myrepresentations:consultation-from-an-appellant-heading"
|
||||
)}
|
||||
kindLabelText={t(
|
||||
"myrepresentations:kind-of-consultation-label"
|
||||
)}
|
||||
isTypeSelected={isTypeConfirmed}
|
||||
selectedTypeDisplay={selectedRepresentationTypeDisplay}
|
||||
representationType={selectedRepresentationType}
|
||||
setTypeSelectionConfirmed={setTypeSelectionConfirmed}
|
||||
onRepresentationTypeChange={onRepresentationTypeChange}
|
||||
onTypeSelectionConfirmed={onTypeSelectionConfirmed}
|
||||
optionsArr={appellantApplicantRepresentationArr}
|
||||
/>
|
||||
{isTypeConfirmed && (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-form-group">
|
||||
<p className="govuk-body">
|
||||
{selectedRepresentationType ==
|
||||
"Consultation Response"
|
||||
? t("myrepresentations:enter-comment-label")
|
||||
: t(
|
||||
"myrepresentations:consultation-comment-label"
|
||||
)}
|
||||
</p>
|
||||
<fieldset
|
||||
className="govuk-fieldset"
|
||||
aria-describedby="commentBox-hint"
|
||||
>
|
||||
{selectedRepresentationType ==
|
||||
"Consultation Response" && (
|
||||
<div className="govuk-form-group">
|
||||
<Field
|
||||
name="representationComments"
|
||||
id="representationComments"
|
||||
component={RenderRichMultiline}
|
||||
type="text"
|
||||
rows="5"
|
||||
className="govuk-textarea govuk-input--width-30"
|
||||
aria-describedby={
|
||||
props.name + "-hint"
|
||||
}
|
||||
/>
|
||||
{formObj.representationForm.values
|
||||
.appealType == "846040004" ? (
|
||||
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label"
|
||||
)}{" "}
|
||||
<a
|
||||
href={t(
|
||||
"myrepresentations:publish-policy-link"
|
||||
)}
|
||||
>
|
||||
{t(
|
||||
"myrepresentations:publish-policy-link-label"
|
||||
)}
|
||||
</a>{" "}
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label-two"
|
||||
)}
|
||||
</p>
|
||||
) : (
|
||||
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label"
|
||||
)}{" "}
|
||||
<a
|
||||
href={t(
|
||||
"myrepresentations:publish-policy-link"
|
||||
)}
|
||||
>
|
||||
{t(
|
||||
"myrepresentations:publish-policy-link-label"
|
||||
)}
|
||||
</a>{" "}
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label-two"
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
||||
<FileUploadField
|
||||
name={"representationDocuments"}
|
||||
id={"representationDocuments"}
|
||||
label={t(
|
||||
"myrepresentations:add-files-label"
|
||||
)}
|
||||
ticketnumber={props.props.caseReference}
|
||||
hint={"sdsd"}
|
||||
fileList={
|
||||
props.currentView.fileList
|
||||
// props.currentView.caseReference.hasOwnProperty(
|
||||
// "repDetails"
|
||||
// )
|
||||
// ? props.currentView.caseReference.repDetails.hasOwnProperty(
|
||||
// "filesList"
|
||||
// ) &&
|
||||
// props.currentView
|
||||
// .caseReference.repDetails
|
||||
// .filesList.length > 0
|
||||
// ? props.currentView
|
||||
// .caseReference
|
||||
// .repDetails.filesList
|
||||
// : []
|
||||
// : []
|
||||
}
|
||||
setFilesForRepresentations={
|
||||
setFilesForRepresentations
|
||||
}
|
||||
containerID={
|
||||
props.props.props.accountDetails
|
||||
.containerID
|
||||
}
|
||||
filenamePrefix={props.formObj}
|
||||
props={props.props.props}
|
||||
setCurrentReference={
|
||||
props.setCurrentReference
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>{" "}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isTypeConfirmed && (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-button-group">
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
disabled={shouldDisableButton({
|
||||
props,
|
||||
formObj
|
||||
})}
|
||||
>
|
||||
{t("common:continue-button")}
|
||||
</button>
|
||||
{/* {router.query.state != "edit" && (
|
||||
<a
|
||||
onClick={() => {
|
||||
setRepresentationCapacity();
|
||||
props.updateField(
|
||||
"representationType",
|
||||
""
|
||||
);
|
||||
}}
|
||||
className="govuk-link"
|
||||
>
|
||||
{t("common:back-link")}
|
||||
</a>
|
||||
)} */}
|
||||
|
||||
{savingStatus ? (
|
||||
<span className=" progress-save-active">
|
||||
{router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"}
|
||||
<img
|
||||
className="data-loading-icon"
|
||||
src="/assets/images/loading.gif"
|
||||
alt={
|
||||
router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"
|
||||
}
|
||||
/>
|
||||
</span>
|
||||
) : (
|
||||
<button
|
||||
className="govuk-button progress-save "
|
||||
onClick={() => {
|
||||
let valuesObj =
|
||||
props.props.props.form[props.form]
|
||||
.values || {};
|
||||
|
||||
//console.log("valuesobj:", valuesObj);
|
||||
|
||||
delete valuesObj[
|
||||
"_pinswg_appellant_value"
|
||||
];
|
||||
|
||||
//console.log("on save:", valuesObj);
|
||||
updateRepresentation(
|
||||
valuesObj,
|
||||
false,
|
||||
true
|
||||
);
|
||||
}}
|
||||
>
|
||||
{t("common:save-exit-button")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
//const mapStateToProps = (state, props) => {};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
updateField: (form, field, newValue) =>
|
||||
dispatch(change(form, field, newValue)),
|
||||
|
||||
setFilesForRepresentations: (fileList) => {
|
||||
dispatch(setFilesForRepresentations(fileList));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps
|
||||
)(
|
||||
reduxForm({
|
||||
form: "representationForm",
|
||||
enableReinitialize: true,
|
||||
destroyOnUnmount: false
|
||||
})(ConsultationAppellant)
|
||||
);
|
||||
@@ -1,368 +0,0 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { Field, change, reduxForm } from "redux-form";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { bytesToSize, getThumbnailIconByExtension } from "../../utils";
|
||||
import {
|
||||
FileUploadField,
|
||||
RenderCondtionalRadioList,
|
||||
RenderRichMultiline,
|
||||
shouldDisableButton
|
||||
} from "./representationElements";
|
||||
import RepresentationTypeSelectorBlock from "./elements/RepresentationTypeSelectorBlock";
|
||||
|
||||
import { useDropzone } from "react-dropzone";
|
||||
import {
|
||||
setRepresentationCapacity,
|
||||
setRepresentationSubmit,
|
||||
setFilesForRepresentations
|
||||
} from "../../../store/currentView/action";
|
||||
|
||||
const ConsultationInterestedPartyPerson = (props) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const {
|
||||
formObj,
|
||||
interestedPersonRepresentationArr,
|
||||
setRepresentationCapacity,
|
||||
setRepresentationSubmit,
|
||||
setRepFileName,
|
||||
updateRepresentation,
|
||||
setSavingStatus,
|
||||
savingStatus,
|
||||
setFilesForRepresentations,
|
||||
onRepresentationTypeChange,
|
||||
onTypeSelectionConfirmed
|
||||
} = props;
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
|
||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||
|
||||
const persistedRepresentationType =
|
||||
props.currentView?.caseReference?.repDetails?.representationType;
|
||||
const [typeSelectionConfirmed, setTypeSelectionConfirmed] = useState(
|
||||
!!persistedRepresentationType
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (persistedRepresentationType) {
|
||||
setTypeSelectionConfirmed(true);
|
||||
}
|
||||
}, [persistedRepresentationType]);
|
||||
|
||||
if (JSON.stringify(formObj) != "{}") {
|
||||
setRepFileName(formObj.representationForm.values);
|
||||
|
||||
let filterFilesList = props.currentView.caseReference.hasOwnProperty(
|
||||
"repDetails"
|
||||
)
|
||||
? props.currentView.caseReference.repDetails.hasOwnProperty(
|
||||
"filesList"
|
||||
)
|
||||
? props.currentView.caseReference.repDetails.filesList.filter(
|
||||
function (el) {
|
||||
return el != null;
|
||||
}
|
||||
)
|
||||
: []
|
||||
: [];
|
||||
|
||||
const files = acceptedFiles.map((file) => (
|
||||
<li key={file.path}>
|
||||
{file.path} - {file.size} bytes
|
||||
</li>
|
||||
));
|
||||
|
||||
const selectedRepresentationType =
|
||||
formObj?.representationForm?.values?.representationType ||
|
||||
props.representationType;
|
||||
|
||||
const isTypeConfirmed =
|
||||
!!selectedRepresentationType && typeSelectionConfirmed;
|
||||
|
||||
const selectedRepresentationTypeDisplay =
|
||||
router.locale == "cy"
|
||||
? selectedRepresentationType == "Questionnaire"
|
||||
? "Holiadur"
|
||||
: selectedRepresentationType == "Statement"
|
||||
? "Datganiad"
|
||||
: selectedRepresentationType == "Final comments"
|
||||
? "Sylwadau terfynol"
|
||||
: selectedRepresentationType
|
||||
: selectedRepresentationType;
|
||||
|
||||
return (
|
||||
<>
|
||||
<RepresentationTypeSelectorBlock
|
||||
t={t}
|
||||
headingText={t(
|
||||
"myrepresentations:consultation-from-an-interested-person-heading"
|
||||
)}
|
||||
kindLabelText={t(
|
||||
"myrepresentations:kind-of-consultation-label"
|
||||
)}
|
||||
isTypeSelected={isTypeConfirmed}
|
||||
selectedTypeDisplay={selectedRepresentationTypeDisplay}
|
||||
representationType={selectedRepresentationType}
|
||||
setTypeSelectionConfirmed={setTypeSelectionConfirmed}
|
||||
onRepresentationTypeChange={onRepresentationTypeChange}
|
||||
onTypeSelectionConfirmed={onTypeSelectionConfirmed}
|
||||
optionsArr={interestedPersonRepresentationArr}
|
||||
validate={[required]}
|
||||
errorMsg={t("myrepresentations:select-an-option-label")}
|
||||
/>
|
||||
{isTypeConfirmed && (
|
||||
<>
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-form-group">
|
||||
<Field
|
||||
name="representationOnBehalfOf"
|
||||
datafieldname="representationOnBehalfOf"
|
||||
// label="In what capacity do you wish to make representations on this case?"
|
||||
options={[
|
||||
t(
|
||||
"myrepresentations:questionnaire-yes"
|
||||
),
|
||||
t("myrepresentations:questionnaire-no")
|
||||
]}
|
||||
id="representationOnBehalfOf"
|
||||
className="govuk-radios__input"
|
||||
errorMsg={t(
|
||||
"myrepresentations:select-an-option-label"
|
||||
)}
|
||||
component={RenderCondtionalRadioList}
|
||||
validate={[required]}
|
||||
legend={t("case:representation-onbehalfof")}
|
||||
hint={t(
|
||||
"myrepresentations:representation-onbehalfof-hint"
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-form-group">
|
||||
<p className="govuk-body">
|
||||
{selectedRepresentationType ==
|
||||
"Consultation Response"
|
||||
? t(
|
||||
"myrepresentations:enter-comment-label"
|
||||
)
|
||||
: t(
|
||||
"myrepresentations:consultation-comment-label"
|
||||
)}
|
||||
</p>
|
||||
<fieldset
|
||||
className="govuk-fieldset"
|
||||
aria-describedby="commentBox-hint"
|
||||
>
|
||||
{" "}
|
||||
{selectedRepresentationType ==
|
||||
"Consultation Response" && (
|
||||
<div className="govuk-form-group">
|
||||
<Field
|
||||
name="representationComments"
|
||||
id="representationComments"
|
||||
component={RenderRichMultiline}
|
||||
type="text"
|
||||
rows="5"
|
||||
className="govuk-textarea govuk-input--width-30"
|
||||
aria-describedby={
|
||||
props.name + "-hint"
|
||||
}
|
||||
/>
|
||||
{formObj.representationForm.values
|
||||
.appealType == "846040004" ? (
|
||||
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label"
|
||||
)}{" "}
|
||||
<a
|
||||
href={t(
|
||||
"myrepresentations:publish-policy-link"
|
||||
)}
|
||||
>
|
||||
{t(
|
||||
"myrepresentations:publish-policy-link-label"
|
||||
)}
|
||||
</a>{" "}
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label-two"
|
||||
)}
|
||||
</p>
|
||||
) : (
|
||||
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label"
|
||||
)}{" "}
|
||||
<a
|
||||
href={t(
|
||||
"myrepresentations:publish-policy-link"
|
||||
)}
|
||||
>
|
||||
{t(
|
||||
"myrepresentations:publish-policy-link-label"
|
||||
)}
|
||||
</a>{" "}
|
||||
{t(
|
||||
"myrepresentations:publish-policy-label-two"
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
||||
<FileUploadField
|
||||
name={"representationDocuments"}
|
||||
id={"representationDocuments"}
|
||||
label={t(
|
||||
"myrepresentations:add-files-label"
|
||||
)}
|
||||
ticketnumber={
|
||||
props.props.caseReference
|
||||
}
|
||||
hint={"sdsd"}
|
||||
fileList={
|
||||
props.currentView.fileList
|
||||
|
||||
// props.currentView.caseReference.hasOwnProperty(
|
||||
// "repDetails"
|
||||
// )
|
||||
// ? props.currentView.caseReference.repDetails.hasOwnProperty(
|
||||
// "filesList"
|
||||
// ) &&
|
||||
// props.currentView
|
||||
// .caseReference
|
||||
// .repDetails.filesList
|
||||
// .length > 0
|
||||
// ? props.currentView
|
||||
// .caseReference
|
||||
// .repDetails
|
||||
// .filesList
|
||||
// : []
|
||||
// : []
|
||||
}
|
||||
setFilesForRepresentations={
|
||||
setFilesForRepresentations
|
||||
}
|
||||
containerID={
|
||||
props.props.props.accountDetails
|
||||
.containerID
|
||||
}
|
||||
filenamePrefix={props.formObj}
|
||||
props={props.props.props}
|
||||
setCurrentReference={
|
||||
props.setCurrentReference
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>{" "}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{isTypeConfirmed && (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-button-group">
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
disabled={shouldDisableButton({
|
||||
props,
|
||||
formObj
|
||||
})}
|
||||
>
|
||||
{t("common:continue-button")}
|
||||
</button>
|
||||
{/*
|
||||
<a
|
||||
onClick={() => {
|
||||
setRepresentationCapacity();
|
||||
props.updateField(
|
||||
"representationForm",
|
||||
"representationCapacity",
|
||||
""
|
||||
);
|
||||
props.updateField(
|
||||
"representationForm",
|
||||
"representationType",
|
||||
""
|
||||
);
|
||||
}}
|
||||
className="govuk-link"
|
||||
>
|
||||
{t("case:summary-back-button-label")}
|
||||
</a> */}
|
||||
{savingStatus ? (
|
||||
<span className=" progress-save-active">
|
||||
{router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"}
|
||||
<img
|
||||
className="data-loading-icon"
|
||||
src="/assets/images/loading.gif"
|
||||
alt={
|
||||
router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"
|
||||
}
|
||||
/>
|
||||
</span>
|
||||
) : (
|
||||
<button
|
||||
className="govuk-button progress-save "
|
||||
onClick={() => {
|
||||
let valuesObj =
|
||||
props.props.props.form[props.form]
|
||||
.values || {};
|
||||
|
||||
//console.log("valuesobj:", valuesObj);
|
||||
|
||||
delete valuesObj[
|
||||
"_pinswg_appellant_value"
|
||||
];
|
||||
|
||||
//console.log("on save:", valuesObj);
|
||||
updateRepresentation(
|
||||
valuesObj,
|
||||
false,
|
||||
true
|
||||
);
|
||||
}}
|
||||
>
|
||||
{t("common:save-exit-button")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
//const mapStateToProps = (state, props) => {};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
updateField: (form, field, newValue) =>
|
||||
dispatch(change(form, field, newValue)),
|
||||
setFilesForRepresentations: (fileList) => {
|
||||
dispatch(setFilesForRepresentations(fileList));
|
||||
}
|
||||
});
|
||||
|
||||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps
|
||||
)(
|
||||
reduxForm({
|
||||
form: "representationForm",
|
||||
enableReinitialize: true,
|
||||
destroyOnUnmount: false
|
||||
})(ConsultationInterestedPartyPerson)
|
||||
);
|
||||
@@ -1,42 +0,0 @@
|
||||
const RepresentationActionButtons = ({
|
||||
t,
|
||||
locale,
|
||||
isSaving,
|
||||
isContinueDisabled,
|
||||
onSaveExit
|
||||
}) => {
|
||||
return (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-button-group">
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
disabled={isContinueDisabled}
|
||||
>
|
||||
{t("common:continue-button")}
|
||||
</button>
|
||||
|
||||
{isSaving ? (
|
||||
<span className=" progress-save-active">
|
||||
{locale == "cy" ? "Nôl data" : "Saving data"}
|
||||
<img
|
||||
className="data-loading-icon"
|
||||
src="/assets/images/loading.gif"
|
||||
alt={locale == "cy" ? "Nôl data" : "Saving data"}
|
||||
/>
|
||||
</span>
|
||||
) : (
|
||||
<button
|
||||
className="govuk-button progress-save "
|
||||
onClick={onSaveExit}
|
||||
>
|
||||
{t("common:save-exit-button")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default RepresentationActionButtons;
|
||||
@@ -1,205 +0,0 @@
|
||||
import { Field } from "redux-form";
|
||||
import router from "next/router";
|
||||
import Link from "next/link";
|
||||
|
||||
const getRepresentationTypeHint = (option, t) => {
|
||||
const map = {
|
||||
"Statement": t("myrepresentations:rep-type-statement-hint"),
|
||||
"Final comments": t("myrepresentations:rep-type-final-comments-hint"),
|
||||
"Questionnaire": t("myrepresentations:rep-type-questionnaire-hint"),
|
||||
"Consultation Response": t(
|
||||
"myrepresentations:rep-type-consultation-hint"
|
||||
),
|
||||
"Local Impact Report": t("myrepresentations:rep-type-lir-hint"),
|
||||
"Marine Impact Report": t("myrepresentations:rep-type-mir-hint")
|
||||
};
|
||||
|
||||
return map[option] || "";
|
||||
};
|
||||
|
||||
const getRepresentationTypeLabel = (option) => {
|
||||
if (router.locale !== "cy") {
|
||||
return option;
|
||||
}
|
||||
|
||||
if (option === "Questionnaire") {
|
||||
return "Holiadur";
|
||||
}
|
||||
|
||||
if (option === "Statement") {
|
||||
return "Datganiad";
|
||||
}
|
||||
|
||||
if (option === "Final comments") {
|
||||
return "Sylwadau terfynol";
|
||||
}
|
||||
|
||||
return option;
|
||||
};
|
||||
|
||||
const RenderRepresentationTypeRadioList = ({
|
||||
name,
|
||||
optionsArr,
|
||||
errorMsg,
|
||||
onRepresentationTypeChange,
|
||||
input,
|
||||
meta: { touched, error }
|
||||
}) => {
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
touched && error
|
||||
? "govuk-form-group govuk-form-group--error"
|
||||
: "govuk-form-group"
|
||||
}
|
||||
>
|
||||
{touched && error && (
|
||||
<span id={`${name}-error`} className="govuk-error-message">
|
||||
<span className="govuk-visually-hidden">Error:</span>{" "}
|
||||
{errorMsg}
|
||||
</span>
|
||||
)}
|
||||
|
||||
<div className="govuk-radios govuk-radios--small">
|
||||
{optionsArr.map((option, index) => {
|
||||
const optionId = `${name}_${index}`;
|
||||
const hintId = `${optionId}-hint`;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={option.value || optionId}
|
||||
className="govuk-radios__item representation-type-option"
|
||||
>
|
||||
<input
|
||||
className="govuk-radios__input"
|
||||
id={optionId}
|
||||
name={input.name}
|
||||
type="radio"
|
||||
value={option.value}
|
||||
checked={input.value === option.value}
|
||||
onChange={() => input.onChange(option.value)}
|
||||
aria-describedby={
|
||||
option.hint ? hintId : undefined
|
||||
}
|
||||
/>
|
||||
|
||||
<label
|
||||
className="govuk-label govuk-radios__label govuk-!-font-weight-bold "
|
||||
htmlFor={optionId}
|
||||
>
|
||||
{option.label}
|
||||
|
||||
{option.hint && (
|
||||
<div
|
||||
id={hintId}
|
||||
className="govuk-hint govuk-!-margin-top-2"
|
||||
>
|
||||
{option.hint}
|
||||
</div>
|
||||
)}
|
||||
</label>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
const RepresentationTypeSelectorBlock = ({
|
||||
t,
|
||||
headingText,
|
||||
kindLabelText,
|
||||
isTypeSelected,
|
||||
selectedTypeDisplay,
|
||||
representationType,
|
||||
setTypeSelectionConfirmed,
|
||||
onRepresentationTypeChange,
|
||||
onTypeSelectionConfirmed,
|
||||
optionsArr,
|
||||
validate,
|
||||
errorMsg
|
||||
}) => {
|
||||
const enhancedOptions = (optionsArr || [])
|
||||
.filter((option) => option && option !== "Select...")
|
||||
.map((option) => ({
|
||||
value: option,
|
||||
label: getRepresentationTypeLabel(option),
|
||||
hint: getRepresentationTypeHint(option, t)
|
||||
}));
|
||||
|
||||
const hasSelectableOptions = enhancedOptions.length > 0;
|
||||
|
||||
return (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-form-group">
|
||||
{!isTypeSelected ? (
|
||||
<>
|
||||
<h2 className="govuk-heading-m ">{headingText}</h2>
|
||||
|
||||
<label
|
||||
className="govuk-label govuk-body-m govuk-!-margin-bottom-2"
|
||||
htmlFor="representationType"
|
||||
>
|
||||
{kindLabelText}
|
||||
</label>
|
||||
|
||||
{hasSelectableOptions ? (
|
||||
<>
|
||||
<Field
|
||||
name="representationType"
|
||||
component={
|
||||
RenderRepresentationTypeRadioList
|
||||
}
|
||||
onRepresentationTypeChange={
|
||||
onRepresentationTypeChange
|
||||
}
|
||||
validate={validate}
|
||||
optionsArr={enhancedOptions}
|
||||
errorMsg={errorMsg}
|
||||
/>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
disabled={!representationType}
|
||||
onClick={() => {
|
||||
if (representationType) {
|
||||
setTypeSelectionConfirmed(true);
|
||||
onTypeSelectionConfirmed &&
|
||||
onTypeSelectionConfirmed(
|
||||
representationType
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{t("common:continue-button")}
|
||||
</button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p className="govuk-body">
|
||||
{t(
|
||||
"myrepresentations:representation-type-unavailable-label"
|
||||
)}
|
||||
</p>
|
||||
<Link className="govuk-link" href="/">
|
||||
{t(
|
||||
"myrepresentations:return-home-link-label"
|
||||
)}
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<label className="govuk-label govuk-body-m">
|
||||
{t("myrepresentations:representation-type")}:{" "}
|
||||
{selectedTypeDisplay}
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default RepresentationTypeSelectorBlock;
|
||||
@@ -0,0 +1,212 @@
|
||||
import Link from "next/link";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import _ from "lodash";
|
||||
import { Field, FieldArray, reduxForm, formValueSelector } from "redux-form";
|
||||
import { connect } from "react-redux";
|
||||
import { useDropzone } from "react-dropzone";
|
||||
|
||||
import { setRepresentationCapacity } from "../../../store/currentView/action";
|
||||
import RepCapacitySelection from "./representationCapacitySelection";
|
||||
import RepDetails from "./representationDetails";
|
||||
import RepAppellant from "./representationAppellant";
|
||||
import RepAgent from "./representationAgent";
|
||||
import RepInterestedPartyPerson from "./representationInterestedPartyPerson";
|
||||
import RepLandOwner from "./representationLandowner";
|
||||
import {
|
||||
RenderPickList,
|
||||
RenderRadioList,
|
||||
RenderTextfield,
|
||||
} from "./representationElements";
|
||||
|
||||
let MakeRepresentation = (props) => {
|
||||
let { t } = useTranslation();
|
||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||
|
||||
const [clearRepForm, setClearRepForm] = useState(false);
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const {
|
||||
caseReference,
|
||||
myCases,
|
||||
myRepresentations,
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
searchResultsObj,
|
||||
currentType,
|
||||
currentView,
|
||||
setRepresentationCapacity,
|
||||
} = props;
|
||||
const formObj = props.props.form;
|
||||
let setCaseQueryObj = props[currentType];
|
||||
var casesObj = {};
|
||||
|
||||
currentType == "searchResultsObj"
|
||||
? (casesObj = jsonpath.query(
|
||||
setCaseQueryObj,
|
||||
'$..[?(@.title=="' + caseReference + '")]'
|
||||
))
|
||||
: (casesObj = jsonpath.query(
|
||||
setCaseQueryObj,
|
||||
'$..[?(@.reference=="' + caseReference + '")]'
|
||||
));
|
||||
|
||||
casesObj = Object.assign({}, ...casesObj);
|
||||
|
||||
const capacityOptionsArr = [
|
||||
"Appellant",
|
||||
"Agent",
|
||||
"Interested Party/Person",
|
||||
"Land Owner",
|
||||
];
|
||||
|
||||
const appellantApplicantRepresentationArr = [
|
||||
"Other",
|
||||
"Statement",
|
||||
"Statement of common ground",
|
||||
"Written statement of evidence",
|
||||
];
|
||||
|
||||
const interestedPersonRepresentationArr = [
|
||||
"Interested Party/Person correspondence",
|
||||
];
|
||||
|
||||
const landOwnerRepresentationArr = [
|
||||
"Other",
|
||||
"Statement",
|
||||
"Written statement of evidence",
|
||||
];
|
||||
|
||||
const repCapacityType = () => {
|
||||
currentView.representationCapacity == false
|
||||
? false
|
||||
: _.isEmpty(formObj["representationForm"])
|
||||
? false
|
||||
: _.isEmpty(formObj["representationForm"].values)
|
||||
? false
|
||||
: _.isEmpty(
|
||||
formObj["representationForm"].values.representationCapacity
|
||||
)
|
||||
? setRepresentationCapacity(false)
|
||||
: setRepresentationCapacity(
|
||||
formObj["representationForm"].values.representationCapacity
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
);
|
||||
|
||||
return currentView.representationCapacity;
|
||||
};
|
||||
|
||||
const whichControl = () => {
|
||||
repCapacityType();
|
||||
switch (currentView.representationCapacity) {
|
||||
case false:
|
||||
return (
|
||||
<RepCapacitySelection
|
||||
formObj={formObj}
|
||||
capacityOptionsArr={capacityOptionsArr}
|
||||
currentType={currentType}
|
||||
casesObj={casesObj}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "appellant":
|
||||
setRepresentationCapacity("appellant");
|
||||
return (
|
||||
<RepAppellant
|
||||
formObj={formObj}
|
||||
appellantApplicantRepresentationArr={
|
||||
appellantApplicantRepresentationArr
|
||||
}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "agent":
|
||||
setRepresentationCapacity("agent");
|
||||
return (
|
||||
<RepAgent
|
||||
formObj={formObj}
|
||||
appellantApplicantRepresentationArr={
|
||||
appellantApplicantRepresentationArr
|
||||
}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "interestedpartyperson":
|
||||
setRepresentationCapacity("interestedpartyperson");
|
||||
return (
|
||||
<RepInterestedPartyPerson
|
||||
formObj={formObj}
|
||||
interestedPersonRepresentationArr={
|
||||
interestedPersonRepresentationArr
|
||||
}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "landowner":
|
||||
setRepresentationCapacity("landowner");
|
||||
return (
|
||||
<RepLandOwner
|
||||
formObj={formObj}
|
||||
landOwnerRepresentationArr={landOwnerRepresentationArr}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
default:
|
||||
return (
|
||||
<RepCapacitySelection
|
||||
formObj={formObj}
|
||||
capacityOptionsArr={capacityOptionsArr}
|
||||
currentType={currentType}
|
||||
casesObj={casesObj}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
{whichControl()} - {props.firstValue}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
currentView: state.currentView,
|
||||
//form: state.form,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setRepresentationCapacity: (representationCapacity) => {
|
||||
dispatch(setRepresentationCapacity(representationCapacity));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const selector = formValueSelector("representationForm");
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(
|
||||
reduxForm({
|
||||
form: "representationForm",
|
||||
destroyOnUnmount: false,
|
||||
})(MakeRepresentation)
|
||||
);
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user