
<?php $__env->startSection('content'); ?>
    <!-- begin::main content -->
    <main class="main-content">
        <div class="container">
            <!-- begin::page header -->
            <div class="page-header">
                <h3>Company Settings</h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="<?php echo e(asset('dashboard')); ?>"><?php echo e(__('message.dashboard')); ?></a></li>
                        <li class="breadcrumb-item active" aria-current="page">Settings</li>
                    </ol>
                </nav>
            </div>
            <!-- end::page header -->
            
            <div class="card">
                <?php if (isset($component)) { $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\FlashMessage::class, []); ?>
<?php $component->withName('flashMessage'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74)): ?>
<?php $component = $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74; ?>
<?php unset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74); ?>
<?php endif; ?>
                <?php if($errors->any()): ?>
                    <div class="alert alert-danger">
                        <ul>
                            <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <li><?php echo e($error); ?></li>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </ul>
                    </div>
                <?php endif; ?>
                <div class="card-body">
                    <!-- Tab Navigation -->
                    <ul class="nav nav-tabs" id="settingsTab" role="tablist">
                        <li class="nav-item">
                            <a class="nav-link active" id="profile-tab" data-toggle="tab" href="#profile" role="tab">
                                <i class="ti ti-user mr-1"></i> Profile
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" id="bank-tab" data-toggle="tab" href="#bank" role="tab">
                                <i class="ti ti-credit-card mr-1"></i> Bank Details
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" id="account-tab" data-toggle="tab" href="#account" role="tab">
                                <i class="ti ti-settings mr-1"></i> Account
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" id="tax-tab" data-toggle="tab" href="#tax" role="tab">
                                <i class="ti ti-receipt mr-1"></i> Tax
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" id="bill-tab" data-toggle="tab" href="#bill" role="tab">
                                <i class="ti ti-file mr-1"></i> Bill Settings
                            </a>
                        </li>
                    </ul>

                    <!-- Tab Content -->
                    <div class="tab-content p-4 border border-top-0 rounded-bottom" id="settingsTabContent">
                        <!-- Profile Tab -->
                        <!-- Profile Tab -->
                        <div class="tab-pane fade show active" id="profile" role="tabpanel">
                            <form action="<?php echo e(asset('account/add-admin-detail')); ?>" method="post" enctype="multipart/form-data">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="admin_detail_id" value="<?php echo e(isset($admin_detail) ? $admin_detail->id : ''); ?>">
                                <div class="mb-3">
                                    <div class="row border" style="height:120px;padding:8px;">
                                        <div class="col-md-6 d-flex align-items-center justify-content-between">
                                            <h5>Logo</h5>
                                            <div id="photo-preview" class="p-2">
                                                <?php if(isset($admin_detail) && $admin_detail->company_logo): ?>
                                                    <img src="<?php echo e($admin_detail->company_logo); ?>" width="110" height="100" alt="company_logo">
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                        <div class="form-group col-md-6">
                                            <label class="col-4">Company Logo</label>
                                            <div class="custom-file col-8">
                                                <input type="file" class="custom-file-input" name="company_logo" id="logoUpload" name="logo">
                                                <label class="custom-file-label" for="logoUpload">Choose file</label>
                                                <small class="form-text text-muted">Recommended Max Size: 1mb</small>
                                            </div>
                                            
                                        </div>
                                    </div>
                                    <div class="row border mt-3" style="height:120px;padding:8px;">
                                        <div class="col-md-6 d-flex align-items-center justify-content-between">
                                            <h5>Favicon</h5>
                                            <div id="favicon-preview" class="p-2">
                                                <?php if(isset($admin_detail) && $admin_detail->favicon): ?>
                                                    <img src="<?php echo e($admin_detail->favicon); ?>" width="110" height="100" alt="company_logo">
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                        <div class="form-group col-md-6">
                                            <label class="col-4">Favicon</label>
                                            <div class="custom-file col-8">
                                                <input type="file" class="custom-file-input"  name="favicon" id="faviconUpload">
                                                <label class="custom-file-label" for="logoUpload">Choose file</label>
                                                <small class="form-text text-muted">Recommended Max Size: 200kb</small>
                                            </div>
                                            
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group row">
                                            <label class="col-4">Company Name</label>
                                            <input type="text" class="form-control col-8" name="company_name" value="<?php echo e(isset($admin_detail) ? $admin_detail->company_name : ''); ?>" required>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-4">Contact Name</label>
                                            <input type="text" class="form-control col-8" name="contact_name" value="<?php echo e(isset($admin_detail) ? $admin_detail->contact_name : ''); ?>" required>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-4">Email</label>
                                            <input type="email" class="form-control col-8" name="email" value="<?php echo e(isset($admin_detail) ? $admin_detail->email : ''); ?>">
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-4">Phone</label>
                                            <input type="text" class="form-control col-8" name="phone" value="<?php echo e(isset($admin_detail) ? $admin_detail->phone : ''); ?>">
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-4">GSTIN</label>
                                            <input type="text" class="form-control col-8" name="gstin" placeholder="09BAOPS0592L1ZW" value="<?php echo e(isset($admin_detail) ? $admin_detail->gstin : ''); ?>">
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-4">Service Tax Number</label>
                                            <input type="text" class="form-control col-8" name="service_tax_no" placeholder="Enter service tax" value="<?php echo e(isset($admin_detail) ? $admin_detail->service_tax_no : ''); ?>">
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group row">
                                            <label class="col-4">Address Line 1</label>
                                            <input type="text" class="form-control col-8" name="address_one" value="<?php echo e(isset($admin_detail) ? $admin_detail->address_one : ''); ?>">
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-4">Address Line 2</label>
                                            <input type="text" class="form-control col-8" name="address_two" value="<?php echo e(isset($admin_detail) ? $admin_detail->address_two : ''); ?>">
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-4">Country</label>
                                            <div class="col-8 px-0">
                                                <select class="select2 px-0 mx-0 select_change_country" name="country">
                                                    <option disabled selected>Select</option>
                                                    <?php $__currentLoopData = $country; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cnt): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($cnt->id); ?>" <?php echo e(isset($admin_detail) ? ($cnt->id == $admin_detail->country ? "selected": "") : ''); ?>>+<?php echo e($cnt->phonecode); ?> - <?php echo e($cnt->name); ?>(<?php echo e($cnt->iso); ?>)</option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                            </div>
                                            
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-4">State</label>
                                            <div class="col-8 px-0">
                                                <select class="select2 px-0 mx-0" name="state" id="state_select_option">
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-4">City</label>
                                            <input type="text" class="form-control col-8" name="city" value="<?php echo e(isset($admin_detail) ? $admin_detail->city : ''); ?>">
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-4">PIN Code</label>
                                            <input type="text" class="form-control col-8" name="pin_code" value="<?php echo e(isset($admin_detail) ? $admin_detail->pin_code : ''); ?>">
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-4">Website</label>
                                            <input type="url" class="form-control col-8" name="website" value="<?php echo e(isset($admin_detail) ? $admin_detail->website : ''); ?>">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group row">
                                            <label class="col-4">Default Currency</label>
                                            <select class="form-control col-8" name="currency">
                                                <option value="INR" selected <?php echo e(isset($admin_detail) ? ($admin_detail->currency=="INR" ? "selected" : "") : ''); ?>>INR (Indian Rupee)</option>
                                                <!-- Other currencies would be listed here -->
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group row">
                                            <label class="col-4">Taxation Type</label>
                                            <select class="form-control col-8" name="taxation_type">
                                                <option value="GST" selected>GST</option>
                                                <!-- Other tax types would be listed here -->
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-check mb-3">
                                    <input class="form-check-input" type="checkbox" id="taxInclusive" name="tax_inclusive" value="<?php echo e(isset($admin_detail) ? $admin_detail->tax_inclusive : ''); ?>">
                                    <label class="form-check-label" for="taxInclusive">Tax inclusive rates</label>
                                </div>
                                
                                
                                <button type="submit" class="btn btn-primary">Save Profile</button>
                            </form>
                        </div>

                        <!-- Bank Details Tab -->
                        <div class="tab-pane fade" id="bank" role="tabpanel">
                            <div class="table-responsive">
                                <table class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th>Bank Name</th>
                                            <th>Account Number</th>                                            
                                            <th>IFSC Code</th>
                                            <th>Branch</th>
                                            <th>Opening Balance</th>
                                            <th>Address</th>
                                            <th>Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__currentLoopData = $banks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td><?php echo e($b->bank_name); ?></td>
                                            <td><?php echo e($b->account_number); ?></td>
                                            <td><?php echo e($b->ifsc); ?></td>
                                            <td><?php echo e($b->branch_name); ?></td>
                                            <td><?php echo e($b->opening_balance); ?></td>
                                            <td><?php echo e($b->address); ?></td>
                                            <td>
                                                <button class="btn btn-sm btn-outline-primary edit_bank_btn" data-toggle="modal" data-target="#addBankModal" bank_details="<?php echo e($b); ?>"><i class="ti ti-pencil"></i></button>
                                                <button class="btn btn-sm btn-outline-danger"><i class="ti ti-trash"></i></button>
                                            </td>
                                        </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        
                                    </tbody>
                                </table>
                            </div>
                            <button class="btn btn-success mt-3 add_bank_btn" data-toggle="modal" data-target="#addBankModal">
                                <i class="ti ti-plus mr-1"></i> Add Bank Account
                            </button>
                        </div>

                        <!-- Account Tab -->
                        <div class="tab-pane fade" id="account" role="tabpanel">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="card mb-4">
                                        <div class="card-header bg-light">
                                            <h6 class="mb-0">Security Settings</h6>
                                        </div>
                                        <div class="card-body">
                                            <form action="<?php echo e(asset('reset-user-password')); ?>" method="post">
                                                <?php echo csrf_field(); ?>
                                                <input type="hidden" name="id" value="<?php echo e(Auth::user()->id); ?>">
                                                <div class="form-group">
                                                    <label for="password">Password</label>
                                                    <input type="password" class="form-control" name="password"
                                                        value="<?php echo e(old('password')); ?>" id="password" placeholder="Enter Password">

                                                    <?php if($errors->has('password')): ?>
                                                        <div class="error">
                                                            <?php echo e($errors->first('password')); ?>

                                                        </div>
                                                    <?php endif; ?>

                                                </div>

                                                <div class="form-group">
                                                    <label for="username">Confirm Password</label>
                                                    <input type="password" class="form-control" name="cpassword"
                                                        value="<?php echo e(old('cpassword')); ?>" id="cpassword" placeholder="Enter Confirm Password">

                                                    <?php if($errors->has('cpassword')): ?>
                                                        <div class="error">
                                                            <?php echo e($errors->first('cpassword')); ?>

                                                        </div>
                                                    <?php endif; ?>

                                                </div>
                                                <button type="submit" class="btn btn-primary">Submit</button>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <!-- <div class="card">
                                        <div class="card-header bg-light">
                                            <h6 class="mb-0">Notification Preferences</h6>
                                        </div>
                                        <div class="card-body">
                                            <div class="form-check mb-2">
                                                <input class="form-check-input" type="checkbox" id="emailNotifications" checked>
                                                <label class="form-check-label" for="emailNotifications">Email Notifications</label>
                                            </div>
                                            <div class="form-check mb-2">
                                                <input class="form-check-input" type="checkbox" id="smsNotifications">
                                                <label class="form-check-label" for="smsNotifications">SMS Notifications</label>
                                            </div>
                                            <div class="form-check">
                                                <input class="form-check-input" type="checkbox" id="invoiceAlerts" checked>
                                                <label class="form-check-label" for="invoiceAlerts">Invoice Alerts</label>
                                            </div>
                                            <button class="btn btn-primary mt-3">Save Preferences</button>
                                        </div>
                                    </div> -->
                                </div>
                            </div>
                        </div>

                        <!-- Tax Tab -->
                        <div class="tab-pane fade" id="tax" role="tabpanel">
                            <div class="alert alert-info">
                                Configure your tax settings for automatic calculations in invoices and bills.
                            </div>
                            <?php if(isset($taxes)): ?>
                                <div class="table-responsive">
                                    <table class="table table-striped">
                                        <thead>
                                            <tr>
                                                <th>SN.</th>
                                                <th>IGST</th>
                                                <th>CGST</th>                                            
                                                <th>SGST</th>
                                                <th>TAX</th>
                                                <th>Actions</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php $__currentLoopData = $taxes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <tr>
                                                <td><?php echo e(++$key); ?></td>
                                                <td><?php echo e($b->igst); ?></td>
                                                <td><?php echo e($b->cgst); ?></td>
                                                <td><?php echo e($b->sgst); ?></td>
                                                <td><?php echo e($b->tax); ?></td>
                                                <td>
                                                    <button class="btn btn-sm btn-outline-primary edit_tax_btn" data-toggle="modal" data-target="#taxModal" bank_details="<?php echo e($b); ?>"><i class="ti ti-pencil"></i></button>
                                                    <button class="btn btn-sm btn-outline-danger tax-delete-btn" tax_id="<?php echo e($b->id); ?>"><i class="ti ti-trash"></i></button>
                                                </td>
                                            </tr>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            
                                        </tbody>
                                    </table>
                                    <div class="mt-3 d-flex justify-content-center">
                                        <?php echo e($taxes->links('pagination::bootstrap-4')); ?> 
                                    </div>
                                </div>
                            <?php endif; ?>

                            <button class="btn btn-success" data-toggle="modal" data-target="#taxModal"> Add Tax Slab</button>
                        </div>

                        <!-- Bill Settings Tab -->
                        <div class="tab-pane fade" id="bill" role="tabpanel">
                            <form>
                                <div class="form-group row">
                                    <label class="col-md-4 col-form-label">Default Bill Prefix</label>
                                    <div class="col-md-8">
                                        <input type="text" class="form-control" value="BILL-">
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label class="col-md-4 col-form-label">Next Bill Number</label>
                                    <div class="col-md-8">
                                        <input type="number" class="form-control" value="1024">
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label class="col-md-4 col-form-label">Default Due Date</label>
                                    <div class="col-md-8">
                                        <select class="form-control">
                                            <option>7 days</option>
                                            <option selected>15 days</option>
                                            <option>30 days</option>
                                            <option>45 days</option>
                                            <option>60 days</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label class="col-md-4 col-form-label">Default Terms</label>
                                    <div class="col-md-8">
                                        <textarea class="form-control" rows="3">Payment due within the specified due date. Late payments may be subject to fees.</textarea>
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label class="col-md-4 col-form-label">Bill Footer Note</label>
                                    <div class="col-md-8">
                                        <textarea class="form-control" rows="2">Thank you for your business!</textarea>
                                    </div>
                                </div>
                                <div class="text-right">
                                    <button type="submit" class="btn btn-primary">Save Bill Settings</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        

        <!-- The Modal -->
        <div class="modal" id="taxModal">
        <div class="modal-dialog">
            <div class="modal-content">

            <!-- Modal Header -->
            <div class="modal-header">
                <h4 class="modal-title">Tax</h4>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>

            <!-- Modal body -->
            <div class="modal-body">
                <form class="tax_form" action="<?php echo e(asset('account/add-tax-slab')); ?>" method="post">
                    <?php echo csrf_field(); ?>
                    <input type="hidden" name="tax_id" id="tax_id">
                    <div class="form-group row">
                        <label class="col-md-3 col-form-label">IGST (%)</label>
                        <div class="col-md-9">
                            <input type="text" max="100" min="1" class="form-control" id="igst" name="igst" placeholder="0.0">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-md-3 col-form-label">CGST (%)</label>
                        <div class="col-md-9">
                            <input type="text" max="100" min="1" class="form-control" id="cgst" name="cgst" placeholder="0.0">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-md-3 col-form-label">SGST (%)</label>
                        <div class="col-md-9">
                            <input type="text" max="100" min="1" class="form-control" id="sgst" name="sgst" placeholder="0.0">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-md-3 col-form-label">GST (%)</label>
                        <div class="col-md-9">
                            <input type="text" max="100" min="1" class="form-control" id="total_tax" name="tax" placeholder="0.0">
                        </div>
                    </div>
                    <div class="d-flex justify-content-end">
                        <button class="btn btn-primary">Save</button>
                    </div>
                    
                </form>
            </div>

            </div>
        </div>
        </div>

        <!-- Add Bank Modal -->
        <div class="modal fade" id="addBankModal">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Add Bank Account</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <form action="<?php echo e(asset('account/add-bank')); ?>" class="bank_form" method="post" enctype="multipart/form-data">
                            <?php echo csrf_field(); ?>
                            <input type="hidden" name="bank_id" id="bank_id">
                        <div class="modal-body">                  
                                                        
                            <!-- Bank Name -->
                            <div class="form-group d-flex align-items-center row">
                                <label for="bank_name" class="col-4">Bank Name </label>
                                <input type="text" class="form-control col-8" name="bank_name" id="bank_name" required>
                            </div>
                            <div class="d-flex justify-content-end px-3 ">
                                <?php if($errors->has('bank_name')): ?>
                                    <div class="text-danger">
                                        <p><?php echo e($errors->first('bank_name')); ?></p>
                                    </div>
                                <?php endif; ?>
                            </div>

                            <!-- Account Number -->
                            <div class="form-group d-flex align-items-center row">
                                <label for="account_number" class="col-4">Account Number</label>
                                <input type="text" class="form-control col-8" name="account_number" id="account_number">
                            </div>
                            <div class="d-flex justify-content-end px-3">
                                <?php if($errors->has('account_number')): ?>
                                    <div class="text-danger">
                                        <p><?php echo e($errors->first('account_number')); ?></p>
                                    </div>
                                <?php endif; ?>
                            </div>

                            <!-- IFSC Code -->
                            <div class="form-group d-flex align-items-center row">
                                <label for="ifsc_code" class="col-4">IFSC</label>
                                <input type="text" class="form-control col-8" name="ifsc" id="ifsc">
                            </div>
                            <div class="d-flex justify-content-end px-3">
                                <?php if($errors->has('ifsc_code')): ?>
                                    <div class="text-danger">
                                        <p><?php echo e($errors->first('ifsc_code')); ?></p>
                                    </div>
                                <?php endif; ?>
                            </div>

                            <!-- Branch Name -->
                            <div class="form-group d-flex align-items-center row">
                                <label for="branch_name" class="col-4">Branch Name</label>
                                <input type="text" class="form-control col-8" name="branch_name" id="branch_name">
                            </div>                           

                            <!-- Opening Balance -->
                            <div class="form-group d-flex align-items-center row">
                                <label for="opening_balance" class="col-4">Opening Balance</label>
                                <input type="number" class="form-control col-8" name="opening_balance" id="opening_balance" step="0.01" value="0.00">
                            </div>
                        <div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                            <button type="submit" class="btn btn-primary">Save Account</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        
    </main>
    <!-- end::main content -->
<?php $__env->stopSection(); ?>

<?php $__env->startPush('footer-script'); ?>
    <script>
        

        $(document).ready(function() {
            
            const admin_details = <?php echo json_encode($admin_detail, 15, 512) ?>;
            //console.log(admin_details);
            fetch_state(admin_details.country,admin_details.state);

            // Enable file input label
            $('.custom-file-input').on('change', function() {
                let fileName = $(this).val().split('\\').pop();
                $(this).next('.custom-file-label').addClass("selected").html(fileName);
            });

            // Initialize tabs
            $('#settingsTab a').on('click', function (e) {
                e.preventDefault();
                $(this).tab('show');
            });

            $(".select_change_country").on("change",function(){
                var country_id = $(this).val();
                fetch_state(country_id);
                
            });

            function fetch_state(country_id,state=null)
            {
                $.ajax({
                    type: "post",
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    data: {
                        "id": country_id
                    },
                    url: "<?php echo e(asset('fetch-state')); ?>",
                    dataType: "html",
                    success: function(result) 
                    {
                        $("#state_select_option").html("");
                        var allData = JSON.parse(result);
                        if(allData.message=="success")
                        {
                            var data = allData.data;
                            var i;
                            var dOption = "<option selected disabled>--Select--</option>";
                            $("#state_select_option").append(dOption);
                            for(i=0;i<data.length;i++)
                            {
                                let is_select = data[i].id == state ? "selected" : "";
                                var option = `<option value="${data[i].id}" ${is_select}>
                                                ${data[i].state_name}
                                                </option>
                                `;
                                $("#state_select_option").append(option);
                            }
                            $("#state_select_option").select2();
                        }
                        else
                        {
                            console.log("failed");
                        }
                    },
                    error:function(xhr,error,status)
                    {
                        $("#state_select_option").html("");
                        console.log(JSON.parse(xhr.responseText));
                    }
                });
            }

            //logo upload
            $('#logoUpload').change(function(e) {
                // Clear previous preview
                $('#photo-preview').empty();
                
                // Check if any file is selected
                if (this.files && this.files.length > 0) {
                    // Create Blob URL for each selected file
                    $.each(this.files, function(i, file) {
                        if (file.type.match('image.*')) {
                            var blobUrl = URL.createObjectURL(file);
                            
                            // Create image element with blob URL
                            var img = $('<img>').attr({
                                'src': blobUrl,
                                'class': 'preview-image',
                                'alt': 'Preview',
                                'width': '110',
                                'height': '100'
                            });
                            
                            // Append to preview div
                            $('#photo-preview').append(img);
                            
                            // Revoke the blob URL when image is loaded to free memory
                            img.on('load', function() {
                                URL.revokeObjectURL(blobUrl);
                            });
                        }
                    });
                }
            });

                 //favicon upload
            $('#faviconUpload').change(function(e) {
                // Clear previous preview
                $('#favicon-preview').empty();
                
                // Check if any file is selected
                if (this.files && this.files.length > 0) {
                    // Create Blob URL for each selected file
                    $.each(this.files, function(i, file) {
                        if (file.type.match('image.*')) {
                            var blobUrl = URL.createObjectURL(file);
                            
                            // Create image element with blob URL
                            var img = $('<img>').attr({
                                'src': blobUrl,
                                'class': 'preview-image',
                                'alt': 'Preview',
                                'width': '110',
                                'height': '100'
                            });
                            
                            // Append to preview div
                            $('#favicon-preview').append(img);
                            
                            // Revoke the blob URL when image is loaded to free memory
                            img.on('load', function() {
                                URL.revokeObjectURL(blobUrl);
                            });
                        }
                    });
                }
            });

            //edit bank button

            $(".add_bank_btn").click(function(){
                $(".bank_form").trigger('reset');
            });

            $(".edit_bank_btn").click(function(){
                var bank_details = $(this).attr("bank_details");
                const allBank = JSON.parse(bank_details);

                $("#bank_id").val(allBank.id);
                $("#bank_name").val(allBank.bank_name);
                $("#account_number").val(allBank.account_number);
                $("#branch_name").val(allBank.branch_name);
                $("#opening_balance").val(allBank.opening_balance);
                $("#ifsc").val(allBank.ifsc);
            });

            $(".add_tax_btn").click(function(){
                $(".tax_form").trigger('reset');
            });

            $(".edit_tax_btn").click(function(){
                var bank_details = $(this).attr("bank_details");
                const allBank = JSON.parse(bank_details);

                $("#tax_id").val(allBank.id);
                $("#igst").val(allBank.igst);
                $("#cgst").val(allBank.cgst);
                $("#sgst").val(allBank.sgst);
                $("#total_tax").val(allBank.tax);
            
            });

            $(".tax-delete-btn").click(function(){
                var id = $(this).attr("tax_id");
               
                swal({
                    title: 'Are you sure?',
                    text: 'Once deleted, you will not be recover!',
                    icon: 'warning',
                    dangerMode: true,
                    buttons: ["Cancel", "Yes!"],
                }).then(function(value) {
                    if (value) {
                        $.ajaxSetup({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            }
                        });
                        $.ajax({
                            type: "post",
                            data: {
                                "id": id
                            },
                            url: "<?php echo e(asset('account/delete-tax-slab')); ?>",
                            dataType: "html",
                            success: function(result) 
                            {
                                swal("success!", "Successfully deleted!", "success");
                                window.location.reload();
                            },
                            error: function(error,xhr,status)
                            {
                                swal("failed!", "failed to delete!", "error");
                                window.location.reload();
                            }
                        });
                       
                    }
                });
            });
        });
    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/peoplebee.in/accounts-admin/resources/views/website_settings/list.blade.php ENDPATH**/ ?>