

<?php $__env->startSection('content'); ?>

<div class="container-fluid py-4">

    

    <div class="d-flex justify-content-between align-items-center mb-4">

        <div>

            <h3 class="fw-bold mb-1">
                <i class="bi bi-person-circle me-2"></i>
                My Profile
            </h3>

            <p class="text-muted mb-0">
                Manage your personal and account information.
            </p>

        </div>

    </div>


    

    <?php if(session('success')): ?>

        <div class="alert alert-success">

            <i class="bi bi-check-circle me-2"></i>

            <?php echo e(session('success')); ?>


        </div>

    <?php endif; ?>


    

    <?php if($errors->any()): ?>

        <div class="alert alert-danger">

            <ul class="mb-0">

                <?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="row g-4">


        

        <div class="col-xl-8 col-lg-7">

            <div class="card border-0 shadow-sm profile-card">

                <div class="card-header bg-white">

                    <h5 class="mb-0 fw-bold">

                        <i class="bi bi-person-vcard me-2"></i>

                        Profile Information

                    </h5>

                </div>


                <div class="card-body p-4">

                    <form
                        method="POST"
                        action="<?php echo e(route('profile.update')); ?>"
                        enctype="multipart/form-data"
                    >

                        <?php echo csrf_field(); ?>


                        

                        <div class="profile-picture-section mb-4">

                            <div class="profile-picture-wrapper">

                                <?php if($user->profile_picture): ?>

                                    <img
                                        src="<?php echo e(asset('storage/' . $user->profile_picture)); ?>"
                                        id="profilePreview"
                                        class="profile-picture"
                                        alt="Profile Picture"
                                    >

                                <?php else: ?>

                                    <div
                                        class="profile-placeholder"
                                        id="profilePlaceholder"
                                    >

                                        <i class="bi bi-person"></i>

                                    </div>

                                <?php endif; ?>

                            </div>


                            <div class="profile-picture-info">

                                <h6 class="fw-bold mb-1">
                                    Profile Picture
                                </h6>

                                <p class="text-muted small mb-2">
                                    JPG, JPEG, PNG or WEBP. Maximum 2 MB.
                                </p>

                                <label
                                    for="profile_picture"
                                    class="btn btn-sm btn-outline-dark"
                                >

                                    <i class="bi bi-camera me-1"></i>

                                    Change Picture

                                </label>

                                <input
                                    type="file"
                                    name="profile_picture"
                                    id="profile_picture"
                                    class="d-none"
                                    accept=".jpg,.jpeg,.png,.webp"
                                >

                            </div>

                        </div>


                        

                        <div class="section-title">

                            <i class="bi bi-person-vcard me-2"></i>

                            Basic Information

                        </div>


                        <div class="row">


                            

                            <div class="col-md-6 mb-3">

                                <label class="form-label">
                                    Name <span class="text-danger">*</span>
                                </label>

                                <input
                                    type="text"
                                    name="name"
                                    class="form-control"
                                    value="<?php echo e(old('name', $user->name)); ?>"
                                    required
                                >

                            </div>


                            

                            <div class="col-md-6 mb-3">

                                <label class="form-label">
                                    Email <span class="text-danger">*</span>
                                </label>

                                <input
                                    type="email"
                                    name="email"
                                    class="form-control"
                                    value="<?php echo e(old('email', $user->email)); ?>"
                                    required
                                >

                            </div>


                            

                            <div class="col-md-6 mb-3">

                                <label class="form-label">
                                    Mobile <span class="text-danger">*</span>
                                </label>

                                <input
                                    type="tel"
                                    name="mobile"
                                    class="form-control"
                                    value="<?php echo e(old('mobile', $user->mobile)); ?>"
                                    maxlength="15"
                                    required
                                >

                            </div>


                            

                            <div class="col-md-6 mb-3">

                                <label class="form-label">
                                    Date of Birth
                                </label>

                                <input
                                    type="date"
                                    name="date_of_birth"
                                    class="form-control"
                                    value="<?php echo e(old(
                                        'date_of_birth',
                                        $user->date_of_birth
                                            ? $user->date_of_birth->format('Y-m-d')
                                            : ''
                                    )); ?>"
                                >

                            </div>


                            

                            <div class="col-md-6 mb-3">

                                <label class="form-label">
                                    Relation Type
                                </label>

                               <select
    name="relation_type"
    class="form-select"
>

    <option value="">
        Select Marital Status
    </option>

    <option
        value="Single"
        <?php echo e(old('relation_type', $user->relation_type) == 'Single' ? 'selected' : ''); ?>

    >
        Single
    </option>

    <option
        value="Married"
        <?php echo e(old('relation_type', $user->relation_type) == 'Married' ? 'selected' : ''); ?>

    >
        Married
    </option>

</select>

                            </div>


                            

                            <div class="col-md-6 mb-3">

                                <label class="form-label">
                                    Father Name
                                </label>

                                <input
                                    type="text"
                                    name="father_name"
                                    class="form-control"
                                    value="<?php echo e(old(
                                        'father_name',
                                        $user->father_name
                                    )); ?>"
                                    placeholder="Enter father name"
                                >

                            </div>


                            

                            <div class="col-md-6 mb-3">

                                <label class="form-label">
                                    Gender
                                </label>

                                <select
                                    name="gender"
                                    class="form-select"
                                >

                                    <option value="">
                                        Select Gender
                                    </option>

                                    <option
                                        value="Male"
                                        <?php echo e(old(
                                            'gender',
                                            $user->gender
                                        ) == 'Male' ? 'selected' : ''); ?>

                                    >
                                        Male
                                    </option>

                                    <option
                                        value="Female"
                                        <?php echo e(old(
                                            'gender',
                                            $user->gender
                                        ) == 'Female' ? 'selected' : ''); ?>

                                    >
                                        Female
                                    </option>

                                    <option
                                        value="Other"
                                        <?php echo e(old(
                                            'gender',
                                            $user->gender
                                        ) == 'Other' ? 'selected' : ''); ?>

                                    >
                                        Other
                                    </option>

                                </select>

                            </div>


                            

                            <div class="col-md-6 mb-3">

                                <label class="form-label">
                                    Employee Code <span class="text-danger">*</span>
                                </label>

                                <input
                                    type="text"
                                    name="employee_code"
                                    class="form-control"
                                    value="<?php echo e(old(
                                        'employee_code',
                                        $user->employee_code
                                    )); ?>"
                                    required
                                >

                            </div>

                        </div>


                        

                        <div class="section-title mt-3">

                            <i class="bi bi-geo-alt me-2"></i>

                            Address Information

                        </div>


                        <div class="row">


                            

                            <div class="col-12 mb-3">

                                <label class="form-label">
                                    Address
                                </label>

                                <textarea
                                    name="address"
                                    class="form-control"
                                    rows="3"
                                    placeholder="Enter complete address"
                                ><?php echo e(old(
                                    'address',
                                    $user->address
                                )); ?></textarea>

                            </div>


                            

                            <div class="col-md-6 mb-3">

                                <label class="form-label">
                                    City
                                </label>

                                <input
                                    type="text"
                                    name="city"
                                    class="form-control"
                                    value="<?php echo e(old(
                                        'city',
                                        $user->city
                                    )); ?>"
                                    placeholder="Enter city"
                                >

                            </div>


                            

                            <div class="col-md-6 mb-3">

                                <label class="form-label">
                                    State
                                </label>

                                <input
                                    type="text"
                                    name="state"
                                    class="form-control"
                                    value="<?php echo e(old(
                                        'state',
                                        $user->state
                                    )); ?>"
                                    placeholder="Enter state"
                                >

                            </div>

                        </div>


                        

                        <div class="border-top pt-3 mt-2">

                            <button
                                type="submit"
                                class="btn btn-dark"
                            >

                                <i class="bi bi-save me-1"></i>

                                Update Profile

                            </button>

                        </div>

                    </form>

                </div>

            </div>

        </div>


        

        <div class="col-xl-4 col-lg-5">


            

            <div class="card border-0 shadow-sm profile-card mb-4">

                <div class="card-header bg-white">

                    <h5 class="mb-0 fw-bold">

                        <i class="bi bi-person-check me-2"></i>

                        Account

                    </h5>

                </div>


                <div class="card-body">

                    <div class="account-info">

                        <span>
                            Employee Code
                        </span>

                        <strong>
                            <?php echo e($user->employee_code ?? '-'); ?>

                        </strong>

                    </div>


                    <div class="account-info">

                        <span>
                            Email
                        </span>

                        <strong>
                            <?php echo e($user->email); ?>

                        </strong>

                    </div>


                    <div class="account-info">

                        <span>
                            Account Created
                        </span>

                        <strong>

                            <?php echo e($user->created_at
                                ? $user->created_at->format('d M Y')
                                : '-'); ?>


                        </strong>

                    </div>

                </div>

            </div>


            

            <div class="card border-0 shadow-sm profile-card">

                <div class="card-header bg-white">

                    <h5 class="mb-0 fw-bold">

                        <i class="bi bi-shield-lock me-2"></i>

                        Change Password

                    </h5>

                </div>


                <div class="card-body">

                    <form
                        method="POST"
                        action="<?php echo e(route('profile.password')); ?>"
                    >

                        <?php echo csrf_field(); ?>


                        

                        <div class="mb-3">

                            <label class="form-label">
                                Current Password
                            </label>

                            <input
                                type="password"
                                name="current_password"
                                class="form-control"
                                required
                            >

                        </div>


                        

                        <div class="mb-3">

                            <label class="form-label">
                                New Password
                            </label>

                            <input
                                type="password"
                                name="password"
                                class="form-control"
                                placeholder="Minimum 8 characters"
                                required
                            >

                        </div>


                        

                        <div class="mb-3">

                            <label class="form-label">
                                Confirm New Password
                            </label>

                            <input
                                type="password"
                                name="password_confirmation"
                                class="form-control"
                                required
                            >

                        </div>


                        <button
                            type="submit"
                            class="btn btn-dark w-100"
                        >

                            <i class="bi bi-key me-1"></i>

                            Change Password

                        </button>

                    </form>

                </div>

            </div>

        </div>

    </div>

</div>




<style>

.profile-card {

    border-radius: 12px;

    overflow: hidden;

}


.profile-card .card-header {

    padding: 16px 20px;

    border-bottom: 1px solid #edf0f2;

}


.profile-picture-section {

    display: flex;

    align-items: center;

    gap: 20px;

    padding: 18px;

    background: #f8f9fa;

    border-radius: 10px;

}


.profile-picture-wrapper {

    width: 90px;

    height: 90px;

    flex-shrink: 0;

}


.profile-picture {

    width: 90px;

    height: 90px;

    object-fit: cover;

    border-radius: 50%;

    border: 3px solid #ffffff;

    box-shadow: 0 2px 8px rgba(0,0,0,.12);

}


.profile-placeholder {

    width: 90px;

    height: 90px;

    border-radius: 50%;

    background: #e9ecef;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 40px;

    color: #6c757d;

    border: 3px solid #ffffff;

    box-shadow: 0 2px 8px rgba(0,0,0,.12);

}


.profile-picture-info h6 {

    margin-bottom: 4px;

}


.section-title {

    font-size: 15px;

    font-weight: 700;

    color: #34495e;

    border-bottom: 1px solid #e5e7eb;

    padding-bottom: 10px;

    margin-bottom: 18px;

}


.form-label {

    font-size: 13px;

    font-weight: 600;

    color: #475569;

    margin-bottom: 7px;

}


.form-control,
.form-select {

    min-height: 44px;

    border: 1px solid #dfe3e8;

    border-radius: 7px;

    font-size: 14px;

}


.form-control:focus,
.form-select:focus {

    border-color: #8a7b74;

    box-shadow: 0 0 0 .2rem rgba(80,60,50,.08);

}


textarea.form-control {

    min-height: 90px;

}


.account-info {

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 15px;

    padding: 12px 0;

    border-bottom: 1px solid #edf0f2;

}


.account-info:last-child {

    border-bottom: 0;

}


.account-info span {

    color: #718096;

    font-size: 13px;

}


.account-info strong {

    color: #263238;

    font-size: 13px;

    text-align: right;

    word-break: break-word;

}


@media (max-width: 768px) {

    .profile-picture-section {

        align-items: flex-start;

    }

}

</style>




<script>

document
    .getElementById('profile_picture')
    .addEventListener('change', function(event) {

        const file = event.target.files[0];

        if (!file) {
            return;
        }

        const reader = new FileReader();

        reader.onload = function(e) {

            let image =
                document.getElementById('profilePreview');

            let placeholder =
                document.getElementById('profilePlaceholder');


            /*
            |--------------------------------------------------------------------------
            | Existing Image
            |--------------------------------------------------------------------------
            */

            if (image) {

                image.src = e.target.result;

                return;
            }


            /*
            |--------------------------------------------------------------------------
            | No Existing Image
            |--------------------------------------------------------------------------
            */

            if (placeholder) {

                const newImage =
                    document.createElement('img');

                newImage.src =
                    e.target.result;

                newImage.id =
                    'profilePreview';

                newImage.className =
                    'profile-picture';

                newImage.alt =
                    'Profile Picture';


                placeholder.replaceWith(newImage);
            }

        };

        reader.readAsDataURL(file);

    });

</script>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\abhay\erp-system\resources\views/auth/profile.blade.php ENDPATH**/ ?>