
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="/struts-dojo-tags" prefix="sx"%>  
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>

<%-- Struts: use context path + .action (works on server with non-root context). --%>
<script type="text/javascript">
if (typeof window.easysContextPath === 'undefined') {
  window.easysContextPath = "${pageContext.request.contextPath}";
}
if (typeof window.easysStrutsActionUrl !== 'function') {
  window.easysStrutsActionUrl = function(actionName) {
    var c = (typeof window.easysContextPath === 'string') ? window.easysContextPath : '';
    if (!actionName) { return c || '/'; }
    return c + '/' + actionName + '.action';
  };
}
</script>

 <script lang="javascript" type="text/javascript">
/* EASYS_NOCONFLICT_WRAP */
jQuery.noConflict();
(function ($) {
 

 window.onload = function() {
	  document.getElementById("searchValue").focus();
	};
	function getSupplierData(str)
	{
		
		 var customerSearchOption = document.getElementById("supplierSearchOption").value;
		 
		 var strlength = str.length;
		
		 if(strlength >4 && str.includes(" "))
		{
		 var url = "supplierInfoJSON?key="+str+"&searchOption="+customerSearchOption;
		
		 var text = "<table class='table table-bordered'>";
		 text = text + "<tr style='font-weight: bold; background-color: rgb(234,234,234);'>";
		 text = text + "<td class='td'>Id</td>";
		 text = text + "<td class='td'>Supplier Name</td>";		
		 text = text + "<td class='td'>Mobile</td>";
		 text = text + "<td class='td'>Address</td>";
		 text = text + "<td class='td'>Debt Amount</td>";		
		 text = text + "<td colspan='2' class='td' align='center'>Action</td>";
		 text = text + "</tr>";
		 
		 $.getJSON(url, function(data)
		{
			 var id;
			 var sname;
			 var mobile;			
			 var address;			
			 var debt;
			 var key;
			
			 var i = 1;
			 
			 $.each(data.supplierInfoList, function()
			{
				  var me = this;//save `this` reference
				 
				
				  id = me.supplierId;
				  sname = me.supplierName;
				  mobile  = me.supplierMobile;
				  address = me.supplierAddress;				  
				  debt = me.debtAmount;
				  key = me.key;
				  
				 
				   text = text+"<tr>";
				   text = text+'<td>'+id+'</td>';
				   text = text+'<td>'+sname+'</td>';
				   text = text+'<td>'+mobile+'</td>';
				   text = text+'<td>'+address+'</td>';
				   text = text+'<td>'+debt+'</td>';				
				  
				  
				 		text = text+"<td align='center'><a href='addSuppPaymentDetailsJsp?key="+key+"'><button type='button' class='btn btn-primary'>Add Payment Details</button></td>";
				 					   
				 	
				 		text = text+"<td align='center'><a href='viewSupplierAccDetailsJsp?key="+key+"'><button type='button' class='btn btn-danger'>View Account Details</button></td>";
				 		
				 
				   text = text+'</tr>';
				  
			 });
			 
			 
			 text = text+'</table>';
			
			document.getElementById("supplierData").innerHTML = text;	
			document.getElementById("billData").innerHTML = "";
			document.getElementById("productData").innerHTML = "";
			document.getElementById("custData").innerHTML = "";
			document.getElementById("employeeData").innerHTML = "";	
			
	});
	}
}

	
	function getProductData(str)
	{
		 //alert(str);
		 var strlength = str.length;
		
		 if(strlength >4 && str.includes(" "))
		{
		 var url = "productInfoJSON?key="+str;
		 var text = "<table class='table table-bordered'>";
		 text = text + "<tr style='font-weight: bold; background-color: rgb(234,234,234);'>";
		 text = text + "<td class='td'>Date(Product Added)</td>";
		 text = text + "<td class='td'>Code</td>";
		 text = text + "<td class='td'>Image</td>";
		 text = text + "<td class='td'>Stock</td>";
		 text = text + "<td class='td'>Rack Number</td>";
		 text = text + "<td class='td'>Product Name</td>";
		 text = text + "<td class='td'>Marathi Name</td>";
		 text = text + "<td class='td'>Customer Sale Rate</td>";
		 text = text + "<td class='td'>Retailer Sale Rate</td>";
		 text = text + "<td class='td'>Dealer Sale Rate</td>";
		
		 text = text + "<td class='td'>Alias</td>";
		 text = text + "<td class='td'>TAX(%)</td>";
		 text = text + "<td colspan='2' class='td' align='center'>Action</td>";
		 text = text + "</tr>";
		 
		 $.getJSON(url, function(data)
		{
			 var date;
			 var pid;
			 var code;
			 var name;
			 var mname;	
			 var stock;
			 var crate;
			 var rrate;
			 var drate;
			 var rackNo;
			 var alias;
			 var tax;
			
			 var i = 1;
			 
			 $.each(data.searchProductInfo, function()
			{
				  var me = this;//save `this` reference
				 
				
				  date = me.addDate;
				  pid = me.productId;
				  code = me.productCode;
				  name = me.productName;
				  mname  = me.marathiName;
				  stock = me.inStockQuantity
				  crate = me.customerSalesRate;
				  rrate = me.retailerSaleRate;
				  drate = me.dealerSalesRate;
				  rackNo= me.rackNumber;
				  alias = me.alias;
				  tax = me.taxPercentage;
				  
				 
				   text = text+"<tr>";
				   text = text+'<td>'+date+'</td>';
				   text = text+'<td>'+code+'</td>';
				   text = text+'<td><a href="productImage.action?id='+pid+'" target="_blank"><img width="200" height="200" src=productImage.action?id='+pid+'/></a></td>';
				   text = text+'<td>'+stock+'</td>';
				   text = text+'<td>'+rackNo+'</td>';
				   text = text+'<td>'+name+'</td>';
				   text = text+'<td>'+mname+'</td>';
				   text = text+'<td>'+crate+'</td>';
				   text = text+'<td>'+rrate+'</td>';
				   text = text+'<td>'+drate+'</td>';
				   text = text+'<td>'+alias+'</td>';
				   text = text+'<td>'+tax+'</td>';
				  
				   text = text+"<td align='center'><a href='editProductJsp?id="+pid+"&code="+code+"'><button type='button' class='btn btn-primary'>UPDATE</button></td>";
				 					   
				 	
				   text = text+'</tr>';
				  
			 });
			 
			 
			 text = text+'</table>';
			
			document.getElementById("productData").innerHTML = text;
			document.getElementById("billData").innerHTML="";
			document.getElementById("custData").innerHTML="";
			document.getElementById("employeeData").innerHTML = "";	
			document.getElementById("supplierData").innerHTML = "";	
			
	});
	}
}
		
	function getBillData(str)
	{
		 
		 var strlength = str.length;
		 var billDate = document.getElementById("billDate").value;
		 var isAll =  document.getElementById("allBill").checked;
		
		 
		 
		 if(strlength >4 && str.includes(" "))
		{
			
		 var url = "billInfoJSON?key="+str+"&billDate="+billDate+"&billAll="+isAll;
		 var text = "<table class='table table-bordered'>";
		 text = text + "<tr style='font-weight: bold; background-color: rgb(234,234,234);'>";
		 text = text + "<td class='td'>Date</td>";
		 text = text + "<td class='td'>Bill No</td>";
		 text = text + "<td class='td'>Items</td>";
		 text = text + "<td class='td'>Customer Name</td>";
		 text = text + "<td class='td'>Total Amount</td>";	
		 text = text + "<td class='td'>Paid</td>";
		 text = text + "<td class='td'>Balance</td>";	
		 text = text + "<td colspan='2' class='td' align='center'>Action</td>";
		 text = text + "</tr>";
		 
		 $.getJSON(url, function(data)
		{
			 var billdate;
			 var billnumber;
			 var itemscount;			
			 var cname;
			 var tamt;
			 var bamt;
			 var amtPaid;
			
			 var i = 1;
			 
			 $.each(data.billInfoForSearchList, function()
			{
				  var me = this;//save `this` reference
				 
				
				  billdate = me.billDate;
				  billnumber = me.billNumber;
				  itemscount  = me.itemsCount;
				  cname = me.customerName;
				  tamt = me.totalAmount;
				  bamt = me.balanceAmount;
				  amtPaid = me.amountReceived;
				  bType = me.billType;
				 
				   text = text+"<tr>";
				   text = text+'<td>'+billdate+'</td>';
				   text = text+'<td>'+billnumber+'</td>';
				   text = text+'<td>'+itemscount+'</td>';
				   text = text+'<td>'+cname+'</td>';
				   text = text+'<td>'+tamt+'</td>';
				   text = text+'<td>'+amtPaid+'</td>';
				   text = text+'<td>'+bamt+'</td>';
				 
				  
				 		text = text+"<td align='center'><a href='viewBillJsp?billNumber="+billnumber+"&typeOfBill="+bType+"'><button type='button' class='btn btn-primary'>VIEW</button></td>";
				 		
				 
				   text = text+'</tr>';
				  
			 });
			 
			 
			 text = text+'</table>';
			
			document.getElementById("billData").innerHTML = text;
			document.getElementById("productData").innerHTML = "";		
			document.getElementById("custData").innerHTML="";
			document.getElementById("employeeData").innerHTML = "";	
			document.getElementById("supplierData").innerHTML = "";	
			
	});
	}
}
		

	function getCustomerData(str)
	{
		 //alert(str);
		 var customerSearchOption = document.getElementById("customerSearchOption").value;
		 
		 var strlength = str.length;
		
		 if(strlength >4 && str.includes(" "))
		{
		 var url = "customerInfoJSON?key="+str+"&searchOption="+customerSearchOption;
	
		 var text = "<table class='table table-bordered'>";
		 text = text + "<tr style='font-weight: bold; background-color: rgb(234,234,234);'>";
		 text = text + "<td class='td'>Id</td>";
		 text = text + "<td class='td'>Customer Name</td>";
		 text = text + "<td class='td'>Image</td>";
		
		 text = text + "<td class='td'>Mobile</td>";
		 text = text + "<td class='td'>Address</td>";
		 text = text + "<td class='td'>Mobile Verified?</td>";
		 text = text + "<td class='td'>Outstanding Amount</td>";		
		 text = text + "<td colspan='2' class='td' align='center'>Action</td>";
		 text = text + "</tr>";
		 
		 $.getJSON(url, function(data)
		{
			 var id;
			 var cname;
			 var mobile;			
			 var address;
			 var mverified;
			 var outstanding;
			 var key;
			
			 var i = 1;
			 
			 $.each(data.custInfoList, function()
			{
				  var me = this;//save `this` reference
				 
				
				  id = me.customerId;
				  cname = me.custName;
				  mobile  = me.mobileNumber;
				  address = me.billingaddress;
				  mverified = me.mobileVerified;
				  outstanding = me.totalOutStandingAmount;
				  key = me.key;
				  
				 
				   text = text+"<tr>";
				   text = text+'<td>'+id+'</td>';
				   text = text+'<td>'+cname+'</td>';
				   text = text+'<td><a href="customerImage.action?custId='+id+'" target="_blank"><img width="95" height="120" src=customerImage.action?custId='+id+'/></a></td>';
				   text = text+'<td>'+mobile+'</td>';
				   text = text+'<td>'+address+'</td>';
				   text = text+'<td>'+mverified+'</td>';
				   text = text+'<td>'+outstanding+'</td>';
				  
				  
				 		text = text+"<td align='center'><a href='addPaymentDetailsJsp?key="+key+"'><button type='button' class='btn btn-primary'>Add Payment Details</button></td>";
				 					   
				 	
				 		text = text+"<td align='center'><a href='viewAccountDetailsJsp?key="+key+"'><button type='button' class='btn btn-danger'>View Account Details</button></td>";
				 		
				 
				   text = text+'</tr>';
				  
			 });
			 
			 
			 text = text+'</table>';
			
			document.getElementById("custData").innerHTML = text;	
			document.getElementById("billData").innerHTML = "";
			document.getElementById("productData").innerHTML = "";
			document.getElementById("employeeData").innerHTML = "";	
			document.getElementById("supplierData").innerHTML = "";	
			
         
	});
	}
}

	
	function getEmployeeData(str)
	{
		 
		 var employeerSearchOption = document.getElementById("employeeSearchOption").value;
		 
		 var strlength = str.length;
		
		 if(strlength >4 && str.includes(" "))
		{
			 
		 var url = "employeeInfoJSON?key="+str+"&searchOption="+employeerSearchOption;

		 var text = "<table class='table table-bordered'>";
		 text = text + "<tr style='font-weight: bold; background-color: rgb(234,234,234);'>";
		 text = text + "<td class='td'>Id</td>";
		 text = text + "<td class='td'>Employee Name</td>";
		 text = text + "<td class='td'>Employee Mobile</td>";	
		 text = text + "<td class='td'>Designation</td>";	
		 text = text + "<td class='td' align='center' colspan='2'>Action</td>";
		 text = text + "</tr>";
		 
		 $.getJSON(url, function(data)
		{
			 var empId;
			 var empName;
			 var empMobile;	
			 var empDesignation;
			 
			 var key;
			
			 var i = 1;
			 
			 $.each(data.employeeInfoList, function()
			{
				  var me = this;//save `this` reference
				 
				
				  empId = me.employeeId;
				  empName = me.employeeName;
				  empMobile  = me.employeeMobileNumber;
				  empDesignation = me.employeeDesignation;
				  key = me.key;
				  
				 
				   text = text+"<tr>";
				   text = text+'<td>'+empId+'</td>';
				   text = text+'<td>'+empName+'</td>';
				   text = text+'<td>'+empMobile+'</td>';
				   text = text+'<td>'+empDesignation+'</td>';
				  
				 
				  
				  
				   text = text+"<td align='center'><a href='addEmployeePaymentJsp?key="+key+"'><button type='button' class='btn btn-primary'>ADD EMPLOYEE PAYMENT</button></td>";
				   text = text+"<td align='center'><a href='viewEmployeeAccountDetailsJsp?key="+key+"'><button type='button' class='btn btn-primary'>View Account Details</button></td>";
				  		
				   text = text+'</tr>';
				  
			 });
			 
			 
			 text = text+'</table>';
			
			document.getElementById("employeeData").innerHTML = text;	
			document.getElementById("custData").innerHTML = "";	
			document.getElementById("billData").innerHTML = "";
			document.getElementById("productData").innerHTML = "";
			document.getElementById("supplierData").innerHTML = "";	
			
	});
	}
}
	
	
 function stateChange(req){   
 if (req.readyState==4 || req.readyState=="complete"){   
 document.getElementById("dataRes").innerHTML=req.responseText;  
 }   
 }   
 
 function alertdelete()
 {
	 
	var txt = confirm("Do you really want to DELETE?");
	
	return txt;
 }

 /* Inline onkeyup handlers need globals; keep $ local via IIFE. */
 window.getSupplierData = getSupplierData;
 window.getProductData = getProductData;
 window.getBillData = getBillData;
 window.getCustomerData = getCustomerData;
 window.getEmployeeData = getEmployeeData;
 window.stateChange = stateChange;
 window.alertdelete = alertdelete;
 
 
})(jQuery);
</script>

<style type="text/css">
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@500;600;700&display=swap');

.easys-dash {
  --ed-bg: #eef2f9;
  --ed-surface: #ffffff;
  --ed-ink: #04122e;
  --ed-muted: #5b6b86;
  --ed-line: #c5d4e8;
  --ed-accent: #004a9b;
  --ed-accent-2: #0e4194;
  --ed-accent-soft: #d6e6f8;
  --ed-sky: #1e6ec8;
  --ed-danger: #dc2626;
  --ed-success: #059669;
  --ed-radius: 16px;
  --ed-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --ed-font: "DM Sans", "Segoe UI", sans-serif;
  --ed-mono: "JetBrains Mono", ui-monospace, monospace;
  font-family: var(--ed-font);
  color: var(--ed-ink);
  max-width: 1680px;
  width: 100%;
  margin: 16px auto 40px;
  padding: 0 20px 32px;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  background:
    radial-gradient(1100px 420px at 8% -12%, rgba(14, 65, 148, 0.14), transparent 55%),
    radial-gradient(900px 380px at 100% 0%, rgba(111, 184, 232, 0.16), transparent 50%),
    linear-gradient(180deg, #eef2f9 0%, var(--ed-bg) 42%, #e4edf8 100%);
  border-radius: 20px;
  overflow: hidden;
}
.easys-dash *, .easys-dash *::before, .easys-dash *::after { box-sizing: border-box; }
.easys-dash .ui-widget { font-family: var(--ed-font); }

.easys-dash::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image: repeating-linear-gradient(
    90deg,
    #0f172a 0 2px,
    transparent 2px 5px,
    #0f172a 5px 7px,
    transparent 7px 12px,
    #0f172a 12px 13px,
    transparent 13px 18px
  );
  mask-image: linear-gradient(180deg, #000 0%, transparent 38%);
  z-index: 0;
}

.ed-scanline {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  top: 0;
  background: linear-gradient(90deg, transparent, rgba(30, 110, 200, 0.55), transparent);
  animation: edScan 4.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}
@keyframes edScan {
  0%   { transform: translateY(0); opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 0.7; }
  100% { transform: translateY(220px); opacity: 0; }
}

.ed-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: stretch;
  margin: 18px 0 18px;
  padding: 22px 24px;
  border-radius: var(--ed-radius);
  background: linear-gradient(135deg, #1e6ec8 0%, #0e4194 52%, #04122e 100%);
  color: #f8fafc;
  box-shadow: 0 16px 40px rgba(4, 18, 46, 0.28);
  overflow: hidden;
  animation: edFadeUp 0.55s ease both;
}
.ed-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -50px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}
.ed-hero-copy { position: relative; z-index: 1; max-width: none; }
.ed-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ed-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 12px;
}
.ed-kicker-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #5eead4;
  box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.7);
  animation: edPulse 1.8s ease-out infinite;
}
@keyframes edPulse {
  0%   { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.65); }
  70%  { box-shadow: 0 0 0 10px rgba(94, 234, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); }
}
.ed-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 2.1vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #f8fafc;
  white-space: nowrap;
}
.ed-hero p {
  margin: 0 0 18px;
  font-size: 0.98rem;
  line-height: 1.45;
  color: rgba(248, 250, 252, 0.88);
  max-width: 42ch;
}
.ed-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.ed-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 12px;
  background: #f8fafc;
  color: #004a9b !important;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none !important;
  border: none;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.ed-cta:hover, .ed-cta:focus {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.22);
  color: #04122e !important;
  text-decoration: none !important;
}
.ed-cta button {
  all: unset;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.ed-cta-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.28);
  color: #f8fafc !important;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none !important;
  transition: background 0.18s ease;
}
.ed-cta-ghost:hover {
  background: rgba(255,255,255,0.2);
  color: #fff !important;
  text-decoration: none !important;
}
.ed-cta-ghost button { all: unset; cursor: pointer; font: inherit; color: inherit; }
.ed-shortcut {
  font-family: var(--ed-mono);
  font-size: 0.72rem;
  opacity: 0.85;
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 1px 5px;
}

.ed-barcode-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(6px);
  min-height: 150px;
}
.ed-barcode-stripes {
  display: flex;
  align-items: flex-end;
  height: 72px;
  gap: 0;
  padding: 0 8px;
  animation: edBarcodeIn 0.7s ease 0.15s both;
}
.ed-barcode-stripes span {
  display: block;
  background: #f8fafc;
  height: 100%;
  border-radius: 1px;
}
.ed-barcode-stripes span:nth-child(odd) { width: 3px; }
.ed-barcode-stripes span:nth-child(even) { width: 2px; opacity: 0.35; }
.ed-barcode-stripes span:nth-child(3n) { width: 5px; opacity: 1; }
.ed-barcode-stripes span:nth-child(5n) { width: 2px; height: 88%; }
.ed-barcode-stripes span:nth-child(7n) { width: 4px; height: 100%; }
.ed-barcode-code {
  font-family: var(--ed-mono);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: rgba(248,250,252,0.92);
  font-weight: 600;
}
@keyframes edBarcodeIn {
  from { opacity: 0; transform: scaleX(0.6); }
  to   { opacity: 1; transform: scaleX(1); }
}
@keyframes edFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ed-msg {
  position: relative;
  z-index: 1;
  margin-bottom: 16px;
  animation: edFadeUp 0.45s ease 0.05s both;
}
.easys-dash .alert {
  border-radius: 12px;
  border: none;
  margin: 0;
  padding: 14px 18px;
  font-weight: 500;
  box-shadow: var(--ed-shadow);
}
.easys-dash .alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border-left: 4px solid var(--ed-danger);
}
.easys-dash .alert-success {
  background: #e8f1fb;
  color: #065f46;
  border-left: 4px solid var(--ed-success);
}
.ed-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--ed-surface);
  border: 1px solid var(--ed-line);
  box-shadow: var(--ed-shadow);
}
.ed-welcome-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ed-ink);
  margin: 0;
}
.ed-welcome-text span {
  color: var(--ed-accent);
}
.ed-role-pill {
  font-family: var(--ed-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--ed-accent-soft);
  color: var(--ed-accent);
  border: 1px solid #bfe6ff;
}

.ed-section {
  position: relative;
  z-index: 1;
  margin-bottom: 18px;
  animation: edFadeUp 0.5s ease both;
}
.ed-section:nth-of-type(3) { animation-delay: 0.08s; }
.ed-section:nth-of-type(4) { animation-delay: 0.14s; }
.ed-section-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}
.ed-section-hd h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ed-ink);
  text-align: left;
  text-transform: none;
  border: none;
}
.ed-section-hd p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ed-muted);
}

.ed-actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.ed-action {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--ed-surface);
  border: 1px solid var(--ed-line);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
  text-decoration: none !important;
  color: var(--ed-ink) !important;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  min-height: 0;
}
.ed-action:hover {
  transform: translateY(-2px);
  border-color: #bfe6ff;
  box-shadow: 0 8px 16px rgba(4, 18, 46, 0.10);
  text-decoration: none !important;
  color: var(--ed-ink) !important;
}
.ed-action button {
  all: unset;
  cursor: pointer;
  font: inherit;
  color: inherit;
  width: 100%;
  min-width: 0;
}
.ed-action-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--ed-accent-soft);
  color: var(--ed-accent);
  font-family: var(--ed-mono);
  font-weight: 700;
  font-size: 0.68rem;
}
.ed-action-label {
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.2;
}
.ed-action-hint {
  display: none;
}
.ed-action--primary {
  background: linear-gradient(160deg, #1e6ec8 0%, #004a9b 100%);
  border-color: transparent;
  color: #f8fafc !important;
  box-shadow: 0 12px 28px rgba(4, 18, 46, 0.25);
  grid-column: span 1;
}
.ed-action--primary:hover {
  color: #fff !important;
  border-color: transparent;
  box-shadow: 0 16px 34px rgba(4, 18, 46, 0.32);
}
.ed-action--primary .ed-action-icon {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
.ed-action--primary .ed-action-hint { color: rgba(248,250,252,0.75); }

.ed-search {
  background: var(--ed-surface);
  border: 1px solid var(--ed-line);
  border-radius: var(--ed-radius);
  box-shadow: var(--ed-shadow);
  padding: 18px 18px 8px;
}
.ed-search-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.ed-search-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px 12px;
}
.ed-search-field label {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
   color: #000000;
  font-family: var(--ed-mono);
}
.ed-search-field .ed-field-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.easys-dash .textBoxSmall,
.easys-dash .selectSmall,
.easys-dash input[type="text"],
.easys-dash select {
  width: 100% !important;
  max-width: 100% !important;
  height: 42px !important;
  min-height: 42px !important;
  border: 1px solid var(--ed-line) !important;
  border-radius: 10px !important;
  background: #f8fafc !important;
  padding: 8px 12px !important;
  font-family: var(--ed-font) !important;
  font-size: 0.92rem !important;
  color: var(--ed-ink) !important;
  box-shadow: none !important;
  outline: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.easys-dash .textBoxSmall:focus,
.easys-dash .selectSmall:focus,
.easys-dash input[type="text"]:focus,
.easys-dash select:focus {
  border-color: var(--ed-accent-2) !important;
  box-shadow: 0 0 0 3px rgba(14, 65, 148, 0.18) !important;
  background: #fff !important;
}
.ed-search-employee {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--ed-line);
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  align-items: end;
  padding-bottom: 10px;
}

.ed-results {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.ed-results .ui-widget:empty { display: none; }
.easys-dash .table {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  background: var(--ed-surface);
  border: 1px solid var(--ed-line) !important;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--ed-shadow);
}
.easys-dash .table > tbody > tr > td,
.easys-dash .table > thead > tr > th,
.easys-dash .table th,
.easys-dash .table td {
  border-color: var(--ed-line) !important;
  vertical-align: middle !important;
  padding: 10px 12px !important;
  font-size: 0.88rem;
}
.easys-dash .table tr[style*="234,234,234"],
.easys-dash .table tr[style*="font-weight: bold"] {
  background: #f1f5f9 !important;
}
.easys-dash .btn-primary {
  background: var(--ed-accent) !important;
  border-color: var(--ed-accent) !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  padding: 6px 12px !important;
}
.easys-dash .btn-primary:hover {
  background: #0e4194 !important;
  border-color: #0e4194 !important;
}
.easys-dash .btn-danger {
  border-radius: 8px !important;
  font-weight: 600 !important;
}

.ed-notes {
  position: relative;
  z-index: 1;
  background: var(--ed-surface);
  border: 1px solid var(--ed-line);
  border-radius: var(--ed-radius);
  box-shadow: var(--ed-shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.ed-notes-hd {
  padding: 12px 16px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--ed-line);
  font-weight: 700;
  font-size: 0.9rem;
}
.ed-notes-bd {
  min-height: 48px;
  padding: 14px 16px;
  color: var(--ed-muted);
  font-size: 0.9rem;
}

.ed-report {
  position: relative;
  z-index: 1;
  background: var(--ed-surface);
  border: 1px solid var(--ed-line);
  border-radius: var(--ed-radius);
  box-shadow: var(--ed-shadow);
  overflow: hidden;
  margin-bottom: 8px;
}
.ed-report-hd {
  padding: 12px 16px;
  background: linear-gradient(90deg, #e8f1fb, #f0f9ff);
  border-bottom: 1px solid var(--ed-line);
  font-weight: 700;
}
.ed-report .table {
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
}

.ed-notify {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #14532d;
  color: #ffffff !important;
  border: 1px solid #14532d;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none !important;
}

.ed-notify:hover {
  background: #14532d;
  color: #ffffff !important;
  text-decoration: none !important;
}

.ed-notify .material-icons {
  font-size: 14px !important;
  color: #ffffff !important;
}



@media (max-width: 980px) {
  .ed-hero { grid-template-columns: 1fr; }
  .ed-barcode-panel { min-height: 120px; }
  .ed-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ed-search-grid { grid-template-columns: 1fr; }
  .ed-search-employee { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .easys-dash { padding: 0 12px 24px; margin-top: 12px; }
  .ed-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-hero { padding: 18px 16px; }
  .ed-hero h1 { white-space: normal; }
}
</style>

<s:if test='#session.shopValidityAlert == "YES"'>
    <style type="text/css">
      .validity-modal {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.65);
        z-index: 200000;
        padding: 16px;
      }
      .validity-modal-content {
        background: #ffffff;
        border-radius: 16px;
        max-width: 360px;
        width: 100%;
        text-align: center;
        box-shadow: 0 20px 48px rgba(15, 23, 42, 0.3);
        overflow: hidden;
        border: 1px solid #f1f5f9;
      }
      .validity-modal-top {
        background: linear-gradient(145deg, #fff7ed 0%, #ffedd5 100%);
        padding: 20px 20px 16px;
      }
      .validity-modal-top h3 {
        margin: 0 0 4px;
        font-size: 18px;
        font-weight: 600;
        color: #9a3412;
      }
      .validity-modal-top p {
        margin: 0;
        font-size: 12px;
        color: #c2410c;
        font-weight: 500;
      }
      .validity-modal-body { padding: 16px 20px 20px; }
      .validity-days-badge {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        min-width: 88px;
        padding: 10px 16px;
        margin-bottom: 12px;
        border-radius: 12px;
        background: linear-gradient(180deg, #fffbeb, #fef3c7);
        border: 1px solid #fde68a;
      }
      .validity-days-badge .days-num {
        font-size: 28px;
        font-weight: 700;
        line-height: 1;
        color: #c2410c;
      }
      .validity-days-badge .days-label {
        margin-top: 4px;
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.6px;
        color: #b45309;
      }
      .validity-modal-body p {
        margin: 0 0 8px;
        font-size: 13px;
        line-height: 1.45;
        color: #475569;
      }
      .validity-date-row {
        display: inline-flex;
        margin: 4px 0 14px;
        padding: 7px 12px;
        border-radius: 8px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        font-size: 12px;
        font-weight: 600;
        color: #334155;
      }
      .validity-modal-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 120px;
        padding: 10px 20px;
        border: none;
        border-radius: 10px;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        color: #ffffff;
        background: linear-gradient(135deg, #f59e0b, #ea580c);
      }
    </style>
    <div id="validityExpiryModal" class="validity-modal" role="dialog" aria-modal="true"
      aria-labelledby="validityExpiryTitle">
      <div class="validity-modal-content">
        <div class="validity-modal-top">
          <h3 id="validityExpiryTitle">Validity Expiring Soon</h3>
          <p>Please renew to avoid interruption</p>
        </div>
        <div class="validity-modal-body">
          <div class="validity-days-badge">
            <s:if test='#session.shopValidityDaysRemaining == "0"'>
              <span class="days-num" style="font-size: 20px;">Today</span>
              <span class="days-label">Expires</span>
            </s:if>
            <s:else>
              <span class="days-num"><s:property value="#session.shopValidityDaysRemaining" /></span>
              <span class="days-label">
                <s:if test='#session.shopValidityDaysRemaining == "1"'>Day Left</s:if>
                <s:else>Days Left</s:else>
              </span>
            </s:else>
          </div>
          <p>
            <s:if test='#session.shopValidityDaysRemaining == "0"'>
              Your account validity expires <strong>today</strong>.
            </s:if>
            <s:elseif test='#session.shopValidityDaysRemaining == "1"'>
              Your account validity will expire in <strong>1 day</strong>.
            </s:elseif>
            <s:else>
              Your account validity will expire in
              <strong><s:property value="#session.shopValidityDaysRemaining" /> days</strong>.
            </s:else>
          </p>
          <div class="validity-date-row">
            Valid till: <s:property value="#session.shopValidityEndDate" />
          </div>
          <p style="font-size: 12px; color: #94a3b8; margin-bottom: 14px;">
            Please contact the administrator to renew.
          </p>
          <button type="button" class="validity-modal-btn" onclick="closeValidityExpiryModal()">Got It</button>
        </div>
      </div>
    </div>
    <%
      session.removeAttribute("shopValidityAlert");
      session.removeAttribute("shopValidityDaysRemaining");
      session.removeAttribute("shopValidityEndDate");
    %>
    <script type="text/javascript">
      function closeValidityExpiryModal() {
        var modal = document.getElementById('validityExpiryModal');
        if (!modal) {
          return;
        }
        modal.style.opacity = '0';
        modal.style.transition = 'opacity 0.2s ease';
        setTimeout(function() {
          if (modal.parentNode) {
            modal.parentNode.removeChild(modal);
          }
        }, 200);
      }
      document.addEventListener('keydown', function(e) {
        if (e.key === 'Escape') {
          closeValidityExpiryModal();
        }
      });
    </script>
</s:if>
<div class="easys-dash">
  <div class="ed-scanline" aria-hidden="true"></div>

  <section class="ed-hero">
    <div class="ed-hero-copy">
      <div class="ed-kicker"><span class="ed-kicker-dot" aria-hidden="true"></span> Billing · Stock · Reports</div>
      <h1>Your billing workspace, ready to go</h1>
      <p>Create bills, manage stock, customers, and payments.</p>
      <div class="ed-hero-actions">
        <a class="ed-cta" href="addBillJsp" title="Add New Bill">
          <button type="button">Add New Bill</button>
        </a>
      </div>
    </div>
  </section>

  <s:div id="successMessage" name="successMessage" cssClass="ed-msg">
    <s:if test="hasActionErrors()">
      <div class="alert alert-danger">
        <strong>Error!</strong>
        <s:iterator var="error" value="%{errorMessages}">
          <s:property value="%{error}"/>
        </s:iterator>
      </div>
    </s:if>
    <s:elseif test="hasActionMessages()">
      <div class="alert alert-success">
        <strong>Success!</strong>
        <s:iterator var="message" value="%{actionMessages}">
          <s:property value="%{message}"/>
        </s:iterator>
      </div>
    </s:elseif>
    <s:else>
      <div class="ed-welcome">
        <p class="ed-welcome-text">
          <s:property value="getText('welcome.message')" />,
          <span><s:property value="#session.userFullName"/></span>
        </p>
        <s:if test="#session.role != null">
          <span class="ed-role-pill"><s:property value="#session.role"/></span>
        </s:if>
      </div>
    </s:else>
  </s:div>




  <s:if test="#session.role=='SALES'">
  <section class="ed-section">
    <div class="ed-section-hd">
      <h2>Quick actions</h2>
      <p>Everyday billing shortcuts</p>
    </div>
    <div class="ed-actions">
      <a class="ed-action" href="addNewProductJsp" accesskey="p">
        <span class="ed-action-icon">P</span>
        <button type="button"><span class="ed-action-label">Add <u>P</u>roduct</span></button>
        <span class="ed-action-hint">Alt + P</span>
      </a>
      <a class="ed-action" href="addNewCustomerJsp" accesskey="c">
        <span class="ed-action-icon">C</span>
        <button type="button"><span class="ed-action-label">Add <u>C</u>ustomer</span></button>
        <span class="ed-action-hint">Alt + C</span>
      </a>
      <a class="ed-action ed-action--primary" href="addBillJsp">
        <span class="ed-action-icon">BL</span>
        <button type="button"><span class="ed-action-label">Add New Bill</span></button>
        <span class="ed-action-hint">Standard bill</span>
      </a>
      <a class="ed-action" href="searchCustomerJsp" accesskey="m">
        <span class="ed-action-icon">$</span>
        <button type="button"><span class="ed-action-label">Customer Pay<u>m</u>ent</span></button>
        <span class="ed-action-hint">Alt + M</span>
      </a>
    </div>
  </section>
  </s:if>

  <s:if test="#session.role=='ADMIN'">
  <section class="ed-section">
    <div class="ed-section-hd">
      <h2>Quick actions</h2>
      <p>Stock, sales, and purchase</p>
    </div>
    <div class="ed-actions">
      <a class="ed-action" href="addNewProductJsp" accesskey="p">
        <span class="ed-action-icon">P</span>
        <button type="button"><span class="ed-action-label">Add <u>P</u>roduct</span></button>
        <span class="ed-action-hint">Alt + P</span>
      </a>
      <a class="ed-action" href="addNewCustomerJsp" accesskey="c">
        <span class="ed-action-icon">C</span>
        <button type="button"><span class="ed-action-label">Add <u>C</u>ustomer</span></button>
        <span class="ed-action-hint">Alt + C</span>
      </a>
      <a class="ed-action" href="addSupplierJsp" accesskey="g">
        <span class="ed-action-icon">G</span>
        <button type="button"><span class="ed-action-label">Add <u>G</u>oods Supplier</span></button>
        <span class="ed-action-hint">Alt + G</span>
      </a>
      <a class="ed-action ed-action--primary" href="addBillJsp">
        <span class="ed-action-icon">BL</span>
        <button type="button"><span class="ed-action-label">Add New Bill</span></button>
        <span class="ed-action-hint">Standard bill</span>
      </a>
      <a class="ed-action" href="addNewPurchaseJsp" accesskey="u">
        <span class="ed-action-icon">PU</span>
        <button type="button"><span class="ed-action-label">Add P<u>u</u>rchase</span></button>
        <span class="ed-action-hint">Alt + U</span>
      </a>
      <a class="ed-action" href="addDailyExpenseJsp" accesskey="e">
        <span class="ed-action-icon">EX</span>
        <button type="button"><span class="ed-action-label">Daily <u>E</u>xpense</span></button>
        <span class="ed-action-hint">Alt + E</span>
      </a>
      <a class="ed-action" href="searchCustomerJsp" accesskey="m">
        <span class="ed-action-icon">$</span>
        <button type="button"><span class="ed-action-label">Customer Pay<u>m</u>ent</span></button>
        <span class="ed-action-hint">Alt + M</span>
      </a>
      <a class="ed-action" href="searchSupplierJsp">
        <span class="ed-action-icon">SP</span>
        <button type="button"><span class="ed-action-label">Search Supplier</span></button>
        <span class="ed-action-hint">Find supplier</span>
      </a>
      <a class="ed-action" href="calculatorJsp" accesskey="o">
        <span class="ed-action-icon">=</span>
        <button type="button"><span class="ed-action-label"><u>O</u>pen Calculator</span></button>
        <span class="ed-action-hint">Alt + O</span>
      </a>
      <a class="ed-action" href="searchSaleBillJsp" accesskey="s">
        <span class="ed-action-icon">SB</span>
        <button type="button"><span class="ed-action-label"><u>S</u>earch Sale Bill</span></button>
        <span class="ed-action-hint">Alt + S</span>
      </a>
      <a class="ed-action" href="searchChallanJsp" accesskey="h">
        <span class="ed-action-icon">CH</span>
        <button type="button"><span class="ed-action-label">Search C<u>h</u>allan</span></button>
        <span class="ed-action-hint">Alt + H</span>
      </a>
    </div>
  </section>
  </s:if>

  <section class="ed-section">
    <div class="ed-section-hd">
      <h2>Quick search</h2>
      <p>Type at least 5 characters with a space to search</p>
    </div>
    <div class="ed-search">
      <div class="ed-search-grid">
        <div class="ed-search-field">
          <label for="searchValue">Search product</label>
          <s:textfield id="searchValue" name="searchValue" onkeyup="getProductData(this.value)" theme="simple" cssClass="textBoxSmall" placeholder="Product name or code"/>
        </div>
        <div class="ed-search-field">
          <label for="supplierSearchOption">Search supplier</label>
          <div class="ed-field-row">
            <s:select theme="simple" list="customerSearchOptionList" name="supplierSearchOption" id="supplierSearchOption" headerKey="" headerValue="SELECT OPTION" cssClass="selectSmall"/>
            <s:textfield id="searchValueSupplier" name="searchValue" onkeyup="getSupplierData(this.value)" theme="simple" cssClass="textBoxSmall" placeholder="Supplier name or mobile"/>
          </div>
        </div>
        <div class="ed-search-field">
          <label for="customerSearchOption">Search customer</label>
          <div class="ed-field-row">
            <s:select theme="simple" list="customerSearchOptionList" name="customerSearchOption" id="customerSearchOption" headerKey="" headerValue="SELECT OPTION" cssClass="selectSmall"/>
            <s:textfield id="searchValueCustomer" name="searchValue" onkeyup="getCustomerData(this.value)" theme="simple" cssClass="textBoxSmall" placeholder="Customer name or mobile"/>
          </div>
        </div>
      </div>
      <div class="ed-search-employee">
        <div class="ed-search-field" style="padding-bottom:0;">
          <label for="employeeSearchOption">Search option</label>
          <s:select theme="simple" list="customerSearchOptionList" name="employeeSearchOption" id="employeeSearchOption" headerKey="" headerValue="SELECT OPTION" cssClass="selectSmall"/>
        </div>
        <div class="ed-search-field" style="padding-bottom:0;">
          <label for="searchValueEmployee">Search employee</label>
          <s:textfield id="searchValueEmployee" name="searchValue" onkeyup="getEmployeeData(this.value)" theme="simple" cssClass="textBoxSmall" placeholder="Employee name or mobile"/>
        </div>
      </div>
    </div>
  </section>

  <div class="ed-results">
    <div class="ui-widget" id="productData"></div>
    <div class="ui-widget" id="billData"></div>
    <div class="ui-widget" id="custData"></div>
    <div class="ui-widget" id="supplierData"></div>
    <div class="ui-widget" id="employeeData"></div>
  </div>

  <div class="ed-notes">
    <div class="ed-notes-hd">New changes</div>
    <div class="ed-notes-bd"></div>
  </div>

  <s:if test="messageSendReportList.size()>0">
  <div class="ed-report">
    <div class="ed-report-hd">Outstanding Amount Message Sent Report</div>
    <table class="table table-bordered">
      <tr>
        <th>Name</th>
        <th>Address</th>
        <th>Mobile</th>
        <th>Amount</th>
        <th>Message Status</th>
      </tr>
      <s:iterator value="messageSendReportList">
      <tr>
        <td><s:property value="custName"/></td>
        <td><s:property value="custAddress"/></td>
        <td><s:property value="custMobile"/></td>
        <td><s:property value="outStandingAmount"/></td>
        <td><s:property value="messageSendYesNo"/></td>
      </tr>
      </s:iterator>
    </table>
  </div>
  </s:if>
</div>

<script type="text/javascript">
/* EASYS_NOCONFLICT_WRAP */
jQuery.noConflict();
(function ($) {

$(function() {
	$('#successMessage').delay(50000).fadeOut('slow');
});

/* Barcode product autocomplete list: embedded in addBarcodeBill.jsp from session (login data) — no separate preload. */


})(jQuery);
</script>


