refactor/totales #41

Merged
atasistro merged 16 commits from refactor/totales into master 2025-04-13 23:22:10 -03:00
2 changed files with 4 additions and 14 deletions
Showing only changes of commit c46073ed06 - Show all commits

View file

@ -5,11 +5,10 @@ namespace App\Http\Controllers\Api;
use App\GrupoDeCompra;
use App\Http\Controllers\Controller;
use App\Http\Resources\GrupoDeCompraResource;
use Illuminate\Http\Request;
class GrupoDeCompraController extends Controller
{
public function index(Request $request)
public function index()
{
return GrupoDeCompraResource::collection(GrupoDeCompra::all());
}

View file

@ -28,18 +28,9 @@ Route::middleware('api')->group(function () {
$atributos_a_ocultar = ['telefono', 'cantidad_de_nucleos', 'correo', 'referente_finanzas', 'created_at', 'updated_at'];
return GrupoDeCompra::all()->makeHidden($atributos_a_ocultar)->sortBy('nombre')->groupBy('region');
});
Route::get('/{gdc}/bonos-de-transporte', function($gdc) {
$grupo = GrupoDeCompra::where('id',$gdc)->first();
return ['bdt' => $grupo->calcularCantidadBDT()];
});
Route::get('/{gdc}/bonos-barriales', function($gdc) {
$grupo = GrupoDeCompra::where('id',$gdc)->first();
return ['bonos_barriales' => $grupo->totalBonosBarriales()];
});
Route::get('/{gdc}/devoluciones', function($gdc) {
$habilitadas = GrupoDeCompra::find($gdc)->devoluciones_habilitadas;
return ['devoluciones' => $habilitadas];
});
Route::get('/{grupoDeCompra}', 'Api\GrupoDeCompraController@show');
Route::post('/{gdc}/devoluciones', function($gdc) {
$habilitadas = GrupoDeCompra::find($gdc)->toggleDevoluciones();
return ['devoluciones' => $habilitadas];