# VW_EVENT_COLOR_OLD

## Colonne

| Colonna | Tipo |
|---------|------|
| ID | NUMBER |
| STATUS | VARCHAR2(28) |
| COLOR | CHAR(7) |

## Definizione

```sql
CREATE OR REPLACE VIEW VW_EVENT_COLOR_OLD AS
select  e.id ,
        case when e.flg_superato = 1 
             then 'Prev non Accettato/Superato'
             when e.stato = 0 and d.id_evento is null 
             then 'Preventivo' 
             when e.stato = 0
             then 'Scheda Evento (preparazione)'                        
             when e.stato = 10 
             then 'Scheda Confermata' 
             when e.stato = 20 
             then 'Confermato' 
         end as status,       
        case when e.flg_superato = 1 
             then '#913096'
             when e.stato = 0 and d.id_evento is null 
             then '#ffffff' 
             when e.stato = 0
             then '#CAE3FC'                        
             when e.stato = 10 
             then '#FFFFB8' 
             when e.stato = 20 
             then '#B8FFB8' 
         end as color
  from eventi e
  left join (select max(data) data_deg , id_evento 
               from eventi_det_degust
             group by  id_evento
            ) d on e.id = d.id_evento
```
