diff --git a/application/controllers/admin/Dashboard.php b/application/controllers/admin/Dashboard.php index 5b8428beed5cf8872c175a31cf77eb76ea5b4013..09a44d51babf7ce60f6b049bf9c1b70ab26fd5ed 100644 --- a/application/controllers/admin/Dashboard.php +++ b/application/controllers/admin/Dashboard.php @@ -20,6 +20,7 @@ $data['guests_per_year_guests'] = json_encode($guests_per_year['guests']); $data['changelog'] = $this->dashboard_model->get_changelog(); $data['history'] = $this->logging_model->history_get(10); + $data['bookings'] = $this->dashboard_model->get_bookings_count(); $data['view'] = 'admin/dashboard/index'; $this->load->view('admin/layout', $data); } diff --git a/application/controllers/admin/Guests.php b/application/controllers/admin/Guests.php index ccec5888dd7c85719f144ea7afd55e4ee70dbb56..1644b24cc9c41fa03a391be3c01139fb8158e341 100644 --- a/application/controllers/admin/Guests.php +++ b/application/controllers/admin/Guests.php @@ -131,5 +131,12 @@ $this->guests_model->visit_add($event, $this->input->post('guests_id')); redirect(base_url('admin/guests/visit_add/'.$event)); } + public function bookings() + { + $data['guests'] = $this->guests_model->bookings_get(); + $data['title'] = 'Gast Voranmeldungen'; + $data['view'] = 'admin/guests/guests_bookings'; + $this->load->view('admin/layout', $data); + } } ?> \ No newline at end of file diff --git a/application/models/admin/Dashboard_model.php b/application/models/admin/Dashboard_model.php index 6c790ac016136afeae74be862a29903ead771e4e..203693e4e772294cd2af9392f1093f26e667191d 100644 --- a/application/models/admin/Dashboard_model.php +++ b/application/models/admin/Dashboard_model.php @@ -58,5 +58,8 @@ $query = $this->db->get(); return $query->result_array(); } + public function get_bookings_count() { + return $this->db->count_all('guests_register'); + } } ?> \ No newline at end of file diff --git a/application/models/admin/Guests_model.php b/application/models/admin/Guests_model.php index e18f3e6926f77ad52656ab7e223fa293f714ecff..04a7edd657f438aaa764a95f9d977bcdc9ba860a 100644 --- a/application/models/admin/Guests_model.php +++ b/application/models/admin/Guests_model.php @@ -61,5 +61,12 @@ $query = $this->db->get(); return $result = $query->result_array(); } + public function bookings_get($limit=null) { + $this->db->select('guests_register.*'); + $this->db->from('guests_register'); + if($limit) { $this->db->limit($limit); } + $query = $this->db->get(); + return $result = $query->result_array(); + } } ?> \ No newline at end of file diff --git a/application/views/admin/dashboard/index.php b/application/views/admin/dashboard/index.php index ecc24a3b00d7d354f752e1ef0ea9f7ff5e60deb4..9b5b4537bc1860b7a59d613ca246c94d2e731db1 100644 --- a/application/views/admin/dashboard/index.php +++ b/application/views/admin/dashboard/index.php @@ -45,6 +45,15 @@ </div> </div> </div> + <div class="col-md-2 col-sm-6 col-xs-12"> + <div class="info-box"> + <span class="info-box-icon bg-aqua"><i class="fa fa-map-pin"></i></span> + <div class="info-box-content"> + <span class="info-box-text">Voranmeldungen</span> + <span class="info-box-number"><?= $bookings; ?></span> + </div> + </div> + </div> </div> <div class="row"> <div class="col-md-4 col-sm-4 col-xs-10"> @@ -62,7 +71,7 @@ </div> </div> </div> - <div class="col-md-6 col-sm-4 col-xs-10"> + <div class="col-md-4 col-sm-4 col-xs-8"> <div class="box box-info"> <div class="box-header with-border"> <h3 class="box-title">Gastpiloten (Flugfest)</h3> diff --git a/application/views/admin/guests/guests_bookings.php b/application/views/admin/guests/guests_bookings.php new file mode 100644 index 0000000000000000000000000000000000000000..ebf66cd4bbbead16dc49cec62e75b09cddab4ca7 --- /dev/null +++ b/application/views/admin/guests/guests_bookings.php @@ -0,0 +1,87 @@ +<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/r/bs/jszip-2.5.0,pdfmake-0.1.18,dt-1.10.9,b-1.0.3,b-html5-1.0.3,b-print-1.0.3/datatables.min.css" /> + +<section class="content"> + <div class="row"> + <div class="col-md-12"> + <div class="box box-body"> + <div class="col-md-6"> + <h4><i class="fa fa-address-book"></i> Voranmeldungen Gastpiloten</h4> + </div> + </div> + </div> + </div> + <div class="box border-top-solid"> + <div class="box-body table-responsive"> + <table id="example1" class="table table-bordered table-striped "> + <thead> + <tr> + <th>Vorname</th> + <th>Nachname</th> + <th>Straße</th> + <th>PLZ</th> + <th>Ort</th> + <th>Geburtstag</th> + <th>Email</th> + <th>Telefon</th> + <th>Versicherung</th> + <th>Verein</th> + <th>Camping</th> + </tr> + </thead> + <tbody> + <?php foreach($guests as $row): ?> + <tr> + <td><?= $row['firstname']; ?></td> + <td><?= $row['lastname']; ?></td> + <td><?= $row['street']; ?></td> + <td><?= $row['zip']; ?></td> + <td><?= $row['town']; ?></td> + <td><?= date_to_german($row['birthday']); ?></td> + <td><?= $row['email']; ?></td> + <td><?= $row['phone']; ?></td> + <td><?= $row['insurance_number']; ?></td> + <td><?= $row['club']; ?></td> + <td><?= $row['camping']; ?></td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + </div> + </div> +</section> + +<script type="text/javascript" src="https://cdn.datatables.net/r/bs/jszip-2.5.0,pdfmake-0.1.18,dt-1.10.9,b-1.0.3,b-html5-1.0.3,b-print-1.0.3/datatables.min.js"></script> +<script> + $(function () { + var example1 = $("#example1").DataTable({ + responsive: true, + lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "Alle"]], + buttons: ['excelHtml5', 'pdfHtml5'], + language: { + "sEmptyTable": "Keine Daten in der Tabelle vorhanden", + "sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen", + "sInfoEmpty": "0 bis 0 von 0 Einträgen", + "sInfoFiltered": "(gefiltert von _MAX_ Einträgen)", + "sInfoPostFix": "", + "sInfoThousands": ".", + "sLengthMenu": "_MENU_ Einträge anzeigen", + "sLoadingRecords": "Wird geladen...", + "sProcessing": "Bitte warten...", + "sSearch": "Suchen", + "sZeroRecords": "Keine Einträge vorhanden.", + "oPaginate": { + "sFirst": "Erste", + "sPrevious": "Zurück", + "sNext": "Nächste", + "sLast": "Letzte" + }, + "oAria": { + "sSortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren", + "sSortDescending": ": aktivieren, um Spalte absteigend zu sortieren" + } + } + }); + example1.buttons().container().appendTo($('.col-sm-6:eq(0)', example1.table().container())); + }); + $("#guests_bookings").addClass('active'); +</script> \ No newline at end of file diff --git a/application/views/admin/include/sidebar.php b/application/views/admin/include/sidebar.php index cc180262d5626d063c075ebf0c56e1a8def3a360..d68da5534d96a3502fcc51355ab95932b247cec0 100644 --- a/application/views/admin/include/sidebar.php +++ b/application/views/admin/include/sidebar.php @@ -54,6 +54,7 @@ $cur_tab = $this->uri->segment(2)==''?'dashboard': $this->uri->segment(2); <ul class="treeview-menu"> <li id="guests_add" class=""><a href="<?= base_url('admin/guests/add'); ?>"><i class="fa fa-plus"></i> Gast hinzufügen</a></li> <li id="guests_list" class=""><a href="<?= base_url('admin/guests'); ?>"><i class="fa fa-address-book"></i> Gäste anzeigen</a></li> + <li id="guests_bookings" class=""><a href="<?= base_url('admin/guests/bookings'); ?>"><i class="fa fa-hand-pointer"></i> Voranmeldungen</a></li> <li id="guests_visit_add" class=""><a href="<?= base_url('admin/guests/visit_add'); ?>"><i class="fa fa-user-plus"></i> Besuch erfassen</a></li> </ul> </li>