Compare commits
11 Commits
v0.11.0-rc
...
90c5d9dcd6
Author | SHA1 | Date | |
---|---|---|---|
90c5d9dcd6 | |||
7a0ec94abe | |||
319cd5e44e | |||
cf18949409 | |||
ac571273f5 | |||
667e929b2f | |||
c206934099 | |||
575693def1 | |||
080577d002 | |||
9e8533ea50 | |||
bca4665721 |
@ -3,13 +3,16 @@ use DI\Bridge\Slim\Bridge;
|
||||
|
||||
include_once 'composer.php';
|
||||
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(dirname(__DIR__));
|
||||
$dotenv->load();
|
||||
|
||||
$container_builder = new DI\ContainerBuilder();
|
||||
|
||||
$folders = [
|
||||
'common'
|
||||
];
|
||||
if (isset($_ENV)) {
|
||||
$folders []= $_ENV;
|
||||
if (isset($__environment)) {
|
||||
$folders []= $__environment;
|
||||
}
|
||||
|
||||
$file = 'config.php';
|
||||
|
@ -9,5 +9,6 @@ return [
|
||||
'{folders.resources}',
|
||||
'routes'
|
||||
])),
|
||||
'urls.base' => '/provm/raby'
|
||||
'base_url' => getenv('BASE_URL'),
|
||||
'urls.base' => getenv('URLS_BASE')
|
||||
];
|
||||
|
@ -1,3 +1,3 @@
|
||||
<?php
|
||||
$_ENV = 'web';
|
||||
$__environment = 'web';
|
||||
include_once 'app.php';
|
||||
|
@ -47,12 +47,13 @@ return [
|
||||
'uploads'
|
||||
])),
|
||||
'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.notaria.turno' => 'https://www.notariosyconservadores.cl/notarias-de-turno/',
|
||||
'urls.fojas' => 'http://fojas.cl/?motv=vista_descarga_web&cons_sel=not_patricrabybenavent',
|
||||
'urls.atencion' => 'https://zeroq.cl/#/local/notaria-patricio-raby/48',
|
||||
'urls.atencion.logo' => 'https://zeroq.cl/img/logo-small.png',
|
||||
'urls.map' => 'https://maps.google.com/maps?hl=es&q=Notaria%20Patricio%20Raby+(Notaria%20Patricio%20Raby)&ie=UTF8&z=16&iwloc=B&output=embed',
|
||||
'urls.map2' => 'https://www.google.com/maps/embed/v1/place?q=notaria+patricio+raby&key=AIzaSyBFw0Qbyq9zTFTd-tUY6dZWTgaQzuU17R8',
|
||||
'urls.direccion' => 'https://goo.gl/maps/xcxs1SQ9BPAbUDi69',
|
||||
'styles' => [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/semantic.min.css',
|
||||
DI\string(implode('/', ['{urls.styles}', 'iconmoon.css'])),
|
||||
@ -76,14 +77,24 @@ return [
|
||||
'email.recepcion' => 'recepcion@notariaraby.cl',
|
||||
'email.administrativo' => 'vwielandt@notariaraby.cl',
|
||||
'email' => [
|
||||
'host' => 'smtp.notariaraby.cl',
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
'secure' => 'ssl'
|
||||
'host' => 'mail.notariaraby.cl',
|
||||
'username' => 'contacto@notariaraby.cl',
|
||||
'password' => 'ntrco2020'
|
||||
],
|
||||
'scripts' => [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/semantic.min.js',
|
||||
'https://friconix.com/cdn/friconix.js'
|
||||
]
|
||||
],
|
||||
'app.cookie.name' => 'login',
|
||||
'app.cookie.time' => 20 * 60 * 60, // 20 min
|
||||
'files.login' => 'login.yml',
|
||||
'urls.admin' => DI\string(implode('/', [
|
||||
'{urls.base}',
|
||||
'admin'
|
||||
])),
|
||||
'urls.login' => DI\string(implode('/', [
|
||||
'{urls.admin}',
|
||||
'login'
|
||||
]))
|
||||
];
|
||||
|
@ -1,11 +1,2 @@
|
||||
<?php
|
||||
$app->add(new ProVM\NotariaRaby\Common\Middleware\Blade($app->getContainer()));
|
||||
$app->add(new Tuupola\Middleware\HttpBasicAuthentication([
|
||||
'path' => $app->getContainer()->get('urls.base') . '/admin',
|
||||
'ignore' => [
|
||||
'/admin/login'
|
||||
],
|
||||
'users' => [
|
||||
'admin' => 'admin'
|
||||
]
|
||||
]));
|
||||
|
@ -11,7 +11,7 @@ return [
|
||||
null,
|
||||
[
|
||||
'urls' => (object) [
|
||||
'base' => $container->get('urls.base'),
|
||||
'base' => $container->get('base_url'),
|
||||
'assets' => (object) [
|
||||
'images' => $container->get('urls.images'),
|
||||
'styles' => $container->get('urls.styles'),
|
||||
@ -24,7 +24,9 @@ return [
|
||||
'url' => $container->get('urls.atencion'),
|
||||
'logo' => $container->get('urls.atencion.logo')
|
||||
],
|
||||
'uploads' => $container->get('urls.uploads')
|
||||
'uploads' => $container->get('urls.uploads'),
|
||||
'direccion' => $container->get('urls.direccion'),
|
||||
'admin' => $container->get('urls.admin')
|
||||
],
|
||||
'horario' => $horario,
|
||||
'styles' => $container->get('styles'),
|
||||
@ -38,9 +40,32 @@ return [
|
||||
$manager->addFolder('data', $c->get('folders.data'));
|
||||
return $manager;
|
||||
},
|
||||
ProVM\NotariaRaby\Common\Service\Login::class => function(Container $c) {
|
||||
return new ProVM\NotariaRaby\Common\Service\Login(
|
||||
$c->get('app.cookie.name'),
|
||||
$c->get('app.cookie.time'),
|
||||
$c->get('urls.admin'),
|
||||
getenv('ADMIN_PASSWORD'),
|
||||
$c->get('files.login'),
|
||||
$c->get(ProVM\Common\Service\Filemanager::class)
|
||||
);
|
||||
},
|
||||
ProVM\NotariaRaby\Common\Middleware\Auth::class => function(Container $c) {
|
||||
return new ProVM\NotariaRaby\Common\Middleware\Auth(
|
||||
['admin'],
|
||||
$c->get('urls.login'),
|
||||
$c->get(ProVM\NotariaRaby\Common\Service\Login::class)
|
||||
);
|
||||
},
|
||||
Nette\Mail\SendmailMailer::class => DI\create(),
|
||||
Nette\Mail\SmtpMailer::class => function(Container $c) {
|
||||
return new Nette\Mail\SmtpMailer($c->get('email'));
|
||||
},
|
||||
Nette\Mail\FallbackMailer::class => function(Container $c) {
|
||||
return new Nette\Mail\FallbackMailer([
|
||||
$c->get(Nette\Mail\SmtpMailer::class),
|
||||
$c->get(Nette\Mail\SendmailMailer::class)
|
||||
]);
|
||||
},
|
||||
Nette\Mail\Message::class => DI\create()
|
||||
];
|
||||
|
41
common/Controller/Web/Admin/Clave.php
Normal file
41
common/Controller/Web/Admin/Clave.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace ProVm\NotariaRaby\Common\Controller\Web\Admin;
|
||||
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Views\Blade as View;
|
||||
use ProVM\Common\Service\Filemanager;
|
||||
use ProVM\NotariaRaby\Common\Service\Login;
|
||||
|
||||
class Clave {
|
||||
public function __invoke(Request $request, Response $response, View $view): Response {
|
||||
return $view->render($response, 'admin.clave');
|
||||
}
|
||||
public function do_edit(Request $request, Response $response, Container $container, Filemanager $filemanager, Login $service): Response {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__, 4),
|
||||
'.env'
|
||||
]);
|
||||
$vars = [];
|
||||
if (file_exists($filename)) {
|
||||
$vars = explode(PHP_EOL, trim(file_get_contents($filename)));
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($vars as $i => $var) {
|
||||
if (strpos($var, 'ADMIN_PASSWORD=') !== false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
$post = $request->getParsedBody();
|
||||
$enc = password_hash($post['clave'], \PASSWORD_DEFAULT);
|
||||
$vars[$i] = implode('=', [
|
||||
'ADMIN_PASSWORD',
|
||||
'"' . $enc . '"'
|
||||
]);
|
||||
file_put_contents($filename, implode(PHP_EOL, $vars));
|
||||
return $response
|
||||
->withHeader('Location', $container->get('urls.admin'))
|
||||
->withStatus(301);
|
||||
}
|
||||
}
|
@ -4,9 +4,31 @@ namespace ProVM\NotariaRaby\Common\Controller\Web\Admin;
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Views\Blade as View;
|
||||
use Carbon\Carbon;
|
||||
use ProVM\Common\Service\Filemanager;
|
||||
|
||||
class Documentos {
|
||||
public function __invoke(Request $request, Response $response, Container $container, View $view, $tipo): Response {
|
||||
$glob = implode(DIRECTORY_SEPARATOR, [
|
||||
$container->get('folders.upload'),
|
||||
$tipo . '*.pdf'
|
||||
]);
|
||||
$files = glob($glob);
|
||||
$archivos = [];
|
||||
foreach ($files as $filename) {
|
||||
$file = new \SplFileInfo($filename);
|
||||
$archivos []= $file;
|
||||
}
|
||||
$titulo = $tipo;
|
||||
$months = (object) ['full' => [], 'short' => []];
|
||||
$m = Carbon::createFromDate(0, 1, 1);
|
||||
for ($i = 0; $i < 12; $i ++) {
|
||||
$months->full []= ucwords($m->copy()->addMonths($i)->locale('es_ES')->isoFormat('MMMM'));
|
||||
$months->short []= ucwords($m->copy()->addMonths($i)->locale('es_ES')->isoFormat('MMM'));
|
||||
}
|
||||
return $view->render($response, 'admin.archivos.list', compact('titulo', 'archivos', 'months'));
|
||||
}
|
||||
public function upload(Request $request, Response $response, Filemanager $filemanager, Container $container): Response {
|
||||
$post = $request->getParsedBody();
|
||||
$files = $request->getUploadedFiles();
|
||||
@ -33,4 +55,21 @@ class Documentos {
|
||||
->withHeader('Content-Type', 'application/json')
|
||||
->withStatus(201);
|
||||
}
|
||||
public function delete(Request $request, Response $response, Container $container): Response {
|
||||
$post = $request->getParsedBody();
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
$container->get('folders.upload'),
|
||||
$post['archivo'] . '.pdf'
|
||||
]);
|
||||
$status = unlink($filename);
|
||||
$output = [
|
||||
'informacion' => $post,
|
||||
'estado' => $status,
|
||||
'archivo' => $filename
|
||||
];
|
||||
$response->getBody()->write(json_encode($output));
|
||||
return $response
|
||||
->withHeader('Content-Type', 'application/json')
|
||||
->withStatus(201);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,26 @@
|
||||
<?php
|
||||
namespace ProVM\NotariaRaby\Common\Controller\Web\Admin;
|
||||
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Views\Blade as View;
|
||||
use ProVM\NotariaRaby\Common\Service\Login as Service;
|
||||
|
||||
class Login {
|
||||
public function __invoke(Request $request, Response $response, View $view): Response {
|
||||
return $view->render($response, 'admin.login');
|
||||
}
|
||||
public function do_login(Request $request, Response $response, Service $login, Container $container): Response {
|
||||
$login->login($request);
|
||||
return $response
|
||||
->withHeader('Location', $container->get('urls.admin'))
|
||||
->withStatus(302);
|
||||
}
|
||||
public function logout(Request $request, Response $response, Service $login, Container $container): Response {
|
||||
$login->logout();
|
||||
return $response
|
||||
->withHeader('Location', $container->get('urls.base'))
|
||||
->withStatus(302);
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,12 @@ class Notificacion {
|
||||
if (isset($post['activo'])) {
|
||||
$notificacion->activo = json_decode($post['activo']);
|
||||
}
|
||||
$filemanager->folder('data')->save($filename, $notificacion);
|
||||
$status = $filemanager->folder('data')->save($filename, $notificacion);
|
||||
|
||||
$output = [
|
||||
'informacion' => $post,
|
||||
'editado' => $notificacion
|
||||
'editado' => $notificacion,
|
||||
'estado' => ($status !== false) ? 'ok' : 'error'
|
||||
];
|
||||
$response->getBody()->write(json_encode($output));
|
||||
return $response
|
||||
|
@ -20,11 +20,12 @@ class Transparencia {
|
||||
if (isset($post['activo'])) {
|
||||
$transparencia->activo = json_decode($post['activo']);
|
||||
}
|
||||
$filemanager->folder('data')->save($filename, $transparencia);
|
||||
$status = $filemanager->folder('data')->save($filename, $transparencia);
|
||||
|
||||
$output = [
|
||||
'informacion' => $post,
|
||||
'editado' => $transparencia
|
||||
'editado' => $transparencia,
|
||||
'estado' => ($status !== false) ? 'ok' : 'error'
|
||||
];
|
||||
$response->getBody()->write(json_encode($output));
|
||||
return $response
|
||||
|
@ -5,7 +5,7 @@ use Psr\Container\ContainerInterface as Container;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Views\Blade as View;
|
||||
use Nette\Mail\SendmailMailer as Mailer;
|
||||
use Nette\Mail\FallbackMailer as Mailer;
|
||||
use Nette\Mail\Message;
|
||||
|
||||
class Contacto {
|
||||
@ -17,24 +17,39 @@ class Contacto {
|
||||
$post = $request->getParsedBody();
|
||||
|
||||
$body = [];
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
$container->get('folders.templates'),
|
||||
'contacto',
|
||||
'email.php'
|
||||
]);
|
||||
$html = file_get_contents($filename);
|
||||
foreach ($post as $key => $val) {
|
||||
$body []= $key . ': ' . $val;
|
||||
$body []= ucwords($key) . ': ' . $val;
|
||||
$html = str_replace('{{$' . $key . '}}', $val, $html);
|
||||
}
|
||||
$body = implode(PHP_EOL, $body);
|
||||
|
||||
$subject = 'Contacto Web - ' . $post['nombre'];
|
||||
|
||||
$message = $container->make(Message::class)
|
||||
->setFrom($post['email'], $post['nombre'])
|
||||
->setFrom($container->get('email')['username'])
|
||||
->addTo($container->get('email.recepcion'))
|
||||
->addCc($container->get('email.administrativo'))
|
||||
->setSubject($subject)
|
||||
->setBody($body)
|
||||
->setHTMLBody(nl2br($body));
|
||||
//$mailer->send($message);
|
||||
->setHTMLBody($html);
|
||||
$mailer->send($message);
|
||||
$message = $container->make(Message::class)
|
||||
->setFrom($container->get('email')['username'])
|
||||
->addTo($post['email'], $post['nombre'])
|
||||
->setSubject($subject)
|
||||
->setBody('Su correo a Notaría Patricio Raby Benavente ha sido recibido.');
|
||||
$mailer->send($message);
|
||||
|
||||
$output = [
|
||||
'informacion' => $post,
|
||||
'mail' => [
|
||||
'from' => $post['email'],
|
||||
'to' => $container->get('email.recepcion'),
|
||||
'cc' => $container->get('email.administrativo'),
|
||||
'asunto' => $subject,
|
||||
|
25
common/Controller/Web/Documentos.php
Normal file
25
common/Controller/Web/Documentos.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace ProVM\NotariaRaby\Common\Controller\Web;
|
||||
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
||||
class Documentos {
|
||||
public function existe(Request $request, Response $response, Container $container, $documento): Response {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
$container->get('folders.upload'),
|
||||
$documento . '.pdf'
|
||||
]);
|
||||
$existe = file_exists($filename);
|
||||
$output = [
|
||||
'informacion' => $documento,
|
||||
'archivo' => $filename,
|
||||
'existe' => $existe
|
||||
];
|
||||
$response->getBody()->write(json_encode($output));
|
||||
return $response
|
||||
->withHeader('Content-Type', 'application/json')
|
||||
->withStatus(201);
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ class Home {
|
||||
public function __invoke(Request $request, Response $response, View $view, Filemanager $manager, Container $container): Response {
|
||||
$banner = (object) [
|
||||
'titulo' => "5° NOTARÍA DE SANTIAGO",
|
||||
'contenido' => "Gertrudis Echenique 30, of. 32, El Golf\n<i class=\"large icon icon-metro\"></i> Metro Alcantara"
|
||||
'contenido' => '<a href="' . $container->get('urls.direccion') . '">Gertrudis Echenique 30, of. 32, El Golf' . "\n" . '<i class="large icon icon-metro"></i> Metro Alcantara</a>'
|
||||
];
|
||||
|
||||
$links = $manager->folder('data')->load('documentos.yml');
|
||||
|
@ -4,6 +4,7 @@ namespace ProVM\NotariaRaby\Common\Controller\Web;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Views\Blade as View;
|
||||
use Carbon\Carbon;
|
||||
use ProVM\Common\Service\Filemanager;
|
||||
|
||||
class Notaria {
|
||||
@ -12,6 +13,12 @@ class Notaria {
|
||||
$equipos = $filemanager->folder('data')->load($filename);
|
||||
$filename = 'transparencia.yml';
|
||||
$transparencia = $filemanager->folder('data')->load($filename);
|
||||
return $view->render($response, 'notaria', compact('equipos', 'transparencia'));
|
||||
$months = (object) ['full' => [], 'short' => []];
|
||||
$m = Carbon::createFromDate(0, 1, 1);
|
||||
for ($i = 0; $i < 12; $i ++) {
|
||||
$months->full []= ucwords($m->copy()->addMonths($i)->locale('es_ES')->isoFormat('MMMM'));
|
||||
$months->short []= ucwords($m->copy()->addMonths($i)->locale('es_ES')->isoFormat('MMM'));
|
||||
}
|
||||
return $view->render($response, 'notaria', compact('equipos', 'transparencia', 'months'));
|
||||
}
|
||||
}
|
||||
|
28
common/Middleware/Auth.php
Normal file
28
common/Middleware/Auth.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace ProVM\NotariaRaby\Common\Middleware;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Server\RequestHandlerInterface as Handler;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
use ProVM\NotariaRaby\Common\Service\Login;
|
||||
|
||||
class Auth {
|
||||
protected $users;
|
||||
public function __construct(array $users, string $login_url, Login $service) {
|
||||
$this->users = $users;
|
||||
$this->login_url = $login_url;
|
||||
$this->login = $service;
|
||||
}
|
||||
public function __invoke(Request $request, Handler $handler): Response {
|
||||
$response = $handler->handle($request);
|
||||
|
||||
$is_logged_in = $this->login->checkAuth($request);
|
||||
if (!$is_logged_in and $request->getRequestTarget() != $this->login_url and $request->getRequestTarget() != implode('/', [dirname($this->login_url), 'logout'])) {
|
||||
return $response
|
||||
->withHeader('Location', $this->login_url)
|
||||
->withStatus(301);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
122
common/Service/Login.php
Normal file
122
common/Service/Login.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
namespace ProVM\NotariaRaby\Common\Service;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Carbon\Carbon;
|
||||
use ProVM\Common\Service\Filemanager;
|
||||
|
||||
class Login {
|
||||
protected $cookie_name;
|
||||
protected $time_limit;
|
||||
protected $password;
|
||||
protected $filename;
|
||||
protected $manager;
|
||||
public function __construct(string $cookie_name, int $time_limit, string $base_url, string $encrypted_password, string $login_file, Filemanager $filemanager) {
|
||||
$this->cookie_name = $cookie_name;
|
||||
$this->base_url = $base_url;
|
||||
$this->time_limit = $time_limit;
|
||||
$this->password = $encrypted_password;
|
||||
$this->filename = $login_file;
|
||||
$this->manager = $filemanager;
|
||||
}
|
||||
|
||||
protected $selector;
|
||||
protected $token;
|
||||
public function loadCookie() {
|
||||
if (isset($_COOKIE[$this->cookie_name])) {
|
||||
list($s, $t) = \explode(':', $_COOKIE[$this->cookie_name]);
|
||||
$this->selector = $s;
|
||||
$this->token = $t;
|
||||
}
|
||||
}
|
||||
public function saveCookie() {
|
||||
$now = Carbon::now();
|
||||
$exp = $now->addSeconds($this->time_limit);
|
||||
\setcookie($this->cookie_name, implode(':', [$this->selector, $this->token]), $exp->timestamp, $this->base_url);
|
||||
}
|
||||
public function removeCookie() {
|
||||
\setcookie($this->cookie_name, '', Carbon::now()->timestamp, '/');
|
||||
}
|
||||
protected function generateToken() {
|
||||
$this->selector = bin2hex(\random_bytes(12));
|
||||
$this->token = bin2hex(\random_bytes(20));
|
||||
}
|
||||
protected $data;
|
||||
public function getData() {
|
||||
if ($this->data === null) {
|
||||
$this->data = (object) [
|
||||
'ip' => 0,
|
||||
'token' => '',
|
||||
'time' => 0
|
||||
];
|
||||
if ($this->manager->folder('data')->exists($this->filename)) {
|
||||
$this->data = $this->manager->folder('data')->load($this->filename);
|
||||
$this->data->time = Carbon::parse($this->data->time);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected $ip;
|
||||
public function getIp(Request $request) {
|
||||
if ($this->ip === null) {
|
||||
$this->ip = $request->getHeader('host')[0];
|
||||
}
|
||||
return $this->ip;
|
||||
}
|
||||
|
||||
protected $is_logged_in;
|
||||
public function checkAuth(Request $request): bool {
|
||||
if ($this->is_logged_in === null) {
|
||||
$this->loadCookie();
|
||||
if ($this->selector === null) {
|
||||
$this->is_logged_in = false;
|
||||
return false;
|
||||
}
|
||||
$this->getIp($request);
|
||||
$this->getData();
|
||||
|
||||
if ($this->data->ip != $this->ip) {
|
||||
$this->is_logged_in = false;
|
||||
return false;
|
||||
}
|
||||
if ($this->data->token != implode(':', [$this->selector, $this->token])) {
|
||||
$this->is_logged_in = false;
|
||||
return false;
|
||||
}
|
||||
$now = Carbon::now();
|
||||
if ($this->data->time->copy()->addSeconds($this->time_limit)->diffInSeconds($now->copy()) < 0) {
|
||||
$this->is_logged_in = false;
|
||||
}
|
||||
$this->is_logged_in = true;
|
||||
}
|
||||
return $this->is_logged_in;
|
||||
}
|
||||
public function login(Request $request): bool {
|
||||
$post = $request->getParsedBody();
|
||||
if (!password_verify($post['clave'], $this->password)) {
|
||||
return false;
|
||||
}
|
||||
$this->generateToken();
|
||||
$this->getIp($request);
|
||||
$time = Carbon::now();
|
||||
$data = [
|
||||
'ip' => $this->ip,
|
||||
'token' => implode(':', [$this->selector, $this->token]),
|
||||
'time' => $time->format('Y-m-d H:i')
|
||||
];
|
||||
$this->manager->folder('data')->save($this->filename, $data);
|
||||
$this->saveCookie();
|
||||
$this->is_logged_in = true;
|
||||
return true;
|
||||
}
|
||||
public function logout(): bool {
|
||||
$this->removeCookie();
|
||||
$data = [
|
||||
'ip' => 0,
|
||||
'token' => ':',
|
||||
'time' => 0
|
||||
];
|
||||
$this->manager->folder('data')->save($this->filename, $data);
|
||||
$this->is_logged_in = false;
|
||||
return true;
|
||||
}
|
||||
}
|
@ -15,7 +15,8 @@
|
||||
"tuupola/slim-basic-auth": "^3.2",
|
||||
"mustangostang/spyc": "^0.6.3",
|
||||
"nette/mail": "^3.1",
|
||||
"nesbot/carbon": "^2.32"
|
||||
"nesbot/carbon": "^2.32",
|
||||
"vlucas/phpdotenv": "^4.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5",
|
||||
|
@ -11,7 +11,7 @@ abstract class Controller implements ControllerInterface {
|
||||
->withHeader('Content-Type', 'application/json')
|
||||
->withStatus(201);
|
||||
}
|
||||
public function withRedirect(string $uri): Response {
|
||||
public function withRedirect(Response $response, string $uri): Response {
|
||||
return $response
|
||||
->withHeader('Location', $uri)
|
||||
->withStatus(303);
|
||||
|
@ -30,9 +30,12 @@ class Filemanager {
|
||||
public function folder(string $name) {
|
||||
return new Filemanager($this->filesystem, $this->folders[$name]);
|
||||
}
|
||||
public function exists(string $filename) {
|
||||
return $this->filesystem->exists($this->fullPath($filename));
|
||||
}
|
||||
public function load(string $filename) {
|
||||
$filename = $this->fullPath($filename);
|
||||
if (!$this->filesystem->exists($filename)) {
|
||||
if (!$this->exists($filename)) {
|
||||
return false;
|
||||
}
|
||||
$file = new \SplFileInfo($filename);
|
||||
@ -67,7 +70,7 @@ class Filemanager {
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
public function save(string $filename, $data) {
|
||||
public function save(string $filename, $data): bool {
|
||||
if (is_object($data)) {
|
||||
$data = (array) $data;
|
||||
}
|
||||
@ -75,6 +78,6 @@ class Filemanager {
|
||||
$data = Yaml::YAMLDump($data, false, false, true);
|
||||
}
|
||||
$filename = $this->fullPath($filename);
|
||||
file_put_contents($filename, $data);
|
||||
return file_put_contents($filename, $data);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,14 @@
|
||||
background-blend-mode: multiply;
|
||||
color: white;
|
||||
}
|
||||
@media screen and (max-width: 991px) {
|
||||
#banner {
|
||||
background-position: 75% !important;
|
||||
}
|
||||
}
|
||||
#banner a {
|
||||
color: inherit;
|
||||
}
|
||||
#banner .segment {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
@ -100,11 +108,11 @@
|
||||
font-weight: bold;
|
||||
font-size: 16pt;
|
||||
}
|
||||
|
||||
#servicios .seguimiento {
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
min-height: 10rem !important;
|
||||
}
|
||||
|
||||
#indice .grid {
|
||||
@ -121,6 +129,7 @@
|
||||
#indice .img,
|
||||
#indice .img img {
|
||||
max-height: 20rem !important;
|
||||
min-height: 20rem !important;
|
||||
}
|
||||
#indice .contenido {
|
||||
padding-top: 5rem !important;
|
||||
|
@ -20,7 +20,17 @@ html {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
#page_container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
.content {
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
|
||||
footer {
|
||||
flex: none;
|
||||
color: white;
|
||||
height: 260px;
|
||||
font-family: Roboto;
|
||||
|
@ -8,3 +8,6 @@
|
||||
padding-bottom: 50px;
|
||||
font-family: Roboto;
|
||||
}
|
||||
#transparencia .accordion .title, #transparencia .accordion .title a {
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include_once implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__),
|
||||
'bootstrap',
|
||||
|
4
resources/data/login.yml
Normal file
4
resources/data/login.yml
Normal file
@ -0,0 +1,4 @@
|
||||
ip: localhost
|
||||
token: >
|
||||
6386affcb3431a356ef46974:c16ce52735ec95255d450d57945cd35992d1b21f
|
||||
time: 2020-04-22 22:42
|
@ -1,5 +1,5 @@
|
||||
activo: true
|
||||
descripcion: 'La función del notario Público se encuentra regida por las normas establecidas en el Título XI párrafo 7 artículo 399 al 445 del Código Orgánico de tribunales. Son funciones del Notario, entre otras, las contenidas en el artículo 401 del código señalado y que se expresan a continuación:'
|
||||
descripcion: "La función del notario Público se encuentra regida por las normas establecidas en el Título XI párrafo 7 artículo 399 al 445 del Código Orgánico de tribunales.\n Son funciones del Notario, entre otras, las contenidas en el artículo 401 del código señalado y que se expresan a continuación:"
|
||||
funciones:
|
||||
- >
|
||||
Extender los instrumentos públicos con
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$folder = implode(DIRECTORY_SEPARATOR, [
|
||||
__DIR__,
|
||||
$_ENV
|
||||
$__environment
|
||||
]);
|
||||
$filename = $_ENV . '.php';
|
||||
$filename = $__environment . '.php';
|
||||
include_once $filename;
|
||||
|
@ -17,4 +17,4 @@ $app->group('/admin', function($app) {
|
||||
}
|
||||
|
||||
$app->get('[/]', Admin::class);
|
||||
});
|
||||
})->add($app->getContainer()->get(ProVM\NotariaRaby\Common\Middleware\Auth::class));
|
||||
|
7
resources/routes/web/admin/clave.php
Normal file
7
resources/routes/web/admin/clave.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
use ProVM\NotariaRaby\Common\Controller\Web\Admin\Clave;
|
||||
|
||||
$app->group('/clave', function($app) {
|
||||
$app->get('[/]', Clave::class);
|
||||
$app->post('[/]', [Clave::class, 'do_edit']);
|
||||
});
|
@ -2,5 +2,7 @@
|
||||
use ProVM\NotariaRaby\Common\Controller\Web\Admin\Documentos;
|
||||
|
||||
$app->group('/documentos', function($app) {
|
||||
$app->post('/delete', [Documentos::class, 'delete']);
|
||||
$app->get('/{tipo}', Documentos::class);
|
||||
$app->post('[/]', [Documentos::class, 'upload']);
|
||||
});
|
||||
|
8
resources/routes/web/admin/login.php
Normal file
8
resources/routes/web/admin/login.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
use ProVM\NotariaRaby\Common\Controller\Web\Admin\Login;
|
||||
|
||||
$app->group('/login', function($app) {
|
||||
$app->get('[/]', Login::class);
|
||||
$app->post('[/]', [Login::class, 'do_login']);
|
||||
});
|
||||
$app->get('/logout', [Login::class, 'logout']);
|
6
resources/routes/web/documentos.php
Normal file
6
resources/routes/web/documentos.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
use ProVM\NotariaRaby\Common\Controller\Web\Documentos;
|
||||
|
||||
$app->group('/documentos', function($app) {
|
||||
$app->get('/existe/{documento}', [Documentos::class, 'existe']);
|
||||
});
|
@ -1,6 +1,6 @@
|
||||
@extends('admin.layout.base')
|
||||
|
||||
@section('content')
|
||||
@section('page_content')
|
||||
<div id="admin">
|
||||
<div class="ui container">
|
||||
<div class="ui stackable two columns grid">
|
||||
|
142
resources/views/admin/archivos/list.blade.php
Normal file
142
resources/views/admin/archivos/list.blade.php
Normal file
@ -0,0 +1,142 @@
|
||||
@extends('admin.layout.base')
|
||||
|
||||
@section('page_content')
|
||||
<div class="ui container">
|
||||
<h1 class="ui header">
|
||||
{{str_replace('_', ' ', mb_strtoupper($titulo))}}
|
||||
</h1>
|
||||
<div class="ui grid">
|
||||
<div class="row">
|
||||
<div class="nine wide column">
|
||||
<div class="ui top attached right aligned segment">
|
||||
<button class="ui inverted dark-blue button form_link">
|
||||
NUEVO
|
||||
</button>
|
||||
</div>
|
||||
<table class="ui bottom attached celled table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Documento</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($archivos as $archivo)
|
||||
<tr>
|
||||
<td>{{str_replace([$titulo, '_'], ['', ' '], $archivo->getBasename('.' . $archivo->getExtension()))}}</td>
|
||||
<td class="center aligned">
|
||||
<i class="trash alternate outline icon" data-file="{{$archivo->getBasename('.' . $archivo->getExtension())}}"></i>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui basic modal" id="doc_form">
|
||||
<i class="close icon"></i>
|
||||
<div class="inverted dark-blue header">
|
||||
</div>
|
||||
<div class="inverted dark-blue content">
|
||||
<form class="ui form" method="post" action="#">
|
||||
<input type="hidden" name="filename" />
|
||||
<div class="field">
|
||||
<input type="file" name="archivo" placeholder="Archivo" />
|
||||
</div>
|
||||
<div id="mod" class="field"></div>
|
||||
<button class="ui button">Subir</button>
|
||||
<div id="documento_message"></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
function formulario(link, title, mod) {
|
||||
$('#doc_form').find('.header').html(title)
|
||||
$('#doc_form').find('form').find("[name='filename']").val(link)
|
||||
if (mod == 'fecha') {
|
||||
fecha()
|
||||
}
|
||||
$('#doc_form').modal('show')
|
||||
$('#doc_form').find('form').submit(function(e) {
|
||||
e.preventDefault()
|
||||
var form_data = new FormData(this)
|
||||
$.ajax({
|
||||
url: '{{$urls->base}}/admin/documentos',
|
||||
type: 'post',
|
||||
data: form_data,
|
||||
contentType: false,
|
||||
cache: false,
|
||||
processData: false,
|
||||
success: function(data) {
|
||||
if (data.estado == true) {
|
||||
$('#doc_form').find('.header').html('')
|
||||
$('#doc_form').find('form').find("[name='filename']").val('')
|
||||
$('#doc_form').modal('hide')
|
||||
$('#documento_message').html('')
|
||||
$('#documento_message').hide()
|
||||
location.reload()
|
||||
} else {
|
||||
$('#documento_message').html('Error al subir el archivo.')
|
||||
$('#documento_message').show()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return false
|
||||
})
|
||||
}
|
||||
function fecha() {
|
||||
var fecha = $('<div></div>').attr('class', 'ui calendar').append(
|
||||
$('<div></div>').attr('class', 'ui input left icon').append(
|
||||
$('<i></i>').attr('class', 'calendar icon')
|
||||
).append(
|
||||
$('<input />').attr('type', 'text').attr('name', 'month').attr('placeholder', 'Mex / Año')
|
||||
)
|
||||
)
|
||||
$('#mod').append(fecha)
|
||||
$('#mod').find('.ui.calendar').calendar({
|
||||
type: 'month',
|
||||
text: {
|
||||
months: [
|
||||
'{!!implode("', '", $months->full)!!}'
|
||||
],
|
||||
monthsShort: [
|
||||
'{!!implode("', '", $months->short)!!}'
|
||||
]
|
||||
}
|
||||
})
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$('.trash').css('cursor', 'pointer').click(function() {
|
||||
var file = $(this).attr('data-file')
|
||||
$.post('{{$urls->admin}}/documentos/delete', {archivo: file}, function(data) {
|
||||
if (data.estado) {
|
||||
location.reload()
|
||||
return
|
||||
}
|
||||
alert('No se pudo borrar el archivo.')
|
||||
})
|
||||
})
|
||||
$('#doc_form').modal({
|
||||
onHidden: function() {
|
||||
$('#mod').html('')
|
||||
}
|
||||
})
|
||||
$('#documento_message').hide()
|
||||
$('.form_link').click(function() {
|
||||
var link = '{{$titulo}}'
|
||||
var title = '{{mb_strtoupper($titulo)}}'
|
||||
var mod = 'fecha'
|
||||
if (link == 'valores') {
|
||||
mod = ''
|
||||
}
|
||||
formulario(link, title, mod)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@endpush
|
88
resources/views/admin/clave.blade.php
Normal file
88
resources/views/admin/clave.blade.php
Normal file
@ -0,0 +1,88 @@
|
||||
@extends('admin.layout.base')
|
||||
|
||||
@section('page_content')
|
||||
<div class="ui container">
|
||||
<h2>Cambiar Clave</h2>
|
||||
<form class="ui form" method="post" action="{{$urls->base}}/admin/clave" id="clave_form">
|
||||
<div class="field">
|
||||
<label>Clave</label>
|
||||
<input type="password" name="clave" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Repetir Clave</label>
|
||||
<input type="password" name="clave2" />
|
||||
</div>
|
||||
<button class="ui button">Cambiar</button>
|
||||
<div class="ui warning message" id="warnings">
|
||||
<ul class="ui list"></ul>
|
||||
</div>
|
||||
<div class="ui error message" id="errors">
|
||||
<ul class="ui list"></ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
function clearErrors() {
|
||||
$('#warnings').find('ul.list').html('')
|
||||
$('#warnings').hide()
|
||||
$('#errors').find('ul.list').html('')
|
||||
$('#errors').hide()
|
||||
}
|
||||
function addError(msg) {
|
||||
$('#errors').find('ul.list').append(
|
||||
$('<li></li>').html(msg)
|
||||
)
|
||||
$('#errors').show()
|
||||
}
|
||||
function addWarning(msg) {
|
||||
$('#warnings').find('ul.list').append(
|
||||
$('<li></li>').html(msg)
|
||||
)
|
||||
$('#warnings').show()
|
||||
}
|
||||
function checkClaves() {
|
||||
var c1 = $("input[name='clave']").val()
|
||||
if (!validateClave(c1)) {
|
||||
return false
|
||||
}
|
||||
var c2 = $("input[name='clave2']").val()
|
||||
if (c1 != c2) {
|
||||
addError('Las dos claves no coinciden.')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
function validateClave(clave) {//NotariaR4b¿?
|
||||
console.debug(clave)
|
||||
var strong = new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})")
|
||||
var medium = new RegExp("^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})")
|
||||
if (!medium.test(clave)) {
|
||||
addError('La clave no cumple con el mínimo de fuerza.')
|
||||
return false
|
||||
}
|
||||
if (!strong.test(clave)) {
|
||||
addWarning('Se recomienda una clave mas fuerte.')
|
||||
}
|
||||
return true
|
||||
}
|
||||
$(document).ready(function() {
|
||||
clearErrors()
|
||||
$("input[name='clave']").change(function() {
|
||||
clearErrors()
|
||||
validateClave($(this).val())
|
||||
})
|
||||
$('#clave_form').submit(function(e) {
|
||||
clearErrors()
|
||||
if (checkClaves()) {
|
||||
$(this).submit()
|
||||
return true
|
||||
}
|
||||
e.preventDefault()
|
||||
return false
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@endpush
|
@ -4,11 +4,7 @@
|
||||
{{$descripcion}}
|
||||
</div>
|
||||
<div class="column">
|
||||
<a href="#" data-link="{{$link}}" data-title="{{$descripcion}}"
|
||||
@if (isset($mod))
|
||||
data-mod="{{$mod}}"
|
||||
@endif
|
||||
class="form_link">
|
||||
<a href="{{$urls->admin}}/documentos/{{$link}}">
|
||||
@include('admin.uicon')
|
||||
</a>
|
||||
</div>
|
||||
|
@ -3,29 +3,16 @@
|
||||
</h4>
|
||||
<div class="ui list">
|
||||
@include('admin.documento', ['descripcion' => 'Índices', 'link' => 'indices', 'mod' => 'fecha'])
|
||||
@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'])
|
||||
</div>
|
||||
<div class="ui basic modal" id="doc_form">
|
||||
<i class="close icon"></i>
|
||||
<div class="inverted dark-blue header">
|
||||
</div>
|
||||
<div class="inverted dark-blue content">
|
||||
<form class="ui form" method="post" action="#">
|
||||
<input type="hidden" name="filename" />
|
||||
<div class="field">
|
||||
<input type="file" name="archivo" placeholder="Archivo" />
|
||||
</div>
|
||||
<div id="mod" class="field"></div>
|
||||
<button class="ui button">Subir</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<h4>
|
||||
Transparencia
|
||||
</h4>
|
||||
<div class="ui list">
|
||||
@include('admin.documento', ['descripcion' => 'Balances Anuales', 'link' => 'balances_anuales', 'mod' => 'fecha'])
|
||||
@include('admin.documento', ['descripcion' => 'Interés y Patrimonio', 'link' => 'intereses_y_patrimonio', 'mod' => 'fecha'])
|
||||
@include('admin.documento', ['descripcion' => 'Informes Fiscalía', 'link' => 'informes_fiscalia', 'mod' => 'fecha'])
|
||||
@include('admin.documento', ['descripcion' => 'Valores', 'link' => 'valores'])
|
||||
</div>
|
||||
<div class="ui toggle checkbox" id="transparencia">
|
||||
<label>Activar</label>
|
||||
<input type="checkbox" name="transparencia"
|
||||
@ -34,75 +21,44 @@
|
||||
@endif
|
||||
/>
|
||||
</div>
|
||||
<div id="transparencia_message" class="ui message transition hidden"></div>
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
function formulario(link, title, mod) {
|
||||
$('#doc_form').find('.header').html(title)
|
||||
$('#doc_form').find('form').find("[name='filename']").val(link)
|
||||
if (mod == 'fecha') {
|
||||
fecha()
|
||||
}
|
||||
$('#doc_form').modal('show')
|
||||
$('#doc_form').find('form').submit(function(e) {
|
||||
e.preventDefault()
|
||||
var form_data = new FormData(this)
|
||||
$.ajax({
|
||||
url: '{{$urls->base}}/admin/documentos',
|
||||
type: 'post',
|
||||
data: form_data,
|
||||
contentType: false,
|
||||
cache: false,
|
||||
processData: false,
|
||||
success: function(data) {
|
||||
if (data.estado == true) {
|
||||
$('#doc_form').find('.header').html('')
|
||||
$('#doc_form').find('form').find("[name='filename']").val('')
|
||||
$('#doc_form').modal('hide')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return false
|
||||
})
|
||||
}
|
||||
function fecha() {
|
||||
var fecha = $('<div></div>').attr('class', 'ui calendar').append(
|
||||
$('<div></div>').attr('class', 'ui input left icon').append(
|
||||
$('<i></i>').attr('class', 'calendar icon')
|
||||
).append(
|
||||
$('<input />').attr('type', 'text').attr('name', 'month').attr('placeholder', 'Mex / Año')
|
||||
)
|
||||
)
|
||||
$('#mod').append(fecha)
|
||||
$('#mod').find('.ui.calendar').calendar({
|
||||
type: 'month',
|
||||
text: {
|
||||
months: [
|
||||
'{!!implode("', '", $months->full)!!}'
|
||||
],
|
||||
monthsShort: [
|
||||
'{!!implode("', '", $months->short)!!}'
|
||||
]
|
||||
}
|
||||
})
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$('#transparencia_message').hide()
|
||||
$('#transparencia').checkbox()
|
||||
$('#transparencia').click(function() {
|
||||
var status = $(this).checkbox('is checked')
|
||||
$.post('{{$urls->base}}/admin/transparencia', {'activo': status}, function(data) {}, 'json')
|
||||
})
|
||||
$('#doc_form').modal({
|
||||
onHidden: function() {
|
||||
$('#mod').html('')
|
||||
}
|
||||
})
|
||||
$('.form_link').click(function() {
|
||||
var link = $(this).attr('data-link')
|
||||
var title = $(this).attr('data-title')
|
||||
var mod = $(this).attr('data-mod')
|
||||
formulario(link, title, mod)
|
||||
$.post('{{$urls->base}}/admin/transparencia', {'activo': status}, function(data) {
|
||||
var msg = ['<i class="close icon"></i>']
|
||||
if (data.estado == 'ok') {
|
||||
if (data.informacion.activo == 'true') {
|
||||
msg.push('Activado')
|
||||
} else {
|
||||
msg.push('Desactivado')
|
||||
}
|
||||
$('#transparencia_message').addClass('success')
|
||||
} else {
|
||||
msg.push('No se ha podido')
|
||||
if (data.informacion.activo == 'true') {
|
||||
msg.push('activar')
|
||||
} else {
|
||||
msg.push('desactivar')
|
||||
}
|
||||
$('#transparencia_message').addClass('error')
|
||||
}
|
||||
msg.push('correctamente.')
|
||||
$('#transparencia_message').html(msg.join(' '))
|
||||
$('#transparencia_message').removeClass('hidden')
|
||||
$('#transparencia_message').show()
|
||||
$('#transparencia_message').find('.close').click(function() {
|
||||
$('#transparencia_message').html('')
|
||||
$('#transparencia_message').addClass('hidden')
|
||||
$('#transparencia_message').removeClass('success error')
|
||||
$('#transparencia_message').hide()
|
||||
})
|
||||
}, 'json')
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
@ -23,18 +23,44 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="formulario_messages" class="ui message transition hidden">
|
||||
<i class="close icon"></i>
|
||||
<span class="list"></span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
function addMessage(msg) {
|
||||
$('#formulario_messages').find('.list').append(
|
||||
$('<li></li>').html(msg)
|
||||
)
|
||||
$('#formulario_messages').show()
|
||||
$('#formulario_messages').removeClass('hidden')
|
||||
$('#formulario_messages').find('.close').click(function() {
|
||||
$('#formulario_messages').find('.list').html('')
|
||||
$('#formulario_messages').removeClass('success error')
|
||||
$('#formulario_messages').hide()
|
||||
$('#formulario_messages').addClass('hidden')
|
||||
})
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$('#formulario_messages').hide()
|
||||
$('#formulario').submit(function(e) {
|
||||
e.preventDefault()
|
||||
|
||||
var titulo = $(this).find("[name='titulo']").val()
|
||||
var contenido = $(this).find("[name='contenido']").val()
|
||||
$.post('{{$urls->base}}/admin/notificacion', {titulo: titulo, contenido: contenido}, function(data) {
|
||||
console.debug(data)
|
||||
var msg = ''
|
||||
if (data.estado == 'ok') {
|
||||
msg = 'Editado correctamente.'
|
||||
$('#formulario_messages').addClass('success')
|
||||
} else {
|
||||
msg = 'Error al editar.'
|
||||
$('#formulario_messages').addClass('error')
|
||||
}
|
||||
addMessage(msg)
|
||||
}, 'json')
|
||||
|
||||
return false
|
||||
@ -42,7 +68,27 @@
|
||||
$('#activar').checkbox()
|
||||
$('#activar').click(function() {
|
||||
var status = $(this).checkbox('is checked')
|
||||
$.post('{{$urls->base}}/admin/notificacion', {'activo': status}, function(data) {}, 'json')
|
||||
$.post('{{$urls->base}}/admin/notificacion', {'activo': status}, function(data) {
|
||||
msg = []
|
||||
if (data.estado == 'ok') {
|
||||
if (data.editado.activo) {
|
||||
msg.push('Activado')
|
||||
} else {
|
||||
msg.push('Desactivado')
|
||||
}
|
||||
$('#formulario_messages').addClass('success')
|
||||
} else {
|
||||
msg.push('No se ha podido')
|
||||
if (data.editado.activo) {
|
||||
msg.push('activar')
|
||||
} else {
|
||||
msg.push('desactivar')
|
||||
}
|
||||
$('#formulario_messages').addClass('error')
|
||||
}
|
||||
msg.push('correctamente.')
|
||||
addMessage(msg.join(' '))
|
||||
}, 'json')
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
@ -1,12 +1,9 @@
|
||||
@extends('layout.base')
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
@include('layout.head')
|
||||
@include('admin.layout.body')
|
||||
</html>
|
||||
|
||||
@section('page_title')
|
||||
- Admin
|
||||
@endsection
|
||||
|
||||
@section('page_content')
|
||||
<div class="ui fluid container">
|
||||
<br />
|
||||
@yield('content')
|
||||
</div>
|
||||
@endsection
|
||||
|
10
resources/views/admin/layout/body.blade.php
Normal file
10
resources/views/admin/layout/body.blade.php
Normal file
@ -0,0 +1,10 @@
|
||||
<body>
|
||||
<div id="page_container" class="ui fluid container">
|
||||
@include('admin.layout.header')
|
||||
<div class="content">
|
||||
<br />
|
||||
@yield('page_content')
|
||||
</div>
|
||||
@include('admin.layout.footer')
|
||||
</div>
|
||||
</body>
|
12
resources/views/admin/layout/footer.blade.php
Normal file
12
resources/views/admin/layout/footer.blade.php
Normal file
@ -0,0 +1,12 @@
|
||||
<footer class="ui fixed">
|
||||
<div class="inverted dark-blue">
|
||||
<div class="main"></div>
|
||||
</div>
|
||||
<div class="grey">
|
||||
<nav class="ui container attached text stackable menu">
|
||||
<a class="item" href="{{$urls->admin}}/clave">Cambiar Clave</a>
|
||||
<a class="item" href="{{$urls->admin}}/logout">Salir</a>
|
||||
</nav>
|
||||
</div>
|
||||
</footer>
|
||||
@include('layout.scripts')
|
5
resources/views/admin/layout/header.blade.php
Normal file
5
resources/views/admin/layout/header.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
<header class="ui dark-blue inverted">
|
||||
<div class="ui container">
|
||||
@include('admin.layout.menu')
|
||||
</div>
|
||||
</header>
|
@ -1,8 +1,7 @@
|
||||
<div class="ui container">
|
||||
<nav class="ui secondary pointing menu">
|
||||
<a class="item" href="{{$urls->base}}">Inicio</a>
|
||||
<a class="active item" href="{{$urls->base}}/admin">Administración</a>
|
||||
<a class="item" href="{{$urls->base}}/admin/notificacion">Notificación</a>
|
||||
</nav>
|
||||
</div>
|
||||
<br />
|
||||
<nav class="ui inverted attached massive text stackable menu" id="page_menu">
|
||||
<a class="left aligned item brand" href="{{$urls->admin}}">
|
||||
NOTARÍA PATRICIO RABY BENAVENTE
|
||||
</a>
|
||||
<a class="item" href="{{$urls->admin}}/clave">Cambiar Clave</a>
|
||||
<a class="item" href="{{$urls->admin}}/logout">Salir</a>
|
||||
</nav>
|
||||
|
@ -1,11 +1,18 @@
|
||||
@extends('admin.base')
|
||||
@extends('admin.layout.base')
|
||||
|
||||
@section('content')
|
||||
<form class="ui form" method="post" action="{{$base_url}}/admin/login">
|
||||
<div class="inline field">
|
||||
<label>Clave</label>
|
||||
<input type="password" name="clave" />
|
||||
</div>
|
||||
<button class="ui button">Entrar</button>
|
||||
</form>
|
||||
@section('page_content')
|
||||
<div class="ui container">
|
||||
<form class="ui form" method="post" action="{{$urls->base}}/admin/login">
|
||||
<div class="ui center aligned grid">
|
||||
<div class="left aligned five wide column">
|
||||
<h3>Ingresar</h3>
|
||||
<div class="inline field">
|
||||
<label>Clave</label>
|
||||
<input type="password" name="clave" />
|
||||
</div>
|
||||
<button class="ui inverted dark-blue button">Entrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
@ -32,6 +32,10 @@
|
||||
<div class="field">
|
||||
<button class="ui inverted dark-blue button">Enviar</button>
|
||||
</div>
|
||||
<div class="ui message transition hidden" id="mensaje_contacto">
|
||||
<i class="close icon"></i>
|
||||
<span id="msg"></span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="column">
|
||||
@ -57,7 +61,12 @@
|
||||
var mensaje = $(this).find("[name='mensaje']").val()
|
||||
|
||||
$.post('{{$urls->base}}/contacto', {nombre: nombre, telefono: telefono, email: email, mensaje: mensaje}, function(data) {
|
||||
console.debug(data)
|
||||
$('#mensaje_contacto').find('#msg').html('Mensaje enviado.')
|
||||
$('#mensaje_contacto').addClass('success').removeClass('hidden').show()
|
||||
$('#mensaje_contacto').find('.close').click(function() {
|
||||
$('#mensaje_contacto').find('#msg').html('')
|
||||
$('#mensaje_contacto').addClass('hidden').removeClass('success error')
|
||||
})
|
||||
}, 'json')
|
||||
|
||||
return false
|
||||
|
47
resources/views/contacto/email.php
Normal file
47
resources/views/contacto/email.php
Normal file
@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Contacto Web - {{$nombre}}</title>
|
||||
<!--[if !mso]><!-- -->
|
||||
|
||||
<link href='http://fonts.googleapis.com/css2?family=Roboto' rel='stylesheet' type='text/css' />
|
||||
|
||||
<!--<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<table style="font-family: Roboto, sans-serif; font-size: 12pt; color: rgb(109, 110, 112);">
|
||||
<tr>
|
||||
<td style="font-weight: 700; text-align: right;">
|
||||
Nombre
|
||||
</td>
|
||||
<td colspan="6">
|
||||
{{$nombre}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-weight: 700; text-align: right;">
|
||||
Teléfono
|
||||
</td>
|
||||
<td colspan="6">
|
||||
{{$telefono}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-weight: 700; text-align: right;">
|
||||
Email
|
||||
</td>
|
||||
<td colspan="6">
|
||||
{{$email}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-weight: 700; text-align: right; vertical-align: top;">
|
||||
Mensaje
|
||||
</td>
|
||||
<td colspan="6">
|
||||
{{$mensaje}}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -2,7 +2,7 @@
|
||||
<div class="ui stackable grid">
|
||||
<div class="row">
|
||||
<div class="ten wide column img"></div>
|
||||
<div class="four wide column contenido">
|
||||
<div class="six wide column contenido">
|
||||
<div class="titulo">
|
||||
ÍNDICES EN LÍNEA
|
||||
</div>
|
||||
@ -36,6 +36,7 @@
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var file_url = ''
|
||||
$('#indices_calendar').calendar({
|
||||
type: 'month',
|
||||
text: {
|
||||
@ -51,12 +52,23 @@
|
||||
'{!!implode("', '", $months->full)!!}'
|
||||
]
|
||||
var date = arguments[0]
|
||||
var url = '{{$urls->uploads}}/indices_' + date.getFullYear() + '_' + months[date.getMonth()] + '.pdf'
|
||||
$('#indices_descarga').attr('href', url)
|
||||
var test = 'indices_' + date.getFullYear() + '_' + months[date.getMonth()]
|
||||
$.getJSON('{{$urls->base}}/documentos/existe/' + test, function(data) {
|
||||
if (data.existe) {
|
||||
var url = '{{$urls->uploads}}/indices_' + date.getFullYear() + '_' + months[date.getMonth()] + '.pdf'
|
||||
$('#indices_descarga').attr('href', url).show()
|
||||
file_url = url
|
||||
return
|
||||
}
|
||||
$('#indices_descarga').attr('href', '').hide()
|
||||
file_url = ''
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#indices_descarga').hide()
|
||||
$('#form_indices').submit(function(e) {
|
||||
e.preventDefault()
|
||||
window.open(file_url, '_blank')
|
||||
return false
|
||||
})
|
||||
})
|
||||
|
@ -4,7 +4,9 @@
|
||||
<body>
|
||||
<div id="page_container" class="ui fluid container">
|
||||
@include('layout.header')
|
||||
@yield('page_content')
|
||||
<div class="content">
|
||||
@yield('page_content')
|
||||
</div>
|
||||
@include('layout.footer')
|
||||
</div>
|
||||
</body>
|
||||
|
@ -3,10 +3,10 @@
|
||||
<a class="item" href="{{$urls->base}}">
|
||||
Notaría
|
||||
</a>
|
||||
<a class="item" href="{{$urls->base}}#servicios">
|
||||
<a class="item" href="#servicios">
|
||||
Servicios
|
||||
</a>
|
||||
<a class="item" href="{{$urls->base}}#consultas">
|
||||
<a class="item" href="#consultas">
|
||||
Consultas
|
||||
</a>
|
||||
<a class="item" href="{{$urls->base}}/contacto">
|
||||
@ -14,7 +14,7 @@
|
||||
</a>
|
||||
<div class="right menu">
|
||||
<div class="item">
|
||||
Copyright© Todos los derechos reservados a Notaría Raby
|
||||
Copyright© Todos los derechos reservados a ProVM
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
@ -6,10 +6,10 @@
|
||||
<a class="item" href="{{$urls->base}}/notaria">
|
||||
NOTARÍA
|
||||
</a>
|
||||
<a class="item" href="{{$urls->base}}#servicios">
|
||||
<a class="item" href="#servicios">
|
||||
SERVICIOS
|
||||
</a>
|
||||
<a class="item" href="{{$urls->base}}#consultas">
|
||||
<a class="item" href="#consultas">
|
||||
CONSULTAS
|
||||
</a>
|
||||
<a class="item" href="{{$urls->base}}/contacto">
|
||||
|
@ -10,7 +10,7 @@
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
@if (isset($miembro->nombre))
|
||||
{{mb_strtoupper($miembro->nombre)}}@if (isset($miembro->cargo)),
|
||||
{{$miembro->nombre}}@if (isset($miembro->cargo)),
|
||||
{{$miembro->cargo}}
|
||||
@endif
|
||||
@endif
|
||||
|
@ -4,11 +4,7 @@
|
||||
<div class="three column row">
|
||||
<div class="ten wide column">
|
||||
<p>
|
||||
{{$transparencia->descripcion}}
|
||||
La functión del notario Público se encuentra regida por las normas establecidas en el Título XI párrafo 7
|
||||
artículo 399 al 445 del Código Orgánico de tribunales.
|
||||
Son funciones del Notario, entre otras, las contenidas en el artículo 401 del código señalado y que se
|
||||
expresan a continuación
|
||||
{!!nl2br($transparencia->descripcion)!!}
|
||||
</p>
|
||||
<div class="ui stackable grid">
|
||||
<div class="two column row">
|
||||
@ -23,6 +19,8 @@
|
||||
@endif
|
||||
<div class="item">
|
||||
{{$i + 1}}. {{$funcion}}
|
||||
<br />
|
||||
<br />
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@ -33,15 +31,163 @@
|
||||
@if ($transparencia->activo)
|
||||
<div class="column">
|
||||
<h3>TRANSPARENCIA</h3>
|
||||
<nav class="ui vertical text menu">
|
||||
<a class="item" href="{{$urls->uploads}}/balances_anuales.pdf">Balances Anuales</a>
|
||||
<a class="item" href="{{$urls->uploads}}/intereses_y_patrimonio.pdf">Interés y Patrimonio</a>
|
||||
<a class="item" href="{{$urls->uploads}}/informes_fiscalia.pdf">Informes Fiscalía</a>
|
||||
<a class="item" href="{{$urls->uploads}}/valores.pdf">Valores</a>
|
||||
</nav>
|
||||
<div class="ui accordion">
|
||||
<div class="title">
|
||||
<i class="dropdown icon"></i>
|
||||
Balances Anuales
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="ui calendar" id="balances_calendar">
|
||||
<div class="ui input left icon">
|
||||
<i class="calendar icon"></i>
|
||||
<input type="text" name="calendar" placeholder="Mes / Año" />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<a href="#" target="_blank" id="balances_descarga">
|
||||
<button class="ui mini gray button">DESCARGA</button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<i class="dropdown icon"></i>
|
||||
Interés y Patrimonio
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="ui calendar" id="patrimonio_calendar">
|
||||
<div class="ui input left icon">
|
||||
<i class="calendar icon"></i>
|
||||
<input type="text" name="calendar" placeholder="Mes / Año" />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<a href="#" target="_blank" id="patrimonio_descarga">
|
||||
<button class="ui mini gray button">DESCARGA</button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<i class="dropdown icon"></i>
|
||||
Informes Fiscalía
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="ui calendar" id="fiscalia_calendar">
|
||||
<div class="ui input left icon">
|
||||
<i class="calendar icon"></i>
|
||||
<input type="text" name="calendar" placeholder="Mes / Año" />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<a href="#" target="_blank" id="fiscalia_descarga">
|
||||
<button class="ui mini gray button">DESCARGA</button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<a target="_blank" href="{{$urls->uploads}}/valores.pdf">
|
||||
<i class="dropdown icon"></i>
|
||||
Valores
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var urls = {
|
||||
balances: '',
|
||||
patrimonio: '',
|
||||
fiscalia: ''
|
||||
}
|
||||
$('.accordion').accordion()
|
||||
$('#balances_calendar').calendar({
|
||||
type: 'month',
|
||||
text: {
|
||||
months: [
|
||||
'{!!implode("', '", $months->full)!!}'
|
||||
],
|
||||
monthsShort: [
|
||||
'{!!implode("', '", $months->short)!!}'
|
||||
]
|
||||
},
|
||||
onChange: function() {
|
||||
var months = [
|
||||
'{!!implode("', '", $months->full)!!}'
|
||||
]
|
||||
var date = arguments[0]
|
||||
var test = 'balances_anuales_' + date.getFullYear() + '_' + months[date.getMonth()]
|
||||
$.getJSON('{{$urls->base}}/documentos/existe/' + test, function(data) {
|
||||
if (data.existe) {
|
||||
var url = '{{$urls->uploads}}/balances_anuales_' + date.getFullYear() + '_' + months[date.getMonth()] + '.pdf'
|
||||
$('#balances_descarga').attr('href', url).show()
|
||||
urls.balances = url
|
||||
return
|
||||
}
|
||||
$('#balances_descarga').attr('href', '').hide()
|
||||
urls.balances = ''
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#patrimonio_calendar').calendar({
|
||||
type: 'month',
|
||||
text: {
|
||||
months: [
|
||||
'{!!implode("', '", $months->full)!!}'
|
||||
],
|
||||
monthsShort: [
|
||||
'{!!implode("', '", $months->short)!!}'
|
||||
]
|
||||
},
|
||||
onChange: function() {
|
||||
var months = [
|
||||
'{!!implode("', '", $months->full)!!}'
|
||||
]
|
||||
var date = arguments[0]
|
||||
var test = 'intereses_y_patrimonio_' + date.getFullYear() + '_' + months[date.getMonth()]
|
||||
$.getJSON('{{$urls->base}}/documentos/existe/' + test, function(data) {
|
||||
if (data.existe) {
|
||||
var url = '{{$urls->uploads}}/intereses_y_patrimonio_' + date.getFullYear() + '_' + months[date.getMonth()] + '.pdf'
|
||||
$('#patrimonio_descarga').attr('href', url).show()
|
||||
urls.patrimonio = url
|
||||
return
|
||||
}
|
||||
$('#patrimonio_descarga').attr('href', '').hide()
|
||||
urls.patrimonio = ''
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#fiscalia_calendar').calendar({
|
||||
type: 'month',
|
||||
text: {
|
||||
months: [
|
||||
'{!!implode("', '", $months->full)!!}'
|
||||
],
|
||||
monthsShort: [
|
||||
'{!!implode("', '", $months->short)!!}'
|
||||
]
|
||||
},
|
||||
onChange: function() {
|
||||
var months = [
|
||||
'{!!implode("', '", $months->full)!!}'
|
||||
]
|
||||
var date = arguments[0]
|
||||
var test = 'informes_fiscalia_' + date.getFullYear() + '_' + months[date.getMonth()]
|
||||
$.getJSON('{{$urls->base}}/documentos/existe/' + test, function(data) {
|
||||
if (data.existe) {
|
||||
var url = '{{$urls->uploads}}/informes_fiscalia_' + date.getFullYear() + '_' + months[date.getMonth()] + '.pdf'
|
||||
$('#fiscalia_descarga').attr('href', url).show()
|
||||
urls.fiscalia = url
|
||||
return
|
||||
}
|
||||
$('#fiscalia_descarga').attr('href', '').hide()
|
||||
urls.fiscalia = ''
|
||||
})
|
||||
}
|
||||
})
|
||||
$("[id$='_descarga']").hide()
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
Reference in New Issue
Block a user