mark a lab as new

parent 6d920643
...@@ -185,6 +185,7 @@ CREATE TABLE `lab` ( ...@@ -185,6 +185,7 @@ CREATE TABLE `lab` (
`school_id` int(11) unsigned NOT NULL, `school_id` int(11) unsigned NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`labtype_id` int(11) unsigned NOT NULL, `labtype_id` int(11) unsigned NOT NULL,
`is_new` tinyint(1) unsigned DEFAULT 0,
`responsible_id` int(11) unsigned DEFAULT NULL, `responsible_id` int(11) unsigned DEFAULT NULL,
`area` int(11) unsigned DEFAULT NULL, `area` int(11) unsigned DEFAULT NULL,
`attachment` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `attachment` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</div> </div>
<footer class="footer"> <footer class="footer">
<p> <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> </p>
</footer> </footer>
</div> </div>
......
...@@ -124,6 +124,7 @@ CREATE TABLE `lab` ( ...@@ -124,6 +124,7 @@ CREATE TABLE `lab` (
`school_id` int(11) unsigned NOT NULL, `school_id` int(11) unsigned NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`labtype_id` int(11) unsigned NOT NULL, `labtype_id` int(11) unsigned NOT NULL,
`is_new` tinyint(1) unsigned DEFAULT 0,
`responsible_id` int(11) unsigned DEFAULT NULL, `responsible_id` int(11) unsigned DEFAULT NULL,
`area` int(11) unsigned DEFAULT NULL, `area` int(11) unsigned DEFAULT NULL,
`attachment` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `attachment` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
......
...@@ -73,7 +73,9 @@ class ListAssets ...@@ -73,7 +73,9 @@ class ListAssets
}, $itemCategories), }, $itemCategories),
'labs' => array_map(function ($lab) { 'labs' => array_map(function ($lab) {
return ['value' => $lab['id'], 'label' => $lab['name']]; return ['value' => $lab['id'], 'label' => $lab['name']];
}, $labs), }, array_filter($labs, function ($lab) {
return $lab['is_new'] !== "1";
})),
]); ]);
} }
} }
...@@ -43,6 +43,11 @@ class Lab ...@@ -43,6 +43,11 @@ class Lab
$labTypeId->getValidatorChain() $labTypeId->getValidatorChain()
->attach(new Validator\NotEmpty()); ->attach(new Validator\NotEmpty());
$isNew = new Input('is_new');
$isNew->setRequired(false)
->getFilterChain()
->attach(new Filter\ToInt());
$responsibleId = new Input('responsible_id'); $responsibleId = new Input('responsible_id');
$responsibleId->setRequired(false) $responsibleId->setRequired(false)
->getValidatorChain() ->getValidatorChain()
...@@ -115,6 +120,7 @@ class Lab ...@@ -115,6 +120,7 @@ class Lab
->add($id) ->add($id)
->add($name) ->add($name)
->add($labTypeId) ->add($labTypeId)
->add($isNew)
->add($responsibleId) ->add($responsibleId)
->add($area) ->add($area)
->add($lessons) ->add($lessons)
......
...@@ -47,6 +47,7 @@ class LabService implements LabServiceInterface ...@@ -47,6 +47,7 @@ class LabService implements LabServiceInterface
$lab->school_id = $data['school_id']; $lab->school_id = $data['school_id'];
$lab->name = $data['name']; $lab->name = $data['name'];
$lab->labtype_id = $data['labtype_id']; $lab->labtype_id = $data['labtype_id'];
$lab->is_new = isset($data['is_new']);
$lab->area = $data['area']; $lab->area = $data['area'];
$lab->sharedLesson = $this->getLessonsById($data['lessons']); $lab->sharedLesson = $this->getLessonsById($data['lessons']);
$lab->use_ext_program = $data['use_ext_program']; $lab->use_ext_program = $data['use_ext_program'];
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
<tr> <tr>
<th>Ονομασία</th> <th>Ονομασία</th>
<th>Τύπος</th> <th>Τύπος</th>
<th>Δημιουργία νέου χώρου</th>
<th>Υπεύθυνος</th> <th>Υπεύθυνος</th>
<th>Δίκτυο</th> <th>Δίκτυο</th>
<th>Server</th> <th>Server</th>
...@@ -51,6 +52,7 @@ ...@@ -51,6 +52,7 @@
<tr data-lab="{{ lab|json_encode }}" data-id="{{ lab.id }}"> <tr data-lab="{{ lab|json_encode }}" data-id="{{ lab.id }}">
<td>{{ lab.name }}</td> <td>{{ lab.name }}</td>
<td>{{ lab.labtype }}</td> <td>{{ lab.labtype }}</td>
<td>{{ lab.is_new ? 'ΝΑΙ' : 'ΟΧΙ' }}</td>
<td>{{ lab.responsible }}</td> <td>{{ lab.responsible }}</td>
<td>{{ lab.has_network }}</td> <td>{{ lab.has_network }}</td>
<td>{{ lab.has_server }}</td> <td>{{ lab.has_server }}</td>
...@@ -58,7 +60,7 @@ ...@@ -58,7 +60,7 @@
</tr> </tr>
{% else %} {% else %}
<tr> <tr>
<td colspan="6" class="no-records text-center text-muted"> <td colspan="7" class="no-records text-center text-muted">
Δεν έχουν καταχωρηθεί χώροι. Δεν έχουν καταχωρηθεί χώροι.
</td> </td>
</tr> </tr>
...@@ -66,7 +68,7 @@ ...@@ -66,7 +68,7 @@
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="6"></td> <td colspan="7"></td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
...@@ -86,6 +88,7 @@ ...@@ -86,6 +88,7 @@
{{ macros.input('name', 'Όνομα', '', 'text', {'required': ''}) }} {{ macros.input('name', 'Όνομα', '', 'text', {'required': ''}) }}
{{ macros.select('responsible_id', 'Υπεύθυνος', staff, '', {'required': ''}) }} {{ macros.select('responsible_id', 'Υπεύθυνος', staff, '', {'required': ''}) }}
{{ macros.select('labtype_id', 'Τύπος', lab_types, '', {'required': ''}) }} {{ macros.select('labtype_id', 'Τύπος', lab_types, '', {'required': ''}) }}
{{ macros.checkbox('is_new', 'Δημιουργία νέου χώρου') }}
{{ macros.select('has_network', 'Δίκτυο', network_options, '', {'required': ''}) }} {{ macros.select('has_network', 'Δίκτυο', network_options, '', {'required': ''}) }}
{{ macros.select('has_server', 'Ύπαρξη server', server_options, '', {'required': ''}) }} {{ macros.select('has_server', 'Ύπαρξη server', server_options, '', {'required': ''}) }}
{{ macros.input('area', 'Επιφάνεια (m<sup>2</sup>)', '', 'number', {'required': '', 'min': 0, 'max': 500}) }} {{ macros.input('area', 'Επιφάνεια (m<sup>2</sup>)', '', 'number', {'required': '', 'min': 0, 'max': 500}) }}
...@@ -109,6 +112,7 @@ ...@@ -109,6 +112,7 @@
<script type="text/template" id="lab-row-template"> <script type="text/template" id="lab-row-template">
<td><%= lab.name %></td> <td><%= lab.name %></td>
<td><%= lab.labtype %></td> <td><%= lab.labtype %></td>
<td><%= parseInt(lab.is_new, 10) ? 'ΝΑΙ' : 'OXI' %></td>
<td><%= lab.responsible %></td> <td><%= lab.responsible %></td>
<td><%= lab.has_network %></td> <td><%= lab.has_network %></td>
<td><%= lab.has_server %></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