Added field qtyacquired

parent 2af31e8f
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "ce63645072785d61c343bdef07061ae2", "hash": "b3178a5d5f722fad84f4c0311d54457a",
"content-hash": "86cc938c4ba809f58f72c6f3c4a9d635", "content-hash": "f000cf68a96e1a870a120eb816628d24",
"packages": [ "packages": [
{ {
"name": "container-interop/container-interop", "name": "container-interop/container-interop",
...@@ -1079,16 +1079,16 @@ ...@@ -1079,16 +1079,16 @@
}, },
{ {
"name": "slim/slim", "name": "slim/slim",
"version": "3.4.2", "version": "3.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/slimphp/Slim.git", "url": "https://github.com/slimphp/Slim.git",
"reference": "a132385f736063d00632b52b3f8a389fe66fe4fa" "reference": "184352bc1913d7ba552ab4131d62f4730ddb0893"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/a132385f736063d00632b52b3f8a389fe66fe4fa", "url": "https://api.github.com/repos/slimphp/Slim/zipball/184352bc1913d7ba552ab4131d62f4730ddb0893",
"reference": "a132385f736063d00632b52b3f8a389fe66fe4fa", "reference": "184352bc1913d7ba552ab4131d62f4730ddb0893",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -1145,7 +1145,7 @@ ...@@ -1145,7 +1145,7 @@
"micro", "micro",
"router" "router"
], ],
"time": "2016-05-25 11:23:38" "time": "2016-07-26 15:12:13"
}, },
{ {
"name": "slim/twig-view", "name": "slim/twig-view",
......
...@@ -14,10 +14,10 @@ return [ ...@@ -14,10 +14,10 @@ return [
'module/authentication/bootstrap.php', 'module/authentication/bootstrap.php',
'module/authorization/bootstrap.php', 'module/authorization/bootstrap.php',
'module/sch_ldap/bootstrap.php', 'module/sch_ldap/bootstrap.php',
'module/sch_sso/bootstrap.php', // 'module/sch_sso/bootstrap.php',
'module/sch_mm/bootstrap.php', 'module/sch_mm/bootstrap.php',
'module/sch_inventory/bootstrap.php', 'module/sch_inventory/bootstrap.php',
'module/sch_sync/bootstrap.php', // 'module/sch_sync/bootstrap.php',
'module/schools/bootstrap.php', 'module/schools/bootstrap.php',
'module/application_form/bootstrap.php', 'module/application_form/bootstrap.php',
'module/tpe_survey/bootstrap.php', 'module/tpe_survey/bootstrap.php',
......
...@@ -51,6 +51,7 @@ CREATE TABLE `applicationformitem` ( ...@@ -51,6 +51,7 @@ CREATE TABLE `applicationformitem` (
`reasons` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `reasons` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`applicationform_id` int(11) unsigned NOT NULL, `applicationform_id` int(11) unsigned NOT NULL,
`lab_id` int(11) unsigned NOT NULL, `lab_id` int(11) unsigned NOT NULL,
`qtyacquired` int(11) unsigned DEFAULT 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `index_foreignkey_applicationformitem_itemcategory` (`itemcategory_id`), KEY `index_foreignkey_applicationformitem_itemcategory` (`itemcategory_id`),
KEY `index_foreignkey_applicationformitem_applicationform` (`applicationform_id`), KEY `index_foreignkey_applicationformitem_applicationform` (`applicationform_id`),
...@@ -158,6 +159,7 @@ DROP TABLE IF EXISTS `itemcategory`; ...@@ -158,6 +159,7 @@ DROP TABLE IF EXISTS `itemcategory`;
CREATE TABLE `itemcategory` ( CREATE TABLE `itemcategory` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`groupflag` int(11) unsigned DEFAULT 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`) UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
......
...@@ -51,6 +51,7 @@ CREATE TABLE `applicationformitem` ( ...@@ -51,6 +51,7 @@ CREATE TABLE `applicationformitem` (
`reasons` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `reasons` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`applicationform_id` int(11) unsigned NOT NULL, `applicationform_id` int(11) unsigned NOT NULL,
`lab_id` int(11) unsigned NOT NULL, `lab_id` int(11) unsigned NOT NULL,
`qtyacquired` int(11) unsigned DEFAULT 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `index_foreignkey_applicationformitem_itemcategory` (`itemcategory_id`), KEY `index_foreignkey_applicationformitem_itemcategory` (`itemcategory_id`),
KEY `index_foreignkey_applicationformitem_applicationform` (`applicationform_id`), KEY `index_foreignkey_applicationformitem_applicationform` (`applicationform_id`),
......
...@@ -28,6 +28,7 @@ class ApplicationFormService implements ApplicationFormServiceInterface ...@@ -28,6 +28,7 @@ class ApplicationFormService implements ApplicationFormServiceInterface
$item->lab_id = $itemData['lab_id']; $item->lab_id = $itemData['lab_id'];
$item->itemcategory_id = $itemData['itemcategory_id']; $item->itemcategory_id = $itemData['itemcategory_id'];
$item->qty = $itemData['qty']; $item->qty = $itemData['qty'];
$item->qtyacquired = $itemData['qtyacquired'];
$item->reasons = $itemData['reasons']; $item->reasons = $itemData['reasons'];
$items[] = $item; $items[] = $item;
} }
......
...@@ -16,6 +16,7 @@ use Slim\Http\Response; ...@@ -16,6 +16,7 @@ use Slim\Http\Response;
use Slim\Views\Twig; use Slim\Views\Twig;
use Zend\Authentication\Adapter\ValidatableAdapterInterface; use Zend\Authentication\Adapter\ValidatableAdapterInterface;
use Zend\Authentication\AuthenticationService; use Zend\Authentication\AuthenticationService;
use Zend\Crypt\Password\Bcrypt;
class Login class Login
{ {
...@@ -63,6 +64,17 @@ class Login ...@@ -63,6 +64,17 @@ class Login
{ {
if ($req->isPost()) { if ($req->isPost()) {
$adapter = $this->authService->getAdapter(); $adapter = $this->authService->getAdapter();
/* $bcrypt = new Bcrypt([
'salt' => 'local1local2local',
'cost' => 14,
]);
$securePass = $bcrypt->create(trim("panilithios")); */
if ($adapter instanceof ValidatableAdapterInterface) { if ($adapter instanceof ValidatableAdapterInterface) {
$adapter->setIdentity($req->getParam('identity')); $adapter->setIdentity($req->getParam('identity'));
$adapter->setCredential($req->getParam('credential')); $adapter->setCredential($req->getParam('credential'));
...@@ -72,6 +84,10 @@ class Login ...@@ -72,6 +84,10 @@ class Login
if (!$result->isValid()) { if (!$result->isValid()) {
$this->flash->addMessage('danger', reset($result->getMessages())); $this->flash->addMessage('danger', reset($result->getMessages()));
/*
$this->flash->addMessage('danger', $req->getParam('identity'));
$this->flash->addMessage('danger', $req->getParam('credential'));
$this->flash->addMessage('danger', $securePass); */
return $res->withRedirect($req->getUri()); return $res->withRedirect($req->getUri());
} }
......
...@@ -77,6 +77,7 @@ class SyncFromInventory ...@@ -77,6 +77,7 @@ class SyncFromInventory
{ {
$school = $this->schoolService->getSchool($school_id); $school = $this->schoolService->getSchool($school_id);
try { try {
/* inventory service called once here. Returns $equipment object */
$equipment = $this->inventoryService->getUnitEquipment($school['registry_no']); $equipment = $this->inventoryService->getUnitEquipment($school['registry_no']);
} catch (Exception $e) { } catch (Exception $e) {
$this->logger->error(sprintf('Problem retrieving assets from inventory for school %s', $school_id)); $this->logger->error(sprintf('Problem retrieving assets from inventory for school %s', $school_id));
......
/**
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
(function ($, _, utils) {
'use strict';
var ModalView;
ModalView = Backbone.View.extend({
el: '#tpe_survey-form-modal',
model: null,
template: null,
events: {
'submit': 'submitForm'
},
initialize: function () {
this.model = null,
this.template = _.template(this.$el.find('.modal-content script[type="text/template"]').html());
},
render: function () {
var that = this,
html,
url;
if (!this.model) return this;
html = this.template({teacher: this.model.toJSON()});
url = this.$el.find('form').attr('action');
this.$el.find('.modal-content').html(html);
$.ajax({
url: url,
type: 'get',
dataType: 'json',
data: {
teacher_id: that.model.get('id')
}
}).done(function (response) {
var elements = $(that.$el.find('form')[0].elements),
prop,
element;
for (prop in response) {
if (response.hasOwnProperty(prop)) {
elements.closest('[name^="' + prop + '"]').each(function (i, element){
element = $(element);
if ('text' === element.attr('type') && /^assets_in_use/.test(element.attr('name'))) {
element.val(response[prop][response[prop].length - 1]);
} else if ('checkbox' === element.attr('type')) {
element.prop('checked', -1 !== _.indexOf(response[prop], element.val()));
} else {
element.val(response[prop] || '');
}
});
}
}
}).always(function (response) {
that.show();
});
return this;
},
show: function () {
this.$el.modal('show');
return this;
},
hide: function () {
this.$el.modal('hide');
return this;
},
submitForm: function (evt) {
var that = this,
form = this.$el.find('form'),
url = form.attr('action'),
data = utils.serializeObject(form);
evt.preventDefault();
$.ajax({
url: url,
type: 'post',
dataType: 'json',
data: data,
}).done(function (response) {
that.hide();
}).fail(function (xhr, err) {
var messages;
if (422 === xhr.status) {
messages = JSON.parse(xhr.responseText).messages || {};
utils.formMessages.render(form, messages);
} else {
alert('Προέκυψε κάποιο σφάλμα');
}
});
return false;
}
});
var modal = new ModalView(),
staffModel = window.EDULABS.models.staff || {};
$('#school-staff table tbody').on('click', 'td.tpe_survey a', function (evt) {
var target = $(evt.target).closest('a'),
id = target.data('id'),
teacher = typeof staffModel.get === 'function' && staffModel.get(id);
evt.preventDefault();
if(!teacher) {
return;
}
modal.model = teacher;
modal.render();
});
$('#form-total-teachers').on('submit', function (evt) {
var that = $(this);
$.ajax({
url: that.attr('action'),
type: 'post',
dataType: 'json',
data: utils.serializeObject(that)
}).fail(function (xhr, err) {
var messages;
if (422 === xhr.status) {
messages = JSON.parse(xhr.responseText).messages || {};
utils.formMessages.render(that, messages);
} else {
alert('Προέκυψε κάποιο σφάλμα');
}
});
evt.preventDefault();
});
(function () {
var origA, origB;
$('#tpe_survey-form-modal').on('change', 'select#el-already_using_tpe', function (evt) {
if (!origA) {
origA = $('.assets_in_use-container > .form-group > label').html();
}
if (!origB) {
origB = $('.software_in_use-container > .form-group > label').html();
}
if ($(this).val() === 'ΟΧΙ') {
$('.assets_in_use-container > .form-group > label').html('Υλικό που θα χρησιμοποιούσε');
$('.software_in_use-container > .form-group > label').html('Λογισμικό που θα χρησιμοποιούσε');
} else {
$('.assets_in_use-container > .form-group > label').html(origA);
$('.software_in_use-container > .form-group > label').html(origB);
}
});
} ());
}(jQuery, _, window.EDULABS.utils));
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