diff --git a/bootstrap/web/config.php b/bootstrap/web/config.php index 2542315..dfbaff0 100644 --- a/bootstrap/web/config.php +++ b/bootstrap/web/config.php @@ -38,6 +38,10 @@ return [ '{urls.assets}', 'fonts' ])), + 'urls.uploads' => DI\string(implode('', [ + 'file://', + '{folders.upload}' + ])), 'urls.metro.logo' => 'https://img.freepik.com/free-icon/santiago-metro-logo_318-66588.jpg?size=338&ext=jpg', 'urls.notaria.turno' => 'http://www.notariasdeturno.cl', 'urls.atencion' => 'https://zeroq.cl/#/local/notaria-patricio-raby/48', diff --git a/bootstrap/web/setup.php b/bootstrap/web/setup.php index 0e93e81..549b758 100644 --- a/bootstrap/web/setup.php +++ b/bootstrap/web/setup.php @@ -3,6 +3,8 @@ use Psr\Container\ContainerInterface as Container; return [ Slim\Views\Blade::class => function(Container $container) { + $manager = $container->get(ProVM\Common\Service\Filemanager::class); + $horario = $manager->folder('data')->load('horario.yml'); return new Slim\Views\Blade( $container->get('blade_template_path'), $container->get('blade_cache_path'), @@ -20,8 +22,10 @@ return [ 'atencion' => (object) [ 'url' => $container->get('urls.atencion'), 'logo' => $container->get('urls.atencion.logo') - ] + ], + 'uploads' => $container->get('urls.uploads') ], + 'horario' => $horario, 'styles' => $container->get('styles'), 'fonts' => $container->get('fonts'), 'scripts' => $container->get('scripts') diff --git a/common/Controller/Web/Admin/Documentos.php b/common/Controller/Web/Admin/Documentos.php new file mode 100644 index 0000000..bdf70a4 --- /dev/null +++ b/common/Controller/Web/Admin/Documentos.php @@ -0,0 +1,32 @@ +getParsedBody(); + $files = $request->getUploadedFiles(); + $file = $files['archivo']; + + $filename = implode(DIRECTORY_SEPARATOR, [ + $container->get('folders.upload'), + $post['filename'] . '.pdf' + ]); + $file->moveTo($filename); + $status = (file_exists($filename) and filemtime($filename) == time()); + + $output = [ + 'informacion' => $post, + 'estado' => $status, + 'archivo' => $filename + ]; + $response->getBody()->write(json_encode($output)); + return $response + ->withHeader('Content-Type', 'application/json') + ->withStatus(201); + } +} diff --git a/common/Controller/Web/Home.php b/common/Controller/Web/Home.php index 3044095..ffb5666 100644 --- a/common/Controller/Web/Home.php +++ b/common/Controller/Web/Home.php @@ -22,7 +22,8 @@ class Home { $item = new Link($item->texto, $item->uri); }); $aviso = $manager->folder('data')->load('aviso.yml'); - return $view->render($response, 'home', compact('banner', 'aviso', 'links')); + $transparencia = $manager->folder('data')->load('transparencia.yml')->activo; + return $view->render($response, 'home', compact('banner', 'aviso', 'links', 'transparencia')); } } diff --git a/index.php b/index.php new file mode 100644 index 0000000..0c1b1ac --- /dev/null +++ b/index.php @@ -0,0 +1,2 @@ + diff --git a/resources/routes/web/admin/documentos.php b/resources/routes/web/admin/documentos.php new file mode 100644 index 0000000..625887e --- /dev/null +++ b/resources/routes/web/admin/documentos.php @@ -0,0 +1,6 @@ +group('/documentos', function($app) { + $app->post('[/]', [Documentos::class, 'upload']); +}); diff --git a/resources/views/admin/documento.blade.php b/resources/views/admin/documento.blade.php index 9a6c6a7..61d180e 100644 --- a/resources/views/admin/documento.blade.php +++ b/resources/views/admin/documento.blade.php @@ -4,7 +4,7 @@ {{$descripcion}}
- + @include('admin.uicon')
diff --git a/resources/views/admin/documentos.blade.php b/resources/views/admin/documentos.blade.php index 6a84554..c7ed462 100644 --- a/resources/views/admin/documentos.blade.php +++ b/resources/views/admin/documentos.blade.php @@ -2,11 +2,25 @@ Carga de documentos
- @include('admin.documento', ['descripcion' => 'Escrituras Públicas', 'link' => '#']) - @include('admin.documento', ['descripcion' => 'Balances Anuales', 'link' => '#']) - @include('admin.documento', ['descripcion' => 'Interés y Patrimonio', 'link' => '#']) - @include('admin.documento', ['descripcion' => 'Infrormes Fiscalía', 'link' => '#']) - @include('admin.documento', ['descripcion' => 'Valores', 'link' => '#']) + @include('admin.documento', ['descripcion' => 'Escrituras Públicas', 'link' => 'escrituras_publicas']) + @include('admin.documento', ['descripcion' => 'Balances Anuales', 'link' => 'balances_anuales']) + @include('admin.documento', ['descripcion' => 'Interés y Patrimonio', 'link' => 'intereses_y_patrimonio']) + @include('admin.documento', ['descripcion' => 'Informes Fiscalía', 'link' => 'informes_fiscalia']) + @include('admin.documento', ['descripcion' => 'Valores', 'link' => 'valores']) +
+

Transparencia @@ -22,12 +36,44 @@ @push('scripts') @endpush diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index c1c7fd9..a1305c9 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -5,7 +5,9 @@ @include('home.suplente') @include('home.numero') @include('home.links') - @include('home.indice') + @if ($transparencia) + @include('home.indice') + @endif @include('home.aviso') @endsection diff --git a/resources/views/home/aviso.blade.php b/resources/views/home/aviso.blade.php index 89b0d00..5413e69 100644 --- a/resources/views/home/aviso.blade.php +++ b/resources/views/home/aviso.blade.php @@ -1,4 +1,4 @@ -