google_forms/application/views/publish_view.php

152 lines
4.7 KiB
PHP

<style>
/* CSS styles */
.title-column {
color: darkblue;
/* Dark blue color for title */
}
.draft-row {
background-color: #f0f0f0;
/* Light grey background for draft status */
}
.switch {
position: relative;
display: inline-block;
width: 34px;
height: 20px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 14px;
width: 14px;
left: 3px;
bottom: 3px;
background-color: white;
transition: .4s;
}
input:checked+.slider {
background-color: #673AB7;
}
input:checked+.slider:before {
transform: translateX(14px);
}
/* Rounded sliders */
.slider.round {
border-radius: 20px;
}
.slider.round:before {
border-radius: 50%;
}
.switch {
position: relative;
display: inline-block;
}
.switch .tooltip {
visibility: hidden;
width: 70px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 5px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: 125%;
/* Position above the switch */
left: 290%;
margin-left: -60px;
opacity: 0;
transition: opacity 0.3s;
}
.switch:hover .tooltip {
visibility: visible;
opacity: 1;
}
</style>
<div class="container">
<div class="row">
<div class="col-md-12 mt-4">
<div class="card">
<div class="card-header">
<?php if ($this->session->flashdata('status')): ?>
<div class="alert alert-success">
<?= $this->session->flashdata('status'); ?>
</div>
<?php endif; ?>
<h3>
Published Forms
</h3>
</div>
<div class="card-body">
<!-- here your table will occur -->
<table id="basetable1" class="table table-bordered">
<thead>
<tr>
<th>Responses</th>
<th>Title</th>
<th>Response Link</th>
<th>Status</th>
<th>Preview</th>
</tr>
</thead>
<tbody>
<?php $serialNumber = 1;
foreach ($forms as $row): ?>
<tr>
<td><?php echo $serialNumber++; ?></td>
<td class="title-column">
<?php echo $row->title; ?>
</td>
<td>
<a href="<?php echo $row->response_link; ?>"
target="_blank"><?php echo $row->response_link; ?></a>
</td>
<td>
<label class="switch">
<input type="checkbox" class="toggle-switch"
data-form-id="<?php echo $row->id; ?>" <?php echo $row->is_responsive ? 'checked' : ''; ?>>
<span class="slider round"></span>
<span
class="tooltip"><?php echo $row->is_responsive ? 'Active' : 'Disabled'; ?>
</span>
</label>
</td>
<td>
<a href="<?php echo base_url('form_preview/' . $row->id); ?>">
<i class="fas fa-eye"></i> <!-- Eye icon -->
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>