Job Foreman: Michael Vella
Tailboard View 37
#Foreman{
margin-top: -10px !important;
margin-bottom: -10px !important;
padding-bottom: 0px !important;
}
.wp-block-buttons {
padding-right: 0px !important;
text-align: center;
margin: 0;
}
#sign-doc-btn {
background-color: white;
color: rgb(0, 0, 0) !important;
width: 300px !important;
height: 30px !important;
font-size: 24px !important;
font-weight: bold !important;
font-style: italic !important;
font-family: ‘Cambria’, sans-serif;
display: inline-block !important;
padding-top: 5px !important;
padding-bottom: 5px !important;
text-align: center !important;
box-shadow: 0 5px #666 !important;
line-height: 1.2 !important;
border: 2px solid rgb(127, 127, 127) !important;
border-radius: 5px !important;
margin-bottom: 6px !important;
cursor: pointer;
animation: flash 1s infinite; /* Flashing effect */
}
@keyframes flash {
0%, 100% { background-color: rgb(73, 239, 102); } /* Initial color */
50% { background-color: rgb(17, 193, 48); } /* Flash color */
}
.wp-block-pdf-viewer-block-standard {
padding: 5px !important;
padding-top: 0px !important;
text-align: center;
width: 100% !important;
height: 80vh !important;
border: none !important;
}
.wp-block-pdf-viewer-block-standard iframe {
width: 100% !important;
height: 100% !important;
}
#Foreman span {
display: inline;
}
@media (max-width: 1024px) {
.wp-block-pdf-viewer-block-standard {
padding: 5px !important;
padding-top: 0px !important;
text-align: center;
width: 99% !important;
height: 85vh !important;
border: none !important;
}
.wp-block-pdf-viewer-block-standard iframe {
text-align: center !important;
width: 100% !important;
height: 100% !important;
}
.wp-block-buttons {
padding-right: 0px !important;
text-align: center;
margin: 0;
}
#sign-doc-btn {
background-color: white;
color: rgb(0, 0, 0) !important;
width: 300px !important;
height: 30px !important;
font-size: 24px !important;
font-weight: bold !important;
font-style: italic !important;
font-family: ‘Cambria’, sans-serif;
display: inline-block !important;
padding-top: 5px !important;
padding-bottom: 5px !important;
text-align: center !important;
box-shadow: 0 5px #666 !important;
line-height: 1.2 !important;
border: 2px solid rgb(127, 127, 127) !important;
border-radius: 5px !important;
margin-bottom: 6px !important;
cursor: pointer;
animation: flash 1s infinite; /* Flashing effect */
}
@keyframes flash {
0%, 100% { background-color: rgb(73, 239, 102); } /* Initial color */
50% { background-color: rgb(17, 193, 48); } /* Flash color */
}
}
@media (max-width: 768px) {
.wp-block-pdf-viewer-block-standard iframe{
padding: 5px !important;
padding-left: 0px !important;
text-align: center !important;
width: 100% !important;
height: 100% !important;
}
.wp-block-pdf-viewer-block-standard {
margin-bottom: 0px !important;
text-align: center !important;
width: 98% !important;
height: 65vh !important;
}
#Foreman span {
display: block;
}
.wp-block-buttons {
padding-right: 0px !important;
text-align: center;
margin: 0;
}
#sign-doc-btn {
background-color: white;
color: rgb(0, 0, 0) !important;
width: 300px !important;
height: 30px !important;
font-size: 20px !important;
font-weight: bold !important;
font-style: italic !important;
font-family: ‘Cambria’, sans-serif;
display: inline-block !important;
padding-top: 5px !important;
padding-bottom: 5px !important;
text-align: center !important;
box-shadow: 0 5px #666 !important;
line-height: 1.2 !important;
border: 2px solid rgb(127, 127, 127) !important;
border-radius: 5px !important;
margin-bottom: 6px !important;
cursor: pointer;
animation: flash 1s infinite; /* Flashing effect */
}
@keyframes flash {
0%, 100% { background-color: rgb(73, 239, 102); } /* Initial color */
50% { background-color: rgb(17, 193, 48); } /* Flash color */
}
}
document.addEventListener(“DOMContentLoaded”, function() {
const button = document.getElementById(‘sign-doc-btn’);
console.log(‘Button:’, button);
const fileUrl = button ? button.href : ”;
console.log(‘File URL:’, fileUrl);
const jobInfo = getFileNameFromUrl(fileUrl);
console.log(‘Job Info:’, jobInfo);
const titleText = getElementTextById(‘CustomTitleBlock’);
console.log(‘Title Text:’, titleText);
const foremanText = getElementTextById(‘foreman-name’);
console.log(‘Foreman Text:’, foremanText);
const urlParams = new URLSearchParams({
job_info: jobInfo,
title: titleText,
foremanName: foremanText
}).toString();
console.log(‘URL Params:’, urlParams);
button.href = “https://smetailboards.com/signature/?” + urlParams;
console.log(‘Button URL:’, button.href);
function getFileNameFromUrl(url) {
let fileName = url.substring(url.lastIndexOf(‘/’) + 1);
console.log(‘Initial File Name:’, fileName); // Log initial file name
fileName = fileName.replace(/-_-/g, ‘_’);
console.log(‘After Replacing -_-:’, fileName); // Log after replacement
fileName = fileName.replace(‘.pdf’, ”);
console.log(‘After Removing .pdf:’, fileName); // Log after removing .pdf
const yearIndex = fileName.indexOf(‘2024’);
if (yearIndex !== -1) {
fileName = fileName.substring(0, yearIndex + 4);
}
console.log(‘Final File Name:’, fileName); // Log final file name
return fileName;
}
function getElementTextById(id) {
const element = document.getElementById(id);
return element ? element.textContent.trim() : ”;
}
});