mark a lab as new

parent 6d920643
......@@ -185,6 +185,7 @@ CREATE TABLE `lab` (
`school_id` int(11) unsigned NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`labtype_id` int(11) unsigned NOT NULL,
`is_new` tinyint(1) unsigned DEFAULT 0,
`responsible_id` int(11) unsigned DEFAULT NULL,
`area` int(11) unsigned DEFAULT NULL,
`attachment` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
......
......@@ -32,7 +32,7 @@
</div>
<footer class="footer">
<p>
&copy; 2008-{{ "now"|date("Y") }} <a href="https://github.com/eellak/gredu_labs" target="_blank">Greek Free/Open Source Software Society</a>
Copyright &copy; {{ "now"|date("Y") }} <a href="http://www.minedu.gov.gr/" target="_blank">Υπουργείο Παιδείας, Έρευνας & Θρησκευμάτων</a>
</p>
</footer>
</div>
......
......@@ -124,6 +124,7 @@ CREATE TABLE `lab` (
`school_id` int(11) unsigned NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`labtype_id` int(11) unsigned NOT NULL,
`is_new` tinyint(1) unsigned DEFAULT 0,
`responsible_id` int(11) unsigned DEFAULT NULL,
`area` int(11) unsigned DEFAULT NULL,
`attachment` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
......
......@@ -73,7 +73,9 @@ class ListAssets
}, $itemCategories),
'labs' => array_map(function ($lab) {
return ['value' => $lab['id'], 'label' => $lab['name']];
}, $labs),
}, array_filter($labs, function ($lab) {
return $lab['is_new'] !== "1";
})),
]);
}
}
......@@ -43,6 +43,11 @@ class Lab
$labTypeId->getValidatorChain()
->attach(new Validator\NotEmpty());
$isNew = new Input('is_new');
$isNew->setRequired(false)
->getFilterChain()
->attach(new Filter\ToInt());
$responsibleId = new Input('responsible_id');
$responsibleId->setRequired(false)
->getValidatorChain()
......@@ -115,6 +120,7 @@ class Lab
->add($id)
->add($name)
->add($labTypeId)
->add($isNew)
->add($responsibleId)
->add($area)
->add($lessons)
......
......@@ -47,6 +47,7 @@ class LabService implements LabServiceInterface
$lab->school_id = $data['school_id'];
$lab->name = $data['name'];
$lab->labtype_id = $data['labtype_id'];
$lab->is_new = isset($data['is_new']);
$lab->area = $data['area'];
$lab->sharedLesson = $this->getLessonsById($data['lessons']);
$lab->use_ext_program = $data['use_ext_program'];
......
......@@ -40,6 +40,7 @@
<tr>
<th>Ονομασία</th>
<th>Τύπος</th>
<th>Δημιουργία νέου χώρου</th>
<th>Υπεύθυνος</th>
<th>Δίκτυο</th>
<th>Server</th>
......@@ -51,6 +52,7 @@
<tr data-lab="{{ lab|json_encode }}" data-id="{{ lab.id }}">
<td>{{ lab.name }}</td>
<td>{{ lab.labtype }}</td>
<td>{{ lab.is_new ? 'ΝΑΙ' : 'ΟΧΙ' }}</td>
<td>{{ lab.responsible }}</td>
<td>{{ lab.has_network }}</td>
<td>{{ lab.has_server }}</td>
......@@ -58,7 +60,7 @@
</tr>
{% else %}
<tr>
<td colspan="6" class="no-records text-center text-muted">
<td colspan="7" class="no-records text-center text-muted">
Δεν έχουν καταχωρηθεί χώροι.
</td>
</tr>
......@@ -66,7 +68,7 @@
</tbody>
<tfoot>
<tr>
<td colspan="6"></td>
<td colspan="7"></td>
</tr>
</tfoot>
</table>
......@@ -86,6 +88,7 @@
{{ macros.input('name', 'Όνομα', '', 'text', {'required': ''}) }}
{{ macros.select('responsible_id', 'Υπεύθυνος', staff, '', {'required': ''}) }}
{{ macros.select('labtype_id', 'Τύπος', lab_types, '', {'required': ''}) }}
{{ macros.checkbox('is_new', 'Δημιουργία νέου χώρου') }}
{{ macros.select('has_network', 'Δίκτυο', network_options, '', {'required': ''}) }}
{{ macros.select('has_server', 'Ύπαρξη server', server_options, '', {'required': ''}) }}
{{ macros.input('area', 'Επιφάνεια (m<sup>2</sup>)', '', 'number', {'required': '', 'min': 0, 'max': 500}) }}
......@@ -109,6 +112,7 @@
<script type="text/template" id="lab-row-template">
<td><%= lab.name %></td>
<td><%= lab.labtype %></td>
<td><%= parseInt(lab.is_new, 10) ? 'ΝΑΙ' : 'OXI' %></td>
<td><%= lab.responsible %></td>
<td><%= lab.has_network %></td>
<td><%= lab.has_server %></td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment