From dd7783956967763a2295c53816330499b935f1f7 Mon Sep 17 00:00:00 2001 From: "de@itstall.de" <de@itstall.de> Date: Thu, 8 Mar 2018 20:58:37 +0100 Subject: [PATCH] Guest pilot registration --- application/controllers/admin/Dashboard.php | 1 + application/controllers/admin/Guests.php | 7 ++ application/models/admin/Dashboard_model.php | 3 + application/models/admin/Guests_model.php | 7 ++ application/views/admin/dashboard/index.php | 11 ++- .../views/admin/guests/guests_bookings.php | 87 +++++++++++++++++++ application/views/admin/include/sidebar.php | 1 + 7 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 application/views/admin/guests/guests_bookings.php diff --git a/application/controllers/admin/Dashboard.php b/application/controllers/admin/Dashboard.php index 5b8428b..09a44d5 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 ccec588..1644b24 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 6c790ac..203693e 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 e18f3e6..04a7edd 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 ecc24a3..9b5b453 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 0000000..ebf66cd --- /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 cc18026..d68da55 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> -- GitLab