🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:team.php
<?php require APPROOT . '/views/layouts/admin_header.php'; ?> <div class="d-flex justify-content-between align-items-center mb-4"> <h4 class="font-outfit fw-bold text-navy">Manage Team Members</h4> <?php if($data['action'] !== 'add' && $data['action'] !== 'edit'): ?> <a href="<?php echo URLROOT; ?>/admin/team/add" class="btn btn-navy rounded-pill px-4"> <i class="fas fa-plus me-2"></i> Add Team Member </a> <?php endif; ?> </div> <?php if($data['action'] == 'add' || ($data['action'] == 'edit' && $data['selected_member'])): ?> <!-- Add/Edit Form --> <?php $isEdit = $data['action'] == 'edit'; $member = $data['selected_member']; $formAction = $isEdit ? URLROOT . '/admin/team/edit/' . $member->id : URLROOT . '/admin/team/add'; $nameVal = $isEdit ? $member->name : ''; $desigVal = $isEdit ? $member->designation : ''; $photoVal = $isEdit ? $member->photo_url : ''; $orderVal = $isEdit ? $member->order_index : 0; ?> <div class="card border-0 shadow-sm rounded-4 max-width-md mx-auto"> <div class="card-header bg-white border-bottom py-3"> <h5 class="mb-0 font-outfit fw-bold text-navy"><?php echo $isEdit ? 'Edit Team Member' : 'Add Team Member'; ?></h5> </div> <div class="card-body p-4"> <form action="<?php echo $formAction; ?>" method="POST"> <div class="mb-3"> <label for="name" class="form-label font-inter fw-medium text-navy">Full Name</label> <input type="text" name="name" id="name" class="form-control rounded-3 <?php echo (!empty($data['name_err'])) ? 'is-invalid' : ''; ?>" value="<?php echo htmlspecialchars($nameVal); ?>"> <div class="invalid-feedback"><?php echo $data['name_err'] ?? ''; ?></div> </div> <div class="mb-3"> <label for="designation" class="form-label font-inter fw-medium text-navy">Designation (e.g. Chairman, Manager)</label> <input type="text" name="designation" id="designation" class="form-control rounded-3 <?php echo (!empty($data['designation_err'])) ? 'is-invalid' : ''; ?>" value="<?php echo htmlspecialchars($desigVal); ?>"> <div class="invalid-feedback"><?php echo $data['designation_err'] ?? ''; ?></div> </div> <div class="row"> <div class="col-md-6 mb-3"> <label for="photo_url" class="form-label font-inter fw-medium text-navy">Photo URL</label> <input type="text" name="photo_url" id="photo_url" class="form-control rounded-3" value="<?php echo htmlspecialchars($photoVal); ?>" placeholder="e.g. /assets/img/team/member1.jpg"> <small class="text-muted">Relative URL or blank to use default avatar.</small> </div> <div class="col-md-6 mb-3"> <label for="order_index" class="form-label font-inter fw-medium text-navy">Display Order</label> <input type="number" name="order_index" id="order_index" class="form-control rounded-3" value="<?php echo $orderVal; ?>"> </div> </div> <div class="d-flex justify-content-end mt-4 gap-2"> <a href="<?php echo URLROOT; ?>/admin/team" class="btn btn-outline-secondary rounded-pill px-4">Cancel</a> <button type="submit" class="btn btn-navy rounded-pill px-4"><?php echo $isEdit ? 'Update Member' : 'Save Member'; ?></button> </div> </form> </div> </div> <?php else: ?> <!-- List View --> <div class="card border-0 shadow-sm rounded-4"> <div class="card-body p-0"> <div class="table-responsive"> <table class="table table-hover align-middle mb-0"> <thead class="table-light"> <tr> <th class="ps-4">Photo</th> <th>Name</th> <th>Designation</th> <th>Order</th> <th class="text-end pe-4">Actions</th> </tr> </thead> <tbody> <?php if(empty($data['team'])): ?> <tr> <td colspan="5" class="text-center py-5 text-muted"> <i class="fas fa-users-slash fs-2 mb-3 d-block"></i> No team members found. Add some team members to show them on the site. </td> </tr> <?php else: ?> <?php foreach($data['team'] as $member): ?> <tr> <td class="ps-4"> <span class="d-inline-flex align-items-center justify-content-center bg-light text-navy rounded-circle" style="width: 45px; height: 45px; overflow: hidden;"> <?php if(!empty($member->photo_url)): ?> <img src="<?php echo URLROOT; ?>/<?php echo ltrim(htmlspecialchars($member->photo_url), '/'); ?>" alt="<?php echo htmlspecialchars($member->name); ?>" style="width: 100%; height: 100%; object-fit: cover;"> <?php else: ?> <i class="fas fa-user fs-5 text-secondary"></i> <?php endif; ?> </span> </td> <td class="fw-bold text-navy"><?php echo htmlspecialchars($member->name); ?></td> <td class="text-muted"><?php echo htmlspecialchars($member->designation); ?></td> <td><span class="badge bg-secondary rounded-pill"><?php echo $member->order_index; ?></span></td> <td class="text-end pe-4"> <a href="<?php echo URLROOT; ?>/admin/team/edit/<?php echo $member->id; ?>" class="btn btn-sm btn-outline-navy me-1 rounded-pill px-3"> <i class="fas fa-edit me-1"></i> Edit </a> <a href="<?php echo URLROOT; ?>/admin/team/delete/<?php echo $member->id; ?>" class="btn btn-sm btn-outline-danger rounded-pill px-3" onclick="return confirm('Are you sure you want to delete this team member?');"> <i class="fas fa-trash me-1"></i> Delete </a> </td> </tr> <?php endforeach; ?> <?php endif; ?> </tbody> </table> </div> </div> <!-- Pagination --> <?php if(isset($data['total_pages']) && $data['total_pages'] > 1): ?> <div class="card-footer bg-white border-top py-3 d-flex justify-content-between align-items-center" style="border-bottom-left-radius: 12px; border-bottom-right-radius: 12px;"> <div class="text-muted small"> Showing page <strong><?php echo $data['current_page']; ?></strong> of <strong><?php echo $data['total_pages']; ?></strong> </div> <nav aria-label="Page navigation"> <ul class="pagination pagination-sm mb-0"> <li class="page-item <?php echo ($data['current_page'] <= 1) ? 'disabled' : ''; ?>"> <a class="page-link border-light text-navy rounded-circle me-1" href="?page=<?php echo $data['current_page'] - 1; ?>" aria-label="Previous"> <span aria-hidden="true">«</span> </a> </li> <?php for($i = 1; $i <= $data['total_pages']; $i++): ?> <li class="page-item <?php echo ($data['current_page'] == $i) ? 'active' : ''; ?>"> <a class="page-link border-light rounded-circle me-1 <?php echo ($data['current_page'] == $i) ? 'bg-navy border-navy text-white' : 'text-navy'; ?>" href="?page=<?php echo $i; ?>"><?php echo $i; ?></a> </li> <?php endfor; ?> <li class="page-item <?php echo ($data['current_page'] >= $data['total_pages']) ? 'disabled' : ''; ?>"> <a class="page-link border-light text-navy rounded-circle" href="?page=<?php echo $data['current_page'] + 1; ?>" aria-label="Next"> <span aria-hidden="true">»</span> </a> </li> </ul> </nav> </div> <?php endif; ?> </div> <?php endif; ?> <?php require APPROOT . '/views/layouts/admin_footer.php'; ?>
Save Changes
Cancel
Create New File
Create New Folder