From 8f5b89506fbc7470facd5e2579263f51abf3d817 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Wed, 11 Dec 2024 10:15:51 +0000 Subject: [PATCH] LIMS-867: Improve 'Add Lab Contact' page --- .../src/js/modules/contact/views/addcontact.js | 17 +++++++++++++++++ client/src/js/templates/contact/contactadd.html | 11 +++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/client/src/js/modules/contact/views/addcontact.js b/client/src/js/modules/contact/views/addcontact.js index 45f61414a..25eca2a5d 100644 --- a/client/src/js/modules/contact/views/addcontact.js +++ b/client/src/js/modules/contact/views/addcontact.js @@ -28,10 +28,24 @@ define(['views/form', ad: 'textarea[name=ADDRESS]', ci: 'input[name=CITY]', pc: 'input[name=POSTCODE]', + lb: '.leaveblank', }, events: { 'change @ui.pid': 'fillUserInfo', + 'change @ui.country': 'onCountryChange', + }, + + onCountryChange: function() { + let country = this.ui.country.val() + if ( + app.options.get('facility_courier_countries').indexOf(country) > -1 || + app.options.get('facility_courier_countries_nde').indexOf(country) > -1 + ) { + this.ui.lb.html('
Academic users from '+country+' can leave this blank to use the facility courier.') + } else { + this.ui.lb.html('') + } }, fillUserInfo: function() { @@ -65,7 +79,10 @@ define(['views/form', Promise.all([this.countries.fetch(), this.users.fetch()]).then(() => { this.populateCountries(); this.populateUsers(); + this.onCountryChange(); }) + this.ui.ad.css('height', '100px') + this.ui.ad.css('width', '50%') }, populateCountries: function() { diff --git a/client/src/js/templates/contact/contactadd.html b/client/src/js/templates/contact/contactadd.html index 6aee6dc98..217b2d4d3 100644 --- a/client/src/js/templates/contact/contactadd.html +++ b/client/src/js/templates/contact/contactadd.html @@ -10,7 +10,7 @@

Add New Home Lab Contact

  • @@ -37,7 +37,9 @@

    Add New Home Lab Contact

  • - +
  • @@ -58,7 +60,7 @@

    Add New Home Lab Contact

  • @@ -80,7 +82,8 @@

    Add New Home Lab Contact