diff --git a/app/uk/gov/hmrc/cataloguefrontend/deployments/view/DeployServicePage.scala.html b/app/uk/gov/hmrc/cataloguefrontend/deployments/view/DeployServicePage.scala.html index 5c5a0bcdc..2221ad41e 100644 --- a/app/uk/gov/hmrc/cataloguefrontend/deployments/view/DeployServicePage.scala.html +++ b/app/uk/gov/hmrc/cataloguefrontend/deployments/view/DeployServicePage.scala.html @@ -145,14 +145,23 @@

Deploy Service

@helper.form( action = appRoutes.DeployServiceController.step3() , Symbol("method") -> "POST" + , Symbol("id") -> "deployServiceForm" ) { @csrfFormField
- -

+ @if(form.get.environment == Environment.Production && !releases.exists(_.environment == Environment.Production)) { +
+ + +
+ } + +

} } @@ -171,6 +180,28 @@

Deploy Service

minSearch : 1 }); + document.addEventListener('DOMContentLoaded', function () { + const form = document.getElementById('deployServiceForm'); + const deployButton = document.getElementById('deploy-btn'); + const checkbox = document.getElementById('firstDeploymentCheckbox'); + + if (form && checkbox && deployButton) { + const initialButtonIsDisabled = deployButton.disabled; + + deployButton.disabled = !!(!checkbox.checked || initialButtonIsDisabled); + + checkbox.addEventListener('change', function () { + if (checkbox.checked) { + if (!initialButtonIsDisabled) { + deployButton.disabled = false; + } + } else { + deployButton.disabled = true; + } + }); + } + }); + @if(form("serviceName").value.isDefined) { let form2 = document.forms['version-environment-form']; let helpfulVersions = document.getElementById('helpful-versions')