

<?php $__env->startSection('title', 'Company Profile'); ?>

<?php $__env->startSection('content'); ?>
<div class="page-header">
    <div>
        <h4 class="page-title">Company Profile</h4>
        <p class="text-muted mb-0">Manage your company details and documents</p>
    </div>
    <?php if($seller->slug): ?>
        <a href="<?php echo e(route('seller.public.profile', $seller->slug)); ?>" target="_blank" class="btn btn-outline-primary shadow-sm">
            <i class="bi bi-box-arrow-up-right me-1"></i> View Public Profile
        </a>
    <?php endif; ?>
</div>

<div class="row g-4">
    <!-- Profile Form -->
    <div class="col-lg-8">
        <div class="card border-0 shadow-sm mb-4">
            <div class="card-header bg-white py-3 border-bottom">
                <h6 class="fw-bold mb-0 text-primary"><i class="bi bi-building me-2"></i>Company Details</h6>
            </div>
            <div class="card-body p-4">
                <form action="<?php echo e(route('seller.profile.update')); ?>" method="POST" enctype="multipart/form-data">
                    <?php echo csrf_field(); ?>
                    <div class="row g-4">
                        <div class="col-md-6">
                            <label class="form-label fw-bold">Company Name <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" name="company_name" 
                                   value="<?php echo e(old('company_name', $seller->company_name)); ?>" required>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label fw-bold">Mobile Number <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" name="mobile" 
                                   value="<?php echo e(old('mobile', $seller->mobile)); ?>" required>
                        </div>

                        <div class="col-12">
                             <label class="form-label fw-bold">Address <span class="text-danger">*</span></label>
                             <textarea class="form-control" name="address" rows="2" required><?php echo e(old('address', $seller->address)); ?></textarea>
                        </div>

                        <div class="col-md-6">
                            <label class="form-label fw-bold">City <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" name="city" 
                                   value="<?php echo e(old('city', $seller->city)); ?>" required>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label fw-bold">State <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" name="state" 
                                   value="<?php echo e(old('state', $seller->state)); ?>" required>
                        </div>

                        <div class="col-md-6">
                            <label class="form-label fw-bold">Pincode <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" name="pincode" 
                                   value="<?php echo e(old('pincode', $seller->pincode)); ?>" required>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label fw-bold">Country</label>
                            <input type="text" class="form-control" name="country" 
                                   value="<?php echo e(old('country', $seller->country ?? 'India')); ?>">
                        </div>

                        <div class="col-md-6">
                            <label class="form-label fw-bold">MOQ (Minimum Order Quantity) <span class="text-danger">*</span></label>
                            <?php
                                $minMoq = \App\Models\Setting::getValue('registration_moq_min', 10);
                                $maxMoq = \App\Models\Setting::getValue('registration_moq_max', 150);
                            ?>
                            <div class="input-group">
                                <span class="input-group-text bg-light"><i class="bi bi-box-seam"></i></span>
                                <input type="number" class="form-control <?php $__errorArgs = ['moq_quantity'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" 
                                       name="moq_quantity" 
                                       value="<?php echo e(old('moq_quantity', $seller->moq_quantity)); ?>"
                                       min="<?php echo e($minMoq); ?>" 
                                       max="<?php echo e($maxMoq); ?>" 
                                       required>
                                <span class="input-group-text">Units</span>
                            </div>
                            <?php $__errorArgs = ['moq_quantity'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="invalid-feedback d-block"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            <small class="text-muted">
                                <i class="bi bi-info-circle me-1"></i>Allowed range: <strong><?php echo e($minMoq); ?> - <?php echo e($maxMoq); ?></strong> units (Set by Admin)
                            </small>
                        </div>
                        <div class="col-12">
                            <label class="form-label fw-bold">Company Logo</label>
                            <div class="p-4 border border-dashed rounded-3 bg-light text-center">
                                <input type="file" class="form-control mb-2" name="logo" accept="image/*">
                                <small class="text-muted">Recommended size: 500x500px. Max: 2MB</small>
                            </div>
                        </div>
                    </div>
                    <div class="mt-4 text-end">
                        <button type="submit" class="btn btn-primary-gradient px-5 py-2 fw-bold">
                            <i class="bi bi-check-lg me-1"></i> Update Profile
                        </button>
                    </div>
                </form>
            </div>
        </div>

    </div>




    <!-- Sidebar Info -->
    <div class="col-lg-4">
        <div class="card border-0 shadow-sm mb-4">
            <div class="card-body text-center py-5">
                <?php if($seller->logo): ?>
                    <img src="<?php echo e(asset('storage/' . $seller->logo)); ?>" class="rounded-circle mb-3 shadow-sm border" 
                         style="width: 120px; height: 120px; object-fit: cover;">
                <?php else: ?>
                    <div class="bg-primary-subtle text-primary rounded-circle d-inline-flex align-items-center justify-content-center mb-3 shadow-sm" 
                         style="width: 120px; height: 120px; font-size: 3rem; font-weight: bold;">
                        <?php echo e(substr($seller->company_name, 0, 1)); ?>

                    </div>
                <?php endif; ?>
                <h4 class="fw-bold mb-1"><?php echo e($seller->company_name); ?></h4>
                <p class="text-muted mb-2"><?php echo e($seller->category->name ?? 'Uncategorized'); ?></p>

                <!-- Plan Badge -->
                <?php if($seller->subscription && $seller->subscription->plan): ?>
                    <div class="mb-3">
                        <?php if(Str::contains(strtolower($seller->subscription->plan->name), 'silver')): ?>
                            <span class="badge bg-secondary text-white border border-secondary px-3 py-1 rounded-pill">
                                <i class="bi bi-star-fill text-warning me-1"></i> Silver Member
                            </span>
                        <?php elseif(Str::contains(strtolower($seller->subscription->plan->name), 'basic')): ?>
                            <span class="badge bg-primary text-white border border-primary px-3 py-1 rounded-pill">
                                Basic Member
                            </span>
                        <?php else: ?>
                             <span class="badge bg-dark text-white border border-dark px-3 py-1 rounded-pill">
                                Premium Member
                            </span>
                        <?php endif; ?>
                    </div>
                <?php else: ?>
                     <span class="badge bg-light text-muted border px-3 py-1 rounded-pill mb-3">Free Member</span>
                <?php endif; ?>
                
                <div class="d-flex justify-content-around border-top pt-4">
                    <div class="text-center px-3">
                        <h4 class="fw-bold mb-0 text-primary"><?php echo e($seller->products->count()); ?></h4>
                        <small class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Products</small>
                    </div>
                    <div class="vr"></div>
                    <div class="text-center px-3">
                        <h4 class="fw-bold mb-0 text-success"><?php echo e($seller->inquiries->count()); ?></h4>
                        <small class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Inquiries</small>
                    </div>
                </div>

                <!-- MOQ Info -->
                <div class="mt-4 text-start bg-light p-3 rounded small">
                    <div class="d-flex justify-content-between mb-2">
                        <span class="text-muted">Platform MOQ:</span>
                        <span class="fw-bold text-dark">10 - 150 Units</span>
                    </div>
                    <div class="d-flex justify-content-between">
                        <span class="text-muted">Product MOQ:</span>
                        <div class="text-end">
                             <?php if($seller->moq_quantity): ?>
                                <span class="fw-bold text-dark"><?php echo e($seller->moq_quantity); ?> (Custom)</span>
                             <?php else: ?>
                                <span class="text-muted fst-italic">Not Set</span>
                             <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="card border-0 shadow-sm">
            <div class="card-header bg-white py-3 border-bottom">
                 <h6 class="fw-bold mb-0 text-dark">
                    <i class="bi bi-shield-check me-2 text-primary"></i>KYC Status
                </h6>
            </div>
            <div class="card-body p-0">
                <div class="list-group list-group-flush">
                    <div class="list-group-item d-flex justify-content-between align-items-center py-3">
                        <span class="fw-medium">Document Status</span>
                        <?php if($seller->kyc_status === 'verified'): ?>
                             <span class="badge bg-success-subtle text-success rounded-pill px-3">
                                <i class="bi bi-check-circle-fill me-1"></i> Verified
                            </span>
                        <?php elseif($seller->kyc_status === 'submitted'): ?>
                            <span class="badge bg-info-subtle text-info rounded-pill px-3">
                                <i class="bi bi-file-earmark-check me-1"></i> KYC Submitted
                            </span>
                        <?php else: ?>
                             <span class="badge bg-secondary-subtle text-secondary rounded-pill px-3">
                                <i class="bi bi-hourglass me-1"></i> Pending
                            </span>
                        <?php endif; ?>
                    </div>
                     <div class="list-group-item bg-light text-center py-2">
                        <small class="text-muted">
                            <i class="bi bi-info-circle me-1"></i>
                            KYC Verified status is awarded after document approval.
                        </small>
                    </div>
                </div>
            </div>
        </div>

        <!-- Danger Zone -->
        <div class="card border-danger shadow-sm mt-4">
            <div class="card-header bg-danger bg-opacity-10 border-danger py-3">
                 <h6 class="fw-bold mb-0 text-danger">
                    <i class="bi bi-exclamation-triangle-fill me-2"></i>Danger Zone
                </h6>
            </div>
            <div class="card-body p-4">
                <?php if($seller->delete_requested_at): ?>
                    <div class="alert alert-warning border-0 d-flex align-items-center mb-3">
                        <i class="bi bi-clock-history fs-4 me-3"></i>
                        <div>
                            <strong>Account Scheduled for Deletion</strong>
                            <p class="mb-0 small">
                                Your account is scheduled for permanent deletion. 
                                <?php
                                    $months = \App\Models\Setting::getValue('seller_retention_period', 3);
                                    $deletionDate = \Carbon\Carbon::parse($seller->delete_requested_at)->addMonths((int)$months)->format('d M Y');
                                ?>
                                It will be deleted on <strong><?php echo e($deletionDate); ?></strong>.
                            </p>
                        </div>
                    </div>
                    <form action="<?php echo e(route('seller.profile.delete.cancel')); ?>" method="POST">
                        <?php echo csrf_field(); ?>
                        <button type="submit" class="btn btn-outline-success fw-bold">
                            <i class="bi bi-arrow-counterclockwise me-1"></i> Cancel Deletion Request
                        </button>
                    </form>
                <?php else: ?>
                    <p class="text-muted small">
                        Deleting your account will hide your profile and products from buyers. 
                        <strong class="text-success">You can restore your account within 3 months.</strong>
                        After 3 months, your data will be permanently deleted.
                    </p>
                    <form action="<?php echo e(route('seller.profile.delete.request')); ?>" method="POST" onsubmit="return confirm('Are you sure you want to request account deletion? This will start the deletion process.');">
                        <?php echo csrf_field(); ?>
                        <button type="submit" class="btn btn-outline-danger fw-bold">
                            <i class="bi bi-trash me-1"></i> Request Account Deletion
                        </button>
                    </form>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
<script>
    function kycManager() {
        return {
            sellerPhotoPreview: null,
            panCardPreview: null,
            
            previewSellerPhoto(event) {
                const file = event.target.files[0];
                if (file) {
                    const reader = new FileReader();
                    reader.onload = (e) => {
                        this.sellerPhotoPreview = e.target.result;
                    };
                    reader.readAsDataURL(file);
                }
            },
            
            previewPanCard(event) {
                const file = event.target.files[0];
                if (file) {
                    if (file.type === 'application/pdf') {
                        this.panCardPreview = 'pdf';
                    } else {
                        const reader = new FileReader();
                        reader.onload = (e) => {
                            this.panCardPreview = e.target.result;
                        };
                        reader.readAsDataURL(file);
                    }
                }
            }
        }
    }
</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layouts.seller', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/u281583269/domains/theminiport.com/public_html/resources/views/seller/profile.blade.php ENDPATH**/ ?>