Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #25 from napoliblockchain/some-fixes
Browse files Browse the repository at this point in the history
issue #21, #23, #22, #24
  • Loading branch information
jambtc authored Apr 7, 2020
2 parents b2eacf1 + f50cfa3 commit 96c8f30
Show file tree
Hide file tree
Showing 14 changed files with 272 additions and 85 deletions.
37 changes: 37 additions & 0 deletions css/wallet.css
Original file line number Diff line number Diff line change
Expand Up @@ -399,3 +399,40 @@ h1 small.logo-descri {
#consegne-grid-gestore a:selected {
color: blue;
}

a.tipaddress {
/* border-bottom: 1px dashed; */
text-decoration: none


}
a.tipaddress:hover {
cursor: help;
position: relative
}
a.tipaddress span {
display: none
}
a.tipaddress:hover span {
padding: 5px 20px 5px 20px;
display: block;
z-index: 100;

left: -100px;
margin: 10px;
width: 250px;
position: absolute;
top: -50px;
text-decoration: none


border: 1px solid darkblue;
background: #666;
color: yellow;

-moz-border-radius:6px;
-khtml-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius:6px;

}
21 changes: 18 additions & 3 deletions protected/components/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,24 @@ class Controller extends CController
public $breadcrumbs=array();


/**
* Questa funzione ha lo scopo di mascherare l'indirizzo, ma di mostrarlo su
* richiesta (click)
* @var string $address è la stringa indirizzo da celare
* @var number $id è l'id della row da richiamare in caso di click
* @var number $tag è l'operazione richiesta
*/
public function maskAddress($address,$id,$tag=0)
{
$link = Yii::app()->createUrl(
"consegne/view",
["id"=>crypt::Encrypt($id),"tag"=>$tag]
);




$return = CHtml::link('******<span>'.$address.'</span>',$link,[
'class'=>'tipaddress'
]);
return $return;
}

}
44 changes: 26 additions & 18 deletions protected/controllers/ConsegneController.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,20 +443,24 @@ public function actionExport()
->setCategory($Category);

// Add header
$colonne = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q');
$colonne = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u');
$intestazione = array(
"ID",
"Data Inserimento",
"ID User che inserisce",
"Nome User che inserisce",
"Codice Fiscale",
"Nome",
"Cognome",
"Telefono",
"Adulti",
"Neonati",
"Indirizzo",
"Quartiere",
"Municipalità",
"Alert se < 7gg",
"ID Volontario in consegna",
"ID User in consegna",
"Nome User in consegna",
"Pacco in consegna",
"Data presa in carico",
"Consegnato",
Expand All @@ -475,23 +479,27 @@ public function actionExport()
foreach($transactions as $item) {
// Miscellaneous glyphs, UTF-8
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A'.$riga, $item->id_archive)
->setCellValue('B'.$riga, date("d/m/Y",$item->data))
->setCellValue('A'.$riga, $item->id_archive)
->setCellValue('B'.$riga, date("d/m/Y",$item->data))
->setCellValue('C'.$riga, $item->id_user)
->setCellValue('D'.$riga, $item->codfisc)
->setCellValue('E'.$riga, $item->nome)
->setCellValue('F'.$riga, $item->cognome)
->setCellValue('G'.$riga, $item->telefono)
->setCellValue('H'.$riga, $item->adulti)
->setCellValue('I'.$riga, $item->bambini)
->setCellValue('J'.$riga, $item->indirizzo)
->setCellValue('K'.$riga, $item->trigger_alert)
->setCellValue('L'.$riga, $item->id_volontario)
->setCellValue('M'.$riga, $item->in_consegna)
->setCellValue('N'.$riga, ($item->time_inconsegna == 0) ? '' : date("d/m/Y H:i:s",$item->time_inconsegna))
->setCellValue('O'.$riga, $item->consegnato)
->setCellValue('P'.$riga, ($item->time_consegnato == 0) ? '' : date("d/m/Y H:i:s",$item->time_consegnato))
->setCellValue('Q'.$riga, $item->note);
->setCellValue('D'.$riga, Users::model()->findByPk($item->id_user)->email)
->setCellValue('E'.$riga, $item->codfisc)
->setCellValue('F'.$riga, $item->nome)
->setCellValue('G'.$riga, $item->cognome)
->setCellValue('H'.$riga, $item->telefono)
->setCellValue('I'.$riga, $item->adulti)
->setCellValue('J'.$riga, $item->bambini)
->setCellValue('K'.$riga, $item->indirizzo)
->setCellValue('L'.$riga, $item->quartiere)
->setCellValue('M'.$riga, $item->municipalita)
->setCellValue('N'.$riga, $item->trigger_alert)
->setCellValue('O'.$riga, $item->id_volontario)
->setCellValue('P'.$riga, ($item->id_volontario == 0) ? '' : Users::model()->findByPk($item->id_volontario)->email)
->setCellValue('Q'.$riga, $item->in_consegna)
->setCellValue('R'.$riga, ($item->time_inconsegna == 0) ? '' : date("d/m/Y H:i:s",$item->time_inconsegna))
->setCellValue('S'.$riga, $item->consegnato)
->setCellValue('T'.$riga, ($item->time_consegnato == 0) ? '' : date("d/m/Y H:i:s",$item->time_consegnato))
->setCellValue('U'.$riga, $item->note);

$riga++;
$Rows++;
Expand Down
45 changes: 40 additions & 5 deletions protected/controllers/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ public function accessRules()
return array(
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array(
'index', // mostra elenco soci
'view', //visualizza dettagli socio
'create', //crea manualmente un socio
'update', //modifica socio
'disable', //disattiva socio
'index', // mostra elenco operatore
'view', //visualizza dettagli operatore
'create', //crea manualmente un operatore
'update', //modifica operatore
'disable', //disattiva operatore
'changepwd', // cambia la password
),
'users'=>array('@'),
),
Expand All @@ -62,6 +63,14 @@ public function actionView($id)
));
}

public function actionDisable($id)
{
$user = $this->loadModel(crypt::Decrypt($id));
$user->status_activation_code = 0;
$user->update();
$this->redirect(array('index'));
}

/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
Expand Down Expand Up @@ -93,6 +102,32 @@ public function actionCreate()
));
}

/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionChangepwd($id)
{
$model=$this->loadModel(crypt::Decrypt($id));
#echo "<pre>".print_r($_POST,true)."</pre>";
#exit;

if(isset($_POST['Users']))
{
$model->attributes=$_POST['Users'];
$model->password = CPasswordHelper::hashPassword($model->password);

if($model->save()){
$this->redirect(array('view','id'=>crypt::Encrypt($model->id_user)));
}
}

$this->render('changepwd',array(
'model'=>$model,
));
}


/**
* Updates a particular model.
Expand Down
8 changes: 4 additions & 4 deletions protected/models/ConsegneMan.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ public function search()

$criteria=new CDbCriteria;

$criteria->compare('id_archive',$this->id_archive);
$criteria->compare('id_user',$this->id_user);
//$criteria->compare('id_archive',$this->id_archive);
//$criteria->compare('id_user',$this->id_user);
$criteria->compare('codfisc',$this->codfisc,true);
$criteria->compare('nome',$this->nome,true);
$criteria->compare('cognome',$this->cognome,true);
$criteria->compare('telefono',$this->telefono,true);
$criteria->compare('data',$this->data);
//$criteria->compare('data',$this->data);
$criteria->compare('adulti',$this->adulti);
$criteria->compare('bambini',$this->bambini);
$criteria->compare('indirizzo',$this->indirizzo,true);
Expand Down Expand Up @@ -160,7 +160,7 @@ public function search()
'criteria'=>$criteria,
'sort'=>array(
'defaultOrder'=>array(
'id_archive'=>false,
'id_archive'=>true,
)
),
'pagination' => array(
Expand Down
4 changes: 0 additions & 4 deletions protected/views/consegne/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@

<?php echo $form->hiddenField($model,'trigger_alert',array('value'=>0)); ?>





<div class="form-group">
<?php echo CHtml::submitButton(($model->isNewRecord ? 'Inserisci' : 'Modifica'), array('class' => 'btn btn-primary')); ?>
</div>
Expand Down
6 changes: 4 additions & 2 deletions protected/views/consegne/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
array(
'name'=>'Indirizzo',
'type'=>'raw',
'value'=>'CHtml::link($data->indirizzo,Yii::app()->createUrl("consegne/view",["id"=>crypt::Encrypt($data->id_archive),"tag"=>2]) )',
//'value'=>'CHtml::link($data->indirizzo,Yii::app()->createUrl("consegne/view",["id"=>crypt::Encrypt($data->id_archive),"tag"=>2]) )',
'value'=> 'Yii::app()->controller->maskAddress($data->indirizzo,$data->id_archive,2)',
),
array(
'name' => '',
Expand Down Expand Up @@ -122,7 +123,8 @@
array(
'name'=>'Indirizzo',
'type'=>'raw',
'value'=>'CHtml::link($data->indirizzo,Yii::app()->createUrl("consegne/view",["id"=>crypt::Encrypt($data->id_archive),"tag"=>1]) )',
//'value'=>'CHtml::link($data->indirizzo,Yii::app()->createUrl("consegne/view",["id"=>crypt::Encrypt($data->id_archive),"tag"=>1]) )',
'value'=> 'Yii::app()->controller->maskAddress($data->indirizzo,$data->id_archive,1)',
),
array(
'name' => '',
Expand Down
31 changes: 21 additions & 10 deletions protected/views/consegne/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,24 @@
1 => '', // in consegna
2 => '', // in carico
3 => '', // tutti

];


$activeButton[0] = 'active';

if (isset($_GET['typelist']))
$activeButton[$_GET['typelist']] = 'active';
$get = 0;
if (isset($_GET['typelist'])){
$get = $_GET['typelist'];
$activeButton[$get] = 'active';
}


$tag = [
0 => 3,
1 => 1,
2 => 2,
3 => 0
];

?>
<div class='section__content section__content--p30'>
Expand Down Expand Up @@ -84,6 +93,15 @@
// 'class'=>'CCheckBoxColumn',
// 'htmlOptions'=>array('style'=>'padding:0px 0px 0px 0px; margin:0px 0px 0px 0px;vertical-align:middle;'),
// ),
array(

'name'=>Yii::t('lang','data'),
'type'=>'raw',
'value' => 'CHtml::link(date("d/M/Y",$data->data), Yii::app()->createUrl("consegne/view",["id"=>crypt::Encrypt($data->id_archive),"tag"=>'.$tag[$get].']) )',
'htmlOptions'=>array('style'=>'vertical-align:middle;'),
'filter'=>false,
),

array(
'name'=>'id_volontario',
'type'=>'raw',
Expand All @@ -93,14 +111,7 @@
})

),
array(

'name'=>Yii::t('lang','data'),
'type'=>'raw',
'value' => 'CHtml::link(date("d/M/Y",$data->data), Yii::app()->createUrl("consegne/view",["id"=>crypt::Encrypt($data->id_archive)]) )',
'htmlOptions'=>array('style'=>'vertical-align:middle;'),
'filter'=>false,
),
'quartiere',
'municipalita',
'indirizzo',
Expand Down
18 changes: 11 additions & 7 deletions protected/views/consegne/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,18 @@
array(
'name'=>'indirizzo',
'type'=>'raw',
'value'=>'CHtml::link($data->indirizzo,Yii::app()->createUrl("consegne/view",["id"=>crypt::Encrypt($data->id_archive),"tag"=>1]) )',
//'value'=>'CHtml::link($data->indirizzo,Yii::app()->createUrl("consegne/view",["id"=>crypt::Encrypt($data->id_archive),"tag"=>1]) )',
'value'=> 'Yii::app()->controller->maskAddress($data->indirizzo,$data->id_archive,1)',
),
array(
'name'=>'codfisc',
'type' => 'raw',
'value'=>'CHtml::link($data->codfisc,Yii::app()->createUrl("consegne/view",["id"=>crypt::Encrypt($data->id_archive)]) )',
'htmlOptions'=>array('style'=>'vertical-align:middle;'),
),
// array(
// 'name'=>'codfisc',
// 'type' => 'raw',
// 'value'=>'CHtml::link($data->codfisc,Yii::app()->createUrl("consegne/view",["id"=>crypt::Encrypt($data->id_archive)]) )',
// 'htmlOptions'=>array('style'=>'vertical-align:middle;'),
// ),
array(
'value'=>'',
),
)
));
?>
Expand Down
36 changes: 21 additions & 15 deletions protected/views/consegne/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
'note',
'adulti',
'bambini',
array(
'label'=>'Data consegna',
'value'=>date("d/m/Y",$model->time_consegnato),
),
),
));
?>
Expand All @@ -57,22 +61,24 @@
<div class="col-md-6">
<div class="overview-wrap">
<h2 class="title-1">
<a href="<?php echo $modifyURL;?>">
<button type="button" class="btn btn-secondary">Modifica</button>
</a>
<?php if ($tag == 1){ ?>
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#mediumModal">Consegna</button>
<?php } ?>
<?php if ($tag == 2){ ?>
<?php if ($tag == 0): ?>
<a href="<?php echo $modifyURL;?>">
<button type="button" class="btn btn-secondary">Modifica</button>
</a>
<?php endif ?>
<?php if ($tag == 1): ?>
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#mediumModal">Consegna</button>
<?php endif ?>
<?php if ($tag == 2): ?>
<a href="<?php echo $restituisciURL;?>">
<button type="button" class="btn btn-warning">Rimetti in lista</button>
</a>
<?php } ?>
<?php if ($model->id_volontario == 0 && $tag <>2){ ?>
<a href="<?php echo $assegnaURL;?>">
<button type="button" class="btn btn-warning">Assegna a me stesso</button>
</a>
<?php } ?>
<button type="button" class="btn btn-warning">Rimetti in lista</button>
</a>
<?php endif ?>
<?php if ($model->id_volontario == 0 && $tag <>2){ ?>
<a href="<?php echo $assegnaURL;?>">
<button type="button" class="btn btn-warning">Assegna a me stesso</button>
</a>
<?php } ?>
</h2>
</div>
</div>
Expand Down
Loading

0 comments on commit 96c8f30

Please sign in to comment.