# MiMSMS Voter System - Installation Checklist

Use this checklist to ensure proper installation on your cPanel hosting.

## Pre-Installation

- [ ] Download all project files from `/home/ubuntu/mimsms_laravel/`
- [ ] Verify you have cPanel access
- [ ] Verify PHP 8.1+ is available
- [ ] Verify MySQL/MariaDB is available
- [ ] Have SSH access (recommended)

## Step 1: Upload Files

- [ ] Create folder `mimsms` in public_html
- [ ] Upload all project files to this folder
- [ ] Verify all files are uploaded correctly
- [ ] Check that `.env.example` is present

## Step 2: Create Database

- [ ] Log in to cPanel
- [ ] Go to MySQL Databases
- [ ] Create database: `mimsms_voter`
- [ ] Create user: `mimsms_user`
- [ ] Set secure password
- [ ] Assign user to database with ALL privileges
- [ ] Note the credentials

## Step 3: Configure Environment

- [ ] Copy `.env.example` to `.env`
- [ ] Edit `.env` with your database credentials:
  - [ ] DB_HOST=localhost
  - [ ] DB_DATABASE=mimsms_voter
  - [ ] DB_USERNAME=mimsms_user
  - [ ] DB_PASSWORD=your_password
- [ ] Set APP_URL to your domain
- [ ] Set APP_ENV=production
- [ ] Set APP_DEBUG=false

## Step 4: Install Dependencies & Setup

- [ ] Run: `php artisan key:generate`
- [ ] Run: `php artisan migrate --force`
- [ ] Run: `php artisan db:seed --class=DatabaseSeeder`
- [ ] Verify seeding output shows:
  - [ ] 63 districts
  - [ ] 305 thanas
  - [ ] 317 electoral areas

## Step 5: Set Permissions

- [ ] Run: `chmod -R 755 storage`
- [ ] Run: `chmod -R 755 bootstrap/cache`
- [ ] Run: `chmod -R 777 storage`
- [ ] Run: `chmod -R 777 bootstrap/cache`

## Step 6: Verify Installation

- [ ] Visit your domain: `https://your-domain.com/mimsms`
- [ ] Verify home page loads
- [ ] Verify cascading dropdowns work
- [ ] Select a district and verify thanas load
- [ ] Select a thana and verify electoral areas load
- [ ] Select an area and view voter data

## Step 7: Test Admin Login

- [ ] Click "Login" button
- [ ] Enter: admin@mimsms.com
- [ ] Enter password: admin123456
- [ ] Verify you're logged in
- [ ] Go to Admin Dashboard
- [ ] Verify statistics show correct counts:
  - [ ] Districts: 63
  - [ ] Thanas: 305
  - [ ] Electoral Areas: 317

## Step 8: Test User Functions

- [ ] Logout and register a new account
- [ ] Verify email validation works
- [ ] Login with new account
- [ ] Go to "New Order"
- [ ] Select an electoral area
- [ ] Fill in customer details
- [ ] Select a package
- [ ] Submit order
- [ ] Verify confirmation page displays

## Step 9: Configure WHMCS (Optional)

- [ ] Get WHMCS API credentials
- [ ] Edit `.env` file:
  - [ ] WHMCS_API_URL=your_url
  - [ ] WHMCS_API_USERNAME=your_username
  - [ ] WHMCS_API_KEY=your_key
- [ ] Test order creation with WHMCS integration

## Step 10: Security Hardening

- [ ] Change admin password:
  - [ ] Login as admin
  - [ ] Go to profile settings
  - [ ] Change password to something secure
- [ ] Verify `.env` file is not accessible via web
- [ ] Verify `storage/logs` directory is not accessible
- [ ] Enable HTTPS on your domain
- [ ] Set up regular backups

## Post-Installation

- [ ] Create a backup of database and files
- [ ] Set up cron job for scheduled tasks (optional)
- [ ] Monitor error logs: `storage/logs/laravel.log`
- [ ] Test all features thoroughly
- [ ] Document any customizations made

## Troubleshooting

If you encounter issues:

1. **Check error logs**:
   ```bash
   tail -f storage/logs/laravel.log
   ```

2. **Verify database connection**:
   ```bash
   php artisan tinker
   # Type: DB::connection()->getPdo()
   ```

3. **Clear cache**:
   ```bash
   php artisan cache:clear
   php artisan config:clear
   ```

4. **Check file permissions**:
   ```bash
   ls -la storage/
   ls -la bootstrap/cache/
   ```

## Support Resources

- **README.md** - Complete documentation
- **SETUP_INSTRUCTIONS.md** - Detailed setup guide
- **DEPLOYMENT_GUIDE.md** - cPanel deployment
- **QUICK_START.md** - Quick reference
- **Laravel Docs** - https://laravel.com/docs

## Final Verification

- [ ] All pages load without errors
- [ ] Database queries work correctly
- [ ] Admin panel functions properly
- [ ] Orders can be created
- [ ] WHMCS integration works (if configured)
- [ ] Responsive design works on mobile
- [ ] All links navigate correctly
- [ ] Error handling works properly

## Sign-Off

- [ ] Installation completed successfully
- [ ] All tests passed
- [ ] System ready for production use
- [ ] Backups created
- [ ] Admin password changed
- [ ] Documentation reviewed

---

**Installation Date**: _______________

**Completed By**: _______________

**Notes**: 
```
_________________________________________________
_________________________________________________
_________________________________________________
```

**Status**: ✅ READY FOR PRODUCTION
