Thursday, 21 December 2023

Dynamic Custom Cards in Oracle Apex

 Dynamic Custom Cards in Oracle Apex



Create an Application Item with Name PID

Then 

Create an Application Process with name of Getimage_EMP

/********* Application Process Query **************/

begin
 
 
    for c1 in (select a.empid,a.mylob,b.EMPLOYEE_NAME from vhrimages a , V_EMPLOYEES_MASTER@hr b where a.empid = b.employee_id 
    and A.EMPID = :PID  AND B.UNIT_ID = :UNIT_ID ) loop
        --
        sys.htp.init;
        --sys.owa_util.mime_header( c1.PIC_TYPE, FALSE );
        sys.htp.p('Content-length: ' || sys.dbms_lob.getlength( c1.MYLOB));
        sys.htp.p('Content-Disposition: attachment; filename="' || c1.EMPID || '"' );
        sys.htp.p('Cache-Control: max-age=3600');  -- tell the browser to cache for one hour, adjust as necessary
        sys.owa_util.http_header_close;
        sys.wpg_docload.download_file( c1.MYLOB );
     
        apex_application.stop_apex_engine;
      
    end loop;
end;

/*************************** End Query *******************************/ 


( Create Dynamic PL/SQL Region )


declare
cnt number;
begin
/*select nvl(count(*),0) into cnt from v_employees_master@hr where leave_approver = :LEAVE_APPROVER;
if cnt > 0 then 
*/
FOR I IN (
    select a.employee_id employee_id,a.EMPLOYEE_CARD_NO,a.SECTION_NAME,
a.employee_name,
a.deptt_name,
a.designation_name
 from v_employees_master@hr a , smf_user@hr b  
 where a.unit_id = :unit_id 
 and a.leave_approver = :leave_approver 
 and a.status='Active' 
 and b.LEAVE_APPROVER = a.leave_approver
 and b.user_id = :USER_ID
 order by SECTION_NAME,employee_name
)
LOOP
HTP.P('
<div class="product-card">
<div class="badge">'||I.EMPLOYEE_CARD_NO||'</div>
<div class="product-tumb">
<div style="text-shadow: 2px 2px 4px #0000008c;float: left;"><img style="width:100px;height:100px;border-radius:100%;float: left;display:flex;
background"src="f?p=&APP_ID.:0:&APP_SESSION.:APPLICATION_PROCESS=GETIMAGE_EMP:::PID:'||I.EMPLOYEE_ID||'." alt="N/A"></div>
</div>
<div class="product-details">
<span class="product-catagory">'||I.EMPLOYEE_NAME||'</span>
<h4><a href="#">'||I.deptt_name||'</a></h4>
<p>'||I.SECTION_NAME||'</p>
<div class="product-bottom-details">
<div class="product-price"><small></small></div>
<div class="product-links">
<a href="#">'||I.designation_name||'</a>
</div>
</div>
</div>
</div>
  
    ');
END LOOP;
/*
elsif
cnt  = 0 then 
--select nvl(count(*),0) into cnt from v_employees_master@hr where leave_approver_2 = :LEAVE_APPROVER_2;
FOR K IN (
    select a.employee_id employee_id,a.EMPLOYEE_CARD_NO,a.SECTION_NAME,
a.employee_name,
a.deptt_name,
a.designation_name
 from v_employees_master@hr a , smf_user@hr b  
 where a.unit_id = :unit_id 
 and a.leave_approver_2 = :LEAVE_APPROVER_2 
 and a.status='Active' 
 --and b.LEAVE_APPROVER_2 = a.leave_approver_2
 and b.user_id = :USER_ID
 order by SECTION_NAME,employee_name
)
LOOP
HTP.P('
<div class="product-card">
<div class="badge">'||K.EMPLOYEE_CARD_NO||'</div>
<div class="product-tumb">
<div style="text-shadow: 2px 2px 4px #0000008c;float: left;"><img style="width:100px;height:100px;border-radius:100%;float: left;display:flex;
background"src="f?p=&APP_ID.:0:&APP_SESSION.:APPLICATION_PROCESS=GETIMAGE_EMP:::PID:'||K.EMPLOYEE_ID||'." alt="N/A"></div>
</div>
<div class="product-details">
<span class="product-catagory">'||K.EMPLOYEE_NAME||'</span>
<h4><a href="#">'||K.deptt_name||'</a></h4>
<p>'||K.SECTION_NAME||'</p>
<div class="product-bottom-details">
<div class="product-price"><small></small></div>
<div class="product-links">
<a href="#">'||K.designation_name||'</a>
</div>
</div>
</div>
</div>
  
    ');
END LOOP;
*/
--end if;
end ;

/****************** In Line CSS **********************/

.t-HeroRegion-wrap { padding: var(--ut-hero-region-padding-y, 20px) var(--ut-hero-region-padding-x, 20px); display: flex; flex-direction: row; align-items: center; BACKGROUND: aliceblue; text-align: left; } .t-HeroRegion-title { text-shadow: 2px 2px 4px #0000008c; color: #D60707; } .t-Footer{ display: none; } .t-Region-body { position: relative; display: inline-flex; padding-top: var(--ut-region-body-padding-y, 20px); padding-bottom: var(--ut-region-body-padding-y, 20px); padding-left: var(--ut-region-body-padding-x, 20px); padding-right: var(--ut-region-body-padding-x, 20px); flex-direction: row; flex-wrap: wrap; gap: 5px; } //////////////////////////////////////////////////////// Inline CARD REGION CSS //////////////////////// @import url('https://fonts.googleapis.com/css?family=Roboto:400,500,700'); * { -webkit-box-sizing: border-box; box-sizing: border-box; margin: 0; padding: 10; } body { font-family: 'Roboto', sans-serif; } a { text-decoration: none; } .product-card { width: 220px; position: relative; box-shadow: 0 2px 7px #727171; margin: 30px auto; //background: #fafafa; background:aliceblue; border-radius: 10px; } .badge { position: relative; left: 0; top: 5px; text-transform: uppercase; font-size: 13px; font-weight: 900; text-align: center; background: rgba(255, 0, 0, 0); color: rgb(17, 34, 112); padding: 10px 20px; } .product-tumb { display: flex; align-items: center; justify-content: center; height: 150px; padding: 10px; background:rgba(214, 215, 216, 0.623); box-shadow: 0 2px 7px #727171d0; border-radius: 10px; } .product-tumb img { max-width: 100%; max-height: 100%; border: 2px solid #0559a8; border-radius: 100%; padding: 5px; margin: 10px 0 10px; display: flex; } .product-details { padding: 10px; } .product-catagory { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; color: rgb(161, 15, 15); margin-bottom: 18px; } .product-details h4 a { font-weight: 500; display: block; margin-bottom: 18px; text-transform: uppercase; color: #363636; text-decoration: none; transition: 0.3s; } .product-details h4 a:hover { color: #c72b2b; } .product-details p { font-size: 15px; line-height: 22px; margin-bottom: 10px; color: #999; } .product-bottom-details { overflow: hidden; border-top: 1px solid #eee; padding-top: 10px; } .product-bottom-details div { float: right; // width: 50%; } .product-price { font-size: 18px; color: #fbb72c; font-weight: 600; } .product-price small { font-size: 80%; font-weight: 400; text-decoration: line-through; display: inline-block; margin-right: 10px; } .product-links { text-align: center; } .product-links a { display: block; color: #960707; transition: 0.3s; font-size: 12px; text-align: center; } .product-links a:hover { color: #2c6dfb; } .req-card { width: 220px; position: relative; box-shadow: 0 2px 7px #72717100; margin: 30px auto; background: #fafafa00; border-radius: 10px; } .req-catagory { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; color: rgb(161, 15, 15); text-align: center; } .req-details h4 a { font-weight: bold; display: block; margin-bottom: 18px; text-transform: uppercase; color: #c72727; text-decoration: none; transition: 0.3s; } .req-details h4 a:hover { color: #0559a8; } .req-tumb img { max-width: 100%; max-height: 100%; border: 2px solid #0559a8; border-radius: 100%; padding: 5px; margin: 50px 0 15px; display: flex; } .req-tumb { display: flex; align-items: center; justify-content: center; height: 120px; padding: 20px; background:rgba(214, 215, 216, 0); box-shadow: 0 2px 7px #72717100; border-radius: 10px; border: 10px; border-color: rgba(255, 0, 0, 0); margin: 50px 0 15px; } //////////////////////////////////////////////////////////// END CARD REGION //////////////////////////


Saturday, 16 December 2023

Add Column Name in Table in Multiple Schemas in Database

 Add Column Name in Table in Multiple Schemas in Database


declare

   strr varchar2(2000);

begin

for i in (  select * from all_objects where object_type='TABLE' and object_name ='GRNM' and owner <> 'VFIP2324' )

loop

strr:= 'alter  TABLE ' || i.OWNER||'.'||i.object_name || ' add PROD_TYPE varchar2(100) ';

execute immediate strr;

end loop;

EXCEPTION WHEN OTHERS THEN NULL;

end;

  

Monday, 4 December 2023

User Blob Image in Top Navigation Bar

 User Blob Image in Top Navigation Bar


================Navigation Bar Image=================


1. Create application item name > 'FILE_ID',> Session State Protection > Unrestricted.

2. Create Application Processes > 'GETIMAGE',> Process Point > Ajax Callback, > PL/SQL Code >

begin

     for c1 in (select a.empid,a.mylob,b.user_login from vhrimages a , smf_user@hr b where a.empid = b.employee_id and upper(b.user_login) = upper(:FILE_ID)    and   a.EMPID = :EMPLOYEE_ID )

 loop

        --

        sys.htp.init;

        --sys.owa_util.mime_header( c1.PIC_TYPE, FALSE );

        sys.htp.p('Content-length: ' || sys.dbms_lob.getlength( c1.MYLOB));

        sys.htp.p('Content-Disposition: attachment; filename="' || c1.EMPID || '"' );

        sys.htp.p('Cache-Control: max-age=3600');  -- tell the browser to cache for one hour, adjust as necessary

        sys.owa_util.http_header_close;

        sys.wpg_docload.download_file( c1.MYLOB );

     

        apex_application.stop_apex_engine;

      

    end loop;

end;


3. Create/Select navigation bar where you want to show image > User Defined Attributes 1.


<img style="width:35px;height:35px;border-radius:50%;background" 

src="f?p=&APP_ID.:0:&APP_SESSION.:APPLICATION_PROCESS=GETIMAGE:::FILE_ID:&APP_USER." alt="No Image">

Check Internet Connectivity on Local System

if (!navigator.onLine) {     showOfflineAlert(); } else {     // Set a strict 3-second network timeout threshold     const controller = new ...