diff --git a/Claim.sol b/Claim.sol new file mode 100644 index 0000000..a999a46 --- /dev/null +++ b/Claim.sol @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +contract InsurancePolicy { + struct Policy { + uint policyId; + address policyHolder; + uint coverageAmount; + uint premium; + bool isActive; + } + + struct Claim { + uint claimId; + uint policyId; + uint claimAmount; + bool isApproved; + } + + mapping(uint => Policy) public policies; + mapping(uint => Claim) public claims; + + uint public policyCounter; + uint public claimCounter; + + // Function to create a new insurance policy + function createPolicy(address _policyHolder, uint _coverageAmount, uint _premium) public returns (uint) { + policyCounter++; + policies[policyCounter] = Policy(policyCounter, _policyHolder, _coverageAmount, _premium, true); + return policyCounter; // Return the policyId to the user + } + + // Function to view a policy by ID + function viewPolicy(uint _policyId) public view returns (uint, address, uint, uint, bool) { + Policy memory policy = policies[_policyId]; + return (policy.policyId, policy.policyHolder, policy.coverageAmount, policy.premium, policy.isActive); + } + + // Function to submit a claim linked to a policy + function submitClaim(uint _policyId, uint _claimAmount) public returns (uint) { + claimCounter++; + claims[claimCounter] = Claim(claimCounter, _policyId, _claimAmount, false); + return claimCounter; // Return the claimId to the user + } + + // Function to approve a claim + function approveClaim(uint _claimId) public { + claims[_claimId].isApproved = true; + } +} diff --git a/InsurancePolicy.sol b/InsurancePolicy.sol new file mode 100644 index 0000000..098bc39 --- /dev/null +++ b/InsurancePolicy.sol @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +contract InsurancePolicy { + struct Policy { + uint policyId; + address policyHolder; + uint coverageAmount; + uint premium; + bool isActive; + } + + mapping(uint => Policy) public policies; + uint public policyCounter; + + // Event to log policy creation + event PolicyCreated(uint policyId, address policyHolder, uint coverageAmount, uint premium); + + // Event to log the result of viewing a policy + event PolicyViewed(uint policyId, address policyHolder, uint coverageAmount, uint premium, bool isActive); + + // Function to create a new policy + function createPolicy(address _policyHolder, uint _coverageAmount, uint _premium) public returns (uint) { + policyCounter++; + policies[policyCounter] = Policy(policyCounter, _policyHolder, _coverageAmount, _premium, true); + + // Emit event after creating the policy + emit PolicyCreated(policyCounter, _policyHolder, _coverageAmount, _premium); + + return policyCounter; + } + + // Function to view a policy (no longer view-only since it emits events) + function viewPolicy(uint _policyId) public returns (Policy memory) { + // Ensure the policy exists + require(_policyId > 0 && _policyId <= policyCounter, "Policy does not exist"); + + // Emit event for viewing the policy (for debugging) + emit PolicyViewed( + _policyId, + policies[_policyId].policyHolder, + policies[_policyId].coverageAmount, + policies[_policyId].premium, + policies[_policyId].isActive + ); + + return policies[_policyId]; + } +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..02d2297 --- /dev/null +++ b/index.html @@ -0,0 +1,59 @@ + + + + + + Insurance Claim Portal + + + + +
+ + +

Insurance Fraud Prevention System

+
+ + +
+

Login

+
+ + + + + +
+
+ + +
+

Submit Your Claim

+
+ + + + + + + + + +
+
+
+ + +
+

Your Claim History

+
+
+ + + + + + + diff --git a/logo.webp b/logo.webp new file mode 100644 index 0000000..c9cc8f2 Binary files /dev/null and b/logo.webp differ diff --git a/script.js b/script.js new file mode 100644 index 0000000..759cf31 --- /dev/null +++ b/script.js @@ -0,0 +1,73 @@ +// Handle login functionality +document.getElementById("loginForm").addEventListener("submit", function(event) { + event.preventDefault(); + let username = document.getElementById("username").value; + let password = document.getElementById("password").value; + + if (username && password) { + alert(`Logged in as ${username}`); + // Redirect to claim submission or dashboard + window.location.href = "#submitClaim"; + } else { + alert("Please enter a valid username and password."); + } +}); + +// Handle claim submission with file upload progress +document.getElementById("claimForm").addEventListener("submit", function(event) { + event.preventDefault(); + + let claimantName = document.getElementById("claimantName").value; + let claimAmount = document.getElementById("claimAmount").value; + let claimDescription = document.getElementById("claimDescription").value; + let documentUpload = document.getElementById("documentUpload").files[0]; + + if (claimantName && claimAmount && claimDescription && documentUpload) { + // Simulate upload progress + let progressBar = document.getElementById("uploadProgress"); + let progress = 0; + let progressInterval = setInterval(function() { + progress += 10; + progressBar.innerHTML = `
`; + if (progress === 100) { + clearInterval(progressInterval); + alert("Claim submitted successfully!"); + // Reset the form + document.getElementById("claimForm").reset(); + } + }, 500); + } else { + alert("Please fill in all fields and upload a document."); + } +}); + +// Display claim history (simulate with static data) +let claimHistory = [ + { claimId: "12345", claimantName: "John Doe", claimAmount: "$5000", status: "Approved" }, + { claimId: "67890", claimantName: "Jane Smith", claimAmount: "$2000", status: "Pending" }, + { claimId: "11223", claimantName: "George Brown", claimAmount: "$1500", status: "Rejected" } +]; + +// Function to display claim history +function displayClaimHistory() { + let claimHistoryDiv = document.getElementById("claimList"); + claimHistoryDiv.innerHTML = ""; // Clear the previous history + + claimHistory.forEach(claim => { + let claimDiv = document.createElement("div"); + claimDiv.classList.add("claim-item"); + + claimDiv.innerHTML = ` +

Claim ID: ${claim.claimId}

+

Claimant Name: ${claim.claimantName}

+

Claim Amount: ${claim.claimAmount}

+

Status: ${claim.status}

+
+ `; + + claimHistoryDiv.appendChild(claimDiv); + }); +} + +// Call the function to display claim history on page load +displayClaimHistory(); diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..74e88de --- /dev/null +++ b/styles.css @@ -0,0 +1,191 @@ +/* General body styling */ +body { + font-family: 'Roboto', sans-serif; + color: #333; /* Dark text for better readability */ + background-color: #f4f4f4; /* Light gray background */ + margin: 0; + padding: 0; +} + +/* Header Section */ +header { + background-color: #2d3436; /* Dark gray header */ + color: white; /* White text */ + padding: 20px; + text-align: center; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); /* Subtle shadow effect */ + position: sticky; + top: 0; + z-index: 1000; + transition: background-color 0.3s ease; +} + +/* Header text style */ +header h1 { + margin: 0; + font-size: 2.5em; +} + +/* Hover effect for the header */ +header:hover { + background-color: #1e272e; +} + +/* Main Content Section */ +section { + margin: 30px auto; + max-width: 900px; + padding: 20px; + background-color: white; + border-radius: 8px; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); + transition: transform 0.3s ease; +} + +section:hover { + transform: scale(1.02); +} + +/* Form Elements */ +input, textarea { + width: 100%; + padding: 12px; + margin: 10px 0; + font-size: 16px; + border: 1px solid #ddd; + border-radius: 6px; + box-sizing: border-box; + transition: border-color 0.3s ease, box-shadow 0.3s ease; +} + +/* Focused input/textarea */ +input:focus, textarea:focus { + border-color: #3498db; + box-shadow: 0 0 5px rgba(52, 152, 219, 0.5); +} + +/* Submit button */ +button { + background-color: #3498db; /* Blue background */ + color: white; + padding: 12px 24px; + border: none; + border-radius: 6px; + cursor: pointer; + font-size: 16px; + width: 100%; + transition: background-color 0.3s ease, transform 0.3s ease; +} + +/* Hover effect for button */ +button:hover { + background-color: #2980b9; + transform: translateY(-2px); +} + +/* Header Section Animation */ +@keyframes fadeInHeader { + from { + opacity: 0; + transform: translateY(-30px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +header { + animation: fadeInHeader 1s ease-out; +} + +/* Claim History Section */ +#claimList { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 20px; + margin-top: 20px; +} + +.claim-item { + background-color: #ffffff; + padding: 20px; + border-radius: 8px; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); + transition: transform 0.3s ease, box-shadow 0.3s ease; +} + +.claim-item:hover { + transform: translateY(-5px); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); +} + +.claim-item h3 { + font-size: 1.2em; + color: #333; + margin: 0; +} + +.claim-item p { + font-size: 1em; + color: #555; +} + +.claim-item hr { + border-top: 1px solid #eee; +} + +/* Footer Section */ +footer { + background-color: #2d3436; + color: white; + padding: 15px; + text-align: center; + font-size: 0.9em; + position: relative; + bottom: 0; + width: 100%; + box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1); + transition: background-color 0.3s ease; +} + +/* Footer Hover Effect */ +footer:hover { + background-color: #1e272e; +} + +/* Media Queries for Responsive Design */ +@media (max-width: 768px) { + /* Adjust layout for smaller screens */ + section { + padding: 15px; + margin: 20px; + } + + #claimList { + grid-template-columns: 1fr; /* Single column for small screens */ + } + + button { + font-size: 14px; + } + + footer { + font-size: 0.8em; + } +} +/* Logo styling */ +header img.logo { + height: 50px; /* Adjust the height based on your logo's size */ + width: auto; /* Keep the aspect ratio intact */ + margin-right: 20px; /* Space between the logo and title */ + vertical-align: middle; /* Align logo with the text */ +} + +header h1 { + display: inline-block; + font-size: 2em; + color: white; + margin: 0; + vertical-align: middle; +}