Location coordinates are not available
for this practice.
`;
}
/*
* PAS fields.
*/
const pasFields = [
['PAS 1', practice.pas_1],
['PAS 2', practice.pas_2],
['PAS 3', practice.pas_3],
['PAS 4', practice.pas_4],
['PAS 5', practice.pas_5]
];
let pasHTML = '';
pasFields.forEach(function(item){
if(
item[1] !== null &&
item[1] !== undefined &&
String(item[1]).trim() !== ''
){
pasHTML += `
${
type
? `
${gridEscapeHTML(type)}
`
: ''
}
${gridEscapeHTML(title)}
${
category
? `
${gridEscapeHTML(category)}
`
: ''
}
${
reference
? `
GIAN Reference:
${gridEscapeHTML(reference)}
`
: ''
}
About the Practice
${
detail
? `
Detail
${gridFormatText(detail)}
`
: `
No practice description available.
`
}
About the Innovator
${
innovator
? gridDetailRow(
'Knowledge Provider / Innovator',
innovator
)
: ''
}
${
address
? gridDetailRow(
'Address',
address
)
: ''
}
${
city
? gridDetailRow(
'City',
city
)
: ''
}
${
district
? gridDetailRow(
'District',
district
)
: ''
}
${
state
? gridDetailRow(
'State',
state
)
: ''
}
${
pincode
? gridDetailRow(
'PIN Code',
pincode
)
: ''
}
${
practice['Email Address (if any)']
? gridDetailRow(
'Email',
practice['Email Address (if any)']
)
: ''
}
${
practice['Contact no: (if any)']
? gridDetailRow(
'Contact No.',
practice['Contact no: (if any)']
)
: ''
}
Practice / Technology Details
${practiceHTML}
PAS / Resources
${pasHTML}
References
${referencesHTML}
${imageFallbackScript}
`;
/*
* Back button.
*/
const backButton =
document.getElementById(
'grid-back-practices'
);
if(backButton){
backButton.addEventListener(
'click',
function(){
/*
* Reloading restores the
* paginated database.
*/
window.location.reload();
}
);
}
/*
* Keep map/image at top of
* details after AJAX.
*/
app.scrollIntoView({
behavior:'smooth',
block:'start'
});
};
/* =====================================================
COORDINATE DETECTION
===================================================== */
window.gridExtractCoordinates =
function(value){
if(!value){
return null;
}
const text =
String(value);
/*
* Decimal pair:
*
* 21.1702, 72.8311
*
* 21.1702 72.8311
*/
const match =
text.match(
/(-?\d+(?:\.\d+)?)\s*[,;]\s*(-?\d+(?:\.\d+)?)/
);
if(match){
const lat =
parseFloat(match[1]);
const lng =
parseFloat(match[2]);
if(
lat >= -90 &&
lat <= 90 &&
lng >= -180 &&
lng <= 180
){
return {
lat:lat,
lng:lng
};
}
}
return null;
};
/* =====================================================
DETAIL ROW
===================================================== */
window.gridDetailRow =
function(label,value){
return `