BBnepal-Accounts/application/views/admin/school-calendar.php

273 lines
22 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<div class="wraper responsive-width">
<main>
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<div class="subsec_sec">
<div class="subject_r subject_r_lng">
<div class="subject_lsec">
<div class="mb-0">
<nav aria-label="breadcrumb">
<ol class="breadcrumb bg-primary">
<li class="breadcrumb-item"><a href="<?= base_url() . 'dashboard' ?>">Dashboard</a></li>
<li class="breadcrumb-item active" aria-current="page"><?= $title ?></li>
</ol>
</nav>
</div>
<?php if ($this->session->flashdata('success')) { ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<p><b> Success !</b> <?php echo $this->session->flashdata('success') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<?php if ($this->session->flashdata('danger')) { ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<p><b> Error !</b> <?php echo $this->session->flashdata('danger') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<div class="py-3">
<a href="<?= base_url(); ?>admin/event-types" type="button" class="btn btn-sm btn-outline-success float-right">
Event Types
</a>
<div class="clearfix"></div>
</div>
<div class="row justify-content-center">
<div class="col-md-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">Add Event</h5>
<!-- <?php echo base_url(); ?>department -->
<form method="post" action="<?php echo base_url(); ?>admin/school-calendar">
<div class="form-group">
<label class="has-float-label">
<input type="text" id="title" name="title" class=" form-control" placeholder='Enter title' required>
<span>Title</span>
</label>
</div>
<?php //print_r($event_types);
?>
<div class="col form-group px-0">
<label class="has-float-label">
<select id="event_type" class="form-control custom-select" placeholder="Select event type" name="event_type" required>
<option value="0">
Select Event Type
</option>
<?php
foreach ($event_types as $et_key => $event_type) {
?>
<option value="<?= $event_type['id'] ?>">
<?= $event_type['title'] ?>
</option>
<?php
}
?>
</select>
<span>Event Type <b class="text-danger">*</b></span>
</label>
</div>
<div class="form-group ">
<label class="has-float-label">
<input type="text" value="<?= $today_date ?>" name="event_date" id='event_date' class="nepal-date event_date form-control" placeholder="Date" width="100%" required>
<span>Date (In B.S.) <b class="text-danger">*</b></span>
</label>
</div>
<div class="form-group">
<label class="has-float-label">
<input type="text" value="<?= $today_date ?>" name="event_end_date" id='event_end_date' class="nepal-date event_end_date form-control" placeholder="Date" width="100%" required>
<span>End Date (In B.S.) <b class="text-danger">*</b></span>
</label>
</div>
<div class="form-group ">
<label class="has-float-label">
<textarea class="form-control" name="description" rows="4" cols="50"></textarea>
<span>Description</span>
</label>
</div>
<div class="text-center w-10 mt-4">
<input type="submit" name="addEvent" id="addEvent" class="btn btn-sm btn-success w-100" value="Add">
</div>
</form>
</div>
</div>
</div>
<div class="col-md-8 pl-0">
<div class="col-md-12 border rounded py-3">
<!-- -->
<table id="tbl" class="display table-responsive">
<thead>
<tr>
<th class="textCenter">S.No</th>
<th class="textCenter">Title</th>
<th class="textCenter">Type</th>
<th class="textCenter">Date</th>
<th class="textCenter">Is Active</th>
<th class="textCenter">Action</th>
</tr>
</thead>
<tbody>
<?php
// echo '<pre>';
// print_r($event_lists);
foreach ($event_lists as $eventKey => $event) {
?>
<tr>
<td><?= $eventKey + 1 ?></td>
<td class="text-left"><?= $event['title'] ?></td>
<td class="text-left">
<?php
$event_title = '';
foreach ($event_types as $et_key => $et_value) {
if ($et_value['id'] == $event['event_type']) {
$event_title = $et_value['title'];
}
}
echo !empty($event_title) ? $event_title : '-';
?>
</td>
<td>
<?= ucfirst($event['date']) ?>
</td>
<td>
<?= ucfirst($event['is_active']) ?>
</td>
<td>
<button type="button" class="btn btn-sm btn-outline-primary" data-toggle="modal" data-target="#updateModal<?= $event['id'] ?>">
<i class="fa fa-edit"></i>
</button>
<div class="modal fade" id="updateModal<?= $event['id'] ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Update</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="<?= base_url(); ?>admin/school-calendar" method="POST" onkeydown=" return event.key != 'Enter'">
<div class="modal-body">
<input type="hidden" name="eventId" value="<?= $event['id'] ?>">
<div class="form-group mb-0">
<label class="has-float-label">
<input type="text" id="title" name="title" class=" form-control" value="<?= $event['title'] ?>" placeholder='Enter event title' required>
<span>Event Title</span>
</label>
</div>
<div class="form-group mt-4 px-0">
<label class="has-float-label">
<select id="event_type" class="form-control custom-select" placeholder="Select event type" name="event_type" required>
<option value="0">
Select Event Type
</option>
<?php
foreach ($event_types as $et_key => $event_type) {
?>
<option value="<?= $event_type['id'] ?>" <?= $event_type['id'] == $event['event_type'] ? 'selected' : '' ?>>
<?= $event_type['title'] ?>
</option>
<?php
}
?>
</select>
<span>Event Type <b class="text-danger">*</b></span>
</label>
</div>
<div class="form-group mt-4">
<label class="has-float-label">
<input type="text" name="up_event_date" value="<?= $event['date'] ?>" id='up_event_date' class="up_event_date form-control" placeholder="Date" width="100%" required>
<span>Date (In B.S.) <b class="text-danger">*</b></span>
</label>
</div>
<div class="form-group">
<label class="has-float-label">
<input type="text" name="up_event_end_date" value="<?= $event['end_date'] ?>" id='up_event_end_date' class="up_event_end_date form-control" placeholder="Date" width="100%" required>
<span>End Date (In B.S.) <b class="text-danger">*</b></span>
</label>
</div>
<div class="form-group ">
<label class="has-float-label">
<textarea class="form-control" name="description" rows="4" cols="50"><?= $event['remarks'] ?></textarea>
<span>Description</span>
</label>
</div>
<div class="form-group mt-4">
<label class="has-float-label">
<select id="is_active" class="form-control custom-select" placeholder="Is Active" name="is_active">
<option value="yes" <?= $event['is_active'] == 'yes' ? 'selected' : '' ?>>
Yes
</option>
<option value="no" <?= $event['is_active'] == 'no' ? 'selected' : '' ?>>
No
</option>
</select>
<span>Is Active</span>
</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-danger" data-dismiss="modal">Close</button>
<input type="submit" name="deleteEvent" class="btn btn-sm float-left btn-warning" value="Delete">
<input type="submit" name="updateEvent" class="btn btn-sm btn-success" value="Update">
</div>
</form>
</div>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<script>
$(document).ready(function() {
//table js
$('#tbl').DataTable({
"lengthMenu": [
[25, 50, 100, 150, -1],
[25, 50, 100, 150, "All"]
]
});
//table js end
});
</script>