Skip to content

Commit

Permalink
Merge branch 'main' of github.com:WWWPiramalFinanceCOM/piramalfinance
Browse files Browse the repository at this point in the history
  • Loading branch information
omprakashgupta1995 committed Sep 16, 2024
2 parents 839c3a9 + 5caa59c commit f4017ca
Show file tree
Hide file tree
Showing 15 changed files with 134 additions and 39 deletions.
Empty file.
3 changes: 3 additions & 0 deletions blocks/branchkeyfeatures/branchkeyfeatures.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default async function decorate(block){

}
1 change: 1 addition & 0 deletions blocks/branchlocator/branchlocator-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export async function searchBranchByURL() {
let stateCityLatLng = setLocationObj.getExcelData[setLocationObj.geoInfo.state]?.find((eachCityCheck) => eachCityCheck.City === setLocationObj.geoInfo.city);
setLocationObj.lat = stateCityLatLng["Latitude"];
setLocationObj.lng = stateCityLatLng["Longitude"];
setLocationObj.geoInfo.location = stateCityLatLng["Location"];
}

// Country
Expand Down
28 changes: 15 additions & 13 deletions blocks/branchlocator/branchlocator-biz.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { loadScript } from "../../scripts/aem.js";
import { fetchAPI } from "../../scripts/scripts.js";
import { branchURLStr, fetchAPI } from "../../scripts/scripts.js";
import returnLatLan from "../select-tag/getSelectedLanguage.js";
import { initMap, searchBranchByURL } from "./branchlocator-api.js";
import { setLocationObj } from "./branchlocator-init.js";
Expand Down Expand Up @@ -41,19 +41,20 @@ export async function onloadBranchLocator(block) {
);
setLocationObj.lat = defaultLatLng['Latitude'];
setLocationObj.lng = defaultLatLng['Longitude'];
setLocationObj.geoInfo.location = defaultLatLng['Location'];
let locationCode = defaultLatLng['Location Code']
if(!location.href.includes('author') && !location.href.includes(setLocationObj.geoInfo.city)){
location.href = '/branch-locator/'+setLocationObj.geoInfo.state.toLowerCase()+'/'+setLocationObj.geoInfo.city.toLowerCase();
location.href = branchURLStr(setLocationObj.geoInfo.location, setLocationObj.geoInfo.city,setLocationObj.geoInfo.state, "shorthand");
}
}

let URLstate = setLocationObj.geoInfo.state.charAt(0).toLowerCase() + setLocationObj.geoInfo.state.slice(1).replace(' ', '-').toLowerCase();
let URLcity = setLocationObj.geoInfo.city.charAt(0).toLowerCase() + setLocationObj.geoInfo.city.slice(1).replace(' ', '-').toLowerCase();
if(!location.href.includes('author') && !location.href.includes(URLstate)){
if(setLocationObj.geoInfo.state && setLocationObj.geoInfo.city){
location.href = '/branch-locator/'+URLstate+'/'+URLcity.toLowerCase();
location.href = branchURLStr(setLocationObj.geoInfo.location, setLocationObj.geoInfo.city,setLocationObj.geoInfo.state, "shorthand");
}else if(setLocationObj.geoInfo.state){
location.href = '/branch-locator/'+URLstate;
location.href = branchURLStr(setLocationObj.geoInfo.location, setLocationObj.geoInfo.city,setLocationObj.geoInfo.state, "shorthandstate");
}
}

Expand Down Expand Up @@ -218,8 +219,8 @@ function myMap(lat, long, sortedBranch) {
export function bizStateDD(data, block){
setLocationObj.stateLi = Object.keys(data)
.map((state) => {
let newState = state.replace(' ', '-');
return '<a href="/branch-locator/' + newState.toLowerCase() + '"><li class="state-option option" data-info="' + state + '">' + state + '</li></a>';
// let newState = state.replace(' ', '-');
return '<a href="' + branchURLStr("", "", state, 'shorthandstate') + '"><li class="state-option option" data-info="' + state + '">' + state + '</li></a>';
}).join("");
}

Expand All @@ -229,9 +230,9 @@ export function bizCityDD(data, block){
.reduce((acc, { City, "Location Code": locationCode }) => {
if (!setLocationObj.cityhash.hasOwnProperty(City)) {
setLocationObj.cityhash[City] = City;
let newState = setLocationObj.geoInfo.state.replace(' ', '-');
let newCity = City.replace(' ', '-');
acc += "<a href='/branch-locator/" + newState.toLowerCase() + "/" + newCity.toLowerCase() + "'><li class='city-option option' data-info='" + City + "'>" + City + "</li></a>";
// let newState = setLocationObj.geoInfo.state.replace(' ', '-');
// let newCity = City.replace(' ', '-');
acc += '<a href="' + branchURLStr("", City, setLocationObj.geoInfo.state, 'shorthand') + '"><li class="city-option option" data-info="' + City + '">' + City + '</li></a>';
}
return acc;
}, "");
Expand Down Expand Up @@ -309,10 +310,11 @@ export function locateMeClick(block){
block.closest('.section').querySelector('.title-to-show').innerText = 'Find all ' + setLocationObj.geoInfo.city + ' Branches here';
block.closest('.section').querySelector('.btn-locate').classList.add('dp-none');
block.closest('.section').querySelector('.btn-locate-details').classList.remove('dp-none');
setLocationObj.seturl.state = setLocationObj.geoInfo.state.charAt(0).toLowerCase() + setLocationObj.geoInfo.state.slice(1).replace(' ', '-').toLowerCase();
setLocationObj.seturl.city = setLocationObj.geoInfo.city.charAt(0).toLowerCase() + setLocationObj.geoInfo.city.slice(1).replace(' ', '-').toLowerCase();
setLocationObj.seturl.location= branchhList[0]['Location Code'];
let settingBranchURl = '/branch-locator/loans-in-' + setLocationObj.seturl.city + '-' + setLocationObj.seturl.state + '-' + setLocationObj.seturl.location;
// setLocationObj.seturl.state = setLocationObj.geoInfo.state.charAt(0).toLowerCase() + setLocationObj.geoInfo.state.slice(1).replace(' ', '-').toLowerCase();
// setLocationObj.seturl.city = setLocationObj.geoInfo.city.charAt(0).toLowerCase() + setLocationObj.geoInfo.city.slice(1).replace(' ', '-').toLowerCase();
setLocationObj.geoInfo.locationcode= branchhList[0]['Location Code'];
setLocationObj.geoInfo.location= branchhList[0]['Location'];
let settingBranchURl = branchURLStr(setLocationObj.geoInfo.location ,setLocationObj.geoInfo.city, setLocationObj.geoInfo.state, "loans", setLocationObj.geoInfo.locationcode);
// let settingBranchURl = '/branch-locator/' + setLocationObj.seturl.state + '/' + setLocationObj.seturl.city + '/loans-in-' + setLocationObj.seturl.city + '-' + setLocationObj.seturl.state + '-' + setLocationObj.seturl.location;
block.closest('.section').querySelector('.btn-locate-details').setAttribute('href', settingBranchURl);
block.closest('.section').querySelector('.branch-deatils').classList.remove('dp-none');
Expand Down
2 changes: 2 additions & 0 deletions blocks/branchlocator/branchlocator-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ setLocationObj.geoInfo = {
city: "",
state: "",
country: "",
location: "",
locationcode: "",
};
setLocationObj.seturl = {
city: "",
Expand Down
9 changes: 5 additions & 4 deletions blocks/branchlocator/branchlocator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetchAPI } from "../../scripts/scripts.js";
import { branchURLStr, fetchAPI } from "../../scripts/scripts.js";
import { dropDownStateCity, locateMeClick, onloadBranchLocator } from "./branchlocator-biz.js";
import { setLocationObj } from "./branchlocator-init.js";

Expand Down Expand Up @@ -82,15 +82,16 @@ export function branchLocator() {
export function innerBranchFunc(branchhList){
let innerBranch = "";
branchhList.forEach(eachBranch => {
let eachState = eachBranch['State'].charAt(0).toLowerCase() + eachBranch['State'].slice(1).replace(' ', '-').toLowerCase();
let eachCity = eachBranch['City'].charAt(0).toLowerCase() + eachBranch['City'].slice(1).replace(' ', '-').toLowerCase();
let eachState = eachBranch['State'];
let eachCity = eachBranch['City'];
let eachLocationCode = eachBranch['Location Code'];
let eachLocation = eachBranch['Location'];
innerBranch +=
`<div class='card-box'>
<h3 class='card-title'> ${eachBranch['Location']} </h3>
<p class='card-address'>${eachBranch['Address']}</p>
<p class='card-gmail'> <span> <img src='/images/gmail.svg' alt='gmail-icon'/> </span> customercare@piramal.com </p>
<a href="/branch-locator/loans-in-${eachCity}-${eachState}-${eachLocationCode}" id='more-details-btn'> More details </a>
<a href="${branchURLStr(eachLocation ,eachCity, eachState, "loans", eachLocationCode)}" id='more-details-btn'> More details </a>
</div>`;
// <a href="/branch-locator/${eachState}/${eachCity}/loans-in-${eachCity}-${eachState}-${eachLocationCode}" id='more-details-btn'> More details </a>

Expand Down
2 changes: 1 addition & 1 deletion blocks/cards/cards.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url('./support-contact-us.css');
@import url('./support-contact-us-page.css');
.cards > ul {
list-style: none;
margin: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@
position: relative;
}

.section.contact-us-card-wrapper .cards-wrapper .cards ul li:first-child .cards-card-body ul li:last-child:has(p >a) {
display: none;
}
.section.contact-us-card-wrapper .cards-wrapper .cards ul li:first-child .cards-card-body ul li:last-child:has(p >a) p a{
border-radius: 8px;
padding: 8px 16px;
border: 1px solid #365069;
font: 700 12px 'nunito-bold', 'sans-serif';
line-height: 16px;
color: #365069;
background: #ffffff;
margin: 0;
text-decoration: none;
}
.section.contact-us-card-wrapper .cards-wrapper .cards ul li .cards-card-body ul {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -108,6 +122,10 @@
grid-template-columns: 1fr;
}

.section.contact-us-card-wrapper .cards-wrapper .cards ul li:first-child .cards-card-body ul li:last-child:has(p >a){
display: block;
}

.section.contact-us-card-wrapper .cards-wrapper>.cards>ul>li .cards-card-body {
align-items: start;
}
Expand Down Expand Up @@ -177,10 +195,12 @@
height: 81px;
width: 81px;
}

.section.contact-us-download-wrapper .default-content-wrapper p:last-child {
display: none;
}
.section.contact-us-download-wrapper .default-content-wrapper >p:last-child >a {

.section.contact-us-download-wrapper .default-content-wrapper>p:last-child>a {
position: absolute;
background: #f26841;
border-radius: 8px;
Expand All @@ -194,28 +214,37 @@
left: 25px;

}

@media (min-width: 1025px) and (max-width: 1400px) {
.section.contact-us-download-wrapper div:nth-child(2) {
left: calc((100% - 820px) / 2);
}
}
@media screen and (min-width: 768px) and (max-width: 1024px) {
.section.contact-us-download-wrapper div:nth-child(2) {
/* top: 146px; */
left: 64px;
}
}
@media screen and (max-width: 768px) {
.section.download-piramal-wrapper div:nth-child(2){
.section.download-piramal-wrapper div:nth-child(2) {
display: block;
position: relative;
left: unset;
top: unset;
/* left: 66px;
bottom: 25px; */
}
.section.download-piramal-wrapper .default-content-wrapper > *:nth-child(n+1){

.section.download-piramal-wrapper .default-content-wrapper>*:nth-child(n+1) {
display: none;
}

.section.contact-us-download-wrapper .default-content-wrapper p:last-child {
display: block;
position: relative;
left: unset;
top: unset;
bottom: unset;
}
.section.download-piramal-wrapper .default-content-wrapper > *:nth-child(n+1):has(p>a){

.section.download-piramal-wrapper .default-content-wrapper>*:nth-child(n+1):has(p>a) {
display: block;
}
}
Expand Down
2 changes: 2 additions & 0 deletions blocks/moredetailsaddress/moredetailsaddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ async function onbranchDetails(block) {
}else{
document.querySelectorAll('.address-info ul li')[2].remove();
}
}else{
document.querySelectorAll('.address-info ul li')[2].remove();
}
});

Expand Down
8 changes: 5 additions & 3 deletions blocks/nearestlocation/nearestlocation.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { branchURLStr } from "../../scripts/scripts.js";
import { setLocationObj } from "../moredetailsaddress/moredetailsaddress.js";

export function nearestLoction() {
Expand All @@ -11,15 +12,16 @@ export function nearestLoction() {
let branch_cards = "";
let cityName = storedata[0]['City'];
storedata.forEach(eachLocation => {
let eachState = eachLocation['State'].charAt(0).toLowerCase() + eachLocation['State'].slice(1).replace(' ', '-').toLowerCase();
let eachCity = eachLocation['City'].charAt(0).toLowerCase() + eachLocation['City'].slice(1).replace(' ', '-').toLowerCase();
let eachState = eachLocation['State']
let eachCity = eachLocation['City']
let eachLocationCode = eachLocation['Location Code'];
let eachLocationAdd = eachLocation['Location'];
branch_cards += `
<div class='card-box'>
<h3 class='card-title'>${eachLocation['Location']}</h3>
<p class='card-address'>${eachLocation['Address']}</p>
<p class='card-gmail'> <span> <img src='/images/gmail.svg' alt='gmail-icon'/> </span> customercare@piramal.com</p>
<a href="/branch-locator/loans-in-${eachCity}-${eachState}-${eachLocationCode}" id='more-details-btn'> More details </a>
<a href="${branchURLStr(eachLocationAdd ,eachCity, eachState, "loans", eachLocationCode)}" id='more-details-btn'> More details </a>
</div>`;
// <a href="/branch-locator/${eachState}/${eachCity}/loans-in-${eachCity}-${eachState}-${eachLocationCode}" id='more-details-btn'> More details </a>
});
Expand Down
15 changes: 15 additions & 0 deletions component-definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,21 @@
}
}
}
},
{
"title": "Branch key Features",
"id": "branchkeyfeatures",
"plugins": {
"xwalk": {
"page": {
"resourceType": "core/franklin/components/block/v1/block",
"template": {
"name": "branchkeyfeatures",
"model": "branchkeyfeatures"
}
}
}
}
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion component-filters.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@
"nearestlocation",
"fragment",
"formformatpdf",
"branchcarousel"
"branchcarousel",
"branchkeyfeatures"
]
},
{
Expand Down
12 changes: 12 additions & 0 deletions component-models.json
Original file line number Diff line number Diff line change
Expand Up @@ -2710,5 +2710,17 @@
"label": "URL Text"
}
]
},
{
"id": "branchkeyfeatures",
"fields": [
{
"component": "text",
"valueType": "string",
"name": "branchkeyfeatures",
"value": "Url text",
"label": "URL Text"
}
]
}
]
21 changes: 20 additions & 1 deletion scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ async function loadLazy(doc) {
const element = hash ? doc.getElementById(hash.substring(1)) : false;
if (hash && element) element.scrollIntoView();

loadHeader(doc.querySelector("header"));
/* loadHeader(doc.querySelector("header")); */
loadFooter(doc.querySelector("footer"));

loadCSS(`${window.hlx.codeBasePath}/styles/lazy-styles.css`);
Expand All @@ -705,6 +705,7 @@ function loadDelayed() {
}

async function loadPage() {
loadHeader(document.querySelector("header"));
await loadingCustomCss();
await loadEager(document);
await loadLazy(document);
Expand Down Expand Up @@ -935,4 +936,22 @@ export function getDay(){
const daysOfWeek = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const currentDayOfWeek = daysOfWeek[date.getDay()];
return currentDayOfWeek
}


export function branchURLStr(location = "", city = "", state = "", urlstrhand, locationcode = ""){
let locationAdd = location?.replace(/\s+/g, "-").replace(/[()/]/g, "").trim().toLowerCase();
let cityStr = city?.replace(/\s+/g, "-").replace(/[()/]/g, "").trim().toLowerCase();
let stateStr = state?.replace(/\s+/g, "-").replace(/[()/]/g, "").trim().toLowerCase();
if(urlstrhand == "shorthand"){
return `/branch-locator/${stateStr}/${cityStr}`;
}else if(urlstrhand == "shorthandstate"){
return `/branch-locator/${stateStr}`;
}else if(urlstrhand == "loans"){
if(locationAdd == cityStr){
return `/branch-locator/loans-in-${cityStr}-${stateStr}-${locationcode}`;
}else{
return `/branch-locator/loans-in-${locationAdd}-${cityStr}-${stateStr}-${locationcode}`;
}
}
}
Loading

0 comments on commit f4017ca

Please sign in to comment.