Compare commits
2 Commits
957cc88a3f
...
4f9378899b
Author | SHA1 | Date | |
---|---|---|---|
4f9378899b | |||
031e4957b4 |
@ -32,7 +32,7 @@ class CategorieController extends Controller
|
|||||||
|
|
||||||
public function updatePostCategorie(Request $request)
|
public function updatePostCategorie(Request $request)
|
||||||
{
|
{
|
||||||
Categorie::updateNameById($request['id'],$request['cat_name']);
|
Categorie::updateNameById($request);
|
||||||
return redirect(route('categorie'));
|
return redirect(route('categorie'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,16 +22,16 @@ class Categorie extends Model
|
|||||||
|
|
||||||
public static function listSpesa()
|
public static function listSpesa()
|
||||||
{
|
{
|
||||||
return DB::table('categories')->where('cat_uscita','=',1)->get();
|
return DB::table('categories')->where('cat_uscita','=',1)->orderBy('cat_name')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function listEntrata()
|
public static function listEntrata()
|
||||||
{
|
{
|
||||||
return DB::table('categories')->where('cat_entrata','=',1)->get();
|
return DB::table('categories')->where('cat_entrata','=',1)->orderBy('cat_name')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function inserisci($request){
|
public static function inserisci($request){
|
||||||
if ($request['cat_entrata']=='on')
|
if ($request['cat_entrata']==='on')
|
||||||
{
|
{
|
||||||
$entrata=1;
|
$entrata=1;
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ class Categorie extends Model
|
|||||||
$entrata=0;
|
$entrata=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request['cat_uscita']=='on')
|
if ($request['cat_uscita']==='on')
|
||||||
{
|
{
|
||||||
$uscita=1;
|
$uscita=1;
|
||||||
}
|
}
|
||||||
@ -48,6 +48,7 @@ class Categorie extends Model
|
|||||||
{
|
{
|
||||||
$uscita=0;
|
$uscita=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DB::table('categories')->insert([
|
return DB::table('categories')->insert([
|
||||||
'cat_name'=> $request['cat_name'],
|
'cat_name'=> $request['cat_name'],
|
||||||
'cat_entrata'=>$entrata,
|
'cat_entrata'=>$entrata,
|
||||||
@ -68,7 +69,7 @@ class Categorie extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function updateNameById($request) {
|
public static function updateNameById($request) {
|
||||||
if ($request['cat_entrata']=='on')
|
if ($request['cat_entrata']==='on')
|
||||||
{
|
{
|
||||||
$entrata=1;
|
$entrata=1;
|
||||||
}
|
}
|
||||||
@ -77,7 +78,7 @@ class Categorie extends Model
|
|||||||
$entrata=0;
|
$entrata=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request['cat_uscita']=='on')
|
if ($request['cat_uscita']==='on')
|
||||||
{
|
{
|
||||||
$uscita=1;
|
$uscita=1;
|
||||||
}
|
}
|
||||||
@ -85,10 +86,11 @@ class Categorie extends Model
|
|||||||
{
|
{
|
||||||
$uscita=0;
|
$uscita=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::table('categories')
|
DB::table('categories')
|
||||||
->where('id','=', $request['id'])
|
->where('id','=', $request['id'])
|
||||||
->update([
|
->update([
|
||||||
'cat_name' => $request['name'],
|
'cat_name' => $request['cat_name'],
|
||||||
'cat_entrata' => $entrata,
|
'cat_entrata' => $entrata,
|
||||||
'cat_uscita'=>$uscita,
|
'cat_uscita'=>$uscita,
|
||||||
]);
|
]);
|
||||||
|
@ -10,6 +10,8 @@ use Rap2hpoutre\FastExcel\FastExcel;
|
|||||||
class Movimenti extends Model
|
class Movimenti extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
protected $dates = ['mov_data'];
|
||||||
|
protected $casts = [ 'mov_data'=>'datetime'];
|
||||||
|
|
||||||
public static function getList() {
|
public static function getList() {
|
||||||
return DB::table('movimentis')
|
return DB::table('movimentis')
|
||||||
@ -179,7 +181,8 @@ class Movimenti extends Model
|
|||||||
if($line['DARE']<>'')
|
if($line['DARE']<>'')
|
||||||
{
|
{
|
||||||
$dati=[
|
$dati=[
|
||||||
'mov_data'=>self::dateFormat(0,$line['VALUTA']),
|
'mov_data'=>self::dateFormat(0,$line['VALUTA']), // date_format(date_create($movimento->mov_data),'d/m/Y'
|
||||||
|
// 'mov_data'=>date_format(date_create($line['VALUTA']),'Y-m-d'),
|
||||||
'mov_fk_categoria'=>1,
|
'mov_fk_categoria'=>1,
|
||||||
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
|
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
|
||||||
'mov_importo'=>'-'.trim(str_replace(',','.',(str_replace('.','',$line['DARE'])))),
|
'mov_importo'=>'-'.trim(str_replace(',','.',(str_replace('.','',$line['DARE'])))),
|
||||||
@ -191,6 +194,7 @@ class Movimenti extends Model
|
|||||||
{
|
{
|
||||||
$dati=[
|
$dati=[
|
||||||
'mov_data'=>self::dateFormat(0,$line['VALUTA']),
|
'mov_data'=>self::dateFormat(0,$line['VALUTA']),
|
||||||
|
//'mov_data'=>date_format(date_create($line['VALUTA']),'Y-m-d'),
|
||||||
'mov_fk_categoria'=>1,
|
'mov_fk_categoria'=>1,
|
||||||
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
|
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
|
||||||
'mov_importo'=>trim(str_replace(',','.',(str_replace('.','',$line['AVERE'])))),
|
'mov_importo'=>trim(str_replace(',','.',(str_replace('.','',$line['AVERE'])))),
|
||||||
@ -216,11 +220,11 @@ class Movimenti extends Model
|
|||||||
|
|
||||||
if($type)
|
if($type)
|
||||||
{
|
{
|
||||||
$string=$string->format('Y-m-d');
|
// $string=$string->format('Y-m-d');
|
||||||
list($year,$month,$day) = explode('-',$string);
|
list($year,$month,$day) = explode('-',$string);
|
||||||
return $day.'/'.$month.'/'.$year;
|
return $day.'/'.$month.'/'.$year;
|
||||||
} else {
|
} else {
|
||||||
$string=$string->format('d/m/Y');
|
// $string=$string->format('d/m/Y');
|
||||||
list($day,$month,$year) =explode('/',$string);
|
list($day,$month,$year) =explode('/',$string);
|
||||||
return $year.'-'.$month.'-'.$day;
|
return $year.'-'.$month.'-'.$day;
|
||||||
}
|
}
|
||||||
|
7
public/js/app/conti_categorie.js
vendored
7
public/js/app/conti_categorie.js
vendored
@ -21,9 +21,13 @@ $(document).on('click','.open_modal',function(){
|
|||||||
//success data
|
//success data
|
||||||
$('#cat_entrata').prop('checked', false);
|
$('#cat_entrata').prop('checked', false);
|
||||||
$('#cat_uscita').prop('checked', false);
|
$('#cat_uscita').prop('checked', false);
|
||||||
|
|
||||||
|
|
||||||
console.log(data[0]);
|
console.log(data[0]);
|
||||||
console.log(data[0].cat_name);
|
console.log(data[0].cat_name);
|
||||||
$('#H_cat_cat_name').val(data[0].cat_name);
|
|
||||||
|
|
||||||
|
|
||||||
if (data[0].cat_uscita === 1)
|
if (data[0].cat_uscita === 1)
|
||||||
{
|
{
|
||||||
// $('.myCheckbox').prop('checked', true);
|
// $('.myCheckbox').prop('checked', true);
|
||||||
@ -34,6 +38,7 @@ $(document).on('click','.open_modal',function(){
|
|||||||
$('#cat_entrata').prop('checked', true);
|
$('#cat_entrata').prop('checked', true);
|
||||||
}
|
}
|
||||||
$('#H_cat_id').val(data[0].id);
|
$('#H_cat_id').val(data[0].id);
|
||||||
|
$('#H_cat_cat_name').val(data[0].cat_name);
|
||||||
$('#myModal').modal('show');
|
$('#myModal').modal('show');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
70
public/js/app/movimenti.js
vendored
70
public/js/app/movimenti.js
vendored
@ -24,24 +24,32 @@ var strDate = d.getFullYear() + '-' +
|
|||||||
$(document).on('click', '.open_modal_spesa', function() {
|
$(document).on('click', '.open_modal_spesa', function() {
|
||||||
console.log(strDate);
|
console.log(strDate);
|
||||||
$("#categoria").empty();
|
$("#categoria").empty();
|
||||||
|
$("#tags").empty();
|
||||||
$('#form').find('input[type="text"], textarea, input[type="number"],input[type="date"],option').val("");
|
$('#form').find('input[type="text"], textarea, input[type="number"],input[type="date"],option').val("");
|
||||||
$('#form').find('input[type="date"]').val(strDate);
|
$('#form').find('input[type="date"]').val(strDate);
|
||||||
$('#myModal').modal('show');
|
$('#myModal').modal('show');
|
||||||
$('.modal-title').text(' Nuovo movimento in uscita');
|
$('.modal-title').text(' Nuovo movimento in uscita');
|
||||||
$('#form').attr('action', '/admin/movimenti/spesa');
|
$('#form').attr('action', '/admin/movimenti/spesa');
|
||||||
$.getJSON("/admin/service/catlistSpesa", {}, function(data) {
|
$.getJSON("/admin/service/catlistSpesa", {}, function(cats) {
|
||||||
$.each(data, function(i, item) {
|
$.each(cats, function(i, cat) {
|
||||||
$("select[name='mov_fk_categoria']").append(
|
$("select[name='mov_fk_categoria']").append(
|
||||||
new Option(item.cat_name, item.id)
|
new Option(cat.cat_name, cat.id)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
$.getJSON("/admin/service/taglist", {}, function(tags) {
|
||||||
|
$.each(tags, function(i, tag) {
|
||||||
|
$("select[name='mov_fk_tags']").append(
|
||||||
|
new Option(tag.tag_name, tag.id)
|
||||||
|
)
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.open_modal_entrata', function() {
|
$(document).on('click', '.open_modal_entrata', function() {
|
||||||
console.log(strDate);
|
console.log(strDate);
|
||||||
$("#categoria").empty();
|
$("#categoria").empty();
|
||||||
|
$("#tags").empty();
|
||||||
$('#form').find('input[type="text"], textarea, input[type="number"],option').val("");
|
$('#form').find('input[type="text"], textarea, input[type="number"],option').val("");
|
||||||
$('#form').find('input[type="date"]').val(strDate);
|
$('#form').find('input[type="date"]').val(strDate);
|
||||||
$('#myModal').modal('show');
|
$('#myModal').modal('show');
|
||||||
@ -55,48 +63,64 @@ $(document).on('click', '.open_modal_entrata', function() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
$.getJSON("/admin/service/taglist", {}, function(data) {
|
||||||
|
$.each(data, function(i, item) {
|
||||||
|
$("select[name='mov_fk_tags']").append(
|
||||||
|
new Option(item.tag_name, item.id)
|
||||||
|
)
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.open_modal_modifica', function() {
|
$(document).on('click', '.open_modal_modifica', function() {
|
||||||
var url = "/admin/movimenti/modify";
|
var url = "/admin/movimenti/modify";
|
||||||
var riga_id = $(this).val();
|
var riga_id = $(this).val();
|
||||||
$("#categoria").empty();
|
$("#categoria").empty();
|
||||||
|
$("#tags").empty();
|
||||||
$.getJSON(url + '/' + riga_id, function(data) {
|
$.getJSON(url + '/' + riga_id, function(data) {
|
||||||
// success data
|
// success data
|
||||||
console.log(data[0]);
|
console.log(data[0]);
|
||||||
|
$.getJSON("/admin/service/taglist", {}, function(tags) {
|
||||||
|
$.each(tags, function(i, tag) {
|
||||||
|
$("select[name='mov_fk_tags']").append(
|
||||||
|
new Option(tag.tag_name, tag.id)
|
||||||
|
)
|
||||||
|
$('#tags')
|
||||||
|
.find('option:contains(' + data[0].tag_name + ')')
|
||||||
|
.prop('selected', true)
|
||||||
|
.trigger('change');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$.getJSON("/admin/service/catlist", {}, function(cats) {
|
||||||
|
$.each(cats, function(i, cat) {
|
||||||
|
$("select[name='mov_fk_categoria']").append(
|
||||||
|
new Option(cat.cat_name, cat.id)
|
||||||
|
)
|
||||||
|
$('#categoria')
|
||||||
|
.find('option:contains(' + data[0].cat_name + ')')
|
||||||
|
.prop('selected', true)
|
||||||
|
.trigger('change');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
$('.modal-title').text('Modifica movimento');
|
$('.modal-title').text('Modifica movimento');
|
||||||
$('#data').val(data[0].mov_data);
|
$('#data').val(data[0].mov_data);
|
||||||
$('#descrizione').val(data[0].mov_descrizione);
|
$('#descrizione').val(data[0].mov_descrizione);
|
||||||
$('#importo').val(data[0].mov_importo);
|
$('#importo').val(data[0].mov_importo);
|
||||||
$('#tags')
|
|
||||||
.find('option:contains(' + data[0].tag_name + ')')
|
|
||||||
.prop('selected', true)
|
|
||||||
.trigger('change');
|
|
||||||
$('#categoria')
|
|
||||||
.find('option:contains(' + data[0].cat_name + ')')
|
|
||||||
.prop('selected', true)
|
|
||||||
.trigger('change');
|
|
||||||
$('#myModal').modal('show');
|
$('#myModal').modal('show');
|
||||||
// $('.panel-heading').text('Modifica movimento');
|
// $('.panel-heading').text('Modifica movimento');
|
||||||
$('#form').attr('action', '/admin/movimenti/modify');
|
$('#form').attr('action', '/admin/movimenti/modify');
|
||||||
$('#form').append('<input type="hidden" name="id" value="' + riga_id + '">');
|
$('#form').append('<input type="hidden" name="id" value="' + riga_id + '">');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$.getJSON("/admin/service/catlist", {}, function(data) {
|
|
||||||
$.each(data, function(i, item) {
|
|
||||||
$("select[name='mov_fk_categoria']").append(
|
|
||||||
new Option(item.cat_name, item.id)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$.getJSON("/admin/service/taglist", {}, function(data) {
|
/*$.getJSON("/admin/service/taglist", {}, function(data) {
|
||||||
$.each(data, function(i, item) {
|
$.each(data, function(i, item) {
|
||||||
$("select[name='mov_fk_tags']").append(
|
$("select[name='mov_fk_tags']").append(
|
||||||
new Option(item.tag_name, item.id)
|
new Option(item.tag_name, item.id)
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
});
|
});*/
|
||||||
|
@ -61,17 +61,19 @@
|
|||||||
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
|
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
|
||||||
aria-labelledby="myModalLabel" aria-hidden="true">
|
aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
|
<form action="/admin/categorie/modify" method="POST">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title">Modifica Categoria</h4>
|
<h4 class="modal-title">Modifica Categoria</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<form action="/admin/categorie/modify" method="POST">
|
|
||||||
@csrf <label for="H_cat_cat_name" class="form-label">Categoria</label>
|
@csrf
|
||||||
<input type="text" class="form-control" id="H_cat_cat_name"
|
<label for="H_cat_cat_name" class="form-label">Categoria</label>
|
||||||
size="50" name="cat_name" value="" size="50">
|
<input type="text" class="form-control" id="H_cat_cat_name" size="50" name="cat_name">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -94,8 +96,9 @@
|
|||||||
<input type="hidden" name="id" id="H_cat_id">
|
<input type="hidden" name="id" id="H_cat_id">
|
||||||
<button type="submit" class="btn btn-primary">Modifica</button>
|
<button type="submit" class="btn btn-primary">Modifica</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- FINE MODAL MODIFICA -->
|
<!-- FINE MODAL MODIFICA -->
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
@foreach( $movimenti as $movimento )
|
@foreach( $movimenti as $movimento )
|
||||||
<tr>
|
<tr>
|
||||||
<!-- <td>{{ date_format(date_create($movimento->mov_data),'d/m/Y'); }}</td>-->
|
<!-- <td>{{ date_format(date_create($movimento->mov_data),'d/m/Y'); }}</td>-->
|
||||||
<td>{{$movimento->mov_data}}</td>
|
<td>{{ $movimento->mov_data}}</td>
|
||||||
<td>{{ $movimento->cat_name; }}</td>
|
<td>{{ $movimento->cat_name; }}</td>
|
||||||
<td>{{ $movimento->mov_descrizione; }}</td>
|
<td>{{ $movimento->mov_descrizione; }}</td>
|
||||||
<td>€ {{ $movimento->mov_importo; }}</td>
|
<td>€ {{ $movimento->mov_importo; }}</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user