Commit ad740e82 authored by Marcello Pivanti's avatar Marcello Pivanti
Browse files

Initial Commit

parents
{
"name": "arter/amos-ticket",
"description": "Amos Ticket",
"type": "component",
"keywords": [
"amos",
"ticket"
],
"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"
},
"autoload": {
"psr-4": {
"open2\\amos\\ticket\\": "src"
}
}
}
\ No newline at end of file
<?php
/**
* Art-ER Attrattività, ricerca e territorio dell’Emilia-Romagna
* OPEN 2.0
*
*
* @package open2\amos\ticket
* @category CategoryName
* @author Elite Division S.r.l.
*/
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 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 Yii;
/**
* Class AmosTicket
* @package open2\amos\ticket
*/
class AmosTicket extends AmosModule implements ModuleInterface, SearchModuleInterface, CmsModuleInterface
{
public static $CONFIG_FOLDER = 'config';
public $config = [];
public $fieldsConfigurations = [
'required' => [
'ticket_categoria_id',
'titolo',
'descrizione'
],
];
public $enableOrganizationNameString = false;
public $disableInfoFields = false;
public $disableCategory = false;
public $disableTicketOrganization = false;
/**
* @inheritdoc
*/
public function init()
{
parent::init();
\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'));
//
// initialize the module with the configuration loaded from config.php
$config = require(__DIR__ . DIRECTORY_SEPARATOR . self::$CONFIG_FOLDER . DIRECTORY_SEPARATOR . 'config.php');
Yii::configure($this, $config);
}
/**
* @inheritdoc
*/
public static function getModuleName()
{
return 'ticket';
}
/**
* @inheritdoc
*/
public function getWidgetGraphics()
{
return [];
}
/**
* @inheritdoc
*/
public function getWidgetIcons()
{
return [
WidgetIconTicketDashboard::className(),
WidgetIconTicketAdminFaq::className(),
WidgetIconTicketCategorie::className(),
WidgetIconTicketAll::className(),
WidgetIconTicketClosed::className(),
WidgetIconTicketFaq::className(),
WidgetIconTicketProcessing::className(),
WidgetIconTicketWaiting::className(),
];
}
/**
* @inheritdoc
*/
protected function getDefaultModels()
{
return [
'Ticket' => __NAMESPACE__ . '\\' . 'models\Ticket',
'TicketCategorie' => __NAMESPACE__ . '\\' . 'models\TicketCategorie',
'TicketCategorieUsersMm' => __NAMESPACE__ . '\\' . 'models\TicketCategorieUsersMm',
'TicketFaq' => __NAMESPACE__ . '\\' . 'models\TicketFaq',
'TicketSearch' => __NAMESPACE__ . '\\' . 'models\search\TicketSearch',
'TicketFaqSearch' => __NAMESPACE__ . '\\' . 'models\search\TicketFaqSearch',
'TicketCategorieSearch' => __NAMESPACE__ . '\\' . 'models\search\TicketCategorieSearch',
];
}
/**
* @inheritdoc
*/
public static function getModuleIconName()
{
if (!empty(\Yii::$app->params['dashboardEngine']) && \Yii::$app->params['dashboardEngine'] == WidgetAbstract::ENGINE_ROWS) {
return 'assistenza';
} else {
return 'feed';
}
}
/**
* @inheritdoc
*/
public static function getModelClassName()
{
return TicketFaq::className();
}
/**
* @inheritdoc
*/
public static function getModelSearchClassName()
{
return TicketFaqSearch::className();
}
}
<?php
/**
* Art-ER Attrattività, ricerca e territorio dell’Emilia-Romagna
* OPEN 2.0
*
*
* @package open2\amos\ticket\assets
* @category CategoryName
* @author Elite Division S.r.l.
*/
namespace open2\amos\ticket\assets;
use elitedivision\amos\core\widget\WidgetAbstract;
use yii\web\AssetBundle;
/**
* Class TicketAsset
* @package open2\amos\ticket\assets
*/
class TicketAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public $sourcePath = '@vendor/open2/amos-ticket/src/assets/web';
/**
* @inheritdoc
*/
public $publishOptions = [
'forceCopy' => YII_DEBUG,
];
/**
* @inheritdoc
*/
public $css = [
'less/ticket.less',
];
/**
* @inheritdoc
*/
public $js = [
'js/ticket.js'
];
/**
* @inheritdoc
*/
public $depends = [
'yii\web\JqueryAsset',
];
public function init()
{
$moduleL = \Yii::$app->getModule('layout');
if (!empty(\Yii::$app->params['dashboardEngine']) && \Yii::$app->params['dashboardEngine'] == WidgetAbstract::ENGINE_ROWS) {
$this->css = ['less/ticket_fullsize.less'];
}
parent::init();
}
}
$(document).ready(function () {
$('#create-ticket').on('show.bs.modal', function (event) {
var link = $(event.relatedTarget); // link that triggered the modal
var categoryName = link.data('category-name');
var categoryInstance = link.data('category-instance');
var modal = $(this);
modal.find('#modal-title').text(categoryName);
modal.find('.modal-body').load('/ticket/ticket/create?categoriaId=' + categoryInstance);
//modal.find('.modal-body').load('/ticket/ticket/create?categoriaId=7');
})
.on('hidden.bs.modal', function () {
// location.reload(); // quando viene chiusa, ricarica la pagina padre
});
/*function checkChild() {
if (opened.closed) {
clearInterval(timer);
var modal = $('#create-ticket'); // la modale
//console.log('lessonUrl',lessonUrl);
modal.find('.modal-body').load(lessonUrl+'&close=1');
}
}*/
/* $("body").on('click', ".js-btn-entra", function(event) {
event.preventDefault();
var href = $(this).attr('href');
opened = window.open(href);
timer = setInterval(checkChild, 500); // ogni secondo
});*/
/*$("body").on('click', '#save_ticket_button', function () {
console.log("sono qua!!");
var modal = $('#create-ticket'); // la modale
modal.find('.modal-body').load($(this).attr('value'));
});*/
/* var form = jQuery('#ticket-form');
var modal = $('#create-ticket'); // la modale
var form = modal.find('#ticket-form');
var url= form.attr('action');
form.on('beforeSubmit', function (e) {
e.preventDefault();
jQuery.ajax({
url: form.attr('action'),
type: form.attr('method'),
data: new FormData(form[0]),
mimeType: 'multipart/form-data',
contentType: false,
cache: false,
processData: false,
dataType: 'json',
success: function (data) {
alert('ID: ' + data.id + ' someOtherData:' + data.someOtherData);
}
});
return false;
});*/
});
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@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 (optional) "../../backend/web/less/style_custom.less";
.assist-title-primary {
z-index: 10;
display: block;
background-color: #fff;
}
.assist-faq {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
padding: 0 1% 1%;
.assist-faq-item {
width: 32%;
padding: 1%;
background-color: #555;
margin: 0 0.66%;
margin-top: 5px;
@media screen and (max-width: 991px) {
width: 49%;
margin: 0 0.5% 1%;
margin-top: 5px;
}
@media screen and (max-width: 559px) {
width: 100%;
padding: 3%;
margin: 0 0 2%;
margin-top: 5px;
}
a.js-linkcategoria {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
-ms-flex-wrap: wrap;
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;
width: 100%;
}
}
}
.categorySelected {
background-color: #338079;
}
.assist-faq-title {
width: 100%;
text-align: center;
margin-top: 35px;
padding-bottom: 5px;
border-bottom: 2px solid #eee;
}
}
.faq-content {
.ui-accordion {
h2.ui-accordion-header {
background-color: #eee;
border-left: 20px solid #b3b3b3;
span.ui-accordion-header-icon {
color: #006057;
}
p {
color: #000;
font-size: 1.35em;
padding: 0 20px;
}
}
}
}
.ui-accordion-header.ui-corner-top.ui-state-default.ui-accordion-icons.ui-accordion-header-active.ui-state-active {
border-left: 20px solid #006057;
}
.ui-accordion-content.ui-corner-bottom.ui-helper-reset.ui-widget-content.ui-accordion-content-active {
border: none;
border-left: 20px solid #006057;
background-color: #eee;
padding: 10px 27px;
height: auto !important;
}
.btn-tools-container {
h2 > a {
font-size: 30px;
}
}
/**
TICKET FORM
*/
.ticket-form {
.ticket-detail {
margin-bottom: 20px;
background: @light-background-primary-color;
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{
margin: 0;
}
}
> div {
min-height: 20px;
}
.state span{
background: @danger-color;
color: contrast(@danger-color);
padding: 0 5px;
text-transform: uppercase;
font-weight: bold;
}
.state.state-processing span{
background: @warning-color;
color: contrast(@warning-color);
}
.state.state-closed span{
background: @success-color;
color: contrast(@success-color);
}
.field-ticket-ticket_categoria_id {
margin: 0;
}
}
}
/**
TICKET VIEW
*/
.ticket-view {
.ticket-info,
.ticket-forward-from,
.ticket-forward-to,
.ticket-answer{
.flexbox;
.flexbox-column;
.ticket-label {
font-weight: bold;
text-transform: uppercase;
width: 30%;
float: left;
}
.ticket-content {
width: 70%;
float: right;
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{
min-height: 20px;
margin-bottom: @margin-medium;
}
.state span{
background: @danger-color;
color: contrast(@danger-color);
padding: 0 5px;
text-transform: uppercase;
font-weight: bold;
}
.state.state-processing span{
background: @warning-color;
color: contrast(@warning-color);
}
.state.state-closed span{
background: @success-color;
color: contrast(@success-color);
}
}
.ticket-info {
//margin-bottom: 20px;
background: @light-background-primary-color;
padding: @padding-default;
.ticket-label {
width: 15%;
}
.ticket-content {
width: 85%;
}
}
.ticket-date{
margin-bottom: 20px;
background: @light-background-primary-color;
padding: @padding-default;
}
.ticket-forward-from,
.ticket-forward-to {
margin-bottom: 20px;
background: @light-background-color;
border: 1px solid @border-color-default;
padding: @padding-default;
}
.ticket-answer {
margin-bottom: 20px;
.ticket-label {
width: 15%;
}
.ticket-content {
width: 85%;
}
}
.ticket-text {
.ticket-label {
width: 15%;
}
.ticket-content {
width: 85%;
}
.ticket-label-desc{
text-transform: uppercase;
font-weight: bold;
border-bottom: 1px solid @black-color;
}
}
}
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@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
*/
@import (optional) "../../backend/web/less/style_custom.less";
.assist-title-primary {
z-index: 10;
display: block;
background-color: #fff;
}
.assist-faq {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
padding: 0 1% 1%;
.assist-faq-item {
width: 32%;
padding: 1%;
background-color: #555;
margin: 0 0.66%;
margin-top: 5px;
@media screen and (max-width: 991px) {
width: 49%;
margin: 0 0.5% 1%;
margin-top: 5px;
}
@media screen and (max-width: 559px) {
width: 100%;
padding: 3%;
margin: 0 0 2%;
margin-top: 5px;
}