Managing more with less

How do Irish CIOs view the strategic needs of IT in their organisations? The IT manager of Beaumont Hospital, Dublin explains how he maintains and develops IT strategy in an environment of cost cutting and retrenchment

Accepted wisdom has it that investments in IT help to lower the cost of doing business by automating time-consuming and labour-intensive tasks, thereby making employees more productive. This translates to the bottom line when more output is achieved by fewer people. As Mr Micawber might have put it: revenue up, costs down. Result: happiness.

In the case of hospitals, however the same theory does not apply. Investments in IT have an unfortunate tendency to help send costs spiralling, and the more successful the implementation of IT, the greater the rise in costs.

As Tony Kenny, head of IT at one of Dublin’s main health care facilities, Beaumont Hospital, points out this is because although the IT department has an annual budget of EUR2.5m, almost none of it is spent on the main activity of the hospital, namely administering treatment to patients.

 

advertisement

 

‘The work of the hospital breaks down into three generic categories,’ he says. ‘The first is administration which is pretty much the same as in any business: payroll, personnel, accounting and so forth. In that area, we have fairly comprehensive computerisation.’

The second area is what Kenny calls process work involving routine business processes, like the admission or transfer of a patient, or the ordering of an investigation. Again in this area most processes are computerised. ‘There is one exception which is medication prescription and administration,’ he says. ‘We haven’t done that yet, although neither has anybody else in the country that I’m aware of and it’s on our war plan to do this year.’

The third aspect of the hospital’s work, however, is knowledge work and that is the area in which IT has so far had the smallest direct impact, despite the fact that it is the core work of the hospital. ‘When you think about it,’ says Kenny, ‘that’s why people come here — to benefit from the knowledge and expertise of the key knowledge workers we have who are doctors, nurses and therapists’.

Much of their work is still performed manually. ‘If you go to our admission’s process, for example,’ he says, ‘you will see that there are large brown paper charts in which all essential knowledge is captured. Patients’ blood results, X-ray results, and ECG requests are all computerised, but the key work is not and that is a characteristic we share with about 99.8 percent of hospitals around the world.’

The unfortunate part of all this, from an accounting perspective, is that IT has successfully increased productivity in those sections of the treatment process that have traditionally been the least costly, with the effect that a greater amount of work is now being done by the medical staff, what Kenny call’s the hospital’s ‘knowledge workers’. As their time is more expensive, the overall costs of the hospital mount.

There are a few truisms associated with health care. One is that the bulk of the expense incurred when treating a patient happens in the first four days of their treatment. As IT has helped to streamline the less-expensive parts of the process, the total cost of care has increased. Health funding is now a particularly hot political topic with the national newspapers full of reports of the Government seeking cuts in the overall budget.

There is a positive side to this of course. Our hospitals are becoming much more efficient at providing care. ‘That’s one thing that doesn’t get the same amount of media space,’ says Kenny. ‘You have to look at throughput numbers. The ESRI published a report last year that said there had been a 36 percent increase in hospital productivity since 1990 on a national basis.’

Automating knowledge transfer

How to bring technology to bear to improve the efficiency of knowledge workers is a conundrum that is common to all hospitals and indeed to all knowledge-based organisations. The more complex and valuable the knowledge that has to be exploited, the more difficult it is to automate it.

Kenny explains that the problem was brought home to him when he was having a discussion with a company that was trying to interest him in a document-management system. It had already been installed in a major bank which had a persistent problem with its procedural manuals constantly going out of date because of new procedures that were coming on stream. The manuals in hard copy form ran to six lever-arch volumes. The company’s solution was to install an intranet that would allow updates to be published instantly and made available to all users.

All well and good, but Kenny found himself asking how relevant it was to the issues that he faces? ‘Of course some of it was very relevant, and I have exactly the same requirement,’ he says, ‘but the problem is how do I define the process for cardiology? Or neurosurgery? The short answer is that I don’t because I’m not a doctor.’

Whereas industries such as banking, retailing and manufacturing are based on processes that are largely well understood and routine oriented, in the case of health, says Kenny the processes are ‘still hugely individual and particularist. The role of IT in knowledge-based functions is to encourage those people who own the knowledge to collaborate with the IT service to the extent that they see it as beneficial’.

Solving this problem is the key long-term issue facing IT in health care. As Kenny puts it: ‘The task facing us is supporting our knowledge workers. That’s why the hospital is here, and by extension that’s why we’re here. And if we don’t do that then we don’t really fulfil a useful purpose’.

However, he says that he knows of only six hospitals in the world that have tried to implement IT strategies in the area of medical knowledge management, and none of them are in this country. Five are in the US and one is in Belgium.

He concedes that IT has often been caught flat footed in trying to tackle this problem. ‘The way we architect and engineer solutions does not at all match the speed at which an individual can diagnose and resolve a problem in their mind. The key point is that the only people that can own that process are the knowledge workers themselves.’

He has learned that the right approach for IT to take to trying to solve this problem is akin to that of the girl in the dance hall: you have to wait to be asked. ‘The approaches we have adopted in the past have been interesting lessons in failure and we have learned a great deal from them,’ he says. ‘I have in the past been arrogant enough to say “No. No. I know better. This is how we will do this” and I still carry the bruises and broken bones although they were nice to me. They did repair them!’

Following on with the dance hall analogy he says that what the IT department has to do in these cases is make themselves attractive to those suitors who will benefit from their co-operation. ‘We have to make ourselves agile, flexible and responsive to their requests,’ he said. ‘We are having some success but by no means have we climbed the mountain.’

A current project that is underway aims to computerise the hospital’s outpatient departments. ‘Although we consulted widely to try to get the requirements defined, we learned that different firms [i.e. groups of consultants, juniors and nurses] do things in different ways,’ he said. ‘For example we defined the system to say that only doctors will place orders. It turned out that in quite a few places nurses place orders. That’s the way it happens so we needed to have the flexibility to accommodate that and I’m glad to say the system was flexible enough to do it.’

Selling the IT pill

Another positive sign was the willingness of the end users to participate in the project. ‘They were receptive to us coming along and disrupting the effective system they already had so that we could adopt a technology solution,’ says Kenny. ‘The selling job I have to do is to say that there will be short-term pain but there will be longer term gain.’

Another project in the offing at Beaumont concerns the national renal service, hosted at the hospital. This deals with patients who suffer from kidney disease. ‘We have come a very long way in attempting to begin the process of defining the care protocols that will be followed,’ says Kenny, ‘and the roles that will be carried out. That’s been a dialogue that we’ve been involved in for a year and a half and what’s interesting is that they, the knowledge workers, are in the driving seat’.

Although automating the knowledge-based processes of doctors and therapists is a long-term strategic goal, in the meantime Kenny has to get on with managing existing IT processes in an environment of budget cuts and reduced funding. Compared to commercial organisations such as banks and financial institutions, the IT department in a hospital has to make do with less in terms of personnel and budgets.

Beaumont’s IT department consists of 35 people out of a total of 3,000 employees. That represents less than 1 percent of the total stall compliment. Its budget of EUR2.5m annually accounts for 1.4 percent of what it costs to run the organisation. Compared with a bank that’s a lean operation. ‘I spoke to a guy at one of the smaller banks who has 400 staff, and his budget is three times the size of mine,’ says Kenny. ‘In one of the major banks the IT staff accounts for 5 percent of the total and their IT spend is at the high end of 8 percent of the bank’s cost base.’

As cutbacks start to hurt in the health service, Kenny has been forced to concentrate on strategies that offer value for money.

‘This year we are facing a budget shortfall of EUR16m,’ he says. ‘That would put enormous pressure on any institution. My budget is also going to be a target for cuts because the hospital will cut everything else before it starts to cut clinical delivery mechanisms. In 2000 our funding fell by 70 percent and even last year it’s only back to 50 percent of what it was in 1999. I have been working under serious cost pressure for the last three years, so to some degree I’m a bit better equipped to deal with what the rest of the organisation has to deal with.’

One of the key strategies Kenny is following to lower costs is to look at Open Source software and the adoption of an architectural structure so that IT issues can be addressed without spending money.

When adopting new systems, Beaumont has always followed what Kenny calls a ‘mixed-market model’ with regard to choosing between building an application inhouse or buying a ready-made application from an outside software house.

‘If the most appropriate solution is a product that we can buy, then that’s what we do,’ he says. ‘However, we do develop a significant proportion inhouse and indeed many of our key strategic solutions have been built here. However, because of the slow down in funding there has been quite a significant shift and we have now adopted an architectural approach based around the J2EE reference model developed by Sun.’

As a consequence, Beaumont has shifted away from the simple package versus development paradigm and towards a component-based approach. ‘We still look for complete packages as we always have,’ says Kenny, ‘but increasingly we are looking for components that we can use and plug together in a way that gives us real value.’

An example is the pharmacy-prescription project that will be undertaken this year. Beaumont has bought in two components, one of which was developed by the Irish Pharmaceutical Union and which is basically a complete list of all drugs approved for use in the Irish market.

The components have standard interfaces which allow them to be used in an architectural fashion with other components and custom-written code that the hospital’s team can produce to build an application that suits its exact requirements.

Which option fits best?

Kenny says that the decision to adopt the Sun/J233 architecture came about because that approach was the one that made most sense to the Beaumont team. How did they arrive at such a decision and how do they evaluate new technologies and strategic directions?

‘We do a great deal of reading,’ says Kenny. ‘Books and magazines are relatively inexpensive. I find them to be a much more effective way of getting answers than a EUR1,000 a day consultant. We also talk to a lot of people, particularly to contacts that we have in universities.’

With regards to open source software the hospital is currently deploying Linux on many desktop PCs and has already deployed one server-based application, a rostering system for nurses, based on open source software.

Kenny’s major worry about open source is the issue of support. To that end he is in discussions with a university about the possibility of a research project on that very topic: how to obtain workable support systems for open-source projects. ‘One of the great strengths of proprietary solutions is that they come with a phone number and an appropriate support contract,’ says Kenny. ‘It’s not sufficient just to give somebody an application out of the box and say “go to it” and that’s the reason behind this piece of research.’

Kenny reckons that providing this problem is solved, open source software could play a major role in health care in the future. Although value for money is and will remain a big issue with hospitals, Kenny points out that a report last year from consultants Deloitte & Touche said that the health service had not invested enough in IT solutions and that the investments that had taken place were not ones that could be shared. Instead, they were always very specific to institutions or locations. The implication was that the various hospitals and health-care institutions needed to share knowledge and IT systems to a greater extent than they had done.

These were reasonable criticisms, says Kenny, who maintains that even before the report had been published, Beaumont had begun to adopt a practice of sharing what it had developed inhouse because it recognised that the health service could not afford to have bespoke applications in every institution.

However, he points out that greater collaboration depends on adherence to a standard architecture. Beaumont is currently trying to adopt a standard architecture called HL7, which is an international standard for health service IT systems that establishes basic information architectures and common message formats to which disparate systems can adhere. ‘I can’t claim that everything we have conforms to that at the moment,’ he says, ‘but it will’.

Such a standard is necessary because it allows different hospitals in different parts of the country to have a certain level of interoperability while maintaining their own operational independence and their own way of doing things. Hospitals are not like the Revenue Commissioners who operate in exactly the same way from one end of the country to another, says Kenny. ‘It doesn’t make sense to insist that we operate in the same way as Letterkenny General or that we both have the same system,’ he points out. ‘As long as we can standardise around architectures and common message formats, and one hospital can exchange information in an intelligible way with another, then how hospital A and hospital B organise themselves is a matter for them.’

Kenny believes that such collaboration is a really viable way that health service organisations can develop in the future. Already one major hospital has taken one of Beaumont’s inhouse-developed applications and another one is considering the same system.

Kenny has a voice in the overall management of the hospital as a member of the nine-person management team that reports directly to the hospital’s CEO. One of his functions has been to provide the hospital with detailed figures on how much it costs to treat a patient and where the expense occurs. These figures complement the general costing figures which tend to be calculated at the macro level.

However, the IT systems that have been put in place over the years enable more detailed analysis. ‘We have the financial systems and the activity systems available,’ he says. ‘There are some gaps but we are beginning to come up with closer estimates.’ This is an area that Cork University Hospital has been pioneering and in keeping with the collaborative nature of the health service, Beaumont is able to use a similar approach to provide its paymasters, ultimately the government with precise estimates of what it costs to treat each patient.

‘One of the things we need to be aware of is that attempting to satisfy the information needs of our paymasters while neglecting the information needs of those that drive the business is a mistake that is quite common in the health service and also the public sector,’ says Kenny. ‘This point of view is probably best expounded by Jane Wilson who is Professor of Computing in Trinity. She says that if you focus on supporting the core business activities of the organisation, all the information you need on cost, quality and other outcomes that are the legitimate provenance of policy makers will automatically arrive as a by product.’

08/05/2003

RELATED ARTICLES
#mc_embed_signup{background:#fff; false;clear:left; font:14px Helvetica,Arial,sans-serif; width: px;} /* Add your own Mailchimp form style overrides in your site stylesheet or in this style block. We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
Sign up for the
Technology Minute
(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='MMERGE2';ftypes[2]='text';fnames[3]='MMERGE3';ftypes[3]='text';fnames[4]='MMERGE4';ftypes[4]='text';fnames[5]='SIGNUP';ftypes[5]='text';fnames[6]='MMERGE6';ftypes[6]='imageurl';}(jQuery));var $mcj = jQuery.noConflict(true); // SMS Phone Multi-Country Functionality if(!window.MC) { window.MC = {}; } window.MC.smsPhoneData = { defaultCountryCode: 'IE', programs: [], smsProgramDataCountryNames: [] }; function getCountryUnicodeFlag(countryCode) { return countryCode.toUpperCase().replace(/./g, (char) => String.fromCodePoint(char.charCodeAt(0) + 127397)) }; // HTML sanitization function to prevent XSS function sanitizeHtml(str) { if (typeof str !== 'string') return ''; return str .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, ''') .replace(/\//g, '/'); } // URL sanitization function to prevent javascript: and data: URLs function sanitizeUrl(url) { if (typeof url !== 'string') return ''; const trimmedUrl = url.trim().toLowerCase(); if (trimmedUrl.startsWith('javascript:') || trimmedUrl.startsWith('data:') || trimmedUrl.startsWith('vbscript:')) { return '#'; } return url; } const getBrowserLanguage = () => { if (!window?.navigator?.language?.split('-')[1]) { return window?.navigator?.language?.toUpperCase(); } return window?.navigator?.language?.split('-')[1]; }; // getBrowserLanguageCode() and getSmsProgramForCountryAndLanguage() are provided globally // by the external mc-sms-phone.js script loaded alongside this inline form script. function getDefaultCountryProgram(defaultCountryCode, smsProgramData) { if (!smsProgramData || smsProgramData.length === 0) { return null; } var browserCountryCode = getBrowserLanguage(); var browserLangCode = getBrowserLanguageCode(); if (browserCountryCode) { var match = getSmsProgramForCountryAndLanguage(smsProgramData, browserCountryCode, browserLangCode); if (match) { return match; } } if (defaultCountryCode) { var match = getSmsProgramForCountryAndLanguage(smsProgramData, defaultCountryCode, browserLangCode); if (match) { return match; } } return smsProgramData[0]; } function updateSmsLegalText(countryCode, fieldName) { if (!countryCode || !fieldName) { return; } var programs = window?.MC?.smsPhoneData?.programs; if (!programs || !Array.isArray(programs)) { return; } var browserLangCode = getBrowserLanguageCode(); var program = getSmsProgramForCountryAndLanguage(programs, countryCode, browserLangCode); if (!program || !program.requiredTemplate) { return; } var smsConsentHtmlRenderingFixEnabled = true; const legalTextElement = document.querySelector('#legal-text-' + fieldName); if (!legalTextElement) { return; } const divRegex = new RegExp(']*>', 'gi'); const blockWrapperRegex = new RegExp(']*>', 'gi'); const fullAnchorRegex = new RegExp('<a.*?', 'g'); const anchorRegex = new RegExp('(.*?)'); const template = smsConsentHtmlRenderingFixEnabled ? program.requiredTemplate .replace(/\s*

]*>/gi, ' ') .replace(blockWrapperRegex, '') : program.requiredTemplate.replace(divRegex, ''); legalTextElement.textContent = ''; const parts = template.split(/(.*?)/g); parts.forEach(function(part) { if (!part) { return; } const anchorMatch = part.match(/(.+?)/); if (anchorMatch) { const linkElement = document.createElement('a'); linkElement.href = sanitizeUrl(anchorMatch[1]); linkElement.target = anchorMatch[2] ? sanitizeHtml(anchorMatch[2]) : '_blank'; linkElement.rel = 'noopener noreferrer'; linkElement.textContent = sanitizeHtml(anchorMatch[3]); legalTextElement.appendChild(linkElement); } else { legalTextElement.appendChild(document.createTextNode(part)); } }); } function generateDropdownOptions(smsProgramData) { if (!smsProgramData || smsProgramData.length === 0) { return ''; } var programs = true ? smsProgramData.filter(function(p, i, arr) { return arr.findIndex(function(q) { return q.countryCode === p.countryCode; }) === i; }) : smsProgramData; return programs.map(program => { const flag = getCountryUnicodeFlag(program.countryCode); const countryName = getCountryName(program.countryCode); const callingCode = program.countryCallingCode || ''; // Sanitize all values to prevent XSS const sanitizedCountryCode = sanitizeHtml(program.countryCode || ''); const sanitizedCountryName = sanitizeHtml(countryName || ''); const sanitizedCallingCode = sanitizeHtml(callingCode || ''); return '' + sanitizedCountryName + ' ' + sanitizedCallingCode + ''; }).join(''); } function getCountryName(countryCode) { if (window.MC?.smsPhoneData?.smsProgramDataCountryNames && Array.isArray(window.MC.smsPhoneData.smsProgramDataCountryNames)) { for (let i = 0; i < window.MC.smsPhoneData.smsProgramDataCountryNames.length; i++) { if (window.MC.smsPhoneData.smsProgramDataCountryNames[i].code === countryCode) { return window.MC.smsPhoneData.smsProgramDataCountryNames[i].name; } } } return countryCode; } function getDefaultPlaceholder(countryCode) { if (!countryCode || typeof countryCode !== 'string') { return '+1 000 000 0000'; // Default US placeholder } var mockPlaceholders = [ { countryCode: 'US', placeholder: '+1 000 000 0000', helpText: 'Include the US country code +1 before the phone number', }, { countryCode: 'GB', placeholder: '+44 0000 000000', helpText: 'Include the GB country code +44 before the phone number', }, { countryCode: 'CA', placeholder: '+1 000 000 0000', helpText: 'Include the CA country code +1 before the phone number', }, { countryCode: 'AU', placeholder: '+61 000 000 000', helpText: 'Include the AU country code +61 before the phone number', }, { countryCode: 'DE', placeholder: '+49 000 0000000', helpText: 'Fügen Sie vor der Telefonnummer die DE-Ländervorwahl +49 ein', }, { countryCode: 'FR', placeholder: '+33 0 00 00 00 00', helpText: 'Incluez le code pays FR +33 avant le numéro de téléphone', }, { countryCode: 'ES', placeholder: '+34 000 000 000', helpText: 'Incluya el código de país ES +34 antes del número de teléfono', }, { countryCode: 'NL', placeholder: '+31 0 00000000', helpText: 'Voeg de NL-landcode +31 toe vóór het telefoonnummer', }, { countryCode: 'BE', placeholder: '+32 000 00 00 00', helpText: 'Incluez le code pays BE +32 avant le numéro de téléphone', }, { countryCode: 'CH', placeholder: '+41 00 000 00 00', helpText: 'Fügen Sie vor der Telefonnummer die CH-Ländervorwahl +41 ein', }, { countryCode: 'AT', placeholder: '+43 000 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die AT-Ländervorwahl +43 ein', }, { countryCode: 'IE', placeholder: '+353 00 000 0000', helpText: 'Include the IE country code +353 before the phone number', }, { countryCode: 'IT', placeholder: '+39 000 000 0000', helpText: 'Includere il prefisso internazionale IT +39 prima del numero di telefono', }, { countryCode: 'NO', placeholder: '+47 000 00 000', helpText: 'Inkluder NO landskode +47 før telefonnummeret', }, { countryCode: 'SE', placeholder: '+46 00 000 00 00', helpText: 'Inkludera SE landskod +46 före telefonnumret', }, { countryCode: 'DK', placeholder: '+45 00 00 00 00', helpText: 'Inkluder DK landekode +45 før telefonnummeret', }, { countryCode: 'FI', placeholder: '+358 00 000 0000', helpText: 'Sisällytä FI-maakoodi +358 ennen puhelinnumeroa', }, { countryCode: 'EE', placeholder: '+372 0000 0000', helpText: 'Lisage EE riigikood +372 telefoninumbri ette', }, { countryCode: 'PL', placeholder: '+48 000 000 000', helpText: 'Podaj numer kierunkowy PL +48 przed numerem telefonu', }, { countryCode: 'SK', placeholder: '+421 000 000 000', helpText: 'Pred telefónne číslo uveďte kód krajiny SK +421', }, { countryCode: 'LV', placeholder: '+371 0000 0000', helpText: 'Iekļaujiet LV valsts kodu +371 pirms tālruņa numura', }, { countryCode: 'LT', placeholder: '+370 0000 0000', helpText: 'Įtraukite LT šalies kodą +370 prieš telefono numerį', }, { countryCode: 'GR', placeholder: '+30 000 000 0000', helpText: 'Συμπεριλάβετε τον κωδικό χώρας GR +30 πριν από τον αριθμό τηλεφώνου', }, { countryCode: 'PT', placeholder: '+351 000 000 000', helpText: 'Inclua o código de país PT +351 antes do número de telefone', }, { countryCode: 'HR', placeholder: '+385 00 000 0000', helpText: 'Uključite HR pozivni broj države +385 prije telefonskog broja', }, { countryCode: 'SI', placeholder: '+386 00 000 000', helpText: 'Vključite SI kodo države +386 pred telefonsko številko', }, { countryCode: 'IS', placeholder: '+354 000 0000', helpText: 'Láttu IS landsnúmer +354 fylgja á undan símanúmerinu', }, { countryCode: 'LU', placeholder: '+352 000 000 000', helpText: 'Incluez le code pays LU +352 avant le numéro de téléphone', }, { countryCode: 'MC', placeholder: '+377 00 00 00 00', helpText: 'Incluez le code pays MC +377 avant le numéro de téléphone', }, { countryCode: 'AD', placeholder: '+376 000 000', helpText: 'Incloeu el codi de país AD +376 abans del número de telèfon', }, { countryCode: 'JE', placeholder: '+44 0000 000000', helpText: 'Include the JE country code +44 before the phone number', }, { countryCode: 'IM', placeholder: '+44 0000 000000', helpText: 'Include the IM country code +44 before the phone number', }, { countryCode: 'GG', placeholder: '+44 0000 000000', helpText: 'Include the GG country code +44 before the phone number', }, { countryCode: 'AL', placeholder: '+355 00 000 0000', helpText: 'Përfshini kodin e vendit AL +355 para numrit të telefonit', }, { countryCode: 'SM', placeholder: '+378 0000 000000', helpText: 'Includere il prefisso internazionale SM +378 prima del numero di telefono', }, { countryCode: 'FO', placeholder: '+298 000000', helpText: 'Inkluder FO landekode +298 før telefonnummeret', }, { countryCode: 'MT', placeholder: '+356 0000 0000', helpText: 'Include the MT country code +356 before the phone number', }, { countryCode: 'LI', placeholder: '+423 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die LI-Ländervorwahl +423 ein', }, { countryCode: 'GI', placeholder: '+350 000 00000', helpText: 'Include the GI country code +350 before the phone number', }, { countryCode: 'MD', placeholder: '+373 00 000 000', helpText: 'Includeți codul de țară MD +373 înaintea numărului de telefon', }, { countryCode: 'HU', placeholder: '+36 00 000 0000', helpText: 'A telefonszám előtt adja meg a HU országkódot +36', }, { countryCode: 'NZ', placeholder: '+64 00 000 0000', helpText: 'Include the NZ country code +64 before the phone number', }, { countryCode: 'ME', placeholder: '+382 00 000 000', helpText: 'Uključite ME pozivni broj države +382 prije telefonskog broja', }, ]; const selectedPlaceholder = mockPlaceholders.find(function(item) { return item && item.countryCode === countryCode; }); return selectedPlaceholder ? selectedPlaceholder.placeholder : mockPlaceholders[0].placeholder; } function updatePlaceholder(countryCode, fieldName) { if (!countryCode || !fieldName) { return; } const phoneInput = document.querySelector('#mce-' + fieldName); if (!phoneInput) { return; } const placeholder = getDefaultPlaceholder(countryCode); if (placeholder) { phoneInput.placeholder = placeholder; } } function updateCountryCodeInstruction(countryCode, fieldName) { updatePlaceholder(countryCode, fieldName); } function getDefaultHelpText(countryCode) { var mockPlaceholders = [ { countryCode: 'US', placeholder: '+1 000 000 0000', helpText: 'Include the US country code +1 before the phone number', }, { countryCode: 'GB', placeholder: '+44 0000 000000', helpText: 'Include the GB country code +44 before the phone number', }, { countryCode: 'CA', placeholder: '+1 000 000 0000', helpText: 'Include the CA country code +1 before the phone number', }, { countryCode: 'AU', placeholder: '+61 000 000 000', helpText: 'Include the AU country code +61 before the phone number', }, { countryCode: 'DE', placeholder: '+49 000 0000000', helpText: 'Fügen Sie vor der Telefonnummer die DE-Ländervorwahl +49 ein', }, { countryCode: 'FR', placeholder: '+33 0 00 00 00 00', helpText: 'Incluez le code pays FR +33 avant le numéro de téléphone', }, { countryCode: 'ES', placeholder: '+34 000 000 000', helpText: 'Incluya el código de país ES +34 antes del número de teléfono', }, { countryCode: 'NL', placeholder: '+31 0 00000000', helpText: 'Voeg de NL-landcode +31 toe vóór het telefoonnummer', }, { countryCode: 'BE', placeholder: '+32 000 00 00 00', helpText: 'Incluez le code pays BE +32 avant le numéro de téléphone', }, { countryCode: 'CH', placeholder: '+41 00 000 00 00', helpText: 'Fügen Sie vor der Telefonnummer die CH-Ländervorwahl +41 ein', }, { countryCode: 'AT', placeholder: '+43 000 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die AT-Ländervorwahl +43 ein', }, { countryCode: 'IE', placeholder: '+353 00 000 0000', helpText: 'Include the IE country code +353 before the phone number', }, { countryCode: 'IT', placeholder: '+39 000 000 0000', helpText: 'Includere il prefisso internazionale IT +39 prima del numero di telefono', }, { countryCode: 'NO', placeholder: '+47 000 00 000', helpText: 'Inkluder NO landskode +47 før telefonnummeret', }, { countryCode: 'SE', placeholder: '+46 00 000 00 00', helpText: 'Inkludera SE landskod +46 före telefonnumret', }, { countryCode: 'DK', placeholder: '+45 00 00 00 00', helpText: 'Inkluder DK landekode +45 før telefonnummeret', }, { countryCode: 'FI', placeholder: '+358 00 000 0000', helpText: 'Sisällytä FI-maakoodi +358 ennen puhelinnumeroa', }, { countryCode: 'EE', placeholder: '+372 0000 0000', helpText: 'Lisage EE riigikood +372 telefoninumbri ette', }, { countryCode: 'PL', placeholder: '+48 000 000 000', helpText: 'Podaj numer kierunkowy PL +48 przed numerem telefonu', }, { countryCode: 'SK', placeholder: '+421 000 000 000', helpText: 'Pred telefónne číslo uveďte kód krajiny SK +421', }, { countryCode: 'LV', placeholder: '+371 0000 0000', helpText: 'Iekļaujiet LV valsts kodu +371 pirms tālruņa numura', }, { countryCode: 'LT', placeholder: '+370 0000 0000', helpText: 'Įtraukite LT šalies kodą +370 prieš telefono numerį', }, { countryCode: 'GR', placeholder: '+30 000 000 0000', helpText: 'Συμπεριλάβετε τον κωδικό χώρας GR +30 πριν από τον αριθμό τηλεφώνου', }, { countryCode: 'PT', placeholder: '+351 000 000 000', helpText: 'Inclua o código de país PT +351 antes do número de telefone', }, { countryCode: 'HR', placeholder: '+385 00 000 0000', helpText: 'Uključite HR pozivni broj države +385 prije telefonskog broja', }, { countryCode: 'SI', placeholder: '+386 00 000 000', helpText: 'Vključite SI kodo države +386 pred telefonsko številko', }, { countryCode: 'IS', placeholder: '+354 000 0000', helpText: 'Láttu IS landsnúmer +354 fylgja á undan símanúmerinu', }, { countryCode: 'LU', placeholder: '+352 000 000 000', helpText: 'Incluez le code pays LU +352 avant le numéro de téléphone', }, { countryCode: 'MC', placeholder: '+377 00 00 00 00', helpText: 'Incluez le code pays MC +377 avant le numéro de téléphone', }, { countryCode: 'AD', placeholder: '+376 000 000', helpText: 'Incloeu el codi de país AD +376 abans del número de telèfon', }, { countryCode: 'JE', placeholder: '+44 0000 000000', helpText: 'Include the JE country code +44 before the phone number', }, { countryCode: 'IM', placeholder: '+44 0000 000000', helpText: 'Include the IM country code +44 before the phone number', }, { countryCode: 'GG', placeholder: '+44 0000 000000', helpText: 'Include the GG country code +44 before the phone number', }, { countryCode: 'AL', placeholder: '+355 00 000 0000', helpText: 'Përfshini kodin e vendit AL +355 para numrit të telefonit', }, { countryCode: 'SM', placeholder: '+378 0000 000000', helpText: 'Includere il prefisso internazionale SM +378 prima del numero di telefono', }, { countryCode: 'FO', placeholder: '+298 000000', helpText: 'Inkluder FO landekode +298 før telefonnummeret', }, { countryCode: 'MT', placeholder: '+356 0000 0000', helpText: 'Include the MT country code +356 before the phone number', }, { countryCode: 'LI', placeholder: '+423 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die LI-Ländervorwahl +423 ein', }, { countryCode: 'GI', placeholder: '+350 000 00000', helpText: 'Include the GI country code +350 before the phone number', }, { countryCode: 'MD', placeholder: '+373 00 000 000', helpText: 'Includeți codul de țară MD +373 înaintea numărului de telefon', }, { countryCode: 'HU', placeholder: '+36 00 000 0000', helpText: 'A telefonszám előtt adja meg a HU országkódot +36', }, { countryCode: 'NZ', placeholder: '+64 00 000 0000', helpText: 'Include the NZ country code +64 before the phone number', }, { countryCode: 'ME', placeholder: '+382 00 000 000', helpText: 'Uključite ME pozivni broj države +382 prije telefonskog broja', }, ]; if (!countryCode || typeof countryCode !== 'string') { return mockPlaceholders[0].helpText; } const selectedHelpText = mockPlaceholders.find(function(item) { return item && item.countryCode === countryCode; }); return selectedHelpText ? selectedHelpText.helpText : mockPlaceholders[0].helpText; } function setDefaultHelpText(countryCode) { const helpTextSpan = document.querySelector('#help-text'); if (!helpTextSpan) { return; } } function updateHelpTextCountryCode(countryCode, fieldName) { if (!countryCode || !fieldName) { return; } setDefaultHelpText(countryCode); } function initializeSmsPhoneDropdown(fieldName) { if (!fieldName || typeof fieldName !== 'string') { return; } const dropdown = document.querySelector('#country-select-' + fieldName); const displayFlag = document.querySelector('#flag-display-' + fieldName); if (!dropdown || !displayFlag) { return; } const smsPhoneData = window.MC?.smsPhoneData; if (smsPhoneData && smsPhoneData.programs && Array.isArray(smsPhoneData.programs)) { dropdown.innerHTML = generateDropdownOptions(smsPhoneData.programs); } const defaultProgram = getDefaultCountryProgram(smsPhoneData?.defaultCountryCode, smsPhoneData?.programs); if (defaultProgram && defaultProgram.countryCode) { dropdown.value = defaultProgram.countryCode; const flagSpan = displayFlag?.querySelector('#flag-emoji-' + fieldName); if (flagSpan) { flagSpan.textContent = getCountryUnicodeFlag(defaultProgram.countryCode); flagSpan.setAttribute('aria-label', sanitizeHtml(defaultProgram.countryCode) + ' flag'); } updateSmsLegalText(defaultProgram.countryCode, fieldName); updatePlaceholder(defaultProgram.countryCode, fieldName); updateCountryCodeInstruction(defaultProgram.countryCode, fieldName); } var smsNotRequiredRemoveCountryCodeEnabled = true; var smsField = Object.values({"EMAIL":{"name":"EMAIL","label":"Email Address","helper_text":"","type":"email","required":true,"audience_field_name":"Email Address","merge_id":0,"help_text_enabled":false,"enabled":true,"order":0,"field_type":"merge"},"FNAME":{"name":"FNAME","label":"First Name","helper_text":"","type":"text","required":false,"audience_field_name":"First Name","enabled":false,"order":null,"field_type":"merge","merge_id":1},"MMERGE2":{"name":"MMERGE2","label":"Second Name","helper_text":"","type":"text","required":false,"audience_field_name":"Second Name","enabled":false,"order":null,"field_type":"merge","merge_id":2},"MMERGE3":{"name":"MMERGE3","label":"Company Name","helper_text":"","type":"text","required":false,"audience_field_name":"Company Name","enabled":false,"order":null,"field_type":"merge","merge_id":3},"MMERGE4":{"name":"MMERGE4","label":"Job Title","helper_text":"","type":"text","required":false,"audience_field_name":"Job Title","enabled":false,"order":null,"field_type":"merge","merge_id":4},"SIGNUP":{"name":"SIGNUP","label":"Signup form location","helper_text":"","type":"text","required":false,"audience_field_name":"Signup form location","enabled":false,"order":null,"field_type":"merge","merge_id":5},"MMERGE6":{"name":"MMERGE6","label":"Image URL","helper_text":"","type":"imageurl","required":false,"audience_field_name":"Image URL","enabled":false,"order":null,"field_type":"merge","merge_id":6}}).find(function(f) { return f.name === fieldName && f.type === 'smsphone'; }); var isRequired = smsField ? smsField.required : false; var shouldAppendCountryCode = smsNotRequiredRemoveCountryCodeEnabled ? isRequired : true; var phoneInput = document.querySelector('#mce-' + fieldName); if (phoneInput && defaultProgram.countryCallingCode && shouldAppendCountryCode) { phoneInput.value = defaultProgram.countryCallingCode; } displayFlag?.addEventListener('click', function(e) { dropdown.focus(); }); dropdown?.addEventListener('change', function() { const selectedCountry = this.value; if (!selectedCountry || typeof selectedCountry !== 'string') { return; } const flagSpan = displayFlag?.querySelector('#flag-emoji-' + fieldName); if (flagSpan) { flagSpan.textContent = getCountryUnicodeFlag(selectedCountry); flagSpan.setAttribute('aria-label', sanitizeHtml(selectedCountry) + ' flag'); } const selectedProgram = window.MC?.smsPhoneData?.programs.find(function(program) { return program && program.countryCode === selectedCountry; }); var smsNotRequiredRemoveCountryCodeEnabled = true; var smsField = Object.values({"EMAIL":{"name":"EMAIL","label":"Email Address","helper_text":"","type":"email","required":true,"audience_field_name":"Email Address","merge_id":0,"help_text_enabled":false,"enabled":true,"order":0,"field_type":"merge"},"FNAME":{"name":"FNAME","label":"First Name","helper_text":"","type":"text","required":false,"audience_field_name":"First Name","enabled":false,"order":null,"field_type":"merge","merge_id":1},"MMERGE2":{"name":"MMERGE2","label":"Second Name","helper_text":"","type":"text","required":false,"audience_field_name":"Second Name","enabled":false,"order":null,"field_type":"merge","merge_id":2},"MMERGE3":{"name":"MMERGE3","label":"Company Name","helper_text":"","type":"text","required":false,"audience_field_name":"Company Name","enabled":false,"order":null,"field_type":"merge","merge_id":3},"MMERGE4":{"name":"MMERGE4","label":"Job Title","helper_text":"","type":"text","required":false,"audience_field_name":"Job Title","enabled":false,"order":null,"field_type":"merge","merge_id":4},"SIGNUP":{"name":"SIGNUP","label":"Signup form location","helper_text":"","type":"text","required":false,"audience_field_name":"Signup form location","enabled":false,"order":null,"field_type":"merge","merge_id":5},"MMERGE6":{"name":"MMERGE6","label":"Image URL","helper_text":"","type":"imageurl","required":false,"audience_field_name":"Image URL","enabled":false,"order":null,"field_type":"merge","merge_id":6}}).find(function(f) { return f.name === fieldName && f.type === 'smsphone'; }); var isRequired = smsField ? smsField.required : false; var shouldAppendCountryCode = smsNotRequiredRemoveCountryCodeEnabled ? isRequired : true; var phoneInput = document.querySelector('#mce-' + fieldName); if (phoneInput && selectedProgram.countryCallingCode && shouldAppendCountryCode) { phoneInput.value = selectedProgram.countryCallingCode; } updateSmsLegalText(selectedCountry, fieldName); updatePlaceholder(selectedCountry, fieldName); updateCountryCodeInstruction(selectedCountry, fieldName); }); } document.addEventListener('DOMContentLoaded', function() { const smsPhoneFields = document.querySelectorAll('[id^="country-select-"]'); smsPhoneFields.forEach(function(dropdown) { const fieldName = dropdown?.id.replace('country-select-', ''); initializeSmsPhoneDropdown(fieldName); }); });

- Advertisment -

Most Popular