Commit 51480c32 authored by Aster's avatar Aster Committed by waltermazza
Browse files

General Bug Fixes and Improvements

parent 5f4c003b
# Amos Ticket #
Ticket management.
### Installation
You need to require this package and enable the module in your configuration.
add to composer requirements in composer.json
```
"open2/amos-ticket": "dev-master",
```
or run command bash:
```bash
composer require "open2/amos-ticket:dev-master"
```
Enable the News modules in modules-amos.php, add :
```php
'ticket' => [
'class' => 'open2\amos\ticket\AmosTicket',
],
```
add news migrations to console modules (console/config/migrations-amos.php):
```
'@vendor/open2/amos-ticket/src/migrations'
```
Add ticket to Comments:
```
'comments' => [
'class' => 'elitedivision\amos\comments\AmosComments',
'modelsEnabled' => [
.
.
'open2\amos\ticket\models\Ticket', //line to add
.
.
],
'enableMailsNotification' => false,
'enableUserSendMailCheckbox' => false
],
```
{
"name": "arter/amos-ticket",
"name": "open2/amos-ticket",
"description": "Amos Ticket",
"type": "component",
"keywords": [
......@@ -8,14 +8,14 @@
],
"require": {
"php": ">=5.4.0",
"arter/amos-admin": "^2.0.19",
"arter/amos-core": "^1.9.58",
"softark/yii2-dual-listbox": "^1.0",
"arter/amos-email-manager": "^1.1.19"
"elitedivision/amos-admin":"^2.0.31",
"elitedivision/amos-core": "^1.9.58",
"elitedivision/amos-email-manager": "^1.1.19",
"softark/yii2-dual-listbox": "^1.0"
},
"autoload": {
"psr-4": {
"arter\\amos\\ticket\\": "src"
"open2\\amos\\ticket\\": "src"
}
}
}
\ No newline at end of file
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see https://repo.art-er.it Developers' community
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package arter\amos\ticket
* @package open2\amos\ticket
* @category CategoryName
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
namespace arter\amos\ticket;
use arter\amos\core\interfaces\CmsModuleInterface;
use arter\amos\core\interfaces\SearchModuleInterface;
use arter\amos\core\module\AmosModule;
use arter\amos\core\module\ModuleInterface;
use arter\amos\ticket\models\search\TicketFaqSearch;
use arter\amos\ticket\models\TicketFaq;
use arter\amos\ticket\widgets\icons\WidgetIconTicketAdminFaq;
use arter\amos\ticket\widgets\icons\WidgetIconTicketAll;
use arter\amos\ticket\widgets\icons\WidgetIconTicketCategorie;
use arter\amos\ticket\widgets\icons\WidgetIconTicketClosed;
use arter\amos\ticket\widgets\icons\WidgetIconTicketDashboard;
use arter\amos\ticket\widgets\icons\WidgetIconTicketFaq;
use arter\amos\ticket\widgets\icons\WidgetIconTicketProcessing;
use arter\amos\ticket\widgets\icons\WidgetIconTicketWaiting;
namespace open2\amos\ticket;
use elitedivision\amos\core\interfaces\CmsModuleInterface;
use elitedivision\amos\core\interfaces\SearchModuleInterface;
use elitedivision\amos\core\module\AmosModule;
use elitedivision\amos\core\module\ModuleInterface;
use elitedivision\amos\core\user\User;
use open2\amos\ticket\models\search\TicketFaqSearch;
use open2\amos\ticket\models\TicketFaq;
use open2\amos\ticket\widgets\icons\WidgetIconTicketAdminFaq;
use open2\amos\ticket\widgets\icons\WidgetIconTicketAll;
use open2\amos\ticket\widgets\icons\WidgetIconTicketCategorie;
use open2\amos\ticket\widgets\icons\WidgetIconTicketClosed;
use open2\amos\ticket\widgets\icons\WidgetIconTicketDashboard;
use open2\amos\ticket\widgets\icons\WidgetIconTicketFaq;
use open2\amos\ticket\widgets\icons\WidgetIconTicketProcessing;
use open2\amos\ticket\widgets\icons\WidgetIconTicketWaiting;
use open2\amos\ticket\models\Ticket;
use Yii;
/**
* Class AmosTicket
* @package arter\amos\ticket
* @package open2\amos\ticket
*/
class AmosTicket extends AmosModule implements ModuleInterface, SearchModuleInterface, CmsModuleInterface
{
......@@ -62,10 +64,10 @@ class AmosTicket extends AmosModule implements ModuleInterface, SearchModuleInte
public function init()
{
parent::init();
\Yii::setAlias('@arter/amos/' . static::getModuleName() . '/models', __DIR__ . '/models');
\Yii::setAlias('@arter/amos/' . static::getModuleName() . '/controllers', __DIR__ . '/controllers');
\Yii::setAlias('@arter/amos/' . static::getModuleName() . '/widgets/icons', __DIR__ . '/widgets/icons');
\Yii::setAlias('@arter/amos/' . static::getModuleName() . '/migrations', __DIR__ . '/migrations');
\Yii::setAlias('@open2/amos/' . static::getModuleName() . '/models', __DIR__ . '/models');
\Yii::setAlias('@open2/amos/' . static::getModuleName() . '/controllers', __DIR__ . '/controllers');
\Yii::setAlias('@open2/amos/' . static::getModuleName() . '/widgets/icons', __DIR__ . '/widgets/icons');
\Yii::setAlias('@open2/amos/' . static::getModuleName() . '/migrations', __DIR__ . '/migrations');
// \Yii::configure($this, require(__DIR__ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'));
//
......@@ -151,4 +153,41 @@ class AmosTicket extends AmosModule implements ModuleInterface, SearchModuleInte
{
return TicketFaqSearch::className();
}
public static function createTicket($model, $data, $post)
{
/*
print_r($post['RecordDynamicModel']['email']);
die();
*/
$user = User::findByUsername($post['RecordDynamicModel']['email']);
//$titolo = $model->oggetto;
$categoria_id = intval($post['RecordDynamicModel']['categoria']);
$messageText = $post['RecordDynamicModel']['messaggio'];
$styledMessageText = AmosTicket::createMessage($messageText);
$ticket = new Ticket();
$ticket->ticket_categoria_id = $categoria_id;
$ticket->titolo = $post['RecordDynamicModel']['oggetto'];
$ticket->descrizione = $styledMessageText;
$ticket->created_by = $user->id;
//print_r(\Yii::$app->request->post());
//die();
$ticket->save(false);
}
public static function createMessage($messageText){
$styledMessageText = '<p>'.$messageText.'</p>';
return $styledMessageText;
}
}
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see https://repo.art-er.it Developers' community
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package arter\amos\ticket\assets
* @package open2\amos\ticket\assets
* @category CategoryName
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
namespace arter\amos\ticket\assets;
namespace open2\amos\ticket\assets;
use arter\amos\core\widget\WidgetAbstract;
use elitedivision\amos\core\widget\WidgetAbstract;
use yii\web\AssetBundle;
/**
* Class TicketAsset
* @package arter\amos\ticket\assets
* @package open2\amos\ticket\assets
*/
class TicketAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public $sourcePath = '@vendor/arter/amos-ticket/src/assets/web';
public $sourcePath = '@vendor/open2/amos-ticket/src/assets/web';
/**
* @inheritdoc
......
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/variables.less";
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/utility.less";
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/variables.less";
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/utility.less";
/**
IMPORT STYLE-CUSTOM
*/
......
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/v2/variables.less";
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/v2/utility.less";
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/v2/variables.less";
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/v2/utility.less";
/**
IMPORT STYLE-CUSTOM
*/
......@@ -33,6 +33,7 @@ IMPORT STYLE-CUSTOM
background-color: #555;
margin: 0 0.66%;
margin-top: 5px;
@media screen and (max-width: 991px) {
width: 49%;
margin: 0 0.5% 1%;
......@@ -58,18 +59,22 @@ IMPORT STYLE-CUSTOM
flex-wrap: wrap;
color: #fff;
text-decoration: none;
.faq-item_image {
height: 30px;
}
.faq-item_title {
width: 70%;
padding-left: 2%;
h3 {
margin: 0;
line-height: 1.15em;
font-weight: bold;
}
}
p {
font-size: 12px;
line-height: 14px;
......@@ -77,6 +82,7 @@ IMPORT STYLE-CUSTOM
}
}
}
.categorySelected {
background-color: @brand-primary-color;
}
......@@ -95,9 +101,13 @@ IMPORT STYLE-CUSTOM
h2.ui-accordion-header {
background-color: #eee;
border-left: 20px solid #b3b3b3;
span.ui-accordion-header-icon {
color: @brand-primary-color;
font-size: 30px;
margin-right: 10px;
}
p {
color: #000;
font-size: 1.35em;
......@@ -105,22 +115,23 @@ IMPORT STYLE-CUSTOM
}
}
}
}
.ui-accordion-header.ui-corner-top.ui-state-default.ui-accordion-icons.ui-accordion-header-active.ui-state-active {
border-left: 20px solid @brand-primary-color;
}
.ui-accordion-header.ui-corner-top.ui-state-default.ui-accordion-icons.ui-accordion-header-active.ui-state-active {
border-left: 20px solid @brand-primary-color;
}
.ui-accordion-content.ui-corner-bottom.ui-helper-reset.ui-widget-content.ui-accordion-content-active {
border: none;
border-left: 20px solid @brand-primary-color;
background-color: #eee;
padding: 10px 27px;
height: auto !important;
}
.ui-accordion-content.ui-corner-bottom.ui-helper-reset.ui-widget-content.ui-accordion-content-active {
border: none;
border-left: 20px solid @brand-primary-color;
background-color: #eee;
padding: 10px 27px;
height: auto !important;
}
.btn-tools-container {
h2 > a {
h2>a {
font-size: 30px;
}
}
......@@ -135,37 +146,45 @@ TICKET FORM
padding: @padding-default;
.flexbox;
.flexbox-column;
.ticket-label {
font-weight: bold;
text-transform: uppercase;
width: 15%;
float: left;
}
.ticket-content {
width: 85%;
float: right;
p{
p {
margin: 0;
}
}
> div {
>div {
min-height: 20px;
}
.state span{
.state span {
background: @danger-color;
color: contrast(@danger-color);
padding: 0 5px;
text-transform: uppercase;
font-weight: bold;
}
.state.state-processing span{
.state.state-processing span {
background: @warning-color;
color: contrast(@warning-color);
}
.state.state-closed span{
.state.state-closed span {
background: @success-color;
color: contrast(@success-color);
}
.field-ticket-ticket_categoria_id {
margin: 0;
}
......@@ -176,52 +195,62 @@ TICKET FORM
TICKET VIEW
*/
.ticket-view {
.ticket-info,
.ticket-forward-from,
.ticket-forward-to,
.ticket-answer{
.ticket-answer {
.flexbox;
.flexbox-column;
.ticket-label {
font-weight: bold;
text-transform: uppercase;
width: 30%;
float: left;
}
.ticket-content {
width: 70%;
float: right;
p{
p {
margin: 0;
}
}
}
.ticket-info,
.ticket-forward-from,
.ticket-forward-to,
.ticket-answer,
.ticket-date {
a,
.btn.btn-secondary {
float: right;
padding: 0 @padding-min;
}
> div{
>div {
min-height: 20px;
margin-bottom: @margin-medium;
}
.state span{
.state span {
background: @danger-color;
color: contrast(@danger-color);
padding: 0 5px;
text-transform: uppercase;
font-weight: bold;
}
.state.state-processing span{
.state.state-processing span {
background: @warning-color;
color: contrast(@warning-color);
}
.state.state-closed span{
.state.state-closed span {
background: @success-color;
color: contrast(@success-color);
}
......@@ -231,15 +260,17 @@ TICKET VIEW
//margin-bottom: 20px;
background: @light-background-primary-color;
padding: @padding-default;
.ticket-label {
width: 15%;
}
.ticket-content {
width: 85%;
}
}
.ticket-date{
.ticket-date {
margin-bottom: 20px;
background: @light-background-primary-color;
padding: @padding-default;
......@@ -255,9 +286,11 @@ TICKET VIEW
.ticket-answer {
margin-bottom: 20px;
.ticket-label {
width: 15%;
}
.ticket-content {
width: 85%;
}
......@@ -267,10 +300,12 @@ TICKET VIEW
.ticket-label {
width: 15%;
}
.ticket-content {
width: 85%;
}
.ticket-label-desc{
.ticket-label-desc {
text-transform: uppercase;
font-weight: bold;
border-bottom: 1px solid @black-color;
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see https://repo.art-er.it Developers' community
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package arter\amos\ticket\config
* @package open2\amos\ticket\config
* @category CategoryName
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
return [
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see https://repo.art-er.it Developers' community
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package arter\amos\ticket\config
* @package open2\amos\ticket\config
* @category CategoryName
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
/**
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see https://repo.art-er.it Developers' community
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package arter\amos\ticket\controllers
* @package open2\amos\ticket\controllers
* @category CategoryName
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
namespace arter\amos\ticket\controllers;
namespace open2\amos\ticket\controllers;
use arter\amos\core\controllers\CrudController;
use arter\amos\dashboard\controllers\TabDashboardControllerTrait;
use arter\amos\ticket\AmosTicket;
use arter\amos\ticket\models\search\TicketCategorieSearch;
use arter\amos\ticket\models\TicketCategorie;
use elitedivision\amos\core\controllers\CrudController;
use elitedivision\amos\dashboard\controllers\TabDashboardControllerTrait;
use open2\amos\ticket\AmosTicket;
use open2\amos\ticket\models\search\TicketCategorieSearch;
use open2\amos\ticket\models\TicketCategorie;
use Yii;
use yii\filters\AccessControl;
use yii\helpers\ArrayHelper;
......@@ -28,10 +28,10 @@ use yii\helpers\Url;
/**
* Class AssistenzaController
*
* @property \arter\amos\ticket\models\TicketCategorie $model
* @property \arter\amos\ticket\models\search\TicketCategorieSearch $modelSearch
* @property \open2\amos\ticket\models\TicketCategorie $model
* @property \open2\amos\ticket\models\search\TicketCategorieSearch $modelSearch
*
* @packagearter\amos\ticket\controllers
* @packageopen2\amos\ticket\controllers
*/
class AssistenzaController extends CrudController
{
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see https://repo.art-er.it Developers' community
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package arter\amos\ticket\controllers
* @package open2\amos\ticket\controllers
* @category CategoryName
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
namespace arter\amos\ticket\controllers;
namespace open2\amos\ticket\controllers;
use arter\amos\dashboard\controllers\base\DashboardController;
use elitedivision\amos\dashboard\controllers\base\DashboardController;
use Yii;
/**
* Class DefaultController