8000 GitHub - frontlook-admin/PTaxApi-JS: Professional Tax Calculator - JavaScript Frontend. A comprehensive web application for calculating Professional Tax across all Indian states with accurate slabs, date-based validation, and multiple collection modes.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Professional Tax Calculator - JavaScript Frontend. A comprehensive web application for calculating Professional Tax across all Indian states with accurate slabs, date-based validation, and multiple collection modes.

License

Notifications You must be signed in to change notification settings

frontlook-admin/PTaxApi-JS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PTax Calculator - JavaScript Version

A client-side JavaScript implementation of the Professional Tax Calculator for Indian states. This version can be deployed to GitHub Pages and runs entirely in the browser without requiring a backend server.

🌟 Features

  • πŸ“± Client-Side Calculation: Runs entirely in the browser
  • πŸš€ GitHub Pages Ready: Deploy to GitHub Pages with zero configuration
  • 🌍 39 States & UTs: Complete coverage of Indian states and union territories
  • πŸ’° 100+ Tax Slabs: Comprehensive PTax rules and calculations
  • πŸ‘₯ Gender-Specific Rules: Different tax slabs for male/female employees
  • πŸ“… Multiple Collection Modes: Monthly, Quarterly, Half-Yearly, and Yearly
  • πŸ“± Responsive Design: Mobile-friendly interface
  • ⚑ Fast Performance: Instant calculations with local data

🎯 Live Demo

Visit the live calculator: https://frontlook-admin.github.io/PTaxApi-JS/

πŸš€ Quick Start

Option 1: Use the Live Version

Simply visit the live demo link above - no installation required!

Option 2: Run Locally

  1. Clone the repository

    git clone https://github.com/frontlook-admin/PTaxApi-JS.git
    cd PTaxApi-JS
  2. Install dependencies (optional, for development)

    npm install
  3. Start local server

    # Using npm (if you installed dependencies)
    npm start
    
    # Or using Python (if you have Python installed)
    python -m http.server 3000
    
    # Or simply open index.html in your browser
  4. Open in browser

    http://localhost:3000
    

πŸ“ Project Structure

PTaxApi-JS/
β”œβ”€β”€ index.html              # Main HTML file
β”œβ”€β”€ css/
β”‚   └── style.css           # Custom styles
β”œβ”€β”€ js/
β”‚   β”œβ”€β”€ ptax-calculator.js  # Core calculation engine
β”‚   └── app.js              # UI application logic
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ states.json         # Indian states data
β”‚   └── ptax-slabs.json     # PTax rules and slabs
β”œβ”€β”€ package.json            # Project configuration
└── README.md              # This file

πŸ’» Usage Examples

Basic PTax Calculation

// Initialize calculator
const calculator = new PTaxCalculator();
await calculator.init();

// Calculate PTax for Assam, β‚Ή25,000 salary, Male
const result = calculator.calculatePTax(18, 25000, 'Male');
console.log(result);
// Output: { monthlyPTax: 180, yearlyPTax: 2160, ... }

Get All States

const states = calculator.getStates();
console.log(states.length); // 39 states and UTs

Get PTax Slabs for a State

const slabs = calculator.getPTaxSlabsByStateId(18); // Assam
console.log(slabs);

πŸ”§ API Reference

PTaxCalculator Class

Methods

Method Description Parameters Returns
init() Initialize calculator with data None Promise
calculatePTax(stateId, salary, gender) Calculate PTax stateId, salary, gender Object
getStates() Get all states None Array
getPTaxSlabsByStateId(stateId) Get tax slabs for state stateId Array
getStatesWithPTax() Get states with PTax None Array

Calculate PTax Response

{
  stateName: "Assam",
  stateCode: "AS",
  salary: 25000,
  gender: "Male",
  monthlyPTax: 180,
  yearlyPTax: 2160,
  collectionMode: "MONTHLY",
  applicableSlab: { ... },
  breakdown: { ... }
}

πŸš€ Deployment to GitHub Pages

  1. Fork this repository or create your own

  2. Enable GitHub Pages

    • Go to repository Settings
    • Scroll to Pages section
    • Source: Deploy from branch
    • Branch: main (or master)
    • Folder: / (root)
  3. Your calculator will be live at:

    https://yourusername.github.io/PTaxApi-JS/
    

πŸ”„ Updating Data

The PTax data is stored in JSON files in the data/ directory:

  • states.json - Indian states and union territories
  • ptax-slabs.json - PTax rules and tax slabs

To update the data:

  1. Edit the JSON files
  2. Commit and push changes
  3. GitHub Pages will automatically update

🎨 Customization

Styling

Edit css/style.css to customize the appearance:

:root {
    --primary-color: #0066cc;
    --secondary-color: #ffc107;
    /* ... other custom properties */
}

Functionality

Extend the calculator by modifying:

  • js/ptax-calculator.js - Core calculation logic
  • js/app.js - UI interactions and display

πŸ“± Browser Support

  • βœ… Chrome 80+
  • βœ… Firefox 75+
  • βœ… Safari 13+
  • βœ… Edge 80+
  • βœ… Mobile browsers

πŸ” SEO Features

  • Semantic HTML structure
  • Open Graph meta tags
  • Descriptive page titles
  • Mobile-responsive design
  • Fast loading times

πŸ› Troubleshooting

Calculator Not Loading

  • Check browser console for errors
  • Ensure you're serving the files via HTTP (not file://)
  • Verify JSON files are accessible

Incorrect Calculations

  • Check the data in ptax-slabs.json
  • Verify state ID mapping in states.json
  • Review calculation logic in ptax-calculator.js

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ”— Related Projects

πŸ“ž Support

⭐ Show Your Support

If this project helps you, please give it a ⭐ on GitHub!


Built with ❀️ for the Indian developer community

About

Professional Tax Calculator - JavaScript Frontend. A comprehensive web application for calculating Professional Tax across all Indian states with accurate slabs, date-based validation, and multiple collection modes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0