diff --git a/app/plugins/TermsAgreer/resources/locales/en_US/terms_agreer.po b/app/plugins/TermsAgreer/resources/locales/en_US/terms_agreer.po index 76a5a61bc..247472cd5 100644 --- a/app/plugins/TermsAgreer/resources/locales/en_US/terms_agreer.po +++ b/app/plugins/TermsAgreer/resources/locales/en_US/terms_agreer.po @@ -37,12 +37,21 @@ msgstr "Ignore" msgid "enumeration.TAndCEnrollmentModeEnum.IC" msgstr "Implied Consent" +msgid "error.TAndCAgreementMissing" +msgstr "Did not receive agreement for \"{0}\" (T&C {1})" + msgid "field.AgreementCollectors.t_and_c_mode" msgstr "Terms and Conditions Mode" +msgid "information.AgreementCollectors.external" +msgstr "These Terms and Conditions will be loaded in an external browser window. After review, you must return to this window and click \"I Agree\" to continue." + msgid "information.AgreementCollectors.review" msgstr "You must review and agree to these Terms and Conditions before continuing." +msgid "information.AgreementCollectors.review.tc" +msgstr "Review Terms & Conditions" + msgid "result.AgreementCollectors.ignored" msgstr "Terms and Conditions collection disabled" diff --git a/app/plugins/TermsAgreer/src/Controller/AgreementCollectorsController.php b/app/plugins/TermsAgreer/src/Controller/AgreementCollectorsController.php index 751918faa..167b9088c 100644 --- a/app/plugins/TermsAgreer/src/Controller/AgreementCollectorsController.php +++ b/app/plugins/TermsAgreer/src/Controller/AgreementCollectorsController.php @@ -75,8 +75,8 @@ public function dispatch(string $id) { $TermsAndConditions = TableRegistry::getTableLocator()->get('TermsAndConditions'); $whereClause = [ - 'co_id' => $coId, - 'status' => SuspendableStatusEnum::Active + 'TermsAndConditions.co_id' => $coId, + 'TermsAndConditions.status' => SuspendableStatusEnum::Active ]; if(!empty($petition->cou_id)) { @@ -89,6 +89,7 @@ public function dispatch(string $id) { } $tandc = $TermsAndConditions->find() + ->contain(['MostlyStaticPages']) ->where($whereClause) ->order('ordr ASC') ->all(); @@ -118,7 +119,7 @@ public function dispatch(string $id) { if(!isset($data[$key]) || $data[$key] != "1") { $ok = false; - $this->Flash->error("Did not find agreement for T&C " . $tc->id); // XXX I18n + $this->Flash->error(__d('terms_agreer','error.TAndCAgreementMissing', [$tc->description, $tc->id])); } } diff --git a/app/plugins/TermsAgreer/templates/AgreementCollectors/dispatch.inc b/app/plugins/TermsAgreer/templates/AgreementCollectors/dispatch.inc index e5bdfeb61..159fe00ee 100644 --- a/app/plugins/TermsAgreer/templates/AgreementCollectors/dispatch.inc +++ b/app/plugins/TermsAgreer/templates/AgreementCollectors/dispatch.inc @@ -35,40 +35,159 @@ print $this->element('flash', []); $this->Field->enableFormEditMode(); ?> -

+

Form->create(null, [ 'id' => 'agreement-form', 'type' => 'post' ]); -print " - - - - - -"; -foreach($vv_tandc as $tc) { - print " - - - +?> + +
Terms and ConditionsI Agree
" . $tc['description'] . "" . $this->Form->checkbox("tc".$tc['id']) . "
+ + + + + + + + + + + - "; -} + + +
+ + + + url)): // We have a URL based T&C ?> + + + element('TermsAgreer.agreeDialog', ['vv_tc' => $tc]); ?> + + +
+ Form->checkbox( + 'tc'.$tc['id'], + ['id' => 'tc'.$tc['id'], 'class' => 'form-check-input tc-agree-checkbox'] + ) . + $this->Form->label( + 'tc'.$tc['id'], + __d('operation','agree'), + ['class' => 'form-check-label'] + ) + ?> +
+
+ + + \ No newline at end of file diff --git a/app/plugins/TermsAgreer/templates/element/agreeDialog.php b/app/plugins/TermsAgreer/templates/element/agreeDialog.php new file mode 100644 index 000000000..0d710126d --- /dev/null +++ b/app/plugins/TermsAgreer/templates/element/agreeDialog.php @@ -0,0 +1,76 @@ + and