Get License to Practice Water Taxi Activity
.special-conditions-section.list-section ul{
list-style: unset;
padding-left: 20px;
}
.rtl .special-conditions-section.list-section ul{
padding-right: 20px;
padding-left: 0px;
}
4
Payment
922167
922169
3
Reviewing the request
Approving the request
Special conditions
- -
- -
- -
- -
- - -
- -
- -
- -
- -
By selecting 'Start now' you will leave the GUP and be redirected to a
`); return; }else{ let btnUrl = ""; if(authenticationRequired){ if(!themeDisplay.isSignedIn()){ console.log("authentication required-----") btnUrl = '/theqa-login?redirect=/w/renew-insurance-company-license?p_l_back_url_title=Search' }else{ btnUrl = 'https://fsa.gov.om' } }else{ btnUrl = 'https://fsa.gov.om' } $('#btn-loader').removeClass('d-none').addClass('d-flex'); $('#btn-container').addClass('d-none'); redirectToSPPortal(false) .then(({ url, serviceType }) => { const startNowBtn = $('#btn-container').find('gup-button'); localStorage.setItem("serviceType",serviceType); startNowBtn.attr('href', url); if (serviceType !== 'EVENT_PROCESSING' && serviceType !== 'FORM_MANAGEMENT') { startNowBtn.on('click', function (e) { e.preventDefault(); window.open(url, '_blank'); }); } }) .catch(error => { console.error("Error in redirectToSPPortal:", error); }); if(startNowImageFlag){ $('#btn-container').find('#arrow-forward').removeClass('d-none') }else{ $('#btn-container').find('#launch').removeClass('d-none'); $('#btn-container').find('p').removeClass('d-none'); } $('#btn-container').removeClass('d-none').addClass('d-flex'); } }else{ redirectToSPPortal(true) .then(({ url, serviceType }) => { $(".sp-start-now-btn").attr("href", url); }) .catch(error => { console.error("Error in redirectToSPPortal:", error); }); $('#start-now-btn').removeClass('d-none').addClass('d-flex'); } $('#btn-loader').addClass('d-none').removeClass('d-flex'); $('#btn-container').removeClass('d-none').addClass('d-flex'); }) .catch((error) => { console.log(error); $('#btn-loader').addClass('d-none').removeClass('d-flex'); }); } async function getCrNumber(){ let crNumber = null; const civilNumber = '20095'; try { const response = await fetch(window.location.origin+`/o/gup-nortal-custom-wrapper-headless/v1.0/getusersasloggedindata` , { headers: { accept: "application/json", "x-csrf-token": Liferay.authToken, }, }); if (!response.ok) { throw new Error("HTTP error! status: "+response.status); } const wrapperData = await response.json(); if (wrapperData.statusCode=="500") { throw new Error("HTTP error! status: "+wrapperData.responseMessage); } const data = typeof wrapperData.responseMessage == "string" ? JSON.parse(wrapperData.responseMessage) : wrapperData.responseMessage; if(data.items.length > 0 ){ //crNumber=data.items[0].cRNumber; if(data.items[0].viewableAs=="business"){ crNumber=data.items[0].cRNumber; } } } catch (error) { console.error('Error fetching data:', error); throw error; } return crNumber; }; async function getServiceId(){ let serviceId = null; try { const response = await fetch("/o/c/servicedetailsmappings/?restrictFields=actions,creator&filter=articleId eq 1286310", { headers: { 'accept': 'application/json' } }) if (!response.ok) { throw new Error("HTTP error! status: "+response.status); } const data = await response.json(); if(data.items.length > 0 ){ serviceId=data.items[0].aGCCode; } } catch (error) { console.error('Error fetching data:', error); throw error; } return serviceId; }; async function getPublicUserData(){ let data = null; const civilNumber = '20095'; try { const response = await fetch(window.location.origin+"/o/c/publicusers/?filter=civilNumber eq '"+civilNumber+"'" , { headers: { accept: "application/json", "x-csrf-token": Liferay.authToken, }, }); if (!response.ok) { throw new Error("HTTP error! status: "+response.status); } const responseData = await response.json(); if(responseData.items.length > 0 ){ data= sanitizeResponse(responseData.items[0]); } } catch (error) { console.error('Error fetching data:', error); throw error; } return data; } async function getServiceType(serviceId){ let serviceType = null; try { const response = await fetch(window.location.origin+"/o/c/onboardedservicedetails/?restrictFields=actions,creator&filter=serviceId eq '"+serviceId+"'" , { headers: { accept: "application/json", "x-csrf-token": Liferay.authToken, }, }); if (!response.ok) { throw new Error("HTTP error! status: "+response.status); } const responseData = await response.json(); if(responseData.items.length > 0 ){ serviceType = responseData.items[0].serviceType; console.log(serviceType); } } catch (error) { console.error('Error fetching data:', error); throw error; } return serviceType; } async function getHeadlessData(authMethod, serviceId, language, callbackUrl) { console.log("POST getHeadlessData"); const bodyData = { authMethod: authMethod, serviceId: serviceId, //serviceType: serviceType, languageId: language, callbackUrl: callbackUrl, //redirectUrl: spRedirectLink source: "GUP" }; const requestOptions = { method: "POST", headers: { "Content-Type": "application/json", "Accept": "application/json", "x-csrf-token": Liferay.authToken }, body: JSON.stringify(bodyData) }; const url = "/o/gup-nortal-custom-wrapper-headless/v1.0/getServiceDetailsRequestParam"; const response = await fetch(url, requestOptions); const json = await response.json(); console.log("API RESPONSE:", json); return json; } async function redirectToSPPortal(isArrowForward){ const authMethod = localStorage.getItem("authMethod"); const serviceId = await getServiceId(); const serviceType = await getServiceType(serviceId); //const serviceData = await getHeadlessData(); console.log("is logged out :: ", !themeDisplay.isSignedIn() && serviceType); if(!themeDisplay.isSignedIn() && serviceType){ let url='/theqa-login?redirect=/w/renew-insurance-company-license?p_l_back_url_title=Search'; /*if(authMethod=="mpki" || authMethod=="idp"){ url='/pki-login?redirect=/w/renew-insurance-company-license?p_l_back_url_title=Search'; }else{ url= '/theqa-login?redirect=/w/renew-insurance-company-license?p_l_back_url_title=Search' }*/ return { url: url, serviceType: serviceType } } let language = themeDisplay.getLanguageId(); language = language.split("_")[0]; //const crNumber = await getCrNumber(); //console.log("crNumber-----", crNumber); let startNowBtnUrl; let spRedirectLink; if(!(isArrowForward)){ spRedirectLink = 'https://fsa.gov.om'; }else{ spRedirectLink = $("#start-now-btn").attr("href"); } console.log("spRedirectLink : ",spRedirectLink); if(serviceType=="EVENT_PROCESSING"){ console.log("Calling EP Service"); const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const categoryParam = urlParams.get('category'); const contentParam = urlParams.get('content'); let relativeUrl=themeDisplay.getLayoutRelativeURL(); if(relativeUrl.startsWith("/")){ relativeUrl = relativeUrl.substring(1); } let callbackUrl = null; if(authMethod=="theqa"){ callbackUrl = themeDisplay.getCDNBaseURL()+'/'+language+'/theqa-login?redirect='+relativeUrl; }else{ callbackUrl = themeDisplay.getCDNBaseURL()+'/'+language+'/pki-login?redirect='+relativeUrl; } if (categoryParam) { callbackUrl += '&category='+categoryParam; } if (contentParam) { callbackUrl += '&content='+contentParam; } let modifiedspRedirectUrl = spRedirectLink.includes("#") ? spRedirectLink.replace("#", "_HASH_") : spRedirectLink; const serviceUrl = new URL(modifiedspRedirectUrl); const serviceData = await getHeadlessData(authMethod, serviceId, language, callbackUrl); console.log("EP Service Data: ", serviceData); if (serviceData.statusCode=="200" && serviceData?.responseMessage) { //startNowBtnUrl = serviceData.responseMessage; console.log("serviceData.responseMessage :: ", serviceData.responseMessage); modifiedUrl = modifiedspRedirectUrl.includes("_HASH_") ? modifiedspRedirectUrl.replace("_HASH_", "#") : modifiedspRedirectUrl; startNowBtnUrl = modifiedUrl.includes("?") ? modifiedUrl + "&" + serviceData.responseMessage : modifiedUrl + "?" +serviceData.responseMessage; } else { console.error("Backend did not return responseMessage"); } }else{ startNowBtnUrl=spRedirectLink; } return { url: startNowBtnUrl, serviceType: serviceType }; } }); //show more steps document.addEventListener("DOMContentLoaded", () => { const timelineItems = document.querySelectorAll(".timeline-item"); const loadMoreContainer = document.querySelector(".load-more-container"); const loadMoreBtn = document.querySelector(".load-more-btn"); const icon = document.querySelector(".load-more-container i"); const toggleVisibility = (showMore) => { timelineItems.forEach((item, index) => { if (index >= 4) { item.classList.toggle("hidden-steps", !showMore); } if (index == 3) { item.classList.toggle("hide-step-line", !showMore); } }); }; toggleVisibility(false); if(loadMoreBtn){ loadMoreBtn.addEventListener("click", () => { const isExpanded = !timelineItems[4].classList.contains("hidden-steps"); toggleVisibility(!isExpanded); loadMoreBtn.textContent = isExpanded ? loadMoreBtn.getAttribute("data-show-all") : loadMoreBtn.getAttribute("data-show-less"); if (isExpanded) { icon.classList.replace("ri-indeterminate-circle-line", "ri-add-circle-line"); } else { icon.classList.replace("ri-add-circle-line", "ri-indeterminate-circle-line"); } }); } }); //hiding steps if empty const firstTimelineItemP = document.querySelector('.service-steps .timeline-item:first-child p'); const serviceSteps = document.querySelector('.service-steps'); if (firstTimelineItemP) { if (firstTimelineItemP.textContent.trim() === '') { serviceSteps.style.display = 'none'; } else { serviceSteps.style.display = 'block'; } } function getEntitiesList() { const entityID = $('.entities.d-flex ').attr('id'); if(entityID != " "){ fetch( window.location.origin+`/o/c/entities/scopes/20117?fields=categoryImage&restrictFields=actions%2Ccreator&filter=categoryId eq `+entityID ,{ headers: { 'accept': 'application/json', "x-csrf-token": Liferay.authToken, } }).then((response) => response.json()) .then((data) => { if(data.items[0].categoryImage.link != undefined){ $('.entities.d-flex img').attr("src",data.items[0].categoryImage.link.href); } }) .catch((error) => { console.log("Error"); }); } } getEntitiesList(); if(!Liferay.ThemeDisplay.isSignedIn()){ $(".service-user-info").addClass("hide"); }else{ $(".service-user-info").removeClass("hide"); } <div class="description"> <p>This service enables companies to obtain a license to practice water taxi activity.</p> </div> </div> <div class="entities d-flex align-items-center" id="57729"> <img src="/o/gup-theme-css/assets/image/entity-logo.svg" alt="entity-list-logo" /> <span> Ministry of Transport , Communications and IT </span> </div> <time> Published: February 24, 2025 </time> </div> </div> </section> <section class="service-related-section"> <div class="container-fluid container-fluid-max-xl container-padding"> <div class="row"> <div class="service-related-info col-lg-8"> <div class="service-user-info"> <div class="user-info-title"> You are starting service as: </div> <div class="user personal-details" style="display:none;"> <div class="sticker sticker-user-icon sticker-lg"> <span class="sticker user-icon-color-2 sticker-circle sticker-lg"> <span class="sticker-overlay"> <img class="sticker-img" src="/image/user_portrait?img_id=0&img_id_token=USyPXHclxmB08yKlKOuEkLClQms%3D&t=1786942532523" alt="" /> </span> </span> </div> <div class="user-detail"> <div class="username"> </div> <div class="user-account"> Personal account </div> </div> </div> <div class="user business-details" style="display:none;"> <div class="sticker sticker-user-icon sticker-lg hide"> <span class="sticker user-icon-color-2 sticker-circle sticker-lg"> <span class="sticker-overlay text-uppercase"> </span> </span> </div> <div class="user-detail hide"> <div class="username"> </div> <div class="user-account"> gup-business-account-label </div> </div> </div> </div> <div class="checklist"> <h2 class="checklist-title h4"> Before you start </h2> <ul><li>Ship Registration Certificate</li></ul> </div> <ul class="service-category-fee-list" role="tablist"> <li role="presentation"> <h2 onkeydown="onKeyDown(event)" role="tab" tabindex="0" class="step-title d-flex align-items-center justify-content-between mb-0 pb-4 h5" data-toggle="collapse" data-target="#timeline_item_collapse_0" aria-expanded="false" aria-controls="timeline_item_collapse_0"> Service category and fees <span id="timeline_collapse_btn_0" tabindex="-1" class="toggle-step-btn btn btn-outline-primary bg-transparent border-0 shadow-none"> <i class="ri-arrow-down-s-line"></i> <i class="ri-arrow-up-s-line"></i> <span class="show-lbl"> Show </span> <span class="hide-lbl"> Hide </span> </span> </h2> <div class="collapse timeline-item-collapse " role="tabpanel" id="timeline_item_collapse_0"> <div class="d-flex flex-column c-gap-4 mt-0 pb-4"> <div class="service-category"> <div class="title"> Issuing a License to Practice Water Taxi Activity, First and Excellent Class </div> <div class="description"> <p>This fee is paid to obtain a license to practice water taxi activity, first and excellent class.</p> </div> <div class="d-flex"> <img src="/documents/d/guest/Omani-rial" alt="oman-rial" width="30" height="20" alt="OMR"/> 150 </div> </div> <div class="service-category"> <div class="title"> Issuing a License to Practice Water Taxi Activity, Class (2-3-4) </div> <div class="description"> <p>This fee is paid to obtain a license to practice water taxi activity, class (2-3-4).</p> </div> <div class="d-flex"> <img src="/documents/d/guest/Omani-rial" alt="oman-rial" width="30" height="20" alt="OMR"/> 150 </div> </div> </div> </div> </li> </ul> <div class="service-steps"> <h2 class="checklist-title h4">Steps</h2> <ol class="timeline mb-0" role="tablist" aria-label="steps"> <li class="timeline-item " role="presentation"> <span class="timeline-count">1</span> <p>Submitting the Application</p> </li> <li class="timeline-item " role="presentation"> <span class="timeline-count">2</span> <p>Reviewing the Application</p> </li> <li class="timeline-item " role="presentation"> <span class="timeline-count">3</span> <p>Issuance of License and Payment</p> </li> </ol> </div> <div class="special-top-line"></div> <div class="special-conditions-section list-section"> <h2 class="checklist-title h4">Special conditions</h2> <ul><li>-</li></ul> </div> <div class="special-top-line"></div> <div class="special-conditions-section hide"> <h2 class="checklist-title h4">Service Locations</h2> <p></p> </div> </div> <aside class="service-section col-lg-4" aria-label="Start Service"> <div class="service-start-now"> <div class="service-title"> Service </div> <ul class="list-unstyled mb-0" role="list" aria-label="service duration and cost"> <li role="listitem" class="d-flex"> <i class="ri-time-line" aria-hidden="true"></i> 1 Days </li> <li class="d-flex"> <img class="mt-0" src="/documents/d/guest/Omani-rial" alt="oman-rial" width="30" height="20" alt="OMR" /> Fixed Cost </li> </ul> <gup-button id="start-now-btn" style="display: none;" kind="link" href="/theqa-login?redirect=/w/get-license-to-practice-water-taxi-activity?p_l_back_url_title=Search"> Start now <gup-icon slot="icon-end" icon-name="arrow-forward" height="20" width="20"></gup-icon> </gup-button> <gup-button id="internal-link" style="display: none;" kind="link" href="https://esma.mtcit.gov.om/"> Start now <gup-icon slot="icon-end" icon-name="arrow-forward" height="20" width="20"></gup-icon> </gup-button> <div id="startnow-link-online" class="d-none flex-column c-gap-4"> <gup-button kind="link" href="https://esma.mtcit.gov.om/" open-in-new-tab=""> Start now <gup-icon id="startnow-link-online-icon" slot="icon-end" icon-name="launch" height="20" width="20"></gup-icon> </gup-button> <p>By selecting 'Start now' you will leave the GUP and be redirected to a</p> </div> <div id="startnow-link-offline" class="d-none flex-column c-gap-4"> <gup-button kind="link" href="/theqa-login" open-in-new-tab=""> Start now <gup-icon slot="icon-end" icon-name="launch" height="20" width="20"></gup-icon> </gup-button> <p>By selecting 'Start now' you will leave the GUP and be redirected to a</p> </div> <div id="external-link" class="d-none flex-column c-gap-4"> <gup-button kind="link" href="https://esma.mtcit.gov.om/" open-in-new-tab=""> Visit website <gup-icon slot="icon-end" icon-name="launch" height="20" width="20"></gup-icon> </gup-button> <p>By selecting 'Visit website' you will leave the GUP and be redirected to</p> </div> <div id="start-now-section" class="flex-column c-gap-4"> <div id="btn-loader" class="d-flex justify-content-center"> <gup-spinner size="l"></gup-spinner> </div> <div id="btn-container" class="d-none flex-column c-gap-4"> <gup-button kind="link" href=""> Start now <gup-icon id="arrow-forward" slot="icon-end" class="d-none" icon-name="arrow-forward" height="20" width="20"></gup-icon> <gup-icon id="launch" slot="icon-end" class="d-none" icon-name="launch" height="20" width="20"></gup-icon> </gup-button> <p class="d-none">By selecting 'Start now' you will leave the GUP and be redirected to a</p> </div> </div> </div> </aside> </div> </div> </section> </article> <script> let startNowBtnUrl = null; function onKeyDown(event) { if (event.key === 'Enter' || event.key === ' ') { event.target.click(); } } const sanitizeResponse = (data) => { const scriptTagRegex = /<script[^>]*>([\S\s]*?)<\/script>/gi; const dangerousAttributesRegex = /(href|src|action|on\w+)=("[^"]*"|'[^']*'|[^'">\s]+)/gi; const imgTagRegex = /<img[^>]*>/gi; const decodeHTML = (str) => { const txt = document.createElement("textarea"); txt.innerHTML = str; return txt.value; }; const sanitizeHTML = (str) => { str = decodeHTML(str); str = str.replace(scriptTagRegex, (match, content) => content); str = str.replace(dangerousAttributesRegex, ''); str = str.replace(imgTagRegex, ''); return str; }; const sanitizeObject = (obj) => { for (let key in obj) { if (typeof obj[key] === 'string') { obj[key] = sanitizeHTML(obj[key]); } else if (typeof obj[key] === 'object' && obj[key] !== null) { obj[key] = sanitizeObject(obj[key]); } } return obj; }; if (Array.isArray(data)) { data = data.map(item => sanitizeObject(item)); } else if (typeof data === 'object' && data !== null) { data = sanitizeObject(data); } return data; }; async function fetchCurrentUser() { const civilNumber = '20095' try { const response = await fetch(window.location.origin+`/o/gup-nortal-custom-wrapper-headless/v1.0/getusersasloggedindata` , { headers: { accept: "application/json", "x-csrf-token": Liferay.authToken, }, }); const wrapperData = await response.json(); if (wrapperData.statusCode=="500") { throw new Error("HTTP error! status: "+wrapperData.responseMessage); } const data = typeof wrapperData.responseMessage == "string" ? JSON.parse(wrapperData.responseMessage) : wrapperData.responseMessage; return sanitizeResponse(data); // Return the data } catch (error) { console.error('Error fetching data:', error); throw error; // Rethrow the error to handle it in the calling code } } function getNameInitials(name) { if (!name) { return ''; } let cleanedName = name.replace(/[^a-zA-Z\u0600-\u06FF ]/g, ""); let initials = cleanedName.match(/\b\w/g); return initials ? initials.join('') : cleanedName.charAt(0); } function getNameInitialsARName(name) { if (!name) { return ''; } var cleanedName = name.replace(/[^a-zA-Z\u0600-\u06FF ]/g, ""); var initials = cleanedName.match(/\b\w/g); return initials ? initials.join('') : cleanedName.charAt(0); } $(document).ready(function () { fetchCurrentUser() .then(data => { $('.business-details').hide(); $('.personal-details').hide(); if(data.items.length > 0) { const userRecord = data.items[0]; const cRNumber = userRecord.cRNumber; const civilNumber = userRecord.civilNumber; const viewableAs = userRecord.viewableAs; if(viewableAs === "business"){ let companyInitial = getNameInitials(userRecord.name); let companyName = userRecord.name; if(themeDisplay.getLanguageId() == "ar_SA"){ companyInitial = userRecord.nameAR !== "" ? getNameInitialsARName(userRecord.nameAR) : getNameInitials(userRecord.name); companyName = userRecord.nameAR !== "" ? userRecord.nameAR : userRecord.name; ; } //$('.user.business-details').find('.username').html(companyName); //$('.user.business-details').find('.user-account').html(cRNumber); //$('.user.business-details').find('.sticker-overlay').html(companyInitial); $('.business-details').show(); }else{ $('.personal-details').show(); } }else{ $('.personal-details').show(); } }) .catch(error => { console.error('Error:', error); }); getStartNowButtonDetail(); async function getStartNowButtonDetail(){ await fetch("/o/c/servicedetailsmappings/?restrictFields=actions,creator&filter=articleId eq 922169", { headers: { 'accept': 'application/json' } }) .then((response) => response.json()) .then((response) => { if(response?.items.length > 0){ let serviceAccessChannel = response?.items[0]?.serviceAccessChannel; serviceAccessChannel = serviceAccessChannel.toLowerCase(); const startNowImageFlag = response?.items[0]?.startNowImageFlag; const authenticationRequired = response?.items[0]?.authenticationRequired; console.log("serviceAccessChannel------", serviceAccessChannel); if(serviceAccessChannel == "physical"){ //$('#external-link').removeClass('d-none').addClass('d-flex'); $('#start-now-btn').hide(); $('#btn-container').hide(); $('#external-link').hide(); $('#internal-link').hide(); $('#startnow-link-online').hide(); $('#startnow-link-offline').hide(); $('#btn-loader').addClass('d-none').removeClass('d-flex'); $('.service-start-now').append(` <div id="service-unavailable" class="d-flex flex-column c-gap-4"> <p>This is a physical service, please visit the closest ministry branch to proceed</p> </div> `); return; }else{ let btnUrl = ""; if(authenticationRequired){ if(!themeDisplay.isSignedIn()){ console.log("authentication required-----") btnUrl = '/theqa-login?redirect=/w/get-license-to-practice-water-taxi-activity?p_l_back_url_title=Search' }else{ btnUrl = 'https://esma.mtcit.gov.om/' } }else{ btnUrl = 'https://esma.mtcit.gov.om/' } $('#btn-loader').removeClass('d-none').addClass('d-flex'); $('#btn-container').addClass('d-none'); redirectToSPPortal(false) .then(({ url, serviceType }) => { const startNowBtn = $('#btn-container').find('gup-button'); localStorage.setItem("serviceType",serviceType); startNowBtn.attr('href', url); if (serviceType !== 'EVENT_PROCESSING' && serviceType !== 'FORM_MANAGEMENT') { startNowBtn.on('click', function (e) { e.preventDefault(); window.open(url, '_blank'); }); } }) .catch(error => { console.error("Error in redirectToSPPortal:", error); }); if(startNowImageFlag){ $('#btn-container').find('#arrow-forward').removeClass('d-none') }else{ $('#btn-container').find('#launch').removeClass('d-none'); $('#btn-container').find('p').removeClass('d-none'); } $('#btn-container').removeClass('d-none').addClass('d-flex'); } }else{ redirectToSPPortal(true) .then(({ url, serviceType }) => { $(".sp-start-now-btn").attr("href", url); }) .catch(error => { console.error("Error in redirectToSPPortal:", error); }); $('#start-now-btn').removeClass('d-none').addClass('d-flex'); } $('#btn-loader').addClass('d-none').removeClass('d-flex'); $('#btn-container').removeClass('d-none').addClass('d-flex'); }) .catch((error) => { console.log(error); $('#btn-loader').addClass('d-none').removeClass('d-flex'); }); } async function getCrNumber(){ let crNumber = null; const civilNumber = '20095'; try { const response = await fetch(window.location.origin+`/o/gup-nortal-custom-wrapper-headless/v1.0/getusersasloggedindata` , { headers: { accept: "application/json", "x-csrf-token": Liferay.authToken, }, }); if (!response.ok) { throw new Error("HTTP error! status: "+response.status); } const wrapperData = await response.json(); if (wrapperData.statusCode=="500") { throw new Error("HTTP error! status: "+wrapperData.responseMessage); } const data = typeof wrapperData.responseMessage == "string" ? JSON.parse(wrapperData.responseMessage) : wrapperData.responseMessage; if(data.items.length > 0 ){ //crNumber=data.items[0].cRNumber; if(data.items[0].viewableAs=="business"){ crNumber=data.items[0].cRNumber; } } } catch (error) { console.error('Error fetching data:', error); throw error; } return crNumber; }; async function getServiceId(){ let serviceId = null; try { const response = await fetch("/o/c/servicedetailsmappings/?restrictFields=actions,creator&filter=articleId eq 922169", { headers: { 'accept': 'application/json' } }) if (!response.ok) { throw new Error("HTTP error! status: "+response.status); } const data = await response.json(); if(data.items.length > 0 ){ serviceId=data.items[0].aGCCode; } } catch (error) { console.error('Error fetching data:', error); throw error; } return serviceId; }; async function getPublicUserData(){ let data = null; const civilNumber = '20095'; try { const response = await fetch(window.location.origin+"/o/c/publicusers/?filter=civilNumber eq '"+civilNumber+"'" , { headers: { accept: "application/json", "x-csrf-token": Liferay.authToken, }, }); if (!response.ok) { throw new Error("HTTP error! status: "+response.status); } const responseData = await response.json(); if(responseData.items.length > 0 ){ data= sanitizeResponse(responseData.items[0]); } } catch (error) { console.error('Error fetching data:', error); throw error; } return data; } async function getServiceType(serviceId){ let serviceType = null; try { const response = await fetch(window.location.origin+"/o/c/onboardedservicedetails/?restrictFields=actions,creator&filter=serviceId eq '"+serviceId+"'" , { headers: { accept: "application/json", "x-csrf-token": Liferay.authToken, }, }); if (!response.ok) { throw new Error("HTTP error! status: "+response.status); } const responseData = await response.json(); if(responseData.items.length > 0 ){ serviceType = responseData.items[0].serviceType; console.log(serviceType); } } catch (error) { console.error('Error fetching data:', error); throw error; } return serviceType; } async function getHeadlessData(authMethod, serviceId, language, callbackUrl) { console.log("POST getHeadlessData"); const bodyData = { authMethod: authMethod, serviceId: serviceId, //serviceType: serviceType, languageId: language, callbackUrl: callbackUrl, //redirectUrl: spRedirectLink source: "GUP" }; const requestOptions = { method: "POST", headers: { "Content-Type": "application/json", "Accept": "application/json", "x-csrf-token": Liferay.authToken }, body: JSON.stringify(bodyData) }; const url = "/o/gup-nortal-custom-wrapper-headless/v1.0/getServiceDetailsRequestParam"; const response = await fetch(url, requestOptions); const json = await response.json(); console.log("API RESPONSE:", json); return json; } async function redirectToSPPortal(isArrowForward){ const authMethod = localStorage.getItem("authMethod"); const serviceId = await getServiceId(); const serviceType = await getServiceType(serviceId); //const serviceData = await getHeadlessData(); console.log("is logged out :: ", !themeDisplay.isSignedIn() && serviceType); if(!themeDisplay.isSignedIn() && serviceType){ let url='/theqa-login?redirect=/w/get-license-to-practice-water-taxi-activity?p_l_back_url_title=Search'; /*if(authMethod=="mpki" || authMethod=="idp"){ url='/pki-login?redirect=/w/get-license-to-practice-water-taxi-activity?p_l_back_url_title=Search'; }else{ url= '/theqa-login?redirect=/w/get-license-to-practice-water-taxi-activity?p_l_back_url_title=Search' }*/ return { url: url, serviceType: serviceType } } let language = themeDisplay.getLanguageId(); language = language.split("_")[0]; //const crNumber = await getCrNumber(); //console.log("crNumber-----", crNumber); let startNowBtnUrl; let spRedirectLink; if(!(isArrowForward)){ spRedirectLink = 'https://esma.mtcit.gov.om/'; }else{ spRedirectLink = $("#start-now-btn").attr("href"); } console.log("spRedirectLink : ",spRedirectLink); if(serviceType=="EVENT_PROCESSING"){ console.log("Calling EP Service"); const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const categoryParam = urlParams.get('category'); const contentParam = urlParams.get('content'); let relativeUrl=themeDisplay.getLayoutRelativeURL(); if(relativeUrl.startsWith("/")){ relativeUrl = relativeUrl.substring(1); } let callbackUrl = null; if(authMethod=="theqa"){ callbackUrl = themeDisplay.getCDNBaseURL()+'/'+language+'/theqa-login?redirect='+relativeUrl; }else{ callbackUrl = themeDisplay.getCDNBaseURL()+'/'+language+'/pki-login?redirect='+relativeUrl; } if (categoryParam) { callbackUrl += '&category='+categoryParam; } if (contentParam) { callbackUrl += '&content='+contentParam; } let modifiedspRedirectUrl = spRedirectLink.includes("#") ? spRedirectLink.replace("#", "_HASH_") : spRedirectLink; const serviceUrl = new URL(modifiedspRedirectUrl); const serviceData = await getHeadlessData(authMethod, serviceId, language, callbackUrl); console.log("EP Service Data: ", serviceData); if (serviceData.statusCode=="200" && serviceData?.responseMessage) { //startNowBtnUrl = serviceData.responseMessage; console.log("serviceData.responseMessage :: ", serviceData.responseMessage); modifiedUrl = modifiedspRedirectUrl.includes("_HASH_") ? modifiedspRedirectUrl.replace("_HASH_", "#") : modifiedspRedirectUrl; startNowBtnUrl = modifiedUrl.includes("?") ? modifiedUrl + "&" + serviceData.responseMessage : modifiedUrl + "?" +serviceData.responseMessage; } else { console.error("Backend did not return responseMessage"); } }else{ startNowBtnUrl=spRedirectLink; } return { url: startNowBtnUrl, serviceType: serviceType }; } }); //show more steps document.addEventListener("DOMContentLoaded", () => { const timelineItems = document.querySelectorAll(".timeline-item"); const loadMoreContainer = document.querySelector(".load-more-container"); const loadMoreBtn = document.querySelector(".load-more-btn"); const icon = document.querySelector(".load-more-container i"); const toggleVisibility = (showMore) => { timelineItems.forEach((item, index) => { if (index >= 4) { item.classList.toggle("hidden-steps", !showMore); } if (index == 3) { item.classList.toggle("hide-step-line", !showMore); } }); }; toggleVisibility(false); if(loadMoreBtn){ loadMoreBtn.addEventListener("click", () => { const isExpanded = !timelineItems[4].classList.contains("hidden-steps"); toggleVisibility(!isExpanded); loadMoreBtn.textContent = isExpanded ? loadMoreBtn.getAttribute("data-show-all") : loadMoreBtn.getAttribute("data-show-less"); if (isExpanded) { icon.classList.replace("ri-indeterminate-circle-line", "ri-add-circle-line"); } else { icon.classList.replace("ri-add-circle-line", "ri-indeterminate-circle-line"); } }); } }); //hiding steps if empty const firstTimelineItemP = document.querySelector('.service-steps .timeline-item:first-child p'); const serviceSteps = document.querySelector('.service-steps'); if (firstTimelineItemP) { if (firstTimelineItemP.textContent.trim() === '') { serviceSteps.style.display = 'none'; } else { serviceSteps.style.display = 'block'; } } function getEntitiesList() { const entityID = $('.entities.d-flex ').attr('id'); if(entityID != " "){ fetch( window.location.origin+`/o/c/entities/scopes/20117?fields=categoryImage&restrictFields=actions%2Ccreator&filter=categoryId eq `+entityID ,{ headers: { 'accept': 'application/json', "x-csrf-token": Liferay.authToken, } }).then((response) => response.json()) .then((data) => { if(data.items[0].categoryImage.link != undefined){ $('.entities.d-flex img').attr("src",data.items[0].categoryImage.link.href); } }) .catch((error) => { console.log("Error"); }); } } getEntitiesList(); if(!Liferay.ThemeDisplay.isSignedIn()){ $(".service-user-info").addClass("hide"); }else{ $(".service-user-info").removeClass("hide"); } </script>
Are you satisfied with this page?
Service categories
Digital OMAN
© Oman Government
