Commit 76b32fde authored by Γιάννης Δαγκουλής's avatar Γιάννης Δαγκουλής

Merge branch 'AngularTaxisAuthentication' into 'AngularTaxisAuthentication'

# Conflicts:
#   dist/iekserver/modules/ready/jsonapi/README.md
#   dist/iekserver/modules/ready/jsonapi/jsonapi.info.yml
#   dist/iekserver/modules/ready/jsonapi/jsonapi.routing.yml
#   dist/iekserver/modules/ready/jsonapi/jsonapi.services.yml
#   dist/iekserver/modules/ready/jsonapi/src/Context/CurrentContext.php
#   dist/iekserver/modules/ready/jsonapi/src/Context/FieldResolver.php
#   dist/iekserver/modules/ready/jsonapi/src/Controller/EntityResource.php
#   dist/iekserver/modules/ready/jsonapi/src/Controller/RequestHandler.php
#   dist/iekserver/modules/ready/jsonapi/src/EventSubscriber/DefaultExceptionSubscriber.php
#   dist/iekserver/modules/ready/jsonapi/src/Exception/EntityAccessDeniedHttpException.php
#   dist/iekserver/modules/ready/jsonapi/src/Exception/UnprocessableHttpEntityException.php
#   dist/iekserver/modules/ready/jsonapi/src/JsonApiSpec.php
#   dist/iekserver/modules/ready/jsonapi/src/JsonapiServiceProvider.php
#   dist/iekserver/modules/ready/jsonapi/src/LinkManager/LinkManager.php
#   dist/iekserver/modules/ready/jsonapi/src/Normalizer/ConfigEntityNormalizer.php
#   dist/iekserver/modules/ready/jsonapi/src/Normalizer/EntityAccessDeniedHttpExceptionNormalizer.php
#   dist/iekserver/modules/ready/jsonapi/src/Normalizer/EntityNormalizer.php
#   dist/iekserver/modules/ready/jsonapi/src/Normalizer/EntityReferenceFieldNormalizer.php
#   dist/iekserver/modules/ready/jsonapi/src/Normalizer/FieldItemNormalizer.php
#   dist/iekserver/modules/ready/jsonapi/src/Normalizer/FieldNormalizer.php
#   dist/iekserver/modules/ready/jsonapi/src/Normalizer/HttpExceptionNormalizer.php
#   dist/iekserver/modules/ready/jsonapi/src/Normalizer/RelationshipItemNormalizer.php
#   dist/iekserver/modules/ready/jsonapi/src/Normalizer/RelationshipNormalizer.php
#   dist/iekserver/modules/ready/jsonapi/src/Normalizer/Value/FieldNormalizerValueInterface.php
#   dist/iekserver/modules/ready/jsonapi/src/Normalizer/Value/JsonApiDocumentTopLevelNormalizerValue.php
#   dist/iekserver/modules/ready/jsonapi/src/Query/QueryBuilder.php
#   dist/iekserver/modules/ready/jsonapi/src/ResourceResponse.php
#   dist/iekserver/modules/ready/jsonapi/src/Routing/Param/Filter.php
#   dist/iekserver/modules/ready/jsonapi/src/Routing/Param/OffsetPage.php
#   dist/iekserver/modules/ready/jsonapi/src/Routing/Param/Sort.php
#   dist/iekserver/modules/ready/jsonapi/src/Routing/RouteEnhancer.php
#   dist/iekserver/modules/ready/jsonapi/src/Routing/Routes.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Functional/JsonApiFunctionalTestBase.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Kernel/Controller/EntityResourceTest.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Kernel/JsonapiKernelTestBase.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Unit/Context/FieldResolverTest.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Unit/LinkManager/LinkManagerTest.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Unit/Normalizer/EntityReferenceFieldNormalizerTest.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Unit/Normalizer/Value/JsonApiDocumentTopLevelNormalizerValueTest.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Unit/Routing/Param/FilterTest.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Unit/Routing/Param/OffsetPageTest.php
#   dist/iekserver/modules/ready/jsonapi/tests/src/Unit/Routing/Param/SortTest.php
parents 63f90831 8bd7f078
......@@ -97,21 +97,43 @@ class AitisiEntity extends RevisionableContentEntityBase implements AitisiEntity
}
public function getStudent_id() {
public function getSchool() {
return $this->get('iek_id')->entity;
}
public function getSchoolId() {
return $this->get('iek_id')->value;
}
public function setSchoolId($studentId) {
$this->set('iek_id', $studentId);
return $this;
}
public function getStudent() {
return $this->get('student_id')->entity;
}
public function getStudentId() {
return $this->get('student_id')->value;
}
public function setStudent_id($student_id) {
public function setStudentId($student_id) {
$this->set('student_id', $student_id);
return $this;
}
public function getEidikotita() {
return $this->get('eidikotita_id')->entity;
}
public function getEidikotita_id() {
public function getEidikotitaId() {
return $this->get('eidikotita_id')->value;
}
public function setEidikotita_id($eidikotita_id) {
public function setEidikotitaId($eidikotita_id) {
$this->set('eidikotita_id', $eidikotita_id);
return $this;
}
......@@ -143,16 +165,65 @@ class AitisiEntity extends RevisionableContentEntityBase implements AitisiEntity
return $this;
}
public function getRegion_id() {
public function getRegion() {
return $this->get('region_id')->entity;
}
public function getRegionId() {
return $this->get('region_id')->value;
}
public function setRegion_id($region_id) {
public function setRegionId($region_id) {
$this->set('region_id', $region_id);
return $this;
}
/**
* {@inheritdoc}
*/
public function getState() {
return $this->get('state')->value;
}
/**
* {@inheritdoc}
*/
public function setState($state) {
$this->set('state', $state);
return $this;
}
/**
* {@inheritdoc}
*/
public function getFlagiek() {
return $this->get('flagiek')->value;
}
/**
* {@inheritdoc}
*/
public function setFlagiek($flagiek) {
$this->set('flagiek', $flagiek);
return $this;
}
/**
* {@inheritdoc}
*/
public function getFlagbank() {
return $this->get('flagbank')->value;
}
/**
* {@inheritdoc}
*/
public function setFlagbank($flagbank) {
$this->set('flagbank', $flagbank);
return $this;
}
/**
......@@ -427,7 +498,54 @@ class AitisiEntity extends RevisionableContentEntityBase implements AitisiEntity
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['state'] = BaseFieldDefinition::create('list_string')
->setLabel(t('Κατάσταση Αίτησης'))
->setDescription(t('Κατάσταση Αίτησης'))
->setRequired(TRUE)
->setSettings(array(
'max_length' => 16,
'default_value' => 'Draft',
'allowed_values' => array(
'Draft' => 'Draft',
'Pending' => 'Pending',
'Ready' => 'Ready',
),
))
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'options_select',
'weight' => -17,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['flagiek'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Έλεγχος υπεύθυνου ΙΕΚ'))
->setDefaultValue(FALSE)
->setDisplayOptions('form', array(
'type' => 'boolean_checkbox',
'settings' => array(
'display_label' => TRUE,
),
'weight' => -18,
))
->setDisplayConfigurable('form', TRUE);
$fields['flagbank'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Έλεγχος υπεύθυνου τράπεζας'))
->setDefaultValue(FALSE)
->setDisplayOptions('form', array(
'type' => 'boolean_checkbox',
'settings' => array(
'display_label' => TRUE,
),
'weight' => -18,
))
->setDisplayConfigurable('form', TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean')
......
......@@ -19,11 +19,18 @@ interface AitisiEntityInterface extends RevisionableInterface, RevisionLogInterf
// Add get/set methods for your configuration properties here.
public function getStudent_id();
public function setStudent_id($student_id);
public function getSchool();
public function getSchoolId();
public function setSchoolId($studentId);
public function getStudent();
public function getStudentId();
public function setStudentId($student_id);
public function getEidikotita();
public function getEidikotitaId();
public function setEidikotitaId($eidikotita_id);
public function getEidikotita_id();
public function setEidikotita_id($eidikotita_id);
public function getPrabek();
public function setPrabek($prabek);
......@@ -34,8 +41,9 @@ interface AitisiEntityInterface extends RevisionableInterface, RevisionLogInterf
public function getRegno();
public function setRegno($regno);
public function getRegion_id();
public function setRegion_id($region_id);
public function getRegion();
public function getRegionId();
public function setRegionId($region_id);
/**
* Gets the Aitisi entity creation timestamp.
......
......@@ -87,7 +87,7 @@ class SchoolEntity extends ContentEntityBase implements SchoolEntityInterface {
* {@inheritdoc}
*/
public function getIekcode() {
return $this->get('iek_code')->value;
return $this->get('iekcode')->value;
}
/**
......
.progressbar-wrapper{padding:25px;background:#fff;border-radius:4px;text-align:center}.f1-steps{overflow:hidden;position:relative;margin-top:20px}.f1-progress{position:absolute;top:24px;left:0;width:100%;height:1px;background:#ddd}.f1-progress-line{position:absolute;top:0;left:0;height:1px;background:#466bc8}.f1-step{position:relative;float:left;width:33.3333%;padding:0 5px}.f1-step-icon{display:inline-block;width:40px;height:40px;margin-top:4px;background:#ddd;font-size:16px;color:#fff;line-height:40px;border-radius:50%}.f1-step.activated .f1-step-icon{background:#fff;border:1px solid #466bc8;color:#466bc8;line-height:38px}.f1-step.active .f1-step-icon{width:48px;height:48px;margin-top:0;background:#466bc8;font-size:22px;line-height:48px}.f1-step p{color:#ccc}.f1-step.activated p{color:#466bc8}.f1-step.active p{color:#466bc8}form.multistep-two-form h2.form-title{padding:15px}form.multistep-two-form .form-group{margin-bottom:1.2em;overflow:hidden}form.multistep-two-form .form-group label{float:left;width:28%;padding-right:10px;padding-top:8px;text-align:left}form.multistep-two-form .form-group .form-control{font-size:16px;padding:4px 8px;height:36px;width:72%;float:left;border-radius:4px !important}form.multistep-two-form .form-group .form-control[disabled]{background-color:grey;opacity:0.55;color:white;font-weight:bold}form.multistep-two-form .less-p label{padding-top:0}form.multistep-two-form #edit-sex--wrapper{padding-bottom:15px}form.multistep-two-form #edit-sex--wrapper legend{float:left;width:25%;font-size:18px;font-weight:bold;border-style:none}form.multistep-two-form #edit-sex--wrapper .fieldset-wrapper{float:left;width:75%}form.multistep-two-form #edit-sex--wrapper .fieldset-wrapper #edit-sex label{font-size:16px;font-weight:bold}
/*# sourceMappingURL=maincustomform.css.map */
\ No newline at end of file
(function ($, Drupal) {
Drupal.behaviors.logInForm = {
attach: function (context, settings) {
//get all available regions
jQuery.ajax({
url: Drupal.url('/jsonapi/region_entity/region_entity?_format=api_json&fields[region_entity--region_entity]=id,name'),
method: 'GET',
success: function(data, status, xhr) {
var arrObjects = data["data"];
var sel = $("#edit-region-select");
sel.empty();
arrObjects.forEach( function (arrayItem)
{
var attributes = arrayItem['attributes'];
sel.append('<option value="' + attributes['id'] + '">' + attributes['name'] + '</option>');
})
}
});
//select iek
jQuery.ajax({
url: Drupal.url('/jsonapi/school_entity/school_entity?_format=api_json&fields[school_entity--school_entity]=id,name'),
method: 'GET',
success: function(data, status, xhr) {
var arrObjects = data["data"];
var sel = $("#edit-iek-select");
sel.empty();
arrObjects.forEach( function (arrayItem)
{
var attributes = arrayItem['attributes'];
sel.append('<option value="' + attributes['id'] + '">' + attributes['name'] + '</option>');
})
}
});
//select eidikotita
jQuery.ajax({
url: Drupal.url('/jsonapi/eidikotita_entity/eidikotita_entity?_format=api_json&fields[eidikotita_entity--eidikotita_entity]=id,name'),
method: 'GET',
success: function(data, status, xhr) {
var arrObjects = data["data"];
var sel = $("#edit-eidikotita-select");
sel.empty();
arrObjects.forEach( function (arrayItem)
{
var attributes = arrayItem['attributes'];
sel.append('<option value="' + attributes['id'] + '">' + attributes['name'] + '</option>');
})
}
});
function getCsrfToken(callback) {
jQuery
.get(Drupal.url('/session/token'))
.done(function (data) {
var csrfToken = data;
callback(csrfToken);
});
}
function postNode(csrfToken, node) {
jQuery.ajax({
//url: 'http://localhost/drupal8new/api/custom/postentity/?_format=json',
url: Drupal.url('api/custom/postentity/?_format=json'),
method: 'POST',
headers: {
'Content-Type': 'application/hal+json',
'Authorization': 'Basic YWRtaW46Y3Jhenk2MTQ=',
'X-CSRF-Token': csrfToken
},
data: JSON.stringify(node),
success: function(data, textStatus, jqXHR)
{
if($.isNumeric(data['return-message'])) {
var insertedId = data['return-message'];
// e.stopPropagation();
window.location.href = Drupal.url('aitisi/'+insertedId);
} else {
$('#block-customformexample').html(data['return-message']);
}
},
error: function (jqXHR, textStatus, errorThrown)
{
console.log(textStatus);
}
});
}
//$("form.custom-form", context).submit(function(e) {
/* $("form.multistep-three-form #edit-submit", context).click(function(e) {
e.preventDefault();
alert($(this).attr('id'));
var first = drupalSettings.previousFormValues.first;
var last = drupalSettings.previousFormValues.last;
var fname = drupalSettings.previousFormValues.fname;
var mname = drupalSettings.previousFormValues.mname;
var idno = drupalSettings.previousFormValues.idno;
var birth_date = drupalSettings.previousFormValues.birth_date;
var birth_place = drupalSettings.previousFormValues.birth_place;
var email = drupalSettings.previousFormValues.email;
var telephone = drupalSettings.previousFormValues.telephone;
var afm = drupalSettings.previousFormValues.afm;
var sex = drupalSettings.previousFormValues.sex;
if(!sex) {
sex = 'male';
} else {
sex = 'female';
}
var prabek = $('form.multistep-three-form #edit-prabek').val();
var numbek = $('form.multistep-three-form #edit-numbek').val();
var regno = $('form.multistep-three-form #edit-regno').val();
var iek_select = $('form.multistep-three-form #edit-iek-select').val();
var region_select = $('form.multistep-three-form #edit-region-select').val();
var eidikotita_select = $('form.multistep-three-form #edit-eidikotita-select').val();
var newNode = {
"first": [{
"value": first
}],
"last": [{
"value": last
}],
"fname": [{
"value": fname
}],
"mname": [{
"value": mname
}],
"birthdate": [{
"value": birth_date
}],
"birthplace": [{
"value": birth_place
}],
"idno": [{
"value": idno
}],
"sex": [{
"value": sex
}],
"email": [{
"value": email
}],
"telephone": [{
"value": telephone
}],
"afm": [{
"value": afm
}],
"prabek": [{
"value": prabek
}],
"numbek": [{
"value": numbek
}],
"regno": [{
"value": regno
}],
"iek_id": [{
"value": iek_select
}],
"region_id": [{
"value": region_select
}],
"eidikotita_id": [{
"value": eidikotita_select
}],
};
getCsrfToken(function (csrfToken) {
postNode(csrfToken, newNode);
});
//return false;
});*/
}
};
})(jQuery, Drupal);
function isInt16(n) {
return +n === n && !(n % 1) && n < 0x8000 && n >= -0x8000;
}
(function ($, Drupal) {
Drupal.behaviors.progressline = {
attach: function (context, settings) {
// var parent_fieldset = $(this).parents('fieldset');
var next_step = true;
// navigation steps / progress steps
var current_active_step = $('.multistep-two-form').find('.f1-step.active');
var progress_line = $('.multistep-two-form').find('.f1-progress-line');
if( next_step ) {
// change icons
current_active_step.removeClass('active').addClass('activated').next().addClass('active');
// progress bar
bar_progress(progress_line, 'right');
}
// previous step
/*
$('.custom-form #edit-back').on('click', function() {
// navigation steps / progress steps
var current_active_step = $('.custom-form').find('.f1-step.active');
var progress_line = $('.custom-form').find('.f1-progress-line');
// change icons
current_active_step.removeClass('active').prev().removeClass('activated').addClass('active');
// progress bar
bar_progress(progress_line, 'left');
}); */
}
};
})(jQuery, Drupal);
function scroll_to_class(element_class, removed_height) {
var scroll_to = $(element_class).offset().top - removed_height;
if($(window).scrollTop() != scroll_to) {
$('html, body').stop().animate({scrollTop: scroll_to}, 0);
}
}
function bar_progress(progress_line_object, direction) {
var number_of_steps = progress_line_object.data('number-of-steps');
var now_value = progress_line_object.data('now-value');
var new_value = 0;
if(direction == 'right') {
new_value = now_value + ( 100 / number_of_steps );
}
else if(direction == 'left') {
new_value = now_value - ( 100 / number_of_steps );
}
progress_line_object.attr('style', 'width: ' + new_value + '%;').data('now-value', new_value);
}
(function ($, Drupal) {
Drupal.behaviors.progresslinelast = {
attach: function (context, settings) {
// var parent_fieldset = $(this).parents('fieldset');
var next_step = true;
// navigation steps / progress steps
var current_active_step = $('form.multistep-three-form').find('.f1-step.active');
var progress_line = $('form.multistep-three-form').find('.f1-progress-line');
if( next_step ) {
// alert(progress_line);
// change icons
current_active_step.removeClass('active').addClass('activated').next().addClass('active');
// progress bar
bar_progress(progress_line, 'right');
}
}
};
})(jQuery, Drupal);
function scroll_to_class(element_class, removed_height) {
var scroll_to = $(element_class).offset().top - removed_height;
if($(window).scrollTop() != scroll_to) {
$('html, body').stop().animate({scrollTop: scroll_to}, 0);
}
}
function bar_progress(progress_line_object, direction) {
var number_of_steps = progress_line_object.data('number-of-steps');
var now_value = progress_line_object.data('now-value');
var new_value = 0;
if(direction == 'right') {
new_value = now_value + ( 100 / number_of_steps );
}
else if(direction == 'left') {
new_value = now_value - ( 100 / number_of_steps );
}
progress_line_object.attr('style', 'width: ' + new_value + '%;').data('now-value', new_value);
}
name: maincustomform
type: module
description: My main custom form
core: 8.x
package: Custom
dependencies:
- eiek
- entitychanger
entitysaver:
version: 1.x
css:
theme:
assets/css/maincustomform.css: {}
js:
assets/js/entitysaver.js: {}
dependencies:
- core/jquery
- core/drupal
- core/drupalSettings
changeSecondPage:
version: 1.x
js:
assets/js/progressline-second-page.js: {}
dependencies:
- core/jquery
- core/drupal
- core/drupalSettings
changeThirdPage:
version: 1.x
js:
assets/js/progressline-third-page.js: {}
dependencies:
- core/jquery
- core/drupal
- core/drupalSettings
\ No newline at end of file
<?php
/**
* @file
* Contains maincustomform.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().