Commit 45cf6b01 authored by Αχιλλέας Κατσαρός's avatar Αχιλλέας Κατσαρός

Merge branch 'new_feature10' into 'develop'

d8views updates

See merge request !12
parents 7f2d77f8 b45f6b0b
form.edit-eoppep-form h2.form-title{padding:15px}form.edit-eoppep-form .form-group{margin-bottom:1.2em;overflow:hidden}form.edit-eoppep-form .form-group label{float:left;width:28%;padding-right:10px;padding-top:8px;text-align:left}form.edit-eoppep-form .form-group .form-control{font-size:16px;padding:4px 8px;height:36px;width:72%;float:left;border-radius:4px !important}form.edit-eoppep-form .form-group .form-control[disabled]{background-color:grey;opacity:0.55;color:white;font-weight:bold}form.edit-eoppep-form .less-p label{padding-top:0}form.edit-eoppep-form #edit-sex--wrapper{padding-bottom:15px}form.edit-eoppep-form #edit-sex--wrapper legend{float:left;width:25%;font-size:18px;font-weight:bold;border-style:none}form.edit-eoppep-form #edit-sex--wrapper .fieldset-wrapper{float:left;width:75%}form.edit-eoppep-form #edit-sex--wrapper .fieldset-wrapper #edit-sex label{font-size:16px;font-weight:bold}
/*# sourceMappingURL=d8viewscustomform.css.map */
langcode: el
status: true
dependencies:
config:
- system.menu.main
- user.role.administrator
- user.role.diaxeiristis_eoppep
module:
- eiek
- user
id: school_administration
label: 'School Administration'
module: views
description: ''
tag: ''
base_table: school_entity
base_field: id
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: role
options:
role:
administrator: administrator
diaxeiristis_eoppep: diaxeiristis_eoppep
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: mini
options:
items_per_page: 10
offset: 0
id: 0
total_pages: null
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
tags:
previous: ‹‹
next: ››
style:
type: table
row:
type: fields
fields:
name:
id: name
table: school_entity
field: name
relationship: none
group_type: group
admin_label: ''
label: Όνομα
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: false
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: null
entity_field: name
plugin_id: field
iekcode:
id: iekcode
table: school_entity
field: iekcode
relationship: none
group_type: group
admin_label: ''
label: 'Κωδικός ΙΕΚ'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: false
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: school_entity
entity_field: iekcode
plugin_id: field
region_id:
id: region_id
table: school_entity
field: region_id
relationship: none
group_type: group
admin_label: ''
label: Περιοχή
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: target_id
type: entity_reference_label
settings:
link: false
group_column: target_id
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: school_entity
entity_field: region_id
plugin_id: field
filters: { }
sorts: { }
title: 'Κατάλογος ΙΕΚ'
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- user.roles
tags: { }
page_1:
display_plugin: page
id: page_1
display_title: Page
position: 1
display_options:
display_extenders: { }
path: iek/list
menu:
type: normal
title: 'Κατάλογος ΙΕΚ'
description: ''
expanded: false
parent: ''
weight: 15
context: '0'
menu_name: main
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- user.roles
tags: { }
......@@ -5,4 +5,5 @@ core: 8.x
package: Custom
dependencies:
- eiek
- entitychanger
\ No newline at end of file
- entitychanger
modal:
css:
theme:
assets/css/d8viewscustomform.css: {}
js:
js/crutch.js: {}
dependencies:
- core/jquery
- core/ajax
......@@ -23,6 +23,12 @@ function d8views_help($route_name, RouteMatchInterface $route_match) {
}
}
function d8views_preprocess_html(&$variables) {
$variables['page']['#attached']['library'][] = 'd8views/modal';
$variables['page']['#attached']['library'][] = 'core/drupal.ajax';
}
/**
* Implements hook_theme().
*/
......@@ -35,5 +41,8 @@ function d8views_theme() {
'edit_iek_form' => [
'render element' => 'form',
],
'edit_eoppep_form' => [
'render element' => 'form',
],
];
}
......@@ -6,3 +6,12 @@ d8views.edit_iek_form:
_title: 'EditIekForm'
requirements:
_access: 'TRUE'
d8views.edit_eoppep_form:
path: '/eoppep/aitisi/{aid}/edit'
defaults:
_form: '\Drupal\d8views\Form\EditEoppepForm'
_title: 'EditEoppepForm'
requirements:
_access: 'TRUE'
......@@ -5,7 +5,7 @@ if ($view->id() == 'test1') {
foreach ($query->where as &$condition_group) {
foreach ($condition_group['conditions'] as &$condition) {
// dpm($condition);
if ($condition['field'] == 'school_entity_aitisi_entity.iekcode') {
$user = \Drupal::service('current_user');
......@@ -20,6 +20,23 @@ if ($view->id() == 'test1') {
'operator' => '=',
);
}
if ($condition['field'] == 'aitisi_entity.user_id') {
$user = \Drupal::service('current_user');
$uid = $user->id();
//$formatted_name = $user->getDisplayName();
//$raw_name = $user->getAccountName();
//$raw_name = 'admin';
$condition = array(
'field' => 'aitisi_entity.user_id',
'value' => $uid,
'operator' => '=',
);
}
}
}
}
......
(function ($, Drupal, settings) {
"use strict";
Drupal.behaviors.Crutch = { //the name of our behavior
attach: function (context, settings) {
function strip_tags(input, allowed) { //the strip_tags function that cuts unnecessary tags on regular expression and returns clean text. Important! The input parameter works correctly only string data type.
allowed = (((allowed || '') + '')
.toLowerCase()
.match(/<[a-z][a-z0-9]*>/g) || [])
.join('');
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
return input.replace(commentsAndPhpTags, '')
.replace(tags, function($0, $1) {
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
});
}
$(document).bind('ajaxSuccess.Crutch', function() { //run the main code only after Ajax has successfully downloaded your node
var value = $(".ui-dialog-title"); //matching the popup title class
if (value.length && !value.hasClass('do-once')) { //if there is no do-once class,
var text = strip_tags($(value).text()); //then run the strip_tags() function
$(value).text(text);
value.addClass('do-once');
}
$(this).unbind('ajaxSuccess.Crutch');
});
}
};
})(jQuery, Drupal, drupalSettings);
<?php
namespace Drupal\d8views\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Url;
/**
* Class EditEoppepForm.
*
* @package Drupal\d8views\Form
*/
class EditEoppepForm extends FormBase {
/**
* Drupal\Core\Entity\EntityManager definition.
*
* @var \Drupal\Core\Entity\EntityManager
*/
protected $entityManager;
protected $entityObject;
protected $studentObject;
public function __construct(
EntityManager $entity_manager
) {
$this->entityManager = $entity_manager;
}
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager')
);
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'edit_eoppep_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $aid = NULL) {
if(isset($aid)) {
$entity_manager = \Drupal::entityManager();
$entity_storage_aitisi = $entity_manager->getStorage('aitisi_entity');
$aitisiArr = $entity_storage_aitisi->loadByProperties(['id' => $aid]);
$this->entityObject = reset($aitisiArr);
//get the student entity
$this->studentObject = $this->entityObject->getStudent();
if ($this->entityObject) {
$form['#theme'] = 'edit_eoppep_form';
$form['numbek'] = [
'#type' => 'textfield',
'#title' => t('Αριθμός ΒΕΚ'),
'#default_value' => $this->entityObject->getNumbek() ? $this->entityObject->getNumbek() : '',
'#states' => array(
'disabled' => array(
'input[name="numbek"]' => array('filled' => TRUE),
),
),
];
$form['prabek'] = [
'#type' => 'textfield',
'#title' => t('Πράξη ΒΕΚ'),
'#default_value' => $this->entityObject->getPrabek() ? $this->entityObject->getPrabek() : '',
'#states' => array(
'disabled' => array(
'input[name="prabek"]' => array('filled' => TRUE),
),
),
];
$form['regno'] = [
'#type' => 'textfield',
'#title' => t('ΑΜΚ'),
'#default_value' => $this->entityObject->getRegno() ? $this->entityObject->getRegno() : '',
'#states' => array(
'disabled' => array(
'input[name="regno"]' => array('filled' => TRUE),
),
),
];
$form['flagiek'] = array(
'#type' => 'radios',
'#title' => t('Έλεγχος ΙΕΚ'),
'#options' => array(0 => t('Αρχική'), 1 => t('Έλεγχος ολοκληρώθηκε')),
'#default_value' => $this->entityObject->getFlagiek() ? $this->entityObject->getFlagiek() : '',
);
if(!$this->entityObject->getFlagbank()) {
$form['flagbank'] = array(
'#type' => 'radios',
'#title' => t('Έλεγχος Τράπεζας'),
'#options' => array(0 => t('Αρχική'), 1 => t('Έλεγχος ολοκληρώθηκε')),
'#default_value' => $this->entityObject->getFlagbank() ? $this->entityObject->getFlagbank() : '',
);
}
$form['last'] = array(
'#type' => 'textfield',
'#title' => t('Επιθετο'),
'#size' => 60,
'#maxlength' => 120,
'#required' => TRUE,
'#default_value' => $this->studentObject->getLast() ? $this->studentObject->getLast():'',
'#states' => array(
'disabled' => array(
'input[name="last"]' => array('filled' => TRUE),
),
),
);
$form['first'] = array(