Compare commits
60 Commits
feature/ma
...
993e4ff3b8
Author | SHA1 | Date | |
---|---|---|---|
993e4ff3b8 | |||
bc49ba7629 | |||
3c2b486083 | |||
76f69f3bda | |||
8ba3c456b6 | |||
98b18fab3e | |||
12a4831887 | |||
da46914de4 | |||
596bc71cf8 | |||
7f8e4ea943 | |||
5456485f71 | |||
836503a71b | |||
4df0cca675 | |||
00a0adb4ac | |||
037fcd60f3 | |||
7a97fc9dfe | |||
7b2df74e4d | |||
b5d6d0acb9 | |||
8a1e6a7761 | |||
ced673e452 | |||
8a7a1d4e64 | |||
9be20ab1cd | |||
1c40f18624 | |||
db36549699 | |||
4ce83fb270 | |||
b191a01313 | |||
d3b0026ca4 | |||
2b3f476df7 | |||
39c148b7b3 | |||
bae0f1f555 | |||
2e49e2c947 | |||
68aebdb4fe | |||
346001db8e | |||
8b04eb262f | |||
7c7c8315e2 | |||
510e05e5ca | |||
5055d2703c | |||
2bc30ab9e8 | |||
c7ee440e03 | |||
18dd8c4ec0 | |||
8ea4995f6b | |||
aeeca65d94 | |||
5f69069aa0 | |||
095a65a643 | |||
928d2e57be | |||
2a0335f834 | |||
9ccf53fa4e | |||
ef54c36edc | |||
4aa88d5164 | |||
8ea13c3efd | |||
12e3d7ed3b | |||
a7fc89ac29 | |||
a71df4e70d | |||
f17b7a758a | |||
7fb28cd44c | |||
a44bd610ad | |||
28bba8a438 | |||
0ec6ebdafe | |||
3ebe256a66 | |||
9d135e2c26 |
@ -1,22 +1,19 @@
|
|||||||
FROM php:8.4-cli
|
FROM php:8.2-cli
|
||||||
|
|
||||||
ENV TZ "${TZ}"
|
ENV TZ "${TZ}"
|
||||||
ENV APP_NAME "${APP_NAME}"
|
ENV APP_NAME "${APP_NAME}"
|
||||||
|
ENV API_URL "${API_URL}"
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends cron rsyslog nano beanstalkd \
|
RUN apt-get update && apt-get install -y --no-install-recommends cron rsyslog nano && rm -r /var/lib/apt/lists/*
|
||||||
&& rm -r /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN pecl install xdebug-3.4.2 \
|
RUN pecl install xdebug-3.2.2 \
|
||||||
&& docker-php-ext-enable xdebug \
|
&& docker-php-ext-enable xdebug \
|
||||||
&& echo $TZ > /etc/timezone
|
&& echo "#/bin/bash\nprintenv >> /etc/environment\ncron -f -L 11" > /root/entrypoint && chmod a+x /root/entrypoint
|
||||||
|
|
||||||
COPY --chmod=550 ./cli/start_command /root/start_command
|
|
||||||
|
|
||||||
COPY ./php-errors.ini /usr/local/etc/php/conf.d/docker-php-errors.ini
|
COPY ./php-errors.ini /usr/local/etc/php/conf.d/docker-php-errors.ini
|
||||||
COPY ./php-timezone.ini /usr/local/etc/php/conf.d/docker-php-timezone.ini
|
|
||||||
|
|
||||||
WORKDIR /code/bin
|
WORKDIR /code/bin
|
||||||
|
|
||||||
COPY --chmod=644 ./cli/crontab /var/spool/cron/crontabs/root
|
COPY --chmod=644 ./cli/crontab /var/spool/cron/crontabs/root
|
||||||
|
|
||||||
CMD [ "/root/start_command" ]
|
CMD [ "/root/entrypoint" ]
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
FROM php:8.4-fpm
|
FROM php:8.2-fpm
|
||||||
|
|
||||||
ENV TZ=America/Santiago
|
ENV TZ=America/Santiago
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends libzip-dev libicu-dev git \
|
RUN apt-get update && apt-get install -y --no-install-recommends libzip-dev libicu-dev git libpng-dev unzip tzdata \
|
||||||
libpng-dev unzip tzdata libxml2-dev beanstalkd \
|
|
||||||
&& rm -r /var/lib/apt/lists/* \
|
&& rm -r /var/lib/apt/lists/* \
|
||||||
&& docker-php-ext-install pdo pdo_mysql zip intl gd bcmath dom \
|
&& docker-php-ext-install pdo pdo_mysql zip intl gd bcmath \
|
||||||
&& pecl install xdebug-3.4.2 \
|
&& pecl install xdebug-3.3.2 \
|
||||||
&& docker-php-ext-enable xdebug \
|
&& docker-php-ext-enable xdebug \
|
||||||
&& echo $TZ > /etc/timezone
|
&& echo $TZ > /etc/timezone
|
||||||
|
|
||||||
|
@ -2,18 +2,17 @@
|
|||||||
|
|
||||||
APP_URL=
|
APP_URL=
|
||||||
|
|
||||||
|
MYSQL_HOST=db
|
||||||
|
|
||||||
COOKIE_NAME=
|
COOKIE_NAME=
|
||||||
COOKIE_DOMAIN=
|
COOKIE_DOMAIN=
|
||||||
COOKIE_PATH=/
|
COOKIE_PATH=/
|
||||||
MAX_LOGIN_HOURS=120
|
MAX_LOGIN_HOURS=120
|
||||||
|
|
||||||
#REDIS_HOST=redis
|
REDIS_HOST=redis
|
||||||
#REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
|
||||||
DB_HOST=db
|
DB_HOST=db
|
||||||
DB_DATABASE=incoviba
|
DB_DATABASE=incoviba
|
||||||
DB_USER=incoviba
|
DB_USER=incoviba
|
||||||
DB_PASSWORD=
|
DB_PASSWORD=
|
||||||
|
|
||||||
TOKU_URL=
|
|
||||||
TOKU_TOKEN=
|
|
||||||
|
1
app/.gitignore
vendored
1
app/.gitignore
vendored
@ -1,2 +1 @@
|
|||||||
**/bin
|
**/bin
|
||||||
**/public/tests
|
|
||||||
|
@ -10,5 +10,5 @@ notifications:
|
|||||||
failingTests: false
|
failingTests: false
|
||||||
hideManual: true
|
hideManual: true
|
||||||
phpunit:
|
phpunit:
|
||||||
arguments: '--testsuite unit --log-events-text /logs/output.txt --stop-on-failure'
|
arguments: '--log-events-text /logs/output.txt --stop-on-failure'
|
||||||
timeout: 180
|
timeout: 180
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/bash
|
|
||||||
|
|
||||||
php -d auto_prepend_file=test.bootstrap.php -a
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/bash
|
|
||||||
|
|
||||||
bin/phpunit --testsuite acceptance $@
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/bash
|
|
||||||
|
|
||||||
bin/phpunit --testsuite performance $@
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/bash
|
|
||||||
|
|
||||||
./bin/phpunit --testsuite unit $@
|
|
@ -1,6 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Incoviba\Common\Alias;
|
namespace Incoviba\Common\Alias;
|
||||||
|
|
||||||
|
use Illuminate\Events\Dispatcher;
|
||||||
use Slim\Views\Blade;
|
use Slim\Views\Blade;
|
||||||
|
|
||||||
class View extends Blade {}
|
class View extends Blade
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -8,9 +8,9 @@ interface Provider
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $money_symbol
|
* @param string $money_symbol
|
||||||
* @param ?DateTimeInterface $dateTime = null
|
* @param DateTimeInterface $dateTime
|
||||||
* @return float
|
* @return float
|
||||||
* @throws EmptyResponse
|
* @throws EmptyResponse
|
||||||
*/
|
*/
|
||||||
public function get(string $money_symbol, ?DateTimeInterface $dateTime = null): float;
|
public function get(string $money_symbol, DateTimeInterface $dateTime): float;
|
||||||
}
|
}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Incoviba\Common\Ideal;
|
|
||||||
|
|
||||||
use Psr\Log\LoggerAwareInterface;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
|
|
||||||
abstract class LoggerEnabled implements LoggerAwareInterface
|
|
||||||
{
|
|
||||||
public LoggerInterface $logger;
|
|
||||||
public function setLogger(LoggerInterface $logger): void
|
|
||||||
{
|
|
||||||
$this->logger = $logger;
|
|
||||||
}
|
|
||||||
public function getLogger(): LoggerInterface
|
|
||||||
{
|
|
||||||
return $this->logger;
|
|
||||||
}
|
|
||||||
}
|
|
@ -24,11 +24,6 @@ abstract class Repository implements Define\Repository
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConnection(): Define\Connection
|
|
||||||
{
|
|
||||||
return $this->connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function load(array $data_row): Define\Model
|
public function load(array $data_row): Define\Model
|
||||||
{
|
{
|
||||||
$model = $this->create($data_row);
|
$model = $this->create($data_row);
|
||||||
@ -194,7 +189,7 @@ abstract class Repository implements Define\Repository
|
|||||||
try {
|
try {
|
||||||
$this->connection->execute($query, $values);
|
$this->connection->execute($query, $values);
|
||||||
} catch (PDOException $exception) {
|
} catch (PDOException $exception) {
|
||||||
throw new EmptyResult($query, $exception, $data);
|
throw new EmptyResult($query, $exception);
|
||||||
}
|
}
|
||||||
return $this->fetchById($this->getIndex($model));
|
return $this->fetchById($this->getIndex($model));
|
||||||
}
|
}
|
||||||
@ -210,10 +205,10 @@ abstract class Repository implements Define\Repository
|
|||||||
try {
|
try {
|
||||||
$result = $this->connection->execute($query, $data)->fetch(PDO::FETCH_ASSOC);
|
$result = $this->connection->execute($query, $data)->fetch(PDO::FETCH_ASSOC);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new EmptyResult($query, null, $data);
|
throw new EmptyResult($query);
|
||||||
}
|
}
|
||||||
} catch (PDOException $exception) {
|
} catch (PDOException $exception) {
|
||||||
throw new EmptyResult($query, $exception, $data);
|
throw new EmptyResult($query, $exception);
|
||||||
}
|
}
|
||||||
return $this->load($result);
|
return $this->load($result);
|
||||||
}
|
}
|
||||||
@ -229,7 +224,7 @@ abstract class Repository implements Define\Repository
|
|||||||
try {
|
try {
|
||||||
$results = $this->connection->execute($query, $data)->fetchAll(PDO::FETCH_ASSOC);
|
$results = $this->connection->execute($query, $data)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
} catch (PDOException $exception) {
|
} catch (PDOException $exception) {
|
||||||
throw new EmptyResult($query, $exception, $data);
|
throw new EmptyResult($query, $exception);
|
||||||
}
|
}
|
||||||
return array_map([$this, 'load'], $results);
|
return array_map([$this, 'load'], $results);
|
||||||
}
|
}
|
||||||
@ -245,7 +240,7 @@ abstract class Repository implements Define\Repository
|
|||||||
try {
|
try {
|
||||||
$results = $this->connection->execute($query, $data)->fetchAll(PDO::FETCH_ASSOC);
|
$results = $this->connection->execute($query, $data)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
} catch (PDOException $exception) {
|
} catch (PDOException $exception) {
|
||||||
throw new EmptyResult($query, $exception, $data);
|
throw new EmptyResult($query, $exception);
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Incoviba\Common\Ideal\Service;
|
|
||||||
|
|
||||||
use Incoviba\Common\Define;
|
|
||||||
use Incoviba\Common\Ideal;
|
|
||||||
|
|
||||||
abstract class Repository extends Ideal\Service
|
|
||||||
{
|
|
||||||
abstract public function getRepository(): Define\Repository;
|
|
||||||
}
|
|
@ -64,10 +64,10 @@ class Select extends Ideal\Query implements Define\Query\Select
|
|||||||
public function having(array|string $conditions): Select
|
public function having(array|string $conditions): Select
|
||||||
{
|
{
|
||||||
if (is_string($conditions)) {
|
if (is_string($conditions)) {
|
||||||
return $this->addHaving($conditions);
|
return $this->addCondition($conditions);
|
||||||
}
|
}
|
||||||
foreach ($conditions as $condition) {
|
foreach ($conditions as $condition) {
|
||||||
$this->addHaving($condition);
|
$this->addCondition($condition);
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,10 @@ use Throwable;
|
|||||||
|
|
||||||
class EmptyResult extends Exception
|
class EmptyResult extends Exception
|
||||||
{
|
{
|
||||||
public function __construct(public string $query, ?Throwable $previous = null, protected ?array $data = null)
|
public function __construct(public string $query, ?Throwable $previous = null)
|
||||||
{
|
{
|
||||||
$message = "Empty results for {$query}";
|
$message = "Empty results for {$query}";
|
||||||
$code = 700;
|
$code = 700;
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getData(): ?array
|
|
||||||
{
|
|
||||||
return $this->data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Incoviba\Common\Implement\Exception;
|
|
||||||
|
|
||||||
use Throwable;
|
|
||||||
use Exception;
|
|
||||||
|
|
||||||
class HttpException extends Exception
|
|
||||||
{
|
|
||||||
public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, $code, $previous);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Incoviba\Common\Implement\Log\Formatter;
|
|
||||||
|
|
||||||
use Throwable;
|
|
||||||
use Monolog\Formatter\JsonFormatter;
|
|
||||||
use Monolog\LogRecord;
|
|
||||||
|
|
||||||
class PDO extends JsonFormatter
|
|
||||||
{
|
|
||||||
public function __construct(int $batchMode = self::BATCH_MODE_JSON, bool $appendNewline = false, bool $ignoreEmptyContextAndExtra = false, bool $includeStacktraces = true)
|
|
||||||
{
|
|
||||||
parent::__construct($batchMode, $appendNewline, $ignoreEmptyContextAndExtra, $includeStacktraces);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function format(LogRecord $record): string
|
|
||||||
{
|
|
||||||
if (is_a($record->message, Throwable::class)) {
|
|
||||||
$exception = $record->message;
|
|
||||||
$message = $this->normalizeException($exception);
|
|
||||||
$context = $record->context;
|
|
||||||
$context['exception'] = $exception;
|
|
||||||
if ($exception->getPrevious()) {
|
|
||||||
$context['previous'] = $this->walkException($exception);
|
|
||||||
}
|
|
||||||
$new_record = new LogRecord(
|
|
||||||
$record->datetime,
|
|
||||||
$record->channel,
|
|
||||||
$record->level,
|
|
||||||
json_encode($message),
|
|
||||||
$context,
|
|
||||||
$record->extra
|
|
||||||
);
|
|
||||||
$record = $new_record;
|
|
||||||
}
|
|
||||||
$normalized = $this->normalize($record, $this->maxNormalizeDepth);
|
|
||||||
return $normalized['message'];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function walkException(Throwable $exception, int $depth = 0): array
|
|
||||||
{
|
|
||||||
$output = [];
|
|
||||||
$currentDepth = $depth;
|
|
||||||
while ($previous = $exception->getPrevious() and $currentDepth < $this->maxNormalizeDepth) {
|
|
||||||
$output []= $this->normalizeException($previous);
|
|
||||||
}
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Incoviba\Common\Implement\Log\Handler;
|
namespace Incoviba\Common\Implement\Log;
|
||||||
|
|
||||||
use Incoviba\Common\Define\Connection;
|
|
||||||
use Monolog\Handler\AbstractProcessingHandler;
|
|
||||||
use Monolog\Level;
|
|
||||||
use Monolog\LogRecord;
|
|
||||||
use PDOStatement;
|
use PDOStatement;
|
||||||
|
use Monolog\Handler\AbstractProcessingHandler;
|
||||||
|
use Monolog\LogRecord;
|
||||||
|
use Monolog\Level;
|
||||||
|
use Incoviba\Common\Define\Connection;
|
||||||
|
|
||||||
class MySQL extends AbstractProcessingHandler
|
class MySQLHandler extends AbstractProcessingHandler
|
||||||
{
|
{
|
||||||
private bool $initialized = false;
|
private bool $initialized = false;
|
||||||
private PDOStatement $statement;
|
private PDOStatement $statement;
|
||||||
@ -19,12 +19,9 @@ class MySQL extends AbstractProcessingHandler
|
|||||||
public function write(LogRecord $record): void
|
public function write(LogRecord $record): void
|
||||||
{
|
{
|
||||||
if (!$this->initialized) {
|
if (!$this->initialized) {
|
||||||
if (!$this->checkTableExists()) {
|
|
||||||
$this->createTable();
|
|
||||||
}
|
|
||||||
$this->cleanup();
|
|
||||||
$this->initialized();
|
$this->initialized();
|
||||||
}
|
}
|
||||||
|
$this->cleanup();
|
||||||
$this->statement->execute([
|
$this->statement->execute([
|
||||||
'channel' => $record->channel,
|
'channel' => $record->channel,
|
||||||
'level' => $record->level->getName(),
|
'level' => $record->level->getName(),
|
||||||
@ -38,21 +35,6 @@ class MySQL extends AbstractProcessingHandler
|
|||||||
private function initialized(): void
|
private function initialized(): void
|
||||||
{
|
{
|
||||||
$query = <<<QUERY
|
$query = <<<QUERY
|
||||||
INSERT INTO monolog (channel, level, message, time, context, extra)
|
|
||||||
VALUES (:channel, :level, :message, :time, :context, :extra)
|
|
||||||
QUERY;
|
|
||||||
$this->statement = $this->connection->getPDO()->prepare($query);
|
|
||||||
$this->initialized = true;
|
|
||||||
}
|
|
||||||
private function checkTableExists(): bool
|
|
||||||
{
|
|
||||||
$query = "SHOW TABLES LIKE 'monolog'";
|
|
||||||
$result = $this->connection->query($query);
|
|
||||||
return $result->rowCount() > 0;
|
|
||||||
}
|
|
||||||
private function createTable(): void
|
|
||||||
{
|
|
||||||
$query = <<<QUERY
|
|
||||||
CREATE TABLE IF NOT EXISTS monolog (
|
CREATE TABLE IF NOT EXISTS monolog (
|
||||||
channel VARCHAR(255),
|
channel VARCHAR(255),
|
||||||
level VARCHAR(100),
|
level VARCHAR(100),
|
||||||
@ -63,6 +45,12 @@ CREATE TABLE IF NOT EXISTS monolog (
|
|||||||
)
|
)
|
||||||
QUERY;
|
QUERY;
|
||||||
$this->connection->getPDO()->exec($query);
|
$this->connection->getPDO()->exec($query);
|
||||||
|
$query = <<<QUERY
|
||||||
|
INSERT INTO monolog (channel, level, message, time, context, extra)
|
||||||
|
VALUES (:channel, :level, :message, :time, :context, :extra)
|
||||||
|
QUERY;
|
||||||
|
$this->statement = $this->connection->getPDO()->prepare($query);
|
||||||
|
$this->initialized = true;
|
||||||
}
|
}
|
||||||
private function cleanup(): void
|
private function cleanup(): void
|
||||||
{
|
{
|
19
app/common/Implement/Log/PDOFormatter.php
Normal file
19
app/common/Implement/Log/PDOFormatter.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
namespace Incoviba\Common\Implement\Log;
|
||||||
|
|
||||||
|
use Monolog\Formatter\JsonFormatter;
|
||||||
|
use Monolog\LogRecord;
|
||||||
|
|
||||||
|
class PDOFormatter extends JsonFormatter
|
||||||
|
{
|
||||||
|
public function __construct(int $batchMode = self::BATCH_MODE_JSON, bool $appendNewline = false, bool $ignoreEmptyContextAndExtra = false, bool $includeStacktraces = true)
|
||||||
|
{
|
||||||
|
parent::__construct($batchMode, $appendNewline, $ignoreEmptyContextAndExtra, $includeStacktraces);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function format(LogRecord $record): string
|
||||||
|
{
|
||||||
|
$normalized = $this->normalize($record);
|
||||||
|
return $normalized['message'];
|
||||||
|
}
|
||||||
|
}
|
@ -1,139 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Incoviba\Common\Implement\Log\Processor;
|
|
||||||
|
|
||||||
use DateInvalidTimeZoneException;
|
|
||||||
use DateMalformedStringException;
|
|
||||||
use DateTimeImmutable;
|
|
||||||
use DateTimeZone;
|
|
||||||
use Psr\Container\ContainerExceptionInterface;
|
|
||||||
use Psr\Container\ContainerInterface;
|
|
||||||
use Psr\Container\NotFoundExceptionInterface;
|
|
||||||
use Monolog\Formatter;
|
|
||||||
use Monolog\Handler;
|
|
||||||
use Monolog\Level;
|
|
||||||
use Predis;
|
|
||||||
use Incoviba;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class ArrayBuilder
|
|
||||||
{
|
|
||||||
public function __construct(protected ContainerInterface $container) {}
|
|
||||||
|
|
||||||
public function build(array $data): array
|
|
||||||
{
|
|
||||||
$handlers = [];
|
|
||||||
foreach ($data as $handlerData) {
|
|
||||||
if (in_array($handlerData['handler'], [Handler\StreamHandler::class, Handler\RotatingFileHandler::class,])) {
|
|
||||||
$params = [
|
|
||||||
"/logs/{$handlerData['filename']}",
|
|
||||||
];
|
|
||||||
if ($handlerData['handler'] === Handler\RotatingFileHandler::class) {
|
|
||||||
$params []= 10;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
$formatter = Formatter\LineFormatter::class;
|
|
||||||
if (array_key_exists('formatter', $handlerData)) {
|
|
||||||
$formatter = $handlerData['formatter'];
|
|
||||||
}
|
|
||||||
$handler = new $handlerData['handler'](...$params)
|
|
||||||
->setFormatter($this->container->get($formatter));
|
|
||||||
} catch (NotFoundExceptionInterface | ContainerExceptionInterface $exception) {
|
|
||||||
$this->log($exception, ['handlerData' => $handlerData]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} elseif ($handlerData['handler'] === Incoviba\Common\Implement\Log\Handler\MySQL::class) {
|
|
||||||
try {
|
|
||||||
$params = [
|
|
||||||
$this->container->get(Incoviba\Common\Define\Connection::class)
|
|
||||||
];
|
|
||||||
$formatter = Incoviba\Common\Implement\Log\Formatter\PDO::class;
|
|
||||||
if (array_key_exists('formatter', $handlerData)) {
|
|
||||||
$formatter = $handlerData['formatter'];
|
|
||||||
}
|
|
||||||
$handler = new $handlerData['handler'](...$params)
|
|
||||||
->setFormatter($this->container->get($formatter));
|
|
||||||
} catch (NotFoundExceptionInterface | ContainerExceptionInterface $exception) {
|
|
||||||
$this->log($exception, ['handlerData' => $handlerData]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} elseif ($handlerData['handler'] === Handler\RedisHandler::class) {
|
|
||||||
try {
|
|
||||||
$params = [
|
|
||||||
$this->container->get(Predis\ClientInterface::class),
|
|
||||||
"logs:{$handlerData['name']}"
|
|
||||||
];
|
|
||||||
} catch (NotFoundExceptionInterface | ContainerExceptionInterface $exception) {
|
|
||||||
$this->log($exception, ['handlerData' => $handlerData]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$handler = new $handlerData['handler'](...$params);
|
|
||||||
}
|
|
||||||
if (!isset($handler)) {
|
|
||||||
$this->log("Invalid handler", ['handlerData' => $handlerData]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$params = [
|
|
||||||
$handler,
|
|
||||||
];
|
|
||||||
if (is_array($handlerData['levels'])) {
|
|
||||||
foreach ($handlerData['levels'] as $level) {
|
|
||||||
$params []= $level;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$params []= $handlerData['levels'];
|
|
||||||
$params []= Level::Emergency;
|
|
||||||
}
|
|
||||||
$params []= false;
|
|
||||||
$handlers []= new Handler\FilterHandler(...$params);
|
|
||||||
}
|
|
||||||
return $handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function log(string|Throwable $message, array $context = []): void
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$dateTime = new DateTimeImmutable('now', new DateTimeZone($_ENV['TZ'] ?? 'America/Santiago'));
|
|
||||||
} catch (DateMalformedStringException | DateInvalidTimeZoneException $exception) {
|
|
||||||
$dateTime = new DateTimeImmutable();
|
|
||||||
}
|
|
||||||
if (is_a($message, Throwable::class)) {
|
|
||||||
$exception = $message;
|
|
||||||
$message = $exception->getMessage();
|
|
||||||
}
|
|
||||||
$context = json_encode($context, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
|
||||||
if ($context === false) {
|
|
||||||
$context = '[]';
|
|
||||||
}
|
|
||||||
$extra = [];
|
|
||||||
$extra['from'] = __FILE__;
|
|
||||||
if (isset($exception)) {
|
|
||||||
$extra['file'] = $exception->getFile();
|
|
||||||
$extra['line'] = $exception->getLine();
|
|
||||||
$extra['trace'] = $exception->getTrace();
|
|
||||||
}
|
|
||||||
$extra = json_encode($extra, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
|
||||||
$code = 0;
|
|
||||||
if (isset($exception)) {
|
|
||||||
$code = $exception->getCode();
|
|
||||||
}
|
|
||||||
if ($extra === false) {
|
|
||||||
$extra = '[]';
|
|
||||||
}
|
|
||||||
$output = "[{$dateTime->format('Y-m-d H:i:s P')}] [{$code}] {$message} {$context} {$extra}";
|
|
||||||
$filename = '/logs/error.json';
|
|
||||||
$fileContents = [];
|
|
||||||
if (file_exists($filename)) {
|
|
||||||
$fileContents = file_get_contents($filename);
|
|
||||||
$fileContents = json_decode($fileContents, true);
|
|
||||||
if ($fileContents === false) {
|
|
||||||
$fileContents = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$fileContents[$dateTime->getTimestamp()] = $output;
|
|
||||||
$fileContents = json_encode($fileContents, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
|
||||||
if ($fileContents === false) {
|
|
||||||
$fileContents = '[]';
|
|
||||||
}
|
|
||||||
file_put_contents($filename, $fileContents);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Incoviba\Common\Implement\Log\Processor;
|
namespace Incoviba\Common\Implement\Log;
|
||||||
|
|
||||||
use Incoviba\Service;
|
|
||||||
use Monolog\LogRecord;
|
use Monolog\LogRecord;
|
||||||
use Monolog\Processor\ProcessorInterface;
|
use Monolog\Processor\ProcessorInterface;
|
||||||
|
use Incoviba\Service;
|
||||||
|
|
||||||
class User implements ProcessorInterface
|
class UserProcessor implements ProcessorInterface
|
||||||
{
|
{
|
||||||
public function __construct(protected Service\Login $loginService) {}
|
public function __construct(protected Service\Login $loginService) {}
|
||||||
public function __invoke(LogRecord $record): LogRecord
|
public function __invoke(LogRecord $record): LogRecord
|
@ -4,25 +4,21 @@
|
|||||||
"type": "project",
|
"type": "project",
|
||||||
"require": {
|
"require": {
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
"ext-dom": "*",
|
|
||||||
"ext-gd": "*",
|
"ext-gd": "*",
|
||||||
"ext-openssl": "*",
|
"ext-openssl": "*",
|
||||||
"ext-pdo": "*",
|
"ext-pdo": "*",
|
||||||
"ext-sockets": "*",
|
|
||||||
"berrnd/slim-blade-view": "^1",
|
"berrnd/slim-blade-view": "^1",
|
||||||
"guzzlehttp/guzzle": "^7",
|
"guzzlehttp/guzzle": "^7",
|
||||||
"monolog/monolog": "^3",
|
"monolog/monolog": "^3",
|
||||||
"nyholm/psr7": "^1",
|
"nyholm/psr7": "^1",
|
||||||
"nyholm/psr7-server": "^1",
|
"nyholm/psr7-server": "^1",
|
||||||
"pda/pheanstalk": "^7.0",
|
|
||||||
"php-di/php-di": "^7",
|
"php-di/php-di": "^7",
|
||||||
"php-di/slim-bridge": "^3",
|
"php-di/slim-bridge": "^3",
|
||||||
"phpoffice/phpspreadsheet": "^3",
|
"phpoffice/phpspreadsheet": "^3",
|
||||||
"predis/predis": "^2",
|
"predis/predis": "^2",
|
||||||
"robmorgan/phinx": "^0.16",
|
"robmorgan/phinx": "^0.16",
|
||||||
"slim/slim": "^4",
|
"slim/slim": "^4",
|
||||||
"symfony/string": "^7.2",
|
"symfony/string": "^7.2"
|
||||||
"tedivm/jshrink": "^1.7"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fakerphp/faker": "^1",
|
"fakerphp/faker": "^1",
|
||||||
|
496
app/fcgi.conf
496
app/fcgi.conf
@ -1,496 +0,0 @@
|
|||||||
; Start a new pool named 'www'.
|
|
||||||
; the variable $pool can be used in any directive and will be replaced by the
|
|
||||||
; pool name ('www' here)
|
|
||||||
[fcgi]
|
|
||||||
|
|
||||||
; Per pool prefix
|
|
||||||
; It only applies on the following directives:
|
|
||||||
; - 'access.log'
|
|
||||||
; - 'slowlog'
|
|
||||||
; - 'listen' (unixsocket)
|
|
||||||
; - 'chroot'
|
|
||||||
; - 'chdir'
|
|
||||||
; - 'php_values'
|
|
||||||
; - 'php_admin_values'
|
|
||||||
; When not set, the global prefix (or NONE) applies instead.
|
|
||||||
; Note: This directive can also be relative to the global prefix.
|
|
||||||
; Default Value: none
|
|
||||||
;prefix = /path/to/pools/$pool
|
|
||||||
|
|
||||||
; Unix user/group of the child processes. This can be used only if the master
|
|
||||||
; process running user is root. It is set after the child process is created.
|
|
||||||
; The user and group can be specified either by their name or by their numeric
|
|
||||||
; IDs.
|
|
||||||
; Note: If the user is root, the executable needs to be started with
|
|
||||||
; --allow-to-run-as-root option to work.
|
|
||||||
; Default Values: The user is set to master process running user by default.
|
|
||||||
; If the group is not set, the user's group is used.
|
|
||||||
user = www-data
|
|
||||||
group = www-data
|
|
||||||
|
|
||||||
; The address on which to accept FastCGI requests.
|
|
||||||
; Valid syntaxes are:
|
|
||||||
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
|
|
||||||
; a specific port;
|
|
||||||
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
|
|
||||||
; a specific port;
|
|
||||||
; 'port' - to listen on a TCP socket to all addresses
|
|
||||||
; (IPv6 and IPv4-mapped) on a specific port;
|
|
||||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
|
||||||
; Note: This value is mandatory.
|
|
||||||
;listen = 127.0.0.1:9000
|
|
||||||
listen = 9090
|
|
||||||
|
|
||||||
; Set listen(2) backlog.
|
|
||||||
; Default Value: 511 (-1 on Linux, FreeBSD and OpenBSD)
|
|
||||||
;listen.backlog = 511
|
|
||||||
|
|
||||||
; Set permissions for unix socket, if one is used. In Linux, read/write
|
|
||||||
; permissions must be set in order to allow connections from a web server. Many
|
|
||||||
; BSD-derived systems allow connections regardless of permissions. The owner
|
|
||||||
; and group can be specified either by name or by their numeric IDs.
|
|
||||||
; Default Values: Owner is set to the master process running user. If the group
|
|
||||||
; is not set, the owner's group is used. Mode is set to 0660.
|
|
||||||
;listen.owner = www-data
|
|
||||||
;listen.group = www-data
|
|
||||||
;listen.mode = 0660
|
|
||||||
|
|
||||||
; When POSIX Access Control Lists are supported you can set them using
|
|
||||||
; these options, value is a comma separated list of user/group names.
|
|
||||||
; When set, listen.owner and listen.group are ignored
|
|
||||||
;listen.acl_users =
|
|
||||||
;listen.acl_groups =
|
|
||||||
|
|
||||||
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
|
|
||||||
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
|
|
||||||
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
|
|
||||||
; must be separated by a comma. If this value is left blank, connections will be
|
|
||||||
; accepted from any ip address.
|
|
||||||
; Default Value: any
|
|
||||||
;listen.allowed_clients = 127.0.0.1
|
|
||||||
|
|
||||||
; Set the associated the route table (FIB). FreeBSD only
|
|
||||||
; Default Value: -1
|
|
||||||
;listen.setfib = 1
|
|
||||||
|
|
||||||
; Specify the nice(2) priority to apply to the pool processes (only if set)
|
|
||||||
; The value can vary from -19 (highest priority) to 20 (lower priority)
|
|
||||||
; Note: - It will only work if the FPM master process is launched as root
|
|
||||||
; - The pool processes will inherit the master process priority
|
|
||||||
; unless it specified otherwise
|
|
||||||
; Default Value: no set
|
|
||||||
; process.priority = -19
|
|
||||||
|
|
||||||
; Set the process dumpable flag (PR_SET_DUMPABLE prctl for Linux or
|
|
||||||
; PROC_TRACE_CTL procctl for FreeBSD) even if the process user
|
|
||||||
; or group is different than the master process user. It allows to create process
|
|
||||||
; core dump and ptrace the process for the pool user.
|
|
||||||
; Default Value: no
|
|
||||||
; process.dumpable = yes
|
|
||||||
|
|
||||||
; Choose how the process manager will control the number of child processes.
|
|
||||||
; Possible Values:
|
|
||||||
; static - a fixed number (pm.max_children) of child processes;
|
|
||||||
; dynamic - the number of child processes are set dynamically based on the
|
|
||||||
; following directives. With this process management, there will be
|
|
||||||
; always at least 1 children.
|
|
||||||
; pm.max_children - the maximum number of children that can
|
|
||||||
; be alive at the same time.
|
|
||||||
; pm.start_servers - the number of children created on startup.
|
|
||||||
; pm.min_spare_servers - the minimum number of children in 'idle'
|
|
||||||
; state (waiting to process). If the number
|
|
||||||
; of 'idle' processes is less than this
|
|
||||||
; number then some children will be created.
|
|
||||||
; pm.max_spare_servers - the maximum number of children in 'idle'
|
|
||||||
; state (waiting to process). If the number
|
|
||||||
; of 'idle' processes is greater than this
|
|
||||||
; number then some children will be killed.
|
|
||||||
; pm.max_spawn_rate - the maximum number of rate to spawn child
|
|
||||||
; processes at once.
|
|
||||||
; ondemand - no children are created at startup. Children will be forked when
|
|
||||||
; new requests will connect. The following parameter are used:
|
|
||||||
; pm.max_children - the maximum number of children that
|
|
||||||
; can be alive at the same time.
|
|
||||||
; pm.process_idle_timeout - The number of seconds after which
|
|
||||||
; an idle process will be killed.
|
|
||||||
; Note: This value is mandatory.
|
|
||||||
pm = ondemand
|
|
||||||
|
|
||||||
; The number of child processes to be created when pm is set to 'static' and the
|
|
||||||
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
|
|
||||||
; This value sets the limit on the number of simultaneous requests that will be
|
|
||||||
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
|
|
||||||
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
|
|
||||||
; CGI. The below defaults are based on a server without much resources. Don't
|
|
||||||
; forget to tweak pm.* to fit your needs.
|
|
||||||
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
|
||||||
; Note: This value is mandatory.
|
|
||||||
pm.max_children = 2
|
|
||||||
|
|
||||||
; The number of child processes created on startup.
|
|
||||||
; Note: Used only when pm is set to 'dynamic'
|
|
||||||
; Default Value: (min_spare_servers + max_spare_servers) / 2
|
|
||||||
;pm.start_servers = 2
|
|
||||||
|
|
||||||
; The desired minimum number of idle server processes.
|
|
||||||
; Note: Used only when pm is set to 'dynamic'
|
|
||||||
; Note: Mandatory when pm is set to 'dynamic'
|
|
||||||
;pm.min_spare_servers = 1
|
|
||||||
|
|
||||||
; The desired maximum number of idle server processes.
|
|
||||||
; Note: Used only when pm is set to 'dynamic'
|
|
||||||
; Note: Mandatory when pm is set to 'dynamic'
|
|
||||||
;pm.max_spare_servers = 3
|
|
||||||
|
|
||||||
; The number of rate to spawn child processes at once.
|
|
||||||
; Note: Used only when pm is set to 'dynamic'
|
|
||||||
; Note: Mandatory when pm is set to 'dynamic'
|
|
||||||
; Default Value: 32
|
|
||||||
;pm.max_spawn_rate = 32
|
|
||||||
|
|
||||||
; The number of seconds after which an idle process will be killed.
|
|
||||||
; Note: Used only when pm is set to 'ondemand'
|
|
||||||
; Default Value: 10s
|
|
||||||
;pm.process_idle_timeout = 10s;
|
|
||||||
pm.process_idle_timeout = 10s
|
|
||||||
|
|
||||||
; The number of requests each child process should execute before respawning.
|
|
||||||
; This can be useful to work around memory leaks in 3rd party libraries. For
|
|
||||||
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
|
||||||
; Default Value: 0
|
|
||||||
;pm.max_requests = 500
|
|
||||||
|
|
||||||
; The URI to view the FPM status page. If this value is not set, no URI will be
|
|
||||||
; recognized as a status page. It shows the following information:
|
|
||||||
; pool - the name of the pool;
|
|
||||||
; process manager - static, dynamic or ondemand;
|
|
||||||
; start time - the date and time FPM has started;
|
|
||||||
; start since - number of seconds since FPM has started;
|
|
||||||
; accepted conn - the number of request accepted by the pool;
|
|
||||||
; listen queue - the number of request in the queue of pending
|
|
||||||
; connections (see backlog in listen(2));
|
|
||||||
; max listen queue - the maximum number of requests in the queue
|
|
||||||
; of pending connections since FPM has started;
|
|
||||||
; listen queue len - the size of the socket queue of pending connections;
|
|
||||||
; idle processes - the number of idle processes;
|
|
||||||
; active processes - the number of active processes;
|
|
||||||
; total processes - the number of idle + active processes;
|
|
||||||
; max active processes - the maximum number of active processes since FPM
|
|
||||||
; has started;
|
|
||||||
; max children reached - number of times, the process limit has been reached,
|
|
||||||
; when pm tries to start more children (works only for
|
|
||||||
; pm 'dynamic' and 'ondemand');
|
|
||||||
; Value are updated in real time.
|
|
||||||
; Example output:
|
|
||||||
; pool: www
|
|
||||||
; process manager: static
|
|
||||||
; start time: 01/Jul/2011:17:53:49 +0200
|
|
||||||
; start since: 62636
|
|
||||||
; accepted conn: 190460
|
|
||||||
; listen queue: 0
|
|
||||||
; max listen queue: 1
|
|
||||||
; listen queue len: 42
|
|
||||||
; idle processes: 4
|
|
||||||
; active processes: 11
|
|
||||||
; total processes: 15
|
|
||||||
; max active processes: 12
|
|
||||||
; max children reached: 0
|
|
||||||
;
|
|
||||||
; By default the status page output is formatted as text/plain. Passing either
|
|
||||||
; 'html', 'xml' or 'json' in the query string will return the corresponding
|
|
||||||
; output syntax. Example:
|
|
||||||
; http://www.foo.bar/status
|
|
||||||
; http://www.foo.bar/status?json
|
|
||||||
; http://www.foo.bar/status?html
|
|
||||||
; http://www.foo.bar/status?xml
|
|
||||||
;
|
|
||||||
; By default the status page only outputs short status. Passing 'full' in the
|
|
||||||
; query string will also return status for each pool process.
|
|
||||||
; Example:
|
|
||||||
; http://www.foo.bar/status?full
|
|
||||||
; http://www.foo.bar/status?json&full
|
|
||||||
; http://www.foo.bar/status?html&full
|
|
||||||
; http://www.foo.bar/status?xml&full
|
|
||||||
; The Full status returns for each process:
|
|
||||||
; pid - the PID of the process;
|
|
||||||
; state - the state of the process (Idle, Running, ...);
|
|
||||||
; start time - the date and time the process has started;
|
|
||||||
; start since - the number of seconds since the process has started;
|
|
||||||
; requests - the number of requests the process has served;
|
|
||||||
; request duration - the duration in µs of the requests;
|
|
||||||
; request method - the request method (GET, POST, ...);
|
|
||||||
; request URI - the request URI with the query string;
|
|
||||||
; content length - the content length of the request (only with POST);
|
|
||||||
; user - the user (PHP_AUTH_USER) (or '-' if not set);
|
|
||||||
; script - the main script called (or '-' if not set);
|
|
||||||
; last request cpu - the %cpu the last request consumed
|
|
||||||
; it's always 0 if the process is not in Idle state
|
|
||||||
; because CPU calculation is done when the request
|
|
||||||
; processing has terminated;
|
|
||||||
; last request memory - the max amount of memory the last request consumed
|
|
||||||
; it's always 0 if the process is not in Idle state
|
|
||||||
; because memory calculation is done when the request
|
|
||||||
; processing has terminated;
|
|
||||||
; If the process is in Idle state, then information is related to the
|
|
||||||
; last request the process has served. Otherwise information is related to
|
|
||||||
; the current request being served.
|
|
||||||
; Example output:
|
|
||||||
; ************************
|
|
||||||
; pid: 31330
|
|
||||||
; state: Running
|
|
||||||
; start time: 01/Jul/2011:17:53:49 +0200
|
|
||||||
; start since: 63087
|
|
||||||
; requests: 12808
|
|
||||||
; request duration: 1250261
|
|
||||||
; request method: GET
|
|
||||||
; request URI: /test_mem.php?N=10000
|
|
||||||
; content length: 0
|
|
||||||
; user: -
|
|
||||||
; script: /home/fat/web/docs/php/test_mem.php
|
|
||||||
; last request cpu: 0.00
|
|
||||||
; last request memory: 0
|
|
||||||
;
|
|
||||||
; Note: There is a real-time FPM status monitoring sample web page available
|
|
||||||
; It's available in: /usr/local/share/php/fpm/status.html
|
|
||||||
;
|
|
||||||
; Note: The value must start with a leading slash (/). The value can be
|
|
||||||
; anything, but it may not be a good idea to use the .php extension or it
|
|
||||||
; may conflict with a real PHP file.
|
|
||||||
; Default Value: not set
|
|
||||||
;pm.status_path = /status
|
|
||||||
|
|
||||||
; The address on which to accept FastCGI status request. This creates a new
|
|
||||||
; invisible pool that can handle requests independently. This is useful
|
|
||||||
; if the main pool is busy with long running requests because it is still possible
|
|
||||||
; to get the status before finishing the long running requests.
|
|
||||||
;
|
|
||||||
; Valid syntaxes are:
|
|
||||||
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
|
|
||||||
; a specific port;
|
|
||||||
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
|
|
||||||
; a specific port;
|
|
||||||
; 'port' - to listen on a TCP socket to all addresses
|
|
||||||
; (IPv6 and IPv4-mapped) on a specific port;
|
|
||||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
|
||||||
; Default Value: value of the listen option
|
|
||||||
;pm.status_listen = 127.0.0.1:9001
|
|
||||||
|
|
||||||
; The ping URI to call the monitoring page of FPM. If this value is not set, no
|
|
||||||
; URI will be recognized as a ping page. This could be used to test from outside
|
|
||||||
; that FPM is alive and responding, or to
|
|
||||||
; - create a graph of FPM availability (rrd or such);
|
|
||||||
; - remove a server from a group if it is not responding (load balancing);
|
|
||||||
; - trigger alerts for the operating team (24/7).
|
|
||||||
; Note: The value must start with a leading slash (/). The value can be
|
|
||||||
; anything, but it may not be a good idea to use the .php extension or it
|
|
||||||
; may conflict with a real PHP file.
|
|
||||||
; Default Value: not set
|
|
||||||
;ping.path = /ping
|
|
||||||
|
|
||||||
; This directive may be used to customize the response of a ping request. The
|
|
||||||
; response is formatted as text/plain with a 200 response code.
|
|
||||||
; Default Value: pong
|
|
||||||
;ping.response = pong
|
|
||||||
|
|
||||||
; The access log file
|
|
||||||
; Default: not set
|
|
||||||
;access.log = log/$pool.access.log
|
|
||||||
access.log = /proc/self/fd/2
|
|
||||||
|
|
||||||
; The access log format.
|
|
||||||
; The following syntax is allowed
|
|
||||||
; %%: the '%' character
|
|
||||||
; %C: %CPU used by the request
|
|
||||||
; it can accept the following format:
|
|
||||||
; - %{user}C for user CPU only
|
|
||||||
; - %{system}C for system CPU only
|
|
||||||
; - %{total}C for user + system CPU (default)
|
|
||||||
; %d: time taken to serve the request
|
|
||||||
; it can accept the following format:
|
|
||||||
; - %{seconds}d (default)
|
|
||||||
; - %{milliseconds}d
|
|
||||||
; - %{milli}d
|
|
||||||
; - %{microseconds}d
|
|
||||||
; - %{micro}d
|
|
||||||
; %e: an environment variable (same as $_ENV or $_SERVER)
|
|
||||||
; it must be associated with embraces to specify the name of the env
|
|
||||||
; variable. Some examples:
|
|
||||||
; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
|
|
||||||
; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
|
|
||||||
; %f: script filename
|
|
||||||
; %l: content-length of the request (for POST request only)
|
|
||||||
; %m: request method
|
|
||||||
; %M: peak of memory allocated by PHP
|
|
||||||
; it can accept the following format:
|
|
||||||
; - %{bytes}M (default)
|
|
||||||
; - %{kilobytes}M
|
|
||||||
; - %{kilo}M
|
|
||||||
; - %{megabytes}M
|
|
||||||
; - %{mega}M
|
|
||||||
; %n: pool name
|
|
||||||
; %o: output header
|
|
||||||
; it must be associated with embraces to specify the name of the header:
|
|
||||||
; - %{Content-Type}o
|
|
||||||
; - %{X-Powered-By}o
|
|
||||||
; - %{Transfert-Encoding}o
|
|
||||||
; - ....
|
|
||||||
; %p: PID of the child that serviced the request
|
|
||||||
; %P: PID of the parent of the child that serviced the request
|
|
||||||
; %q: the query string
|
|
||||||
; %Q: the '?' character if query string exists
|
|
||||||
; %r: the request URI (without the query string, see %q and %Q)
|
|
||||||
; %R: remote IP address
|
|
||||||
; %s: status (response code)
|
|
||||||
; %t: server time the request was received
|
|
||||||
; it can accept a strftime(3) format:
|
|
||||||
; %d/%b/%Y:%H:%M:%S %z (default)
|
|
||||||
; The strftime(3) format must be encapsulated in a %{<strftime_format>}t tag
|
|
||||||
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
|
|
||||||
; %T: time the log has been written (the request has finished)
|
|
||||||
; it can accept a strftime(3) format:
|
|
||||||
; %d/%b/%Y:%H:%M:%S %z (default)
|
|
||||||
; The strftime(3) format must be encapsulated in a %{<strftime_format>}t tag
|
|
||||||
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
|
|
||||||
; %u: basic auth user if specified in Authorization header
|
|
||||||
;
|
|
||||||
; Default: "%R - %u %t \"%m %r\" %s"
|
|
||||||
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{milli}d %{kilo}M %C%%"
|
|
||||||
|
|
||||||
; A list of request_uri values which should be filtered from the access log.
|
|
||||||
;
|
|
||||||
; As a security precaution, this setting will be ignored if:
|
|
||||||
; - the request method is not GET or HEAD; or
|
|
||||||
; - there is a request body; or
|
|
||||||
; - there are query parameters; or
|
|
||||||
; - the response code is outwith the successful range of 200 to 299
|
|
||||||
;
|
|
||||||
; Note: The paths are matched against the output of the access.format tag "%r".
|
|
||||||
; On common configurations, this may look more like SCRIPT_NAME than the
|
|
||||||
; expected pre-rewrite URI.
|
|
||||||
;
|
|
||||||
; Default Value: not set
|
|
||||||
;access.suppress_path[] = /ping
|
|
||||||
;access.suppress_path[] = /health_check.php
|
|
||||||
|
|
||||||
; The log file for slow requests
|
|
||||||
; Default Value: not set
|
|
||||||
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
|
||||||
;slowlog = log/$pool.log.slow
|
|
||||||
|
|
||||||
; The timeout for serving a single request after which a PHP backtrace will be
|
|
||||||
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
|
|
||||||
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
|
||||||
; Default Value: 0
|
|
||||||
;request_slowlog_timeout = 0
|
|
||||||
|
|
||||||
; Depth of slow log stack trace.
|
|
||||||
; Default Value: 20
|
|
||||||
;request_slowlog_trace_depth = 20
|
|
||||||
|
|
||||||
; The timeout for serving a single request after which the worker process will
|
|
||||||
; be killed. This option should be used when the 'max_execution_time' ini option
|
|
||||||
; does not stop script execution for some reason. A value of '0' means 'off'.
|
|
||||||
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
|
||||||
; Default Value: 0
|
|
||||||
;request_terminate_timeout = 0
|
|
||||||
|
|
||||||
; The timeout set by 'request_terminate_timeout' ini option is not engaged after
|
|
||||||
; application calls 'fastcgi_finish_request' or when application has finished and
|
|
||||||
; shutdown functions are being called (registered via register_shutdown_function).
|
|
||||||
; This option will enable timeout limit to be applied unconditionally
|
|
||||||
; even in such cases.
|
|
||||||
; Default Value: no
|
|
||||||
;request_terminate_timeout_track_finished = no
|
|
||||||
|
|
||||||
; Set open file descriptor rlimit.
|
|
||||||
; Default Value: system defined value
|
|
||||||
;rlimit_files = 1024
|
|
||||||
|
|
||||||
; Set max core size rlimit.
|
|
||||||
; Possible Values: 'unlimited' or an integer greater or equal to 0
|
|
||||||
; Default Value: system defined value
|
|
||||||
;rlimit_core = 0
|
|
||||||
|
|
||||||
; Chroot to this directory at the start. This value must be defined as an
|
|
||||||
; absolute path. When this value is not set, chroot is not used.
|
|
||||||
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
|
|
||||||
; of its subdirectories. If the pool prefix is not set, the global prefix
|
|
||||||
; will be used instead.
|
|
||||||
; Note: chrooting is a great security feature and should be used whenever
|
|
||||||
; possible. However, all PHP paths will be relative to the chroot
|
|
||||||
; (error_log, sessions.save_path, ...).
|
|
||||||
; Default Value: not set
|
|
||||||
;chroot =
|
|
||||||
|
|
||||||
; Chdir to this directory at the start.
|
|
||||||
; Note: relative path can be used.
|
|
||||||
; Default Value: current directory or / when chroot
|
|
||||||
;chdir = /var/www
|
|
||||||
|
|
||||||
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
|
||||||
; stderr will be redirected to /dev/null according to FastCGI specs.
|
|
||||||
; Note: on highloaded environment, this can cause some delay in the page
|
|
||||||
; process time (several ms).
|
|
||||||
; Default Value: no
|
|
||||||
;catch_workers_output = yes
|
|
||||||
catch_workers_output = yes
|
|
||||||
|
|
||||||
; Decorate worker output with prefix and suffix containing information about
|
|
||||||
; the child that writes to the log and if stdout or stderr is used as well as
|
|
||||||
; log level and time. This options is used only if catch_workers_output is yes.
|
|
||||||
; Settings to "no" will output data as written to the stdout or stderr.
|
|
||||||
; Default value: yes
|
|
||||||
;decorate_workers_output = no
|
|
||||||
decorate_workers_output = no
|
|
||||||
|
|
||||||
; Clear environment in FPM workers
|
|
||||||
; Prevents arbitrary environment variables from reaching FPM worker processes
|
|
||||||
; by clearing the environment in workers before env vars specified in this
|
|
||||||
; pool configuration are added.
|
|
||||||
; Setting to "no" will make all environment variables available to PHP code
|
|
||||||
; via getenv(), $_ENV and $_SERVER.
|
|
||||||
; Default Value: yes
|
|
||||||
;clear_env = no
|
|
||||||
clear_env = no
|
|
||||||
|
|
||||||
; Limits the extensions of the main script FPM will allow to parse. This can
|
|
||||||
; prevent configuration mistakes on the web server side. You should only limit
|
|
||||||
; FPM to .php extensions to prevent malicious users to use other extensions to
|
|
||||||
; execute php code.
|
|
||||||
; Note: set an empty value to allow all extensions.
|
|
||||||
; Default Value: .php
|
|
||||||
;security.limit_extensions = .php .php3 .php4 .php5 .php7
|
|
||||||
|
|
||||||
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
|
|
||||||
; the current environment.
|
|
||||||
; Default Value: clean env
|
|
||||||
;env[HOSTNAME] = $HOSTNAME
|
|
||||||
;env[PATH] = /usr/local/bin:/usr/bin:/bin
|
|
||||||
;env[TMP] = /tmp
|
|
||||||
;env[TMPDIR] = /tmp
|
|
||||||
;env[TEMP] = /tmp
|
|
||||||
|
|
||||||
; Additional php.ini defines, specific to this pool of workers. These settings
|
|
||||||
; overwrite the values previously defined in the php.ini. The directives are the
|
|
||||||
; same as the PHP SAPI:
|
|
||||||
; php_value/php_flag - you can set classic ini defines which can
|
|
||||||
; be overwritten from PHP call 'ini_set'.
|
|
||||||
; php_admin_value/php_admin_flag - these directives won't be overwritten by
|
|
||||||
; PHP call 'ini_set'
|
|
||||||
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
|
|
||||||
|
|
||||||
; Defining 'extension' will load the corresponding shared extension from
|
|
||||||
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
|
|
||||||
; overwrite previously defined php.ini values, but will append the new value
|
|
||||||
; instead.
|
|
||||||
|
|
||||||
; Note: path INI options can be relative and will be expanded with the prefix
|
|
||||||
; (pool, global or /usr/local)
|
|
||||||
|
|
||||||
; Default Value: nothing is defined by default except the values in php.ini and
|
|
||||||
; specified at startup with the -d argument
|
|
||||||
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
|
|
||||||
;php_flag[display_errors] = off
|
|
||||||
;php_admin_value[error_log] = /var/log/fpm-php.www.log
|
|
||||||
;php_admin_flag[log_errors] = on
|
|
||||||
;php_admin_value[memory_limit] = 32M
|
|
@ -28,15 +28,16 @@
|
|||||||
<directory>common</directory>
|
<directory>common</directory>
|
||||||
</include>
|
</include>
|
||||||
</source>
|
</source>
|
||||||
<!--<coverage pathCoverage="false" ignoreDeprecatedCodeUnits="true" disableCodeCoverageIgnore="true">
|
<coverage pathCoverage="false" ignoreDeprecatedCodeUnits="true" disableCodeCoverageIgnore="true">
|
||||||
<report>
|
<report>
|
||||||
<html outputDirectory="/code/public/coverage/html"/>
|
<html outputDirectory="/code/public/coverage/html"/>
|
||||||
|
<php outputFile="/code/public/coverage/coverage.php"/>
|
||||||
</report>
|
</report>
|
||||||
</coverage>-->
|
</coverage>
|
||||||
<logging>
|
<logging>
|
||||||
<junit outputFile="/code/cache/tests/junit.xml"/>
|
<junit outputFile="/code/cache/tests/junit.xml"/>
|
||||||
<teamcity outputFile="/code/cache/tests/teamcity.txt"/>
|
<teamcity outputFile="/code/cache/tests/teamcity.txt"/>
|
||||||
<!--<testdoxHtml outputFile="/code/public/tests/testdox.html"/>-->
|
<testdoxHtml outputFile="/code/cache/tests/testdox.html"/>
|
||||||
<testdoxText outputFile="/code/cache/tests/testdox.txt"/>
|
<testdoxText outputFile="/code/cache/tests/testdox.txt"/>
|
||||||
</logging>
|
</logging>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
@ -13,12 +13,3 @@ try {
|
|||||||
$app->getContainer()->get(Psr\Log\LoggerInterface::class)->notice($exception);
|
$app->getContainer()->get(Psr\Log\LoggerInterface::class)->notice($exception);
|
||||||
header('Location: /construccion');
|
header('Location: /construccion');
|
||||||
}
|
}
|
||||||
register_shutdown_function(function() {
|
|
||||||
$error = error_get_last();
|
|
||||||
|
|
||||||
$fatal_errors = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR];
|
|
||||||
if ($error !== null and in_array($error['type'], $fatal_errors, true)) {
|
|
||||||
error_log(json_encode($error).PHP_EOL,3, '/logs/fatal.log');
|
|
||||||
}
|
|
||||||
error_clear_last();
|
|
||||||
});
|
|
||||||
|
@ -18,7 +18,7 @@ class CreateAgente extends Phinx\Migration\AbstractMigration
|
|||||||
->addColumn('telefono', 'integer', ['length' => 11, 'default' => null, 'null' => true])
|
->addColumn('telefono', 'integer', ['length' => 11, 'default' => null, 'null' => true])
|
||||||
->addColumn('correo', 'string', ['length' => 50, 'default' => null, 'null' => true])
|
->addColumn('correo', 'string', ['length' => 50, 'default' => null, 'null' => true])
|
||||||
->addColumn('direccion', 'integer', ['length' => 11, 'default' => null, 'null' => true])
|
->addColumn('direccion', 'integer', ['length' => 11, 'default' => null, 'null' => true])
|
||||||
->addColumn('giro', 'text', ['default' => null, 'null' => true])
|
->addColumn('giro', 'mediumtext', ['default' => null, 'null' => true])
|
||||||
->addColumn('abreviacion', 'string', ['length' => 20, 'default' => null, 'null' => true])
|
->addColumn('abreviacion', 'string', ['length' => 20, 'default' => null, 'null' => true])
|
||||||
->create();
|
->create();
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||||
|
@ -13,9 +13,9 @@ class CreateCartolas extends Phinx\Migration\AbstractMigration
|
|||||||
$this->table('cartolas')
|
$this->table('cartolas')
|
||||||
->addColumn('cuenta_id', 'integer', ['length' => 10, 'null' => false, 'signed' => false])
|
->addColumn('cuenta_id', 'integer', ['length' => 10, 'null' => false, 'signed' => false])
|
||||||
->addColumn('fecha', 'date', ['null' => false])
|
->addColumn('fecha', 'date', ['null' => false])
|
||||||
->addColumn('cargos', 'biginteger', ['length' => 20, 'default' => 0, 'null' => false, 'signed' => false])
|
->addColumn('cargos', 'bigint', ['length' => 20, 'default' => 0, 'null' => false, 'signed' => false])
|
||||||
->addColumn('abonos', 'biginteger', ['length' => 20, 'default' => 0, 'null' => false, 'signed' => false])
|
->addColumn('abonos', 'bigint', ['length' => 20, 'default' => 0, 'null' => false, 'signed' => false])
|
||||||
->addColumn('saldo', 'biginteger', ['length' => 20, 'default' => 0, 'null' => false])
|
->addColumn('saldo', 'bigint', ['length' => 20, 'default' => 0, 'null' => false])
|
||||||
->addForeignKey('cuenta_id', 'cuenta', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
->addForeignKey('cuenta_id', 'cuenta', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
->create();
|
->create();
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||||
|
@ -15,7 +15,7 @@ class CreateCentrosCostos extends Phinx\Migration\AbstractMigration
|
|||||||
->addColumn('categoria_id', 'integer', ['length' => 10, 'null' => false, 'signed' => false])
|
->addColumn('categoria_id', 'integer', ['length' => 10, 'null' => false, 'signed' => false])
|
||||||
->addColumn('tipo_cuenta_id', 'integer', ['length' => 10, 'default' => null, 'null' => true, 'signed' => false])
|
->addColumn('tipo_cuenta_id', 'integer', ['length' => 10, 'default' => null, 'null' => true, 'signed' => false])
|
||||||
->addColumn('cuenta_contable', 'string', ['length' => 100, 'null' => false])
|
->addColumn('cuenta_contable', 'string', ['length' => 100, 'null' => false])
|
||||||
->addColumn('descripcion', 'text', ['null' => false, 'limit' => MysqlAdapter::TEXT_MEDIUM])
|
->addColumn('descripcion', 'mediumtext', ['null' => false])
|
||||||
->addForeignKey('tipo_centro_id', 'tipos_centros_costos', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
->addForeignKey('tipo_centro_id', 'tipos_centros_costos', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
->addForeignKey('categoria_id', 'categorias_centros_costos', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
->addForeignKey('categoria_id', 'categorias_centros_costos', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
->create();
|
->create();
|
||||||
|
@ -19,7 +19,7 @@ class CreateCobro extends Phinx\Migration\AbstractMigration
|
|||||||
->addColumn('iva', 'float', ['default' => 0])
|
->addColumn('iva', 'float', ['default' => 0])
|
||||||
->addColumn('uf', 'float', ['default' => null, 'null' => true])
|
->addColumn('uf', 'float', ['default' => null, 'null' => true])
|
||||||
->addColumn('identificador', 'string', ['length' => 50, 'default' => null, 'null' => true])
|
->addColumn('identificador', 'string', ['length' => 50, 'default' => null, 'null' => true])
|
||||||
->addColumn('glosa', 'text', ['default' => null, 'null' => true, 'limit' => MysqlAdapter::TEXT_MEDIUM])
|
->addColumn('glosa', 'mediumtext', ['default' => null, 'null' => true])
|
||||||
->create();
|
->create();
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ class CreateEscritura extends Phinx\Migration\AbstractMigration
|
|||||||
$this->execute("ALTER DATABASE COLLATE='utf8mb4_general_ci';");
|
$this->execute("ALTER DATABASE COLLATE='utf8mb4_general_ci';");
|
||||||
|
|
||||||
$this->table('escritura')
|
$this->table('escritura')
|
||||||
->addColumn('valor', 'biginteger', ['length' => 20, 'null' => false])
|
->addColumn('valor', 'bigint', ['length' => 20, 'null' => false])
|
||||||
->addColumn('fecha', 'date', ['null' => false])
|
->addColumn('fecha', 'date', ['null' => false])
|
||||||
->addColumn('uf', 'float', ['default' => null, 'null' => true])
|
->addColumn('uf', 'float', ['default' => null, 'null' => true])
|
||||||
->addColumn('abonado', 'integer', ['length' => 11, 'default' => 0])
|
->addColumn('abonado', 'integer', ['length' => 11, 'default' => 0])
|
||||||
|
@ -13,7 +13,7 @@ class CreateEstadoProblema extends Phinx\Migration\AbstractMigration
|
|||||||
$this->table('estado_problema')
|
$this->table('estado_problema')
|
||||||
->addColumn('problema', 'integer', ['length' => 11, 'default' => null, 'null' => true])
|
->addColumn('problema', 'integer', ['length' => 11, 'default' => null, 'null' => true])
|
||||||
->addColumn('fecha', 'date', ['default' => null, 'null' => true])
|
->addColumn('fecha', 'date', ['default' => null, 'null' => true])
|
||||||
->addColumn('estado', 'enum', ['values' => ['ingreso','revision','correccion','ok'], 'default' => null, 'null' => true])
|
->addColumn('estado', 'enum', ['length' => 'ingreso','revision','correccion','ok', 'default' => null, 'null' => true])
|
||||||
->create();
|
->create();
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ class CreateInmobiliariasNubox extends Phinx\Migration\AbstractMigration
|
|||||||
->addColumn('alias', 'string', ['length' => 100, 'null' => false])
|
->addColumn('alias', 'string', ['length' => 100, 'null' => false])
|
||||||
->addColumn('usuario', 'string', ['length' => 100, 'null' => false])
|
->addColumn('usuario', 'string', ['length' => 100, 'null' => false])
|
||||||
->addColumn('contraseña', 'string', ['length' => 100, 'null' => false])
|
->addColumn('contraseña', 'string', ['length' => 100, 'null' => false])
|
||||||
#->addForeignKey('inmobiliaria_rut', 'inmobiliaria', 'rut', ['delete' => 'cascade', 'update' => 'cascade'])
|
->addForeignKey('inmobiliaria_rut', 'inmobiliaria', 'rut', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
->create();
|
->create();
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@ class CreateMovimientos extends Phinx\Migration\AbstractMigration
|
|||||||
->addColumn('fecha', 'date', ['null' => false])
|
->addColumn('fecha', 'date', ['null' => false])
|
||||||
->addColumn('glosa', 'text', ['null' => false])
|
->addColumn('glosa', 'text', ['null' => false])
|
||||||
->addColumn('documento', 'string', ['length' => 50, 'null' => false])
|
->addColumn('documento', 'string', ['length' => 50, 'null' => false])
|
||||||
->addColumn('cargo', 'biginteger', ['length' => 20, 'default' => 0, 'null' => false, 'signed' => false])
|
->addColumn('cargo', 'bigint', ['length' => 20, 'default' => 0, 'null' => false, 'signed' => false])
|
||||||
->addColumn('abono', 'biginteger', ['length' => 20, 'default' => 0, 'null' => false, 'signed' => false])
|
->addColumn('abono', 'bigint', ['length' => 20, 'default' => 0, 'null' => false, 'signed' => false])
|
||||||
->addColumn('saldo', 'biginteger', ['length' => 20, 'default' => 0, 'null' => false])
|
->addColumn('saldo', 'bigint', ['length' => 20, 'default' => 0, 'null' => false])
|
||||||
->addForeignKey('cuenta_id', 'cuenta', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
->addForeignKey('cuenta_id', 'cuenta', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
->create();
|
->create();
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||||
|
@ -12,7 +12,7 @@ class CreateProblema extends Phinx\Migration\AbstractMigration
|
|||||||
|
|
||||||
$this->table('problema')
|
$this->table('problema')
|
||||||
->addColumn('venta', 'integer', ['length' => 11, 'default' => null, 'null' => true])
|
->addColumn('venta', 'integer', ['length' => 11, 'default' => null, 'null' => true])
|
||||||
->addColumn('descripcion', 'text', ['default' => null, 'null' => true, 'limit' => MysqlAdapter::TEXT_MEDIUM])
|
->addColumn('descripcion', 'mediumtext', ['default' => null, 'null' => true])
|
||||||
->create();
|
->create();
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ class CreateProyecto extends Phinx\Migration\AbstractMigration
|
|||||||
|
|
||||||
$this->table('proyecto')
|
$this->table('proyecto')
|
||||||
->addColumn('inmobiliaria', 'integer', ['length' => 10, 'default' => null, 'null' => true, 'signed' => false])
|
->addColumn('inmobiliaria', 'integer', ['length' => 10, 'default' => null, 'null' => true, 'signed' => false])
|
||||||
->addColumn('descripcion', 'text', ['null' => false, 'limit' => MysqlAdapter::TEXT_MEDIUM])
|
->addColumn('descripcion', 'mediumtext', ['null' => false])
|
||||||
->addColumn('direccion', 'integer', ['length' => 10, 'null' => false, 'signed' => false])
|
->addColumn('direccion', 'integer', ['length' => 10, 'null' => false, 'signed' => false])
|
||||||
->addColumn('superficie_terreno', 'float', ['default' => 0, 'null' => false, 'signed' => false])
|
->addColumn('superficie_terreno', 'float', ['default' => 0, 'null' => false, 'signed' => false])
|
||||||
->addColumn('valor_terreno', 'float', ['default' => 0, 'null' => false, 'signed' => false])
|
->addColumn('valor_terreno', 'float', ['default' => 0, 'null' => false, 'signed' => false])
|
||||||
|
@ -18,7 +18,7 @@ class CreateProyectoTipoUnidad extends Phinx\Migration\AbstractMigration
|
|||||||
->addColumn('m2', 'float', ['default' => null, 'null' => true])
|
->addColumn('m2', 'float', ['default' => null, 'null' => true])
|
||||||
->addColumn('logia', 'float', ['default' => 0])
|
->addColumn('logia', 'float', ['default' => 0])
|
||||||
->addColumn('terraza', 'float', ['default' => 0])
|
->addColumn('terraza', 'float', ['default' => 0])
|
||||||
->addColumn('descripcion', 'text', ['default' => null, 'null' => true, 'limit' => MysqlAdapter::TEXT_MEDIUM])
|
->addColumn('descripcion', 'mediumtext', ['default' => null, 'null' => true])
|
||||||
->addForeignKey('proyecto', 'proyecto', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
->addForeignKey('proyecto', 'proyecto', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
->create();
|
->create();
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||||
|
@ -10,8 +10,7 @@ class CreateTipoEstadoPago extends Phinx\Migration\AbstractMigration
|
|||||||
$this->execute("ALTER DATABASE CHARACTER SET 'utf8mb4';");
|
$this->execute("ALTER DATABASE CHARACTER SET 'utf8mb4';");
|
||||||
$this->execute("ALTER DATABASE COLLATE='utf8mb4_general_ci';");
|
$this->execute("ALTER DATABASE COLLATE='utf8mb4_general_ci';");
|
||||||
|
|
||||||
$this->table('tipo_estado_pago', ['id' => false, 'primary_key' => 'id'])
|
$this->table('tipo_estado_pago')
|
||||||
->addColumn('id', 'integer', ['signed' => true])
|
|
||||||
->addColumn('descripcion', 'string', ['length' => 20, 'default' => null, 'null' => true])
|
->addColumn('descripcion', 'string', ['length' => 20, 'default' => null, 'null' => true])
|
||||||
->addColumn('active', 'integer', ['length' => 1, 'default' => 0])
|
->addColumn('active', 'integer', ['length' => 1, 'default' => 0])
|
||||||
->create();
|
->create();
|
||||||
|
@ -33,7 +33,7 @@ class CreateVenta extends Phinx\Migration\AbstractMigration
|
|||||||
->addColumn('resciliacion', 'integer', ['length' => 10, 'default' => null, 'null' => true, 'signed' => false])
|
->addColumn('resciliacion', 'integer', ['length' => 10, 'default' => null, 'null' => true, 'signed' => false])
|
||||||
->addColumn('devolucion', 'integer', ['length' => 10, 'default' => null, 'null' => true, 'signed' => false])
|
->addColumn('devolucion', 'integer', ['length' => 10, 'default' => null, 'null' => true, 'signed' => false])
|
||||||
->addForeignKey('propiedad', 'propiedad', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
->addForeignKey('propiedad', 'propiedad', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
#->addForeignKey('propietario', 'propietario', 'rut', ['delete' => 'cascade', 'update' => 'cascade'])
|
->addForeignKey('propietario', 'propietario', 'rut', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
->create();
|
->create();
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Phinx\Db\Adapter\MysqlAdapter;
|
||||||
|
|
||||||
|
class CreateVentaAbonoCuotas extends Phinx\Migration\AbstractMigration
|
||||||
|
{
|
||||||
|
public function change(): void
|
||||||
|
{
|
||||||
|
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
|
||||||
|
$this->execute("ALTER DATABASE CHARACTER SET 'utf8mb4';");
|
||||||
|
$this->execute("ALTER DATABASE COLLATE='utf8mb4_general_ci';");
|
||||||
|
|
||||||
|
$this->table('venta_abono_cuotas')
|
||||||
|
->addColumn('venta_id', 'integer', ['length' => 11, 'null' => false, 'signed' => false])
|
||||||
|
->addColumn('pago_id', 'integer', ['length' => 11, 'null' => false, 'signed' => false])
|
||||||
|
->addColumn('numero', 'integer', ['length' => 11, 'default' => 1, 'null' => false, 'signed' => false])
|
||||||
|
->addForeignKey('venta_id', 'venta', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
|
->addForeignKey('pago_id', 'pago', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
|
->create();
|
||||||
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||||
|
}
|
||||||
|
}
|
@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Migration\AbstractMigration;
|
|
||||||
|
|
||||||
final class CreateTokuCustomers extends AbstractMigration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Change Method.
|
|
||||||
*
|
|
||||||
* Write your reversible migrations using this method.
|
|
||||||
*
|
|
||||||
* More information on writing migrations is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
|
||||||
*
|
|
||||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
||||||
* with the Table class.
|
|
||||||
*/
|
|
||||||
public function change(): void
|
|
||||||
{
|
|
||||||
$this->table('toku_customers')
|
|
||||||
->addColumn('rut', 'string', ['length' => 9])
|
|
||||||
->addColumn('toku_id', 'string', ['length' => 255])
|
|
||||||
->addTimestamps()
|
|
||||||
->addIndex(['rut'], ['unique' => true])
|
|
||||||
->create();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Migration\AbstractMigration;
|
|
||||||
|
|
||||||
final class CreateTokuSubscriptions extends AbstractMigration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Change Method.
|
|
||||||
*
|
|
||||||
* Write your reversible migrations using this method.
|
|
||||||
*
|
|
||||||
* More information on writing migrations is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
|
||||||
*
|
|
||||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
||||||
* with the Table class.
|
|
||||||
*/
|
|
||||||
public function change(): void
|
|
||||||
{
|
|
||||||
$this->table('toku_subscriptions')
|
|
||||||
->addColumn('venta_id', 'integer', ['signed' => false])
|
|
||||||
->addColumn('toku_id', 'string', ['length' => 255])
|
|
||||||
->addTimestamps()
|
|
||||||
->addIndex(['venta_id'], ['unique' => true])
|
|
||||||
->create();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Migration\AbstractMigration;
|
|
||||||
|
|
||||||
final class CreateTokuInvoices extends AbstractMigration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Change Method.
|
|
||||||
*
|
|
||||||
* Write your reversible migrations using this method.
|
|
||||||
*
|
|
||||||
* More information on writing migrations is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
|
||||||
*
|
|
||||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
||||||
* with the Table class.
|
|
||||||
*/
|
|
||||||
public function change(): void
|
|
||||||
{
|
|
||||||
$this->table('toku_invoices')
|
|
||||||
->addColumn('cuota_id', 'integer', ['signed' => false])
|
|
||||||
->addColumn('toku_id', 'string', ['length' => 255])
|
|
||||||
->addTimestamps()
|
|
||||||
->addIndex(['cuota_id'], ['unique' => true])
|
|
||||||
->create();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Migration\AbstractMigration;
|
|
||||||
|
|
||||||
final class CreateJobs extends AbstractMigration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Change Method.
|
|
||||||
*
|
|
||||||
* Write your reversible migrations using this method.
|
|
||||||
*
|
|
||||||
* More information on writing migrations is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
|
||||||
*
|
|
||||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
||||||
* with the Table class.
|
|
||||||
*/
|
|
||||||
public function change(): void
|
|
||||||
{
|
|
||||||
$this->table('jobs')
|
|
||||||
->addColumn('configuration', 'json')
|
|
||||||
->addColumn('executed', 'boolean', ['default' => false])
|
|
||||||
->addTimestamps()
|
|
||||||
->create();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Migration\AbstractMigration;
|
|
||||||
|
|
||||||
final class CreateTokuWebhooks extends AbstractMigration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Change Method.
|
|
||||||
*
|
|
||||||
* Write your reversible migrations using this method.
|
|
||||||
*
|
|
||||||
* More information on writing migrations is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
|
||||||
*
|
|
||||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
||||||
* with the Table class.
|
|
||||||
*/
|
|
||||||
public function change(): void
|
|
||||||
{
|
|
||||||
$this->table('toku_webhooks')
|
|
||||||
->addColumn('secret', 'string', ['length' => 255])
|
|
||||||
->addColumn('events', 'json')
|
|
||||||
->addColumn('enabled', 'boolean', ['default' => true])
|
|
||||||
->addTimestamps()
|
|
||||||
->create();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Migration\AbstractMigration;
|
|
||||||
|
|
||||||
final class CreateTokuAccounts extends AbstractMigration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Change Method.
|
|
||||||
*
|
|
||||||
* Write your reversible migrations using this method.
|
|
||||||
*
|
|
||||||
* More information on writing migrations is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
|
||||||
*
|
|
||||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
||||||
* with the Table class.
|
|
||||||
*/
|
|
||||||
public function change(): void
|
|
||||||
{
|
|
||||||
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
|
|
||||||
|
|
||||||
$this->table('toku_accounts')
|
|
||||||
->addColumn('sociedad_rut', 'integer', ['limit' => 8, 'signed' => false, 'null' => false])
|
|
||||||
->addColumn('toku_id', 'string', ['length' => 255, 'null' => false])
|
|
||||||
->addColumn('account_key', 'string', ['length' => 255, 'null' => false])
|
|
||||||
->addColumn('enabled', 'boolean', ['default' => true])
|
|
||||||
->addTimestamps()
|
|
||||||
#->addForeignKey('sociedad_rut', 'inmobiliaria', 'rut', ['delete' => 'CASCADE', 'update' => 'CASCADE'])
|
|
||||||
->addIndex(['toku_id'], ['unique' => true])
|
|
||||||
->create();
|
|
||||||
|
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Migration\AbstractMigration;
|
|
||||||
|
|
||||||
final class ChangeTelefonoSizeInPropietario extends AbstractMigration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Change Method.
|
|
||||||
*
|
|
||||||
* Write your reversible migrations using this method.
|
|
||||||
*
|
|
||||||
* More information on writing migrations is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
|
||||||
*
|
|
||||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
||||||
* with the Table class.
|
|
||||||
*/
|
|
||||||
public function change(): void
|
|
||||||
{
|
|
||||||
$this->table('propietario')
|
|
||||||
->changeColumn('telefono', 'biginteger', ['null' => true, 'signed' => false, 'default' => null])
|
|
||||||
->update();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Seed\AbstractSeed;
|
|
||||||
|
|
||||||
class Comuna extends AbstractSeed
|
|
||||||
{
|
|
||||||
public function getDependencies(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'Provincia',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run Method.
|
|
||||||
*
|
|
||||||
* Write your database seeder using this method.
|
|
||||||
*
|
|
||||||
* More information on writing seeders is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/seeding.html
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
|
|
||||||
|
|
||||||
$table = $this->table('comuna');
|
|
||||||
$table->truncate();
|
|
||||||
|
|
||||||
$filename = implode(DIRECTORY_SEPARATOR, [getcwd(), 'resources', 'database', 'seeds', 'comuna.csv']);
|
|
||||||
$dataRows = explode(PHP_EOL, trim(file_get_contents($filename)));
|
|
||||||
$data = array_map(fn($row) => explode(';', $row), $dataRows);
|
|
||||||
$columns = array_shift($data);
|
|
||||||
$columns = array_map(function($column) {
|
|
||||||
if (str_contains($column, 'id')) {
|
|
||||||
return 'id';
|
|
||||||
}
|
|
||||||
if (str_contains($column, 'provincia')) {
|
|
||||||
return 'provincia';
|
|
||||||
}
|
|
||||||
return $column;
|
|
||||||
}, $columns);
|
|
||||||
$data = array_map(function ($row) use ($columns) {
|
|
||||||
return array_combine($columns, $row);
|
|
||||||
}, $data);
|
|
||||||
|
|
||||||
$table->insert($data)->save();
|
|
||||||
|
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Seed\AbstractSeed;
|
|
||||||
|
|
||||||
class Provincia extends AbstractSeed
|
|
||||||
{
|
|
||||||
public function getDependencies(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'Region',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run Method.
|
|
||||||
*
|
|
||||||
* Write your database seeder using this method.
|
|
||||||
*
|
|
||||||
* More information on writing seeders is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/seeding.html
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
|
|
||||||
|
|
||||||
$table = $this->table('provincia');
|
|
||||||
$table->truncate();
|
|
||||||
|
|
||||||
$filename = implode(DIRECTORY_SEPARATOR, [getcwd(), 'resources', 'database', 'seeds', 'provincia.csv']);
|
|
||||||
$dataRows = explode(PHP_EOL, trim(file_get_contents($filename)));
|
|
||||||
$data = array_map(fn($row) => explode(';', $row), $dataRows);
|
|
||||||
$columns = array_shift($data);
|
|
||||||
$columns = array_map(function($column) {
|
|
||||||
if (str_contains($column, 'id')) {
|
|
||||||
return 'id';
|
|
||||||
}
|
|
||||||
if (str_contains($column, 'region')) {
|
|
||||||
return 'region';
|
|
||||||
}
|
|
||||||
return $column;
|
|
||||||
}, $columns);
|
|
||||||
$data = array_map(function ($row) use ($columns) {
|
|
||||||
return array_combine($columns, $row);
|
|
||||||
}, $data);
|
|
||||||
|
|
||||||
$table->insert($data)->save();
|
|
||||||
|
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Seed\AbstractSeed;
|
|
||||||
|
|
||||||
class Region extends AbstractSeed
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run Method.
|
|
||||||
*
|
|
||||||
* Write your database seeder using this method.
|
|
||||||
*
|
|
||||||
* More information on writing seeders is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/seeding.html
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
|
|
||||||
|
|
||||||
$table = $this->table('region');
|
|
||||||
$table->truncate();
|
|
||||||
|
|
||||||
$filename = implode(DIRECTORY_SEPARATOR, [getcwd(), 'resources', 'database', 'seeds', 'region.csv']);
|
|
||||||
$dataRows = explode(PHP_EOL, trim(file_get_contents($filename)));
|
|
||||||
$data = array_map(fn($row) => explode(';', $row), $dataRows);
|
|
||||||
$columns = array_shift($data);
|
|
||||||
$columns = array_map(function($column) {
|
|
||||||
if (str_contains($column, 'id')) {
|
|
||||||
return 'id';
|
|
||||||
}
|
|
||||||
if (str_contains($column, 'numeracion')) {
|
|
||||||
return 'numeracion';
|
|
||||||
}
|
|
||||||
return $column;
|
|
||||||
}, $columns);
|
|
||||||
$data = array_map(function ($row) use ($columns) {
|
|
||||||
return array_combine($columns, $row);
|
|
||||||
}, $data);
|
|
||||||
|
|
||||||
$table->insert($data)->save();
|
|
||||||
|
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Seed\AbstractSeed;
|
|
||||||
|
|
||||||
class TipoEstadoPago extends AbstractSeed
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run Method.
|
|
||||||
*
|
|
||||||
* Write your database seeder using this method.
|
|
||||||
*
|
|
||||||
* More information on writing seeders is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/seeding.html
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
|
|
||||||
|
|
||||||
$table = $this->table('tipo_estado_pago');
|
|
||||||
$table->truncate();
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
['id' => -3, 'descripcion' => 'anulado'],
|
|
||||||
['id' => -2, 'descripcion' => 'reemplazado'],
|
|
||||||
['id' => -1, 'descripcion' => 'devuelto'],
|
|
||||||
['id' => 0, 'descripcion' => 'no pagado', 'active' => 1],
|
|
||||||
['id' => 1, 'descripcion' => 'depositado', 'active' => 1],
|
|
||||||
['id' => 2, 'descripcion' => 'abonado', 'active' => 1],
|
|
||||||
];
|
|
||||||
$table->insert($data)->saveData();
|
|
||||||
|
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Seed\AbstractSeed;
|
|
||||||
|
|
||||||
class TipoPago extends AbstractSeed
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run Method.
|
|
||||||
*
|
|
||||||
* Write your database seeder using this method.
|
|
||||||
*
|
|
||||||
* More information on writing seeders is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/seeding.html
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
$table = $this->table('tipo_pago');
|
|
||||||
$data = [
|
|
||||||
[
|
|
||||||
'descripcion' => 'cheque',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'descripcion' => 'carta de resguardo',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'descripcion' => 'vale vista'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'descripcion' => 'deposito',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'descripcion' => 'efectivo',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'descripcion' => 'tarjeta de credito',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'descripcion' => 'transferencia electronica',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'descripcion' => 'virtual',
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$table->truncate();
|
|
||||||
$table
|
|
||||||
->insert($data)
|
|
||||||
->saveData();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Seed\AbstractSeed;
|
|
||||||
|
|
||||||
class TipoSociedad extends AbstractSeed
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run Method.
|
|
||||||
*
|
|
||||||
* Write your database seeder using this method.
|
|
||||||
*
|
|
||||||
* More information on writing seeders is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/seeding.html
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
|
|
||||||
|
|
||||||
$table = $this->table('tipo_sociedad');
|
|
||||||
$table->truncate();
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
[
|
|
||||||
'descripcion' => 'Limitada',
|
|
||||||
'abreviacion' => 'Ltda',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'descripcion' => 'Sociedad Anónima',
|
|
||||||
'abreviacion' => 'SA',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'descripcion' => 'Sociedad por Acciones',
|
|
||||||
'abreviacion' => 'SpA',
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$table->insert($data)->saveData();
|
|
||||||
|
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Phinx\Seed\AbstractSeed;
|
|
||||||
|
|
||||||
class TipoUnidad extends AbstractSeed
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run Method.
|
|
||||||
*
|
|
||||||
* Write your database seeder using this method.
|
|
||||||
*
|
|
||||||
* More information on writing seeders is available here:
|
|
||||||
* https://book.cakephp.org/phinx/0/en/seeding.html
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
|
|
||||||
|
|
||||||
$table = $this->table('tipo_unidad');
|
|
||||||
$table->truncate();
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
[
|
|
||||||
'descripcion' => 'departamento',
|
|
||||||
'orden' => 0,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'descripcion' => 'estacionamiento',
|
|
||||||
'orden' => 1,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'descripcion' => 'bodega',
|
|
||||||
'orden' => 2,
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$table->insert($data)->saveData();
|
|
||||||
|
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,347 +0,0 @@
|
|||||||
id;descripcion;provincia
|
|
||||||
1101;Iquique;11
|
|
||||||
1107;Alto Hospicio;11
|
|
||||||
1401;Pozo Almonte;14
|
|
||||||
1402;Camiña;14
|
|
||||||
1403;Colchane;14
|
|
||||||
1404;Huara;14
|
|
||||||
1405;Pica;14
|
|
||||||
2101;Antofagasta;21
|
|
||||||
2102;Mejillones;21
|
|
||||||
2103;Sierra Gorda;21
|
|
||||||
2104;Taltal;21
|
|
||||||
2201;Calama;22
|
|
||||||
2202;Ollagüe;22
|
|
||||||
2203;San Pedro de Atacama;22
|
|
||||||
2301;Tocopilla;23
|
|
||||||
2302;María Elena;23
|
|
||||||
3101;Copiapó;31
|
|
||||||
3102;Caldera;31
|
|
||||||
3103;Tierra Amarilla;31
|
|
||||||
3201;Chañaral;32
|
|
||||||
3202;Diego de Almagro;32
|
|
||||||
3301;Vallenar;33
|
|
||||||
3302;Alto del Carmen;33
|
|
||||||
3303;Freirina;33
|
|
||||||
3304;Huasco;33
|
|
||||||
4101;La Serena;41
|
|
||||||
4102;Coquimbo;41
|
|
||||||
4103;Andacollo;41
|
|
||||||
4104;La Higuera;41
|
|
||||||
4105;Paiguano;41
|
|
||||||
4106;Vicuña;41
|
|
||||||
4201;Illapel;42
|
|
||||||
4202;Canela;42
|
|
||||||
4203;Los Vilos;42
|
|
||||||
4204;Salamanca;42
|
|
||||||
4301;Ovalle;43
|
|
||||||
4302;Combarbalá;43
|
|
||||||
4303;Monte Patria;43
|
|
||||||
4304;Punitaqui;43
|
|
||||||
4305;Río Hurtado;43
|
|
||||||
5101;Valparaíso;51
|
|
||||||
5102;Casablanca;51
|
|
||||||
5103;Concón;51
|
|
||||||
5104;Juan Fernández;51
|
|
||||||
5105;Puchuncaví;51
|
|
||||||
5107;Quintero;51
|
|
||||||
5109;Viña del Mar;51
|
|
||||||
5201;Isla de Pascua;52
|
|
||||||
5301;Los Andes;53
|
|
||||||
5302;Calle Larga;53
|
|
||||||
5303;Rinconada;53
|
|
||||||
5304;San Esteban;53
|
|
||||||
5401;La Ligua;54
|
|
||||||
5402;Cabildo;54
|
|
||||||
5403;Papudo;54
|
|
||||||
5404;Petorca;54
|
|
||||||
5405;Zapallar;54
|
|
||||||
5501;Quillota;55
|
|
||||||
5502;Calera;55
|
|
||||||
5503;Hijuelas;55
|
|
||||||
5504;La Cruz;55
|
|
||||||
5506;Nogales;55
|
|
||||||
5601;San Antonio;56
|
|
||||||
5602;Algarrobo;56
|
|
||||||
5603;Cartagena;56
|
|
||||||
5604;El Quisco;56
|
|
||||||
5605;El Tabo;56
|
|
||||||
5606;Santo Domingo;56
|
|
||||||
5701;San Felipe;57
|
|
||||||
5702;Catemu;57
|
|
||||||
5703;Llaillay;57
|
|
||||||
5704;Panquehue;57
|
|
||||||
5705;Putaendo;57
|
|
||||||
5706;Santa María;57
|
|
||||||
5801;Quilpué;58
|
|
||||||
5802;Limache;58
|
|
||||||
5803;Olmué;58
|
|
||||||
5804;Villa Alemana;58
|
|
||||||
6101;Rancagua;61
|
|
||||||
6102;Codegua;61
|
|
||||||
6103;Coinco;61
|
|
||||||
6104;Coltauco;61
|
|
||||||
6105;Doñihue;61
|
|
||||||
6106;Graneros;61
|
|
||||||
6107;Las Cabras;61
|
|
||||||
6108;Machalí;61
|
|
||||||
6109;Malloa;61
|
|
||||||
6110;Mostazal;61
|
|
||||||
6111;Olivar;61
|
|
||||||
6112;Peumo;61
|
|
||||||
6113;Pichidegua;61
|
|
||||||
6114;Quinta de Tilcoco;61
|
|
||||||
6115;Rengo;61
|
|
||||||
6116;Requínoa;61
|
|
||||||
6117;San Vicente;61
|
|
||||||
6201;Pichilemu;62
|
|
||||||
6202;La Estrella;62
|
|
||||||
6203;Litueche;62
|
|
||||||
6204;Marchihue;62
|
|
||||||
6205;Navidad;62
|
|
||||||
6206;Paredones;62
|
|
||||||
6301;San Fernando;63
|
|
||||||
6302;Chépica;63
|
|
||||||
6303;Chimbarongo;63
|
|
||||||
6304;Lolol;63
|
|
||||||
6305;Nancagua;63
|
|
||||||
6306;Palmilla;63
|
|
||||||
6307;Peralillo;63
|
|
||||||
6308;Placilla;63
|
|
||||||
6309;Pumanque;63
|
|
||||||
6310;Santa Cruz;63
|
|
||||||
7101;Talca;71
|
|
||||||
7102;Constitución;71
|
|
||||||
7103;Curepto;71
|
|
||||||
7104;Empedrado;71
|
|
||||||
7105;Maule;71
|
|
||||||
7106;Pelarco;71
|
|
||||||
7107;Pencahue;71
|
|
||||||
7108;Río Claro;71
|
|
||||||
7109;San Clemente;71
|
|
||||||
7110;San Rafael;71
|
|
||||||
7201;Cauquenes;72
|
|
||||||
7202;Chanco;72
|
|
||||||
7203;Pelluhue;72
|
|
||||||
7301;Curicó;73
|
|
||||||
7302;Hualañé;73
|
|
||||||
7303;Licantén;73
|
|
||||||
7304;Molina;73
|
|
||||||
7305;Rauco;73
|
|
||||||
7306;Romeral;73
|
|
||||||
7307;Sagrada Familia;73
|
|
||||||
7308;Teno;73
|
|
||||||
7309;Vichuquén;73
|
|
||||||
7401;Linares;74
|
|
||||||
7402;Colbún;74
|
|
||||||
7403;Longaví;74
|
|
||||||
7404;Parral;74
|
|
||||||
7405;Retiro;74
|
|
||||||
7406;San Javier;74
|
|
||||||
7407;Villa Alegre;74
|
|
||||||
7408;Yerbas Buenas;74
|
|
||||||
8101;Concepción;81
|
|
||||||
8102;Coronel;81
|
|
||||||
8103;Chiguayante;81
|
|
||||||
8104;Florida;81
|
|
||||||
8105;Hualqui;81
|
|
||||||
8106;Lota;81
|
|
||||||
8107;Penco;81
|
|
||||||
8108;San Pedro de la Paz;81
|
|
||||||
8109;Santa Juana;81
|
|
||||||
8110;Talcahuano;81
|
|
||||||
8111;Tomé;81
|
|
||||||
8112;Hualpén;81
|
|
||||||
8201;Lebu;82
|
|
||||||
8202;Arauco;82
|
|
||||||
8203;Cañete;82
|
|
||||||
8204;Contulmo;82
|
|
||||||
8205;Curanilahue;82
|
|
||||||
8206;Los Álamos;82
|
|
||||||
8207;Tirúa;82
|
|
||||||
8301;Los Ángeles;83
|
|
||||||
8302;Antuco;83
|
|
||||||
8303;Cabrero;83
|
|
||||||
8304;Laja;83
|
|
||||||
8305;Mulchén;83
|
|
||||||
8306;Nacimiento;83
|
|
||||||
8307;Negrete;83
|
|
||||||
8308;Quilaco;83
|
|
||||||
8309;Quilleco;83
|
|
||||||
8310;San Rosendo;83
|
|
||||||
8311;Santa Bárbara;83
|
|
||||||
8312;Tucapel;83
|
|
||||||
8313;Yumbel;83
|
|
||||||
8314;Alto Biobío;83
|
|
||||||
8401;Chillán;84
|
|
||||||
8402;Bulnes;84
|
|
||||||
8403;Cobquecura;84
|
|
||||||
8404;Coelemu;84
|
|
||||||
8405;Coihueco;84
|
|
||||||
8406;Chillán Viejo;84
|
|
||||||
8407;El Carmen;84
|
|
||||||
8408;Ninhue;84
|
|
||||||
8409;Ñiquén;84
|
|
||||||
8410;Pemuco;84
|
|
||||||
8411;Pinto;84
|
|
||||||
8412;Portezuelo;84
|
|
||||||
8413;Quillón;84
|
|
||||||
8414;Quirihue;84
|
|
||||||
8415;Ránquil;84
|
|
||||||
8416;San Carlos;84
|
|
||||||
8417;San Fabián;84
|
|
||||||
8418;San Ignacio;84
|
|
||||||
8419;San Nicolás;84
|
|
||||||
8420;Treguaco;84
|
|
||||||
8421;Yungay;84
|
|
||||||
9101;Temuco;91
|
|
||||||
9102;Carahue;91
|
|
||||||
9103;Cunco;91
|
|
||||||
9104;Curarrehue;91
|
|
||||||
9105;Freire;91
|
|
||||||
9106;Galvarino;91
|
|
||||||
9107;Gorbea;91
|
|
||||||
9108;Lautaro;91
|
|
||||||
9109;Loncoche;91
|
|
||||||
9110;Melipeuco;91
|
|
||||||
9111;Nueva Imperial;91
|
|
||||||
9112;Padre las Casas;91
|
|
||||||
9113;Perquenco;91
|
|
||||||
9114;Pitrufquén;91
|
|
||||||
9115;Pucón;91
|
|
||||||
9116;Saavedra;91
|
|
||||||
9117;Teodoro Schmidt;91
|
|
||||||
9118;Toltén;91
|
|
||||||
9119;Vilcún;91
|
|
||||||
9120;Villarrica;91
|
|
||||||
9121;Cholchol;91
|
|
||||||
9201;Angol;92
|
|
||||||
9202;Collipulli;92
|
|
||||||
9203;Curacautín;92
|
|
||||||
9204;Ercilla;92
|
|
||||||
9205;Lonquimay;92
|
|
||||||
9206;Los Sauces;92
|
|
||||||
9207;Lumaco;92
|
|
||||||
9208;Purén;92
|
|
||||||
9209;Renaico;92
|
|
||||||
9210;Traiguén;92
|
|
||||||
9211;Victoria;92
|
|
||||||
10101;Puerto Montt;101
|
|
||||||
10102;Calbuco;101
|
|
||||||
10103;Cochamó;101
|
|
||||||
10104;Fresia;101
|
|
||||||
10105;Frutillar;101
|
|
||||||
10106;Los Muermos;101
|
|
||||||
10107;Llanquihue;101
|
|
||||||
10108;Maullín;101
|
|
||||||
10109;Puerto Varas;101
|
|
||||||
10201;Castro;102
|
|
||||||
10202;Ancud;102
|
|
||||||
10203;Chonchi;102
|
|
||||||
10204;Curaco de Vélez;102
|
|
||||||
10205;Dalcahue;102
|
|
||||||
10206;Puqueldón;102
|
|
||||||
10207;Queilén;102
|
|
||||||
10208;Quellón;102
|
|
||||||
10209;Quemchi;102
|
|
||||||
10210;Quinchao;102
|
|
||||||
10301;Osorno;103
|
|
||||||
10302;Puerto Octay;103
|
|
||||||
10303;Purranque;103
|
|
||||||
10304;Puyehue;103
|
|
||||||
10305;Río Negro;103
|
|
||||||
10306;San Juan de la Costa;103
|
|
||||||
10307;San Pablo;103
|
|
||||||
10401;Chaitén;104
|
|
||||||
10402;Futaleufú;104
|
|
||||||
10403;Hualaihué;104
|
|
||||||
10404;Palena;104
|
|
||||||
11101;Coihaique;111
|
|
||||||
11102;Lago Verde;111
|
|
||||||
11201;Aisén;112
|
|
||||||
11202;Cisnes;112
|
|
||||||
11203;Guaitecas;112
|
|
||||||
11301;Cochrane;113
|
|
||||||
11302;O’Higgins;113
|
|
||||||
11303;Tortel;113
|
|
||||||
11401;Chile Chico;114
|
|
||||||
11402;Río Ibáñez;114
|
|
||||||
12101;Punta Arenas;121
|
|
||||||
12102;Laguna Blanca;121
|
|
||||||
12103;Río Verde;121
|
|
||||||
12104;San Gregorio;121
|
|
||||||
12201;Cabo de Hornos (Ex Navarino);122
|
|
||||||
12202;Antártica;122
|
|
||||||
12301;Porvenir;123
|
|
||||||
12302;Primavera;123
|
|
||||||
12303;Timaukel;123
|
|
||||||
12401;Natales;124
|
|
||||||
12402;Torres del Paine;124
|
|
||||||
13101;Santiago;131
|
|
||||||
13102;Cerrillos;131
|
|
||||||
13103;Cerro Navia;131
|
|
||||||
13104;Conchalí;131
|
|
||||||
13105;El Bosque;131
|
|
||||||
13106;Estación Central;131
|
|
||||||
13107;Huechuraba;131
|
|
||||||
13108;Independencia;131
|
|
||||||
13109;La Cisterna;131
|
|
||||||
13110;La Florida;131
|
|
||||||
13111;La Granja;131
|
|
||||||
13112;La Pintana;131
|
|
||||||
13113;La Reina;131
|
|
||||||
13114;Las Condes;131
|
|
||||||
13115;Lo Barnechea;131
|
|
||||||
13116;Lo Espejo;131
|
|
||||||
13117;Lo Prado;131
|
|
||||||
13118;Macul;131
|
|
||||||
13119;Maipú;131
|
|
||||||
13120;Ñuñoa;131
|
|
||||||
13121;Pedro Aguirre Cerda;131
|
|
||||||
13122;Peñalolén;131
|
|
||||||
13123;Providencia;131
|
|
||||||
13124;Pudahuel;131
|
|
||||||
13125;Quilicura;131
|
|
||||||
13126;Quinta Normal;131
|
|
||||||
13127;Recoleta;131
|
|
||||||
13128;Renca;131
|
|
||||||
13129;San Joaquín;131
|
|
||||||
13130;San Miguel;131
|
|
||||||
13131;San Ramón;131
|
|
||||||
13132;Vitacura;131
|
|
||||||
13201;Puente Alto;132
|
|
||||||
13202;Pirque;132
|
|
||||||
13203;San José de Maipo;132
|
|
||||||
13301;Colina;133
|
|
||||||
13302;Lampa;133
|
|
||||||
13303;Tiltil;133
|
|
||||||
13401;San Bernardo;134
|
|
||||||
13402;Buin;134
|
|
||||||
13403;Calera de Tango;134
|
|
||||||
13404;Paine;134
|
|
||||||
13501;Melipilla;135
|
|
||||||
13502;Alhué;135
|
|
||||||
13503;Curacaví;135
|
|
||||||
13504;María Pinto;135
|
|
||||||
13505;San Pedro;135
|
|
||||||
13601;Talagante;136
|
|
||||||
13602;El Monte;136
|
|
||||||
13603;Isla de Maipo;136
|
|
||||||
13604;Padre Hurtado;136
|
|
||||||
13605;Peñaflor;136
|
|
||||||
14101;Valdivia;141
|
|
||||||
14102;Corral;141
|
|
||||||
14103;Lanco;141
|
|
||||||
14104;Los Lagos;141
|
|
||||||
14105;Máfil;141
|
|
||||||
14106;Mariquina;141
|
|
||||||
14107;Paillaco;141
|
|
||||||
14108;Panguipulli;141
|
|
||||||
14201;La Unión;142
|
|
||||||
14202;Futrono;142
|
|
||||||
14203;Lago Ranco;142
|
|
||||||
14204;Río Bueno;142
|
|
||||||
15101;Arica;151
|
|
||||||
15102;Camarones;151
|
|
||||||
15201;Putre;152
|
|
||||||
15202;General Lagos;152
|
|
|
@ -1,55 +0,0 @@
|
|||||||
id;descripcion;region
|
|
||||||
11;Iquique;1
|
|
||||||
14;Tamarugal;1
|
|
||||||
21;Antofagasta;2
|
|
||||||
22;El Loa;2
|
|
||||||
23;Tocopilla;2
|
|
||||||
31;Copiap;3
|
|
||||||
32;Chañaral;3
|
|
||||||
33;Huasco;3
|
|
||||||
41;Elqui;4
|
|
||||||
42;Choapa;4
|
|
||||||
43;Limari;4
|
|
||||||
51;Valparaíso;5
|
|
||||||
52;Isla de Pascua;5
|
|
||||||
53;Los Andes;5
|
|
||||||
54;Petorca;5
|
|
||||||
55;Quillota;5
|
|
||||||
56;San Antonio;5
|
|
||||||
57;San Felipe;5
|
|
||||||
58;Marga Marga;5
|
|
||||||
61;Cachapoal;6
|
|
||||||
62;Cardenal Caro;6
|
|
||||||
63;Colchagua;6
|
|
||||||
71;Talca;7
|
|
||||||
72;Cauquenes;7
|
|
||||||
73;Curico;7
|
|
||||||
74;Linares;7
|
|
||||||
81;Concepci;8
|
|
||||||
82;Arauco;8
|
|
||||||
83;Bío- Bío;8
|
|
||||||
84;Ñuble;8
|
|
||||||
91;Cautín;9
|
|
||||||
92;Malleco;9
|
|
||||||
101;Llanquihue;10
|
|
||||||
102;Chiloe;10
|
|
||||||
103;Osorno;10
|
|
||||||
104;Palena;10
|
|
||||||
111;Coihaique;11
|
|
||||||
112;Aisén;11
|
|
||||||
113;Capitan Prat;11
|
|
||||||
114;General Carrera;11
|
|
||||||
121;Magallanes;12
|
|
||||||
122;Antártica Chilena;12
|
|
||||||
123;Tierra del Fuego;12
|
|
||||||
124;Ultima Esperanza;12
|
|
||||||
131;Santiago;13
|
|
||||||
132;Cordillera;13
|
|
||||||
133;Chacabuco;13
|
|
||||||
134;Maipo;13
|
|
||||||
135;Melipilla;13
|
|
||||||
136;Talagante;13
|
|
||||||
141;Valdivia;14
|
|
||||||
142;Ranco;14
|
|
||||||
151;Arica;15
|
|
||||||
152;Parinacota;15
|
|
|
@ -1,16 +0,0 @@
|
|||||||
id;descripcion;numeral;numeracion
|
|
||||||
1;Región de Tarapacá;I;1
|
|
||||||
2;Región de Antofagasta;II;2
|
|
||||||
3;Región de Atacama;III;3
|
|
||||||
4;Región de Coquimbo;IV;4
|
|
||||||
5;Región de Valparaíso;V;5
|
|
||||||
6;Región del Libertador Gral. Bernardo O’Higgins;VI;6
|
|
||||||
7;Región del Maule;VII;7
|
|
||||||
8;Región del Biobío;VIII;8
|
|
||||||
9;Región de la Araucanía;IX;9
|
|
||||||
10;Región de Los Lagos;X;10
|
|
||||||
11;Región Aisén del Gral. Carlos Ibáñez del Campo;XI;11
|
|
||||||
12;Región de Magallanes y de la Antártica Chilena;XII;12
|
|
||||||
13;Región Metropolitana de Santiago;RM;13
|
|
||||||
14;Región de Los Ríos;XIV;14
|
|
||||||
15;Región de Arica y Parinacota;XV;15
|
|
|
@ -7,4 +7,4 @@ $app->group('/contabilidad', function($app) {
|
|||||||
}
|
}
|
||||||
include_once $file->getRealPath();
|
include_once $file->getRealPath();
|
||||||
}
|
}
|
||||||
})->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
});
|
||||||
|
@ -7,4 +7,4 @@ $app->group('/admin', function($app) {
|
|||||||
}
|
}
|
||||||
include_once $file->getRealPath();
|
include_once $file->getRealPath();
|
||||||
}
|
}
|
||||||
})->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
});
|
||||||
|
@ -2,9 +2,5 @@
|
|||||||
use Incoviba\Controller\API\Admin\Users;
|
use Incoviba\Controller\API\Admin\Users;
|
||||||
|
|
||||||
$app->group('/users', function($app) {
|
$app->group('/users', function($app) {
|
||||||
$app->post('/add[/]', [Users::class, 'add']);
|
$app->post('/add[/]', Users::class . ':add');
|
||||||
});
|
|
||||||
$app->group('/user/{user_id}', function($app) {
|
|
||||||
$app->post('/edit[/]', [Users::class, 'edit']);
|
|
||||||
$app->delete('[/]', [Users::class, 'delete']);
|
|
||||||
});
|
});
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
use Incoviba\Controller\API\External;
|
|
||||||
|
|
||||||
$app->group('/external', function($app) {
|
|
||||||
$files = new FilesystemIterator(implode(DIRECTORY_SEPARATOR, [__DIR__, 'external']));
|
|
||||||
foreach ($files as $file) {
|
|
||||||
if ($file->isDir()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
include_once $file->getRealPath();
|
|
||||||
}
|
|
||||||
$app->group('/services', function($app) {
|
|
||||||
$app->get('/check[/]', [External::class, 'check']);
|
|
||||||
$app->get('/update[/]', [External::class, 'update']);
|
|
||||||
});
|
|
||||||
});
|
|
11
app/resources/routes/api/external/toku.php
vendored
11
app/resources/routes/api/external/toku.php
vendored
@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
use Incoviba\Controller\API\Ventas\MediosPago\Toku;
|
|
||||||
|
|
||||||
$app->group('/toku', function($app) {
|
|
||||||
$app->post('/cuotas/{venta_id}[/]', [Toku::class, 'cuotas']);
|
|
||||||
$app->post('/success[/]', [Toku::class, 'success']);
|
|
||||||
$app->get('/test[/]', [Toku::class, 'test']);
|
|
||||||
$app->delete('/reset[/]', [Toku::class, 'reset']);
|
|
||||||
$app->post('/enqueue[/]', [Toku::class, 'enqueue']);
|
|
||||||
$app->post('/update[/{type}[/]]', [Toku::class, 'update']);
|
|
||||||
});
|
|
@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
use Incoviba\Controller\API\Queues;
|
|
||||||
|
|
||||||
$app->group('/queue', function($app) {
|
|
||||||
#$app->get('/jobs[/]', [Queues::class, 'jobs']);
|
|
||||||
$app->group('/run', function($app) {
|
|
||||||
#$app->get('/{job_id:[0-9]+}[/]', [Queues::class, 'run']);
|
|
||||||
$app->get('[/]', Queues::class);
|
|
||||||
});
|
|
||||||
});
|
|
@ -21,7 +21,6 @@ $app->group('/ventas', function($app) {
|
|||||||
});
|
});
|
||||||
$app->group('/by', function($app) {
|
$app->group('/by', function($app) {
|
||||||
$app->get('/unidad/{unidad_id}', [Ventas::class, 'unidad']);
|
$app->get('/unidad/{unidad_id}', [Ventas::class, 'unidad']);
|
||||||
$app->post('/unidades[/]', [Ventas::class, 'byUnidades']);
|
|
||||||
});
|
});
|
||||||
$app->post('/get[/]', [Ventas::class, 'getMany']);
|
$app->post('/get[/]', [Ventas::class, 'getMany']);
|
||||||
$app->post('[/]', [Ventas::class, 'proyecto']);
|
$app->post('[/]', [Ventas::class, 'proyecto']);
|
||||||
|
@ -14,15 +14,15 @@
|
|||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="users">
|
<tbody>
|
||||||
@foreach($users as $user)
|
@foreach($users as $user)
|
||||||
<tr data-user="{{ $user->id }}">
|
<tr>
|
||||||
<td>{{ $user->name }}</td>
|
<td>{{ $user->name }}</td>
|
||||||
<td class="right aligned">
|
<td class="right aligned">
|
||||||
<button class="ui mini blue icon button edit" data-user="{{ $user->id }}">
|
<button class="ui mini blue icon button">
|
||||||
<i class="edit icon"></i>
|
<i class="edit icon"></i>
|
||||||
</button>
|
</button>
|
||||||
<button class="ui mini red icon button remove" data-user="{{ $user->id }}">
|
<button class="ui mini red icon button">
|
||||||
<i class="trash icon"></i>
|
<i class="trash icon"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@ -50,10 +50,6 @@
|
|||||||
<label>Contraseña</label>
|
<label>Contraseña</label>
|
||||||
<input type="password" name="password" placeholder="Contraseña">
|
<input type="password" name="password" placeholder="Contraseña">
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
|
||||||
<label>Confirmar contraseña</label>
|
|
||||||
<input type="password" name="password_confirmation" placeholder="Confirmar contraseña">
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
@ -66,45 +62,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui modal" id="edit-user-modal">
|
|
||||||
<i class="close icon"></i>
|
|
||||||
<div class="header">
|
|
||||||
Editar usuario
|
|
||||||
</div>
|
|
||||||
<div class="content">
|
|
||||||
<form class="ui form">
|
|
||||||
<input type="hidden" name="id" />
|
|
||||||
<div class="field">
|
|
||||||
<label>Contraseña Antigua</label>
|
|
||||||
<input type="password" name="old_password" placeholder="Contraseña Antigua">
|
|
||||||
</div>
|
|
||||||
<div class="field">
|
|
||||||
<label>Force Change?</label>
|
|
||||||
<div class="ui checkbox">
|
|
||||||
<input type="checkbox" name="force" >
|
|
||||||
<label>Yes</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="field">
|
|
||||||
<label>Contraseña</label>
|
|
||||||
<input type="password" name="password" placeholder="Contraseña">
|
|
||||||
</div>
|
|
||||||
<div class="field">
|
|
||||||
<label>Confirmar contraseña</label>
|
|
||||||
<input type="password" name="password_confirmation" placeholder="Confirmar contraseña">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="actions">
|
|
||||||
<div class="ui black deny button">
|
|
||||||
Cancelar
|
|
||||||
</div>
|
|
||||||
<div class="ui positive right labeled icon button">
|
|
||||||
Guardar
|
|
||||||
<i class="checkmark icon"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@include('layout.body.scripts.cryptojs')
|
@include('layout.body.scripts.cryptojs')
|
||||||
@ -117,20 +74,12 @@
|
|||||||
return [passphrase, encrypted.toString()].join('')
|
return [passphrase, encrypted.toString()].join('')
|
||||||
}
|
}
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
const $createUserModal = $('#create-user-modal')
|
$('#create-user-modal').modal({
|
||||||
$createUserModal.modal({
|
|
||||||
onApprove: function() {
|
onApprove: function() {
|
||||||
const form = document.querySelector('#create-user-modal form')
|
|
||||||
const password = form.querySelector('[name="password"]').value
|
|
||||||
const password_confirmation = form.querySelector('[name="password_confirmation"]').value
|
|
||||||
if (password !== password_confirmation) {
|
|
||||||
alert('Las contraseñas no coinciden')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const url = '{{$urls->api}}/admin/users/add'
|
const url = '{{$urls->api}}/admin/users/add'
|
||||||
const method = 'post'
|
const method = 'post'
|
||||||
const body = new FormData(form)
|
const body = new FormData(document.querySelector('#create-user-modal form'))
|
||||||
body.set('password', encryptPassword(password))
|
body.set('password', encryptPassword(body.get('password')))
|
||||||
fetchAPI(url, {method, body}).then(response => {
|
fetchAPI(url, {method, body}).then(response => {
|
||||||
if (!response) {
|
if (!response) {
|
||||||
return;
|
return;
|
||||||
@ -143,64 +92,8 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const $editUserModal = $('#edit-user-modal')
|
$('#create-user-button').on('click', function () {
|
||||||
$editUserModal.modal({
|
$('#create-user-modal').modal('show')
|
||||||
onApprove: function() {
|
|
||||||
const form = document.querySelector('#edit-user-modal form')
|
|
||||||
const user_id = form.querySelector('[name="id"]').value
|
|
||||||
const old_password = form.querySelector('[name="old_password"]').value
|
|
||||||
const password = form.querySelector('[name="password"]').value
|
|
||||||
const password_confirmation = form.querySelector('[name="password_confirmation"]').value
|
|
||||||
if (password !== password_confirmation) {
|
|
||||||
alert('Las nuevas contraseñas no coinciden')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const url = `{{$urls->api}}/admin/user/${user_id}/edit`
|
|
||||||
const method = 'post'
|
|
||||||
const body = new FormData(form)
|
|
||||||
body.set('old_password', encryptPassword(old_password))
|
|
||||||
body.set('password', encryptPassword(password))
|
|
||||||
if (form.querySelector('[name="force"]').checked) {
|
|
||||||
body.set('force', 'true')
|
|
||||||
}
|
|
||||||
fetchAPI(url, {method, body}).then(response => {
|
|
||||||
if (!response) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
response.json().then(result => {
|
|
||||||
if (result.success) {
|
|
||||||
location.reload()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
document.getElementById('create-user-modal').addEventListener('submit', event => {
|
|
||||||
$createUserModal.modal('show')
|
|
||||||
})
|
|
||||||
document.querySelectorAll('.button.edit').forEach(button => {
|
|
||||||
button.addEventListener('click', clickEvent => {
|
|
||||||
const user_id = clickEvent.currentTarget.dataset.user
|
|
||||||
$editUserModal.find('input[name="id"]').val(user_id)
|
|
||||||
$editUserModal.modal('show')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
document.querySelectorAll('.button.remove').forEach(button => {
|
|
||||||
button.addEventListener('click', clickEvent => {
|
|
||||||
const user_id = clickEvent.currentTarget.dataset.user
|
|
||||||
const url = `{{$urls->api}}/admin/user/${user_id}`
|
|
||||||
const method = 'delete'
|
|
||||||
fetchAPI(url, {method}).then(response => {
|
|
||||||
if (!response) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
response.json().then(result => {
|
|
||||||
if (result.success) {
|
|
||||||
location.reload()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
const cuotas = {
|
const cuotas = {
|
||||||
get: function() {
|
get: function() {
|
||||||
return {
|
return {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="ui divided list" id="alertas_escrituras"></div>
|
<div class="ui divided list" id="alertas_escrituras"></div>
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
const alertas_escrituras = {
|
const alertas_escrituras = {
|
||||||
id: '#alertas_escrituras',
|
id: '#alertas_escrituras',
|
||||||
data: {
|
data: {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="ui divided list" id="cierres_vigentes"></div>
|
<div class="ui divided list" id="cierres_vigentes"></div>
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
const cierres_vigentes = {
|
const cierres_vigentes = {
|
||||||
get: function() {
|
get: function() {
|
||||||
const list = $('#cierres_vigentes')
|
const list = $('#cierres_vigentes')
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="ui divided list" id="cuotas_por_vencer"></div>
|
<div class="ui divided list" id="cuotas_por_vencer"></div>
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
const cuotas_por_vencer = {
|
const cuotas_por_vencer = {
|
||||||
get: function() {
|
get: function() {
|
||||||
const list = $('#cuotas_por_vencer')
|
const list = $('#cuotas_por_vencer')
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
function logout() {
|
function logout() {
|
||||||
return fetch('{{$urls->base}}/logout').then(response => {
|
return fetch('{{$urls->base}}/logout').then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
{{--<a class="item" href="{{$urls->base}}/ventas/precios/importar">Importar Precios</a>--}}
|
{{--<a class="item" href="{{$urls->base}}/ventas/precios/importar">Importar Precios</a>--}}
|
||||||
{{--<a class="item" href="{{$urls->base}}/ventas/cierres/evaluar">Evaluar Cierre</a>--}}
|
{{--<a class="item" href="{{$urls->base}}/ventas/cierres/evaluar">Evaluar Cierre</a>--}}
|
||||||
<a class="item" href="{{$urls->base}}/ventas/facturacion">Facturación</a>
|
<a class="item" href="{{$urls->base}}/ventas/facturacion">Facturación</a>
|
||||||
<div class="divider"></div>
|
|
||||||
<a class="item" href="{{$urls->base}}/ventas/add">
|
<a class="item" href="{{$urls->base}}/ventas/add">
|
||||||
Nueva Venta
|
Nueva Venta
|
||||||
<i class="plus icon"></i>
|
<i class="plus icon"></i>
|
||||||
|
@ -1,9 +1,33 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.3/semantic.min.js" integrity="sha512-gnoBksrDbaMnlE0rhhkcx3iwzvgBGz6mOEj4/Y5ZY09n55dYddx6+WYc72A55qEesV8VX2iMomteIwobeGK1BQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.3/semantic.min.js" integrity="sha512-gnoBksrDbaMnlE0rhhkcx3iwzvgBGz6mOEj4/Y5ZY09n55dYddx6+WYc72A55qEesV8VX2iMomteIwobeGK1BQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
|
||||||
@include('layout.body.scripts.api')
|
<script type="text/javascript">
|
||||||
|
class APIClient {
|
||||||
<script>
|
static fetch(url, options=null, showErrors=false) {
|
||||||
|
return fetchAPI(url, options, showErrors)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function fetchAPI(url, options=null, showErrors=false) {
|
||||||
|
if (options === null) {
|
||||||
|
options = {}
|
||||||
|
}
|
||||||
|
if (!Object.hasOwn(options, 'headers')) {
|
||||||
|
options['headers'] = {}
|
||||||
|
}
|
||||||
|
if (!Object.hasOwn(options['headers'], 'Authorization')) {
|
||||||
|
options['headers']['Authorization'] = 'Bearer {{md5($API_KEY)}}{{($login->isIn()) ? $login->getSeparator() . $login->getToken() : ''}}'
|
||||||
|
}
|
||||||
|
return fetch(url, options).then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
throw new Error(JSON.stringify({code: response.status, message: response.statusText, url}))
|
||||||
|
}).catch(error => {
|
||||||
|
if (showErrors) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
const datatables_defaults = {
|
const datatables_defaults = {
|
||||||
language: {
|
language: {
|
||||||
emptyTable: 'No hay datos disponibles',
|
emptyTable: 'No hay datos disponibles',
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
<script>
|
|
||||||
class APIClient {
|
|
||||||
static getApiKey() {
|
|
||||||
return '{{md5($API_KEY)}}{{($login->isIn()) ? $login->getSeparator() . $login->getToken() : ''}}'
|
|
||||||
}
|
|
||||||
|
|
||||||
static fetch(url, options=null, showErrors=false) {
|
|
||||||
if (options === null) {
|
|
||||||
options = {}
|
|
||||||
}
|
|
||||||
if (!Object.hasOwn(options, 'headers')) {
|
|
||||||
options['headers'] = {}
|
|
||||||
}
|
|
||||||
if (!Object.hasOwn(options['headers'], 'Authorization')) {
|
|
||||||
options['headers']['Authorization'] = `Bearer ${APIClient.getApiKey()}`
|
|
||||||
}
|
|
||||||
return fetch(url, options).then(response => {
|
|
||||||
if (response.ok) {
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
throw new Error(JSON.stringify({code: response.status, message: response.statusText, url}))
|
|
||||||
}).catch(error => {
|
|
||||||
if (showErrors) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function fetchAPI(url, options=null, showErrors=false) {
|
|
||||||
return APIClient.fetch(url, options, showErrors)
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,4 +1,4 @@
|
|||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script src="https://cdn.datatables.net/2.0.3/js/dataTables.min.js"></script>
|
<script type="text/javascript" src="https://cdn.datatables.net/2.0.3/js/dataTables.min.js"></script>
|
||||||
<script src="https://cdn.datatables.net/2.0.3/js/dataTables.semanticui.min.js"></script>
|
<script src="https://cdn.datatables.net/2.0.3/js/dataTables.semanticui.min.js"></script>
|
||||||
@endpush
|
@endpush
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
@push('page_scripts')
|
|
||||||
<script>
|
|
||||||
Intl.NumberFormat.prototype.parse = function(valueString) {
|
|
||||||
const format = new Intl.NumberFormat(this.resolvedOptions().locale);
|
|
||||||
const parts = format.formatToParts(-12345.6);
|
|
||||||
const numerals = Array.from({ length: 10 }).map((_, i) => format.format(i));
|
|
||||||
const index = new Map(numerals.map((d, i) => [d, i]));
|
|
||||||
_minusSign = new RegExp(`[${parts.find(d => d.type === 'minusSign').value}]`);
|
|
||||||
_group = new RegExp(`[${parts.find(d => d.type === 'group').value}]`, 'g');
|
|
||||||
_decimal = new RegExp(`[${parts.find(d => d.type === 'decimal').value}]`);
|
|
||||||
_numeral = new RegExp(`[${numerals.join('')}]`, 'g');
|
|
||||||
_index = d => index.get(d);
|
|
||||||
|
|
||||||
const DIRECTION_MARK = /\u061c|\u200e/g
|
|
||||||
return +(
|
|
||||||
valueString.trim()
|
|
||||||
.replace(DIRECTION_MARK, '')
|
|
||||||
.replace(_group, '')
|
|
||||||
.replace(_decimal, '.')
|
|
||||||
.replace(_numeral, _index)
|
|
||||||
.replace(_minusSign, '-')
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Intl.NumberFormat.prototype.isLocale = function(stringValue) {
|
|
||||||
const format = new Intl.NumberFormat(this.resolvedOptions().locale);
|
|
||||||
const parts = format.formatToParts(-12345.6);
|
|
||||||
const group = parts.find(d => d.type === 'group').value;
|
|
||||||
const decimal = parts.find(d => d.type === 'decimal').value;
|
|
||||||
|
|
||||||
if (stringValue.includes(group)) {
|
|
||||||
if (stringValue.includes(decimal)) {
|
|
||||||
return stringValue.indexOf(group) < stringValue.indexOf(decimal)
|
|
||||||
}
|
|
||||||
if (stringValue.split(group).map(d => d.length).filter(d => d > 3).length > 0) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return stringValue.split(group).length > 2;
|
|
||||||
}
|
|
||||||
if (stringValue.includes(decimal)) {
|
|
||||||
return stringValue.split(decimal).length <= 2;
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@endpush
|
|
@ -1,76 +0,0 @@
|
|||||||
@push('page_scripts')
|
|
||||||
<script>
|
|
||||||
if (typeof Intl.NumberFormat.isLocale === 'undefined' || typeof Intl.NumberFormat.isLocale !== 'function') {
|
|
||||||
// Load Intl.NumberFormat custom methods
|
|
||||||
@include('layout.body.scripts.number_format')
|
|
||||||
}
|
|
||||||
class NumberInput {
|
|
||||||
input
|
|
||||||
isRational
|
|
||||||
outputLocale
|
|
||||||
currentValue
|
|
||||||
formatters
|
|
||||||
|
|
||||||
constructor({input, isRational, outputLocale}) {
|
|
||||||
this.input = input
|
|
||||||
this.isRational = isRational
|
|
||||||
this.outputLocale = outputLocale || 'es-CL'
|
|
||||||
|
|
||||||
this.formatters = {}
|
|
||||||
const locales = ['es-CL', 'en-US']
|
|
||||||
locales.forEach(locale => {
|
|
||||||
this.formatters[locale] = {
|
|
||||||
rational: new Intl.NumberFormat(locale, {minimumFractionDigits: 2, maximumFractionDigits: 2}),
|
|
||||||
integer: new Intl.NumberFormat(locale)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if (this.input.value !== '') {
|
|
||||||
this.currentValue = this.process(this.input.value)
|
|
||||||
this.input.value = this.format(this.currentValue)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
watch() {
|
|
||||||
this.input.addEventListener('change', event => {
|
|
||||||
this.currentValue = this.process(event.currentTarget.value)
|
|
||||||
this.input.value = this.format(this.currentValue)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
process(stringValue) {
|
|
||||||
if (stringValue === '') {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
if (typeof stringValue !== 'string') {
|
|
||||||
return stringValue
|
|
||||||
}
|
|
||||||
return this.formatters[this.detectLocale(stringValue)][this.isRational ? 'rational' : 'integer'].parse(stringValue)
|
|
||||||
}
|
|
||||||
detectLocale(stringValue) {
|
|
||||||
if (stringValue === '') {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
if (typeof stringValue !== 'string') {
|
|
||||||
return stringValue
|
|
||||||
}
|
|
||||||
const outputFormat = this.formatters[this.outputLocale][this.isRational ? 'rational' : 'integer'].isLocale(stringValue)
|
|
||||||
const otherFormats = Object.entries(this.formatters).filter(formatter => formatter[0] !== this.outputLocale).map(formatter => {
|
|
||||||
return {
|
|
||||||
locale: formatter[0],
|
|
||||||
value: formatter[1][this.isRational ? 'rational' : 'integer'].isLocale(stringValue)
|
|
||||||
}
|
|
||||||
}).filter(formatter => formatter.value)
|
|
||||||
|
|
||||||
if (outputFormat) {
|
|
||||||
return this.outputLocale
|
|
||||||
}
|
|
||||||
if (otherFormats.length > 0) {
|
|
||||||
return otherFormats[0].locale
|
|
||||||
}
|
|
||||||
return 'en-US'
|
|
||||||
}
|
|
||||||
format(value) {
|
|
||||||
return this.formatters[this.outputLocale][this.isRational ? 'rational' : 'integer'].format(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@endpush
|
|
@ -28,7 +28,7 @@
|
|||||||
if (!(typeof digito === 'string' || digito instanceof String)) {
|
if (!(typeof digito === 'string' || digito instanceof String)) {
|
||||||
digito = digito.toString()
|
digito = digito.toString()
|
||||||
}
|
}
|
||||||
return Rut.digitoVerificador(rut).toString().toUpperCase() === digito.toUpperCase()
|
return Rut.digitoVerificador(rut) === digito
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
@include('layout.body.scripts.cryptojs')
|
@include('layout.body.scripts.cryptojs')
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
function encryptPassword(password) {
|
function encryptPassword(password) {
|
||||||
const passphrase = Math.floor(Math.random() * Date.now()).toString()
|
const passphrase = Math.floor(Math.random() * Date.now()).toString()
|
||||||
const encrypted = CryptoJS.AES.encrypt(password, passphrase)
|
const encrypted = CryptoJS.AES.encrypt(password, passphrase)
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
@extends('layout.base')
|
|
||||||
|
|
||||||
@section('page_title')
|
|
||||||
405 - Método No Permitido
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@section('page_content')
|
|
||||||
<div class="ui container">
|
|
||||||
<div class="ui message">
|
|
||||||
<i class="exclamation triangle icon"></i>
|
|
||||||
No se ha encontrado la página solicitada para el método solicitado.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endsection
|
|
@ -53,7 +53,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@include('layout.body.scripts.rut')
|
@include('layout.body.scripts.rut')
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script>
|
||||||
class AddModal {
|
class AddModal {
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@include('layout.body.scripts.stats')
|
@include('layout.body.scripts.stats')
|
||||||
|
|
||||||
@prepend('page_scripts')
|
@prepend('page_scripts')
|
||||||
<script>
|
<script>
|
||||||
class TableHandler {
|
class TableHandler {
|
||||||
@ -19,163 +18,30 @@
|
|||||||
}
|
}
|
||||||
draw() {}
|
draw() {}
|
||||||
prices(units) {
|
prices(units) {
|
||||||
return units.map(unit => {
|
const prices = []
|
||||||
let price = unit.valor ?? (unit.precio?.valor ?? 0)
|
units.forEach(unit => {
|
||||||
const broker = price / (1 - this.commission)
|
let price = unit.precio?.valor ?? 0
|
||||||
const promotions = unit.promotions?.map(promotion => {
|
let amount = 1
|
||||||
|
let diff = 0
|
||||||
|
unit.promotions?.forEach(promotion => {
|
||||||
if (promotion.type === 1) {
|
if (promotion.type === 1) {
|
||||||
return {
|
diff += promotion.amount
|
||||||
name: promotion.description,
|
return
|
||||||
type: promotion.type,
|
|
||||||
amount: promotion.amount,
|
|
||||||
final: broker + promotion.amount
|
|
||||||
}
|
}
|
||||||
}
|
amount /= 1/(1 - promotion.amount)
|
||||||
return {
|
})
|
||||||
name: promotion.description,
|
amount = 1 - amount
|
||||||
type: promotion.type,
|
price += diff
|
||||||
amount: promotion.amount,
|
prices.push({
|
||||||
final: broker / (1 - promotion.amount)
|
|
||||||
}
|
|
||||||
}) ?? []
|
|
||||||
return {
|
|
||||||
id: unit.id,
|
id: unit.id,
|
||||||
base: price,
|
base: price,
|
||||||
commission: this.commission,
|
commission: this.commission,
|
||||||
broker,
|
broker: price / (1 - this.commission),
|
||||||
promotions
|
amount,
|
||||||
}
|
final: price / (1 - this.commission) / (1 - amount)
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
class GroupedTableHandler extends TableHandler {
|
|
||||||
promotions = {
|
|
||||||
names: new Set(),
|
|
||||||
values: []
|
|
||||||
}
|
|
||||||
process() {
|
|
||||||
return {
|
|
||||||
prices: prices => {
|
|
||||||
let promotions = {}
|
|
||||||
prices.map(price => price.promotions).forEach(promotionArray => {
|
|
||||||
promotionArray.forEach(p => {
|
|
||||||
if (!Object.hasOwn(promotions, p.name)) {
|
|
||||||
promotions[p.name] = {
|
|
||||||
name: p.name,
|
|
||||||
type: p.type,
|
|
||||||
amount: [],
|
|
||||||
final: []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
promotions[p.name].amount.push(p.amount)
|
|
||||||
promotions[p.name].final.push(p.final)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return promotions
|
return prices
|
||||||
},
|
|
||||||
promotions: () => {
|
|
||||||
return {
|
|
||||||
names: promotions => {
|
|
||||||
Object.keys(promotions).forEach(name => {
|
|
||||||
this.add().promotion().name(name)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
values: ({promotions, formatters}) => {
|
|
||||||
const temp = Object.values(promotions)
|
|
||||||
if (temp.length > 0) {
|
|
||||||
const data = temp.map(p => {
|
|
||||||
return {
|
|
||||||
name: p.name,
|
|
||||||
type: p.type,
|
|
||||||
amount: {
|
|
||||||
min: Math.min(...p.amount),
|
|
||||||
max: Math.max(...p.amount),
|
|
||||||
desv: Stat.standardDeviation(p.amount),
|
|
||||||
mean: Stat.mean(p.amount)
|
|
||||||
},
|
|
||||||
final: {
|
|
||||||
min: Math.min(...p.final),
|
|
||||||
max: Math.max(...p.final),
|
|
||||||
desv: Stat.standardDeviation(p.final),
|
|
||||||
mean: Stat.mean(p.final)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.add().promotion().values({promotions: data, formatters})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.promotions.values.push([])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
add() {
|
|
||||||
return {
|
|
||||||
promotion: () => {
|
|
||||||
return {
|
|
||||||
name: name => {
|
|
||||||
this.promotions.names.add(name)
|
|
||||||
},
|
|
||||||
values: ({promotions, formatters}) => {
|
|
||||||
this.promotions.values.push(promotions.map(promotion => {
|
|
||||||
const amount_tooltip = [
|
|
||||||
`Min: ${promotion.type === 1 ? 'UF ' + formatters.ufs.format(promotion.amount.min) : formatters.percent.format(promotion.amount.min)}`,
|
|
||||||
`Max: ${promotion.type === 1 ? 'UF ' + formatters.ufs.format(promotion.amount.max) : formatters.percent.format(promotion.amount.max)}`,
|
|
||||||
`Desv: ${promotion.type === 1 ? 'UF ' + formatters.ufs.format(promotion.amount.desv) : formatters.percent.format(promotion.amount.desv)}`
|
|
||||||
].join("\n").replaceAll(' ', ' ')
|
|
||||||
const final_tooltip = [
|
|
||||||
`Min: UF ${formatters.ufs.format(promotion.final.min)}`,
|
|
||||||
`Max: UF ${formatters.ufs.format(promotion.final.max)}`,
|
|
||||||
`Desv: UF ${formatters.ufs.format(promotion.final.desv)}`
|
|
||||||
].join("\n").replaceAll(' ', ' ')
|
|
||||||
return {
|
|
||||||
name: promotion.name,
|
|
||||||
value: [
|
|
||||||
`<td class="right aligned"><span data-tooltip="${amount_tooltip}" data-position="right center" data-variation="wide multiline">${promotion.type === 1 ? formatters.ufs.format(promotion.amount.mean) : formatters.percent.format(promotion.amount.mean)}</td>`,
|
|
||||||
`<td class="right aligned"><span data-tooltip="${final_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(promotion.final.mean)}</td></td>`,
|
|
||||||
].join("\n")
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
build() {
|
|
||||||
return {
|
|
||||||
promotions: (table, tbody) => {
|
|
||||||
if (this.promotions.names.size > 0) {
|
|
||||||
const title = document.getElementById(this.ids.promotions)
|
|
||||||
title.innerHTML = this.promotions.names.size > 0 ? Array.from(this.promotions.names)[0] : ''
|
|
||||||
title.setAttribute('colspan', '2')
|
|
||||||
if (this.promotions.names.size > 1) {
|
|
||||||
const thead = table.querySelector('thead')
|
|
||||||
Array.from(this.promotions.names).slice(1).forEach(name => {
|
|
||||||
thead.insertAdjacentHTML('beforeend', `<th class="right aligned" style="text-decoration: overline" colspan="2">${name}</th>`)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const trs = tbody.querySelectorAll('tr')
|
|
||||||
this.promotions.values.forEach((row, i) => {
|
|
||||||
const tr = trs[i]
|
|
||||||
const td = tr.querySelector('td.promotions')
|
|
||||||
if (row.length === 0) {
|
|
||||||
td.setAttribute('colspan', 2 * this.promotions.names.size)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
td.remove()
|
|
||||||
this.promotions.names.forEach(name => {
|
|
||||||
const index = row.findIndex(r => r.name === name)
|
|
||||||
if (index === -1) {
|
|
||||||
tr.insertAdjacentHTML('beforeend', '<td colspan="2"></td>')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
tr.insertAdjacentHTML('beforeend', row[index].value)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -183,9 +49,9 @@
|
|||||||
|
|
||||||
@section('brokers_content')
|
@section('brokers_content')
|
||||||
<div class="ui statistic">
|
<div class="ui statistic">
|
||||||
<div class="value">{{ $format->percent($contract->commission ?? 0, 2, true) }}</div>
|
<div class="value">{{ $format->percent($contract->commission, 2, true) }}</div>
|
||||||
<div class="label">
|
<div class="label">
|
||||||
Comisión desde {{ $contract->current()?->date?->format('d/m/Y') }}
|
Comisión desde {{ $contract->current()->date->format('d/m/Y') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
@ -195,9 +61,6 @@
|
|||||||
Promociones Aplicadas
|
Promociones Aplicadas
|
||||||
</div>
|
</div>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
@if (count($contract->promotions()) === 0)
|
|
||||||
- Ninguna
|
|
||||||
@else
|
|
||||||
<div class="ui list">
|
<div class="ui list">
|
||||||
@foreach ($contract->promotions() as $promotion)
|
@foreach ($contract->promotions() as $promotion)
|
||||||
<div class="item">
|
<div class="item">
|
||||||
@ -205,27 +68,16 @@
|
|||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="ui very basic segment">
|
|
||||||
<div class="ui active inline loader" id="loader"></div>
|
|
||||||
<div class="ui indicating progress" id="load_progress">
|
|
||||||
<div class="bar">
|
|
||||||
<div class="progress"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ui active inline loader"></div>
|
||||||
<div id="results">
|
<div id="results">
|
||||||
<div class="ui top attached tabular menu">
|
<div class="ui top attached tabular menu">
|
||||||
<a class="item active" data-tab="tipos">Tipos</a>
|
<a class="item active" data-tab="tipos">Tipos</a>
|
||||||
<a class="item" data-tab="lineas">Líneas</a>
|
<a class="item" data-tab="lineas">Líneas</a>
|
||||||
<a class="item" data-tab="unidades">Unidades</a>
|
<a class="item" data-tab="unidades">Unidades</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui top attached indicating progress" id="values_progress">
|
|
||||||
<div class="bar"></div>
|
|
||||||
</div>
|
|
||||||
<div class="ui bottom attached tab basic fitted segment active" data-tab="tipos">
|
<div class="ui bottom attached tab basic fitted segment active" data-tab="tipos">
|
||||||
@include('proyectos.brokers.contracts.show.tipo')
|
@include('proyectos.brokers.contracts.show.tipo')
|
||||||
</div>
|
</div>
|
||||||
@ -247,9 +99,7 @@
|
|||||||
const units = {
|
const units = {
|
||||||
ids: {
|
ids: {
|
||||||
units: '',
|
units: '',
|
||||||
loader: '',
|
loader: ''
|
||||||
progress: '',
|
|
||||||
load_progress: ''
|
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
project_id: {{ $contract->project->id }},
|
project_id: {{ $contract->project->id }},
|
||||||
@ -280,7 +130,7 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
promotions: progress_bar => {
|
promotions: () => {
|
||||||
const chunkSize = 100
|
const chunkSize = 100
|
||||||
const chunks = []
|
const chunks = []
|
||||||
for (let i = 0; i < units.data.units.length; i += chunkSize) {
|
for (let i = 0; i < units.data.units.length; i += chunkSize) {
|
||||||
@ -293,7 +143,6 @@
|
|||||||
const body = new FormData()
|
const body = new FormData()
|
||||||
chunk.forEach(id => body.append('unidad_ids[]', id))
|
chunk.forEach(id => body.append('unidad_ids[]', id))
|
||||||
promises.push(APIClient.fetch(url, {method, body}).then(response => response.json()).then(json => {
|
promises.push(APIClient.fetch(url, {method, body}).then(response => response.json()).then(json => {
|
||||||
progress_bar.progress('increment', json.input.unidad_ids.length)
|
|
||||||
if (json.unidades.length === 0) {
|
if (json.unidades.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -305,11 +154,7 @@
|
|||||||
})
|
})
|
||||||
return Promise.all(promises)
|
return Promise.all(promises)
|
||||||
},
|
},
|
||||||
prices: progress_bar => {
|
prices: () => {
|
||||||
/*const unsold = [...units.data.units.filter(unit => !unit.sold), ...units.data.units.filter(unit => unit.sold && unit.proyecto_tipo_unidad.tipo_unidad.descripcion !== 'departamento')]
|
|
||||||
const current_total = progress_bar.progress('get total')
|
|
||||||
progress_bar.progress('set total', current_total + unsold.length)*/
|
|
||||||
|
|
||||||
const chunkSize = 100
|
const chunkSize = 100
|
||||||
const chunks = []
|
const chunks = []
|
||||||
for (let i = 0; i < units.data.units.length; i += chunkSize) {
|
for (let i = 0; i < units.data.units.length; i += chunkSize) {
|
||||||
@ -322,7 +167,6 @@
|
|||||||
const body = new FormData()
|
const body = new FormData()
|
||||||
chunk.forEach(id => body.append('unidad_ids[]', id))
|
chunk.forEach(id => body.append('unidad_ids[]', id))
|
||||||
promises.push(APIClient.fetch(url, {method, body}).then(response => response.json()).then(json => {
|
promises.push(APIClient.fetch(url, {method, body}).then(response => response.json()).then(json => {
|
||||||
progress_bar.progress('increment', json.input.unidad_ids.length)
|
|
||||||
if (json.precios.length === 0) {
|
if (json.precios.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -334,69 +178,19 @@
|
|||||||
})
|
})
|
||||||
return Promise.all(promises)
|
return Promise.all(promises)
|
||||||
},
|
},
|
||||||
values: progress_bar => {
|
sold: () => {
|
||||||
const sold = units.data.units.filter(unit => unit.sold && unit.proyecto_tipo_unidad.tipo_unidad.descripcion === 'departamento')
|
|
||||||
progress_bar.progress('set total', sold.length)
|
|
||||||
|
|
||||||
const chunkSize = 10
|
|
||||||
const chunks = []
|
|
||||||
for (let i = 0; i < sold.length; i += chunkSize) {
|
|
||||||
chunks.push(sold.slice(i, i + chunkSize).map(u => u.id))
|
|
||||||
}
|
|
||||||
const promises = []
|
|
||||||
const url = `{{ $urls->api }}/ventas/by/unidades`
|
|
||||||
const method = 'post'
|
|
||||||
chunks.forEach(chunk => {
|
|
||||||
const body = new FormData()
|
|
||||||
chunk.forEach(id => body.append('unidad_ids[]', id))
|
|
||||||
promises.push(APIClient.fetch(url, {method, body}).then(response => response.json()).then(json => {
|
|
||||||
progress_bar.progress('increment', json.input.unidad_ids.length)
|
|
||||||
if (json.ventas.length === 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
json.ventas.forEach(({unidad_id, venta}) => {
|
|
||||||
const unidades = venta.propiedad.unidades
|
|
||||||
const otras_unidades = unidades.filter(unit => unit.id !== parseInt(unidad_id) && unit.proyecto_tipo_unidad.tipo_unidad.descripcion !== 'departamento')
|
|
||||||
const departamentos = unidades.filter(unit => unit.proyecto_tipo_unidad.tipo_unidad.descripcion === 'departamento' && unit.id !== parseInt(unidad_id))
|
|
||||||
const precios = otras_unidades.map(unit => {
|
|
||||||
const idx = units.data.units.findIndex(u => u.id === unit.id)
|
|
||||||
return units.data.units[idx].precio?.valor ?? 0
|
|
||||||
}).reduce((sum, precio) => sum + precio, 0)
|
|
||||||
if (departamentos.length === 0) {
|
|
||||||
const idx = units.data.units.findIndex(unit => unit.id === parseInt(unidad_id))
|
|
||||||
units.data.units[idx].valor = venta.valor - precios
|
|
||||||
units.data.units[idx].venta = venta
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const sum_precios = departamentos.map(departamento => {
|
|
||||||
const idx = units.data.units.findIndex(unit => unit.id === departamento.id)
|
|
||||||
return units.data.units[idx].precio
|
|
||||||
}).reduce((sum, precio) => sum + precio, 0)
|
|
||||||
departamentos.forEach(departamento => {
|
|
||||||
const idx = units.data.units.findIndex(unit => unit.id === departamento.id)
|
|
||||||
const saldo = venta.valor - precios
|
|
||||||
units.data.units[idx].valor = saldo / sum_precios * departamento.precio
|
|
||||||
units.data.units[idx].venta = venta
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
return Promise.all(promises)
|
|
||||||
},
|
|
||||||
sold: progress_bar => {
|
|
||||||
const chunkSize = 100
|
const chunkSize = 100
|
||||||
const chunks = []
|
const chunks = []
|
||||||
for (let i = 0; i < units.data.units.length; i += chunkSize) {
|
for (let i = 0; i < units.data.units.length; i += chunkSize) {
|
||||||
chunks.push(units.data.units.slice(i, i + chunkSize).map(u => u.id))
|
chunks.push(units.data.units.slice(i, i + chunkSize).map(u => u.id))
|
||||||
}
|
}
|
||||||
const promises = []
|
const promises = []
|
||||||
|
chunks.forEach(chunk => {
|
||||||
const url = `{{ $urls->api }}/proyecto/{{ $contract->project->id }}/unidades/estados`
|
const url = `{{ $urls->api }}/proyecto/{{ $contract->project->id }}/unidades/estados`
|
||||||
const method = 'post'
|
const method = 'post'
|
||||||
chunks.forEach(chunk => {
|
|
||||||
const body = new FormData()
|
const body = new FormData()
|
||||||
chunk.forEach(id => body.append('unidad_ids[]', id))
|
chunk.forEach(id => body.append('unidad_ids[]', id))
|
||||||
promises.push(APIClient.fetch(url, {method, body}).then(response => response.json()).then(json => {
|
promises.push(APIClient.fetch(url, {method, body}).then(response => response.json()).then(json => {
|
||||||
progress_bar.progress('increment', json.input.unidad_ids.length)
|
|
||||||
if (json.estados.length === 0) {
|
if (json.estados.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -407,7 +201,7 @@
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
return Promise.all(promises)
|
return Promise.all(promises)
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
draw() {
|
draw() {
|
||||||
@ -440,42 +234,18 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
document.getElementById(units.ids.results).style.visibility = 'hidden'
|
document.getElementById(units.ids.results).style.visibility = 'hidden'
|
||||||
document.getElementById(units.ids.progress).style.visibility = 'hidden'
|
|
||||||
document.getElementById(units.ids.load_progress).style.visibility = 'hidden'
|
|
||||||
|
|
||||||
const loader = $(`#${units.ids.loader}`)
|
|
||||||
|
|
||||||
units.get().units().then(() => {
|
units.get().units().then(() => {
|
||||||
document.getElementById(units.ids.load_progress).style.visibility = 'visible'
|
units.get().prices().then(() => {
|
||||||
|
units.get().promotions().then(() => {
|
||||||
|
units.get().sold().then(() => {
|
||||||
|
$(units.ids.loader).hide()
|
||||||
|
|
||||||
const units_length = units.data.units.length
|
|
||||||
const progress_bar = $(`#${units.ids.load_progress}`)
|
|
||||||
progress_bar.progress({ total: units_length * 3 })
|
|
||||||
|
|
||||||
loader.hide()
|
|
||||||
|
|
||||||
units.get().promotions(progress_bar).then(() => {
|
|
||||||
units.get().sold(progress_bar).then(() => {
|
|
||||||
units.get().prices(progress_bar).then(() => {
|
|
||||||
document.getElementById(units.ids.results).style.visibility = 'visible'
|
document.getElementById(units.ids.results).style.visibility = 'visible'
|
||||||
|
|
||||||
loader.parent().remove()
|
|
||||||
|
|
||||||
units.draw().units()
|
units.draw().units()
|
||||||
units.draw().tipos()
|
units.draw().tipos()
|
||||||
units.draw().lineas()
|
units.draw().lineas()
|
||||||
|
|
||||||
document.getElementById(units.ids.progress).style.visibility = 'visible'
|
|
||||||
const progress_bar = $(`#${units.ids.progress}`)
|
|
||||||
progress_bar.progress()
|
|
||||||
|
|
||||||
units.get().values(progress_bar).then(() => {
|
|
||||||
document.getElementById(units.ids.progress).remove()
|
|
||||||
|
|
||||||
units.draw().units()
|
|
||||||
units.draw().tipos()
|
|
||||||
units.draw().lineas()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -483,7 +253,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
units.setup({results: 'results', loader: 'loader', progress: 'values_progress', load_progress: 'load_progress'})
|
units.setup({results: 'results', loader: '.ui.loader'})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
@ -7,8 +7,9 @@
|
|||||||
<th class="center aligned">Cantidad</th>
|
<th class="center aligned">Cantidad</th>
|
||||||
<th class="right aligned" style="text-decoration: overline">Precio Base</th>
|
<th class="right aligned" style="text-decoration: overline">Precio Base</th>
|
||||||
<th class="right aligned" style="text-decoration: overline">Comisión</th>
|
<th class="right aligned" style="text-decoration: overline">Comisión</th>
|
||||||
|
<th class="right aligned" style="text-decoration: overline">Porcentaje</th>
|
||||||
<th class="right aligned" style="text-decoration: overline">Precio Operador</th>
|
<th class="right aligned" style="text-decoration: overline">Precio Operador</th>
|
||||||
<th class="center aligned" style="text-decoration: overline" id="linea_promociones">Promociones</th>
|
<th class="right aligned" style="text-decoration: overline">Precio Final</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
@ -16,10 +17,9 @@
|
|||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script>
|
||||||
class LineasTable extends GroupedTableHandler {
|
class LineasTable extends TableHandler {
|
||||||
ids = {
|
ids = {
|
||||||
lineas: 'lineas',
|
lineas: 'lineas'
|
||||||
promotions: 'linea_promociones'
|
|
||||||
}
|
}
|
||||||
constructor(commission) {
|
constructor(commission) {
|
||||||
super(commission)
|
super(commission)
|
||||||
@ -27,12 +27,9 @@
|
|||||||
draw({units, formatters}) {
|
draw({units, formatters}) {
|
||||||
const table = document.getElementById(this.ids.lineas)
|
const table = document.getElementById(this.ids.lineas)
|
||||||
const tbody = table.querySelector('tbody')
|
const tbody = table.querySelector('tbody')
|
||||||
tbody.innerHTML = ''
|
|
||||||
const lineas = Object.groupBy(units, unit => {
|
const lineas = Object.groupBy(units, unit => {
|
||||||
return [unit.proyecto_tipo_unidad.tipo_unidad.descripcion, unit.proyecto_tipo_unidad.nombre, unit.orientacion]
|
return [unit.proyecto_tipo_unidad.tipo_unidad.descripcion, unit.proyecto_tipo_unidad.nombre, unit.orientacion]
|
||||||
})
|
})
|
||||||
this.promotions.names = new Set()
|
|
||||||
this.promotions.values = []
|
|
||||||
Object.entries(lineas).sort(([linea1, unidades1], [linea2, unidades2]) => {
|
Object.entries(lineas).sort(([linea1, unidades1], [linea2, unidades2]) => {
|
||||||
const split1 = linea1.split(',')
|
const split1 = linea1.split(',')
|
||||||
const split2 = linea2.split(',')
|
const split2 = linea2.split(',')
|
||||||
@ -66,10 +63,16 @@
|
|||||||
`Max: ${formatters.ufs.format(Math.max(...prices.map(p => p.broker)))}`,
|
`Max: ${formatters.ufs.format(Math.max(...prices.map(p => p.broker)))}`,
|
||||||
`Desv: ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.broker)))}`
|
`Desv: ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.broker)))}`
|
||||||
].join("\n").replaceAll(' ', ' ')
|
].join("\n").replaceAll(' ', ' ')
|
||||||
|
const amount_tooltip = [
|
||||||
const promotions = this.process().prices(prices)
|
`Min: ${formatters.percent.format(Math.min(...prices.map(p => p.amount)))}`,
|
||||||
this.process().promotions().names(promotions)
|
`Max: ${formatters.percent.format(Math.max(...prices.map(p => p.amount)))}`,
|
||||||
this.process().promotions().values({promotions, formatters})
|
`Desv: ${formatters.percent.format(Stat.standardDeviation(prices.map(p => p.amount)))}`
|
||||||
|
].join("\n").replaceAll(' ', ' ')
|
||||||
|
const final_tooltip = [
|
||||||
|
`Min: UF ${formatters.ufs.format(Math.min(...prices.map(p => p.final)))}`,
|
||||||
|
`Max: UF ${formatters.ufs.format(Math.max(...prices.map(p => p.final)))}`,
|
||||||
|
`Desv: UF ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.final)))}`
|
||||||
|
].join("\n").replaceAll(' ', ' ')
|
||||||
|
|
||||||
tbody.innerHTML += [
|
tbody.innerHTML += [
|
||||||
`<tr>`,
|
`<tr>`,
|
||||||
@ -80,11 +83,11 @@
|
|||||||
`<td class="right aligned"><span data-tooltip="${base_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.base)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${base_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.base)))}</span></td>`,
|
||||||
`<td class="right aligned"><span data-tooltip="${commission_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.commission)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${commission_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.commission)))}</span></td>`,
|
||||||
`<td class="right aligned"><span data-tooltip="${broker_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.broker)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${broker_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.broker)))}</span></td>`,
|
||||||
`<td class="right aligned promotions"></td>`,
|
`<td class="right aligned"><span data-tooltip="${amount_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.amount)))}</span></td>`,
|
||||||
|
`<td class="right aligned"><span data-tooltip="${final_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.final)))}</span></td>`,
|
||||||
`</tr>`
|
`</tr>`
|
||||||
].join("\n")
|
].join("\n")
|
||||||
})
|
})
|
||||||
this.build().promotions(table, tbody)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
<th class="right aligned" style="text-decoration: overline">Precio Base</th>
|
<th class="right aligned" style="text-decoration: overline">Precio Base</th>
|
||||||
<th class="right aligned" style="text-decoration: overline">Comisión</th>
|
<th class="right aligned" style="text-decoration: overline">Comisión</th>
|
||||||
<th class="right aligned" style="text-decoration: overline">Precio Operador</th>
|
<th class="right aligned" style="text-decoration: overline">Precio Operador</th>
|
||||||
<th class="center aligned" style="text-decoration: overline" id="tipo_promociones">Promociones</th>
|
<th class="right aligned" style="text-decoration: overline">Porcentaje</th>
|
||||||
|
<th class="right aligned" style="text-decoration: overline">Precio Final</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
@ -14,10 +15,9 @@
|
|||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script>
|
||||||
class TipoTable extends GroupedTableHandler {
|
class TipoTable extends TableHandler {
|
||||||
ids = {
|
ids = {
|
||||||
tipos: 'tipos',
|
tipos: 'tipos'
|
||||||
promotions: 'tipo_promociones'
|
|
||||||
}
|
}
|
||||||
constructor(commission) {
|
constructor(commission) {
|
||||||
super(commission)
|
super(commission)
|
||||||
@ -29,8 +29,6 @@
|
|||||||
const groups = Object.groupBy(units, unit => {
|
const groups = Object.groupBy(units, unit => {
|
||||||
return unit.proyecto_tipo_unidad.tipo_unidad.descripcion
|
return unit.proyecto_tipo_unidad.tipo_unidad.descripcion
|
||||||
})
|
})
|
||||||
this.promotions.names = new Set()
|
|
||||||
this.promotions.values = []
|
|
||||||
Object.entries(groups).forEach(([tipo, unidades]) => {
|
Object.entries(groups).forEach(([tipo, unidades]) => {
|
||||||
const prices = this.prices(unidades)
|
const prices = this.prices(unidades)
|
||||||
const base_tooltip = [
|
const base_tooltip = [
|
||||||
@ -48,10 +46,16 @@
|
|||||||
`Max: ${formatters.ufs.format(Math.max(...prices.map(p => p.broker)))}`,
|
`Max: ${formatters.ufs.format(Math.max(...prices.map(p => p.broker)))}`,
|
||||||
`Desv: ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.broker)))}`
|
`Desv: ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.broker)))}`
|
||||||
].join("\n").replaceAll(' ', ' ')
|
].join("\n").replaceAll(' ', ' ')
|
||||||
|
const amount_tooltip = [
|
||||||
const promotions = this.process().prices(prices)
|
`Min: ${formatters.percent.format(Math.min(...prices.map(p => p.amount)))}`,
|
||||||
this.process().promotions().names(promotions)
|
`Max: ${formatters.percent.format(Math.max(...prices.map(p => p.amount)))}`,
|
||||||
this.process().promotions().values({promotions, formatters})
|
`Desv: ${formatters.percent.format(Stat.standardDeviation(prices.map(p => p.amount)))}`
|
||||||
|
].join("\n").replaceAll(' ', ' ')
|
||||||
|
const final_tooltip = [
|
||||||
|
`Min: UF ${formatters.ufs.format(Math.min(...prices.map(p => p.final)))}`,
|
||||||
|
`Max: UF ${formatters.ufs.format(Math.max(...prices.map(p => p.final)))}`,
|
||||||
|
`Desv: UF ${formatters.ufs.format(Stat.standardDeviation(prices.map(p => p.final)))}`
|
||||||
|
].join("\n").replaceAll(' ', ' ')
|
||||||
|
|
||||||
tbody.innerHTML += [
|
tbody.innerHTML += [
|
||||||
`<tr>`,
|
`<tr>`,
|
||||||
@ -60,11 +64,11 @@
|
|||||||
`<td class="right aligned"><span data-tooltip="${base_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.base)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${base_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.base)))}</span></td>`,
|
||||||
`<td class="right aligned"><span data-tooltip="${commission_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.commission)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${commission_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.commission)))}</span></td>`,
|
||||||
`<td class="right aligned"><span data-tooltip="${broker_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.broker)))}</span></td>`,
|
`<td class="right aligned"><span data-tooltip="${broker_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.broker)))}</span></td>`,
|
||||||
`<td class="right aligned promotions"></td>`,
|
`<td class="right aligned"><span data-tooltip="${amount_tooltip}" data-position="right center" data-variation="wide multiline">${formatters.percent.format(Stat.mean(prices.map(p => p.amount)))}</span></td>`,
|
||||||
|
`<td class="right aligned"><span data-tooltip="${final_tooltip}" data-position="right center" data-variation="wide multiline">UF ${formatters.ufs.format(Stat.mean(prices.map(p => p.final)))}</span></td>`,
|
||||||
`</tr>`
|
`</tr>`
|
||||||
].join("\n")
|
].join("\n")
|
||||||
})
|
})
|
||||||
this.build().promotions(table, tbody)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -9,15 +9,13 @@
|
|||||||
<th>Tipología</th>
|
<th>Tipología</th>
|
||||||
<th>Piso</th>
|
<th>Piso</th>
|
||||||
<th>Orientación</th>
|
<th>Orientación</th>
|
||||||
<th>m² Interior</th>
|
<th>m²</th>
|
||||||
<th>m² Terraza</th>
|
|
||||||
<th>m² Vendibles</th>
|
|
||||||
<th>m² Total</th>
|
|
||||||
<th class="right aligned">Precio Base</th>
|
<th class="right aligned">Precio Base</th>
|
||||||
<th class="right aligned">Comisión</th>
|
<th class="right aligned">Comisión</th>
|
||||||
<th class="right aligned">Precio Operador</th>
|
<th class="right aligned">Precio Operador</th>
|
||||||
<th class="right aligned">UF/m²</th>
|
<th class="right aligned">UF/m²</th>
|
||||||
<th class="center aligned" id="unit_promotions">Promociones</th>
|
<th class="right aligned">Porcentaje</th>
|
||||||
|
<th class="right aligned">Precio Final</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
@ -38,59 +36,16 @@
|
|||||||
'tipologia',
|
'tipologia',
|
||||||
'piso',
|
'piso',
|
||||||
'orientacion',
|
'orientacion',
|
||||||
'metros_interior',
|
|
||||||
'metros_terraza',
|
|
||||||
'metros',
|
'metros',
|
||||||
'metros_total',
|
|
||||||
'precio_base',
|
'precio_base',
|
||||||
'commission',
|
'commission',
|
||||||
'precio_operador',
|
'precio_operador',
|
||||||
'UF/m²',
|
'UF/m²',
|
||||||
'promociones',
|
'porcentaje',
|
||||||
|
'precio_final',
|
||||||
]
|
]
|
||||||
set = {
|
|
||||||
table: false,
|
|
||||||
titles: false
|
|
||||||
}
|
|
||||||
table
|
|
||||||
constructor(commission) {
|
constructor(commission) {
|
||||||
super(commission)
|
super(commission)
|
||||||
}
|
|
||||||
setup() {
|
|
||||||
return {
|
|
||||||
titles: promotions_names => {
|
|
||||||
if (this.set.titles || promotions_names.size === 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const nameArray = Array.from(promotions_names)
|
|
||||||
|
|
||||||
this.columns.pop()
|
|
||||||
this.columns.push(`${nameArray[0].toLowerCase().replaceAll(' ', '_')}.amount`)
|
|
||||||
this.columns.push(`${nameArray[0].toLowerCase().replaceAll(' ', '_')}.final`)
|
|
||||||
|
|
||||||
const table = document.getElementById(this.ids.units)
|
|
||||||
const thead = table.querySelector('thead')
|
|
||||||
const tr = thead.querySelector('tr')
|
|
||||||
const th = tr.querySelector('th#unit_promotions')
|
|
||||||
th.innerHTML = `${nameArray[0]}<br />Porcentaje`
|
|
||||||
tr.insertAdjacentHTML('beforeend', `<th class="right aligned">${nameArray[0]}<br />Precio Final</th>`)
|
|
||||||
|
|
||||||
if (promotions_names.size > 1) {
|
|
||||||
nameArray.slice(1).forEach(name => {
|
|
||||||
this.columns.push(`${name.toLowerCase().replaceAll(' ', '_')}.amount`)
|
|
||||||
this.columns.push(`${name.toLowerCase().replaceAll(' ', '_')}.final`)
|
|
||||||
|
|
||||||
tr.insertAdjacentHTML('beforeend', `<th class="right aligned">${name}<br />Porcentaje</th>`)
|
|
||||||
tr.insertAdjacentHTML('beforeend', `<th class="right aligned">${name}<br />Precio Final</th>`)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.set.titles = true
|
|
||||||
},
|
|
||||||
table: () => {
|
|
||||||
if (typeof this.table !== 'undefined' || this.set.table) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const dto = structuredClone(datatables_defaults)
|
const dto = structuredClone(datatables_defaults)
|
||||||
dto.pageLength = 100
|
dto.pageLength = 100
|
||||||
@ -115,13 +70,6 @@
|
|||||||
]
|
]
|
||||||
dto.order = ['tipo_order', 'unidad_order'].map(column => [this.columns.indexOf(column), 'asc'])
|
dto.order = ['tipo_order', 'unidad_order'].map(column => [this.columns.indexOf(column), 'asc'])
|
||||||
dto.language.searchBuilder = searchBuilder
|
dto.language.searchBuilder = searchBuilder
|
||||||
const exportColumns = ['tipo', 'unidad', 'tipologia', 'piso', 'orientacion', 'metros_interior', 'metros_terraza', 'metros', 'metros_total', 'precio_operador', 'promociones']
|
|
||||||
if (typeof this.columns['promotions'] === 'undefined') {
|
|
||||||
exportColumns.pop()
|
|
||||||
this.columns.slice(this.columns.indexOf('UF/m²')+1).forEach(name => {
|
|
||||||
exportColumns.push(name)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
dto.layout = {
|
dto.layout = {
|
||||||
top1Start: {
|
top1Start: {
|
||||||
searchBuilder: {
|
searchBuilder: {
|
||||||
@ -138,7 +86,7 @@
|
|||||||
title: 'Lista de Precios - {{ $contract->broker->name }} - {{ $contract->project->descripcion }} - {{ (new DateTime())->format('Y-m-d') }}',
|
title: 'Lista de Precios - {{ $contract->broker->name }} - {{ $contract->project->descripcion }} - {{ (new DateTime())->format('Y-m-d') }}',
|
||||||
download: 'open',
|
download: 'open',
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
columns: exportColumns
|
columns: ['tipo', 'unidad', 'tipologia', 'piso', 'orientacion', 'metros', 'commission', 'precio_operador', 'porcentaje', 'precio_final']
|
||||||
.map(column => this.columns.indexOf(column)),
|
.map(column => this.columns.indexOf(column)),
|
||||||
rows: (idx, data, node) => {
|
rows: (idx, data, node) => {
|
||||||
return data[this.columns.indexOf('estado')] === 'Libre'
|
return data[this.columns.indexOf('estado')] === 'Libre'
|
||||||
@ -148,16 +96,7 @@
|
|||||||
if (typeof data === 'string' && data.includes('<span')) {
|
if (typeof data === 'string' && data.includes('<span')) {
|
||||||
return data.replace(/<span.*>(.*)<\/span>/, '$1')
|
return data.replace(/<span.*>(.*)<\/span>/, '$1')
|
||||||
}
|
}
|
||||||
if (typeof data === 'string' && data.includes('UF ')) {
|
if (['metros'].map(column => this.columns.indexOf(column)).includes(columnIdx)) {
|
||||||
return data.replace('UF ', '').replaceAll('.', '').replaceAll(',', '.')
|
|
||||||
}
|
|
||||||
const formatColumns = ['metros', 'metros_interior', 'metros_terraza', 'metros_total']
|
|
||||||
if (this.set.titles) {
|
|
||||||
this.columns.filter(column => column.includes('.amount') || column.includes('.final')).forEach(name => {
|
|
||||||
formatColumns.push(name)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (formatColumns.map(column => this.columns.indexOf(column)).includes(columnIdx)) {
|
|
||||||
return data.replaceAll('.', '').replaceAll(',', '.')
|
return data.replaceAll('.', '').replaceAll(',', '.')
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
@ -168,84 +107,36 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$(`#${this.ids.units}`).DataTable(dto)
|
||||||
this.table = $(`#${this.ids.units}`).DataTable(dto)
|
|
||||||
|
|
||||||
this.set.table = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
draw({units, formatters}) {
|
draw({units, formatters}) {
|
||||||
const prices = this.prices(units)
|
const table = $(`#${this.ids.units}`).DataTable()
|
||||||
|
table.clear()
|
||||||
const promotions_names = new Set()
|
|
||||||
const tableData = []
|
const tableData = []
|
||||||
|
const prices = this.prices(units)
|
||||||
units.forEach(unidad => {
|
units.forEach(unidad => {
|
||||||
const tipo = unidad.proyecto_tipo_unidad.tipo_unidad.descripcion
|
const tipo = unidad.proyecto_tipo_unidad.tipo_unidad.descripcion
|
||||||
const price = prices.find(p => p.id === unidad.id)
|
const price = prices.find(p => p.id === unidad.id)
|
||||||
|
tableData.push([
|
||||||
let promotions = []
|
unidad.sold ? '<span class="ui yellow text">Vendida</span>' : 'Libre',
|
||||||
price.promotions.forEach(p => {
|
|
||||||
if (Object.hasOwn(promotions, p.name)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
promotions[p.name] = {
|
|
||||||
name: p.name,
|
|
||||||
type: p.type,
|
|
||||||
amount: p.type === 1 ? 'UF ' + formatters.ufs.format(p.amount) : formatters.percent.format(p.amount),
|
|
||||||
final: `UF ${formatters.ufs.format(p.final)}`
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
Object.keys(promotions).forEach(name => {
|
|
||||||
promotions_names.add(name)
|
|
||||||
})
|
|
||||||
const temp = Object.values(promotions)
|
|
||||||
|
|
||||||
const data = [
|
|
||||||
unidad.sold ? `<span class="ui yellow text">Vendida</span>` : 'Libre',
|
|
||||||
tipo.charAt(0).toUpperCase() + tipo.slice(1),
|
tipo.charAt(0).toUpperCase() + tipo.slice(1),
|
||||||
unidad.proyecto_tipo_unidad.tipo_unidad.orden,
|
unidad.proyecto_tipo_unidad.tipo_unidad.orden,
|
||||||
unidad.sold && unidad.venta ? `<a href="{{ $urls->base }}/venta/${unidad.venta?.id }" data-tooltip="Valor Promesa: UF ${formatters.ufs.format(unidad.venta?.valor ?? 0)}" data-position="left center">${unidad.descripcion}</a>` : unidad.descripcion,
|
unidad.descripcion,
|
||||||
unidad.descripcion.padStart(4, '0'),
|
unidad.descripcion.padStart(4, '0'),
|
||||||
unidad.proyecto_tipo_unidad.tipologia,
|
unidad.proyecto_tipo_unidad.tipologia,
|
||||||
unidad.piso,
|
unidad.piso,
|
||||||
unidad.orientacion,
|
unidad.orientacion,
|
||||||
formatters.ufs.format(unidad.proyecto_tipo_unidad.util) ?? 0,
|
|
||||||
formatters.ufs.format(unidad.proyecto_tipo_unidad.terraza) ?? 0,
|
|
||||||
formatters.ufs.format(unidad.proyecto_tipo_unidad.vendible) ?? 0,
|
formatters.ufs.format(unidad.proyecto_tipo_unidad.vendible) ?? 0,
|
||||||
formatters.ufs.format(unidad.proyecto_tipo_unidad.superficie) ?? 0,
|
|
||||||
'UF ' + formatters.ufs.format(price.base ?? 0),
|
'UF ' + formatters.ufs.format(price.base ?? 0),
|
||||||
formatters.percent.format(price.commission ?? 0),
|
formatters.percent.format(price.commission ?? 0),
|
||||||
'UF ' + formatters.ufs.format(price.broker ?? 0),
|
'UF ' + formatters.ufs.format(price.broker ?? 0),
|
||||||
formatters.ufs.format(price.broker / unidad.proyecto_tipo_unidad.vendible),
|
formatters.ufs.format(price.broker / unidad.proyecto_tipo_unidad.vendible),
|
||||||
''
|
formatters.percent.format(price.amount ?? 0),
|
||||||
]
|
'UF ' + formatters.ufs.format(price.final ?? 0),
|
||||||
|
unidad.promotion?.start_date ?? '',
|
||||||
if (temp.length > 0) {
|
unidad.promotion?.end_date ?? '',
|
||||||
data.pop()
|
])
|
||||||
temp.forEach((p, i) => {
|
|
||||||
data.push(p.amount)
|
|
||||||
data.push(p.final)
|
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
if (promotions_names.size > 0) {
|
|
||||||
Array.from(promotions_names).forEach(name => {
|
|
||||||
data.push('')
|
|
||||||
data.push('')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tableData.push(data)
|
|
||||||
})
|
|
||||||
|
|
||||||
this.setup().titles(promotions_names)
|
|
||||||
this.setup().table()
|
|
||||||
|
|
||||||
const table = this.table
|
|
||||||
table.clear()
|
|
||||||
|
|
||||||
table.rows.add(tableData)
|
table.rows.add(tableData)
|
||||||
table.draw()
|
table.draw()
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
class Proyecto {
|
class Proyecto {
|
||||||
id
|
id
|
||||||
estados
|
estados
|
||||||
|
@ -141,7 +141,7 @@
|
|||||||
@include('layout.body.scripts.chartjs')
|
@include('layout.body.scripts.chartjs')
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
const superficies = {
|
const superficies = {
|
||||||
ids: {
|
ids: {
|
||||||
vendible: '',
|
vendible: '',
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
class Unidad
|
class Unidad
|
||||||
{
|
{
|
||||||
id
|
id
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
@include('layout.body.scripts.datatables')
|
@include('layout.body.scripts.datatables')
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
class Row
|
class Row
|
||||||
{
|
{
|
||||||
proyecto
|
proyecto
|
||||||
|
@ -150,17 +150,15 @@
|
|||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@include('layout.body.scripts.rut')
|
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
const regiones = [
|
const regiones = [
|
||||||
@foreach ($regiones as $region)
|
@foreach ($regiones as $region)
|
||||||
'<div class="item" data-value="{{$region->id}}">{{$region->numeral}} - {{$region->descripcion}}</div>',
|
'<div class="item" data-value="{{$region->id}}">{{$region->descripcion}}</div>',
|
||||||
@endforeach
|
@endforeach
|
||||||
]
|
]
|
||||||
|
|
||||||
class RutHandler {
|
class Rut {
|
||||||
ids
|
ids
|
||||||
patterns
|
patterns
|
||||||
valid
|
valid
|
||||||
@ -224,7 +222,7 @@
|
|||||||
if (!this.is().like(rut) || (not_suspicious && this.is().suspicious(rut))) {
|
if (!this.is().like(rut) || (not_suspicious && this.is().suspicious(rut))) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return Rut.validar(this.get().digits(rut), this.get().verifier(rut))
|
return this.get().verifier(rut).toLowerCase() === this.calculate().verifier(this.get().digits(rut))
|
||||||
}
|
}
|
||||||
verify(event) {
|
verify(event) {
|
||||||
this.alert().valid()
|
this.alert().valid()
|
||||||
@ -404,21 +402,12 @@
|
|||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
|
||||||
'<label>Otros Datos</label>',
|
|
||||||
'<div class="inline fields">',
|
|
||||||
'<div class="four wide field">',
|
|
||||||
'<input type="email" name="email" placeholder="Email" />',
|
|
||||||
'</div>',
|
|
||||||
'<div class="field">',
|
|
||||||
'<input type="text" name="telefono" placeholder="Teléfono" />',
|
|
||||||
'</div>',
|
|
||||||
'</div>'
|
'</div>'
|
||||||
]
|
]
|
||||||
return lines.join("\n")
|
return lines.join("\n")
|
||||||
}
|
}
|
||||||
activate() {
|
activate() {
|
||||||
new RutHandler({id: '#rut', alert_id: '#alert_rut', valid: this.valid})
|
new Rut({id: '#rut', alert_id: '#alert_rut', valid: this.valid})
|
||||||
const comuna = new Comuna('#comuna')
|
const comuna = new Comuna('#comuna')
|
||||||
new Region({id: '#region', comuna})
|
new Region({id: '#region', comuna})
|
||||||
}
|
}
|
||||||
@ -476,13 +465,11 @@
|
|||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'<div>Representante Legal</div>',
|
'<div>Representante Legal</div>',
|
||||||
'<div class="ui divider"></div>',
|
|
||||||
this.persona.draw()
|
|
||||||
]
|
]
|
||||||
return lines.join("\n")
|
return [lines.join("\n"), this.persona.draw()].join("\n")
|
||||||
}
|
}
|
||||||
activate() {
|
activate() {
|
||||||
new RutHandler({id: '#rut_sociedad', alert_id: '#alert_rut_sociedad'})
|
new Rut({id: '#rut_sociedad', alert_id: '#alert_rut_sociedad'})
|
||||||
const comuna = new Comuna('#comuna_sociedad')
|
const comuna = new Comuna('#comuna_sociedad')
|
||||||
new Region({id: '#region_sociedad', comuna})
|
new Region({id: '#region_sociedad', comuna})
|
||||||
this.persona.activate()
|
this.persona.activate()
|
||||||
@ -497,7 +484,6 @@
|
|||||||
draw() {
|
draw() {
|
||||||
let lines = [
|
let lines = [
|
||||||
this.persona.draw(),
|
this.persona.draw(),
|
||||||
'<div class="ui divider"></div>',
|
|
||||||
'<label for="rut">RUT Otro</label>',
|
'<label for="rut">RUT Otro</label>',
|
||||||
'<div class="inline field">',
|
'<div class="inline field">',
|
||||||
'<input type="text" id="rut_otro" name="rut_otro" required />',
|
'<input type="text" id="rut_otro" name="rut_otro" required />',
|
||||||
@ -550,22 +536,13 @@
|
|||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
|
||||||
'<label>Otros Datos para Otro</label>',
|
|
||||||
'<div class="inline fields">',
|
|
||||||
'<div class="four wide field">',
|
|
||||||
'<input type="email" name="email_otro" placeholder="Email" />',
|
|
||||||
'</div>',
|
|
||||||
'<div class="field">',
|
|
||||||
'<input type="text" name="telefono_otro" placeholder="Teléfono" />',
|
|
||||||
'</div>',
|
|
||||||
'</div>'
|
'</div>'
|
||||||
]
|
]
|
||||||
return lines.join("\n")
|
return lines.join("\n")
|
||||||
}
|
}
|
||||||
activate() {
|
activate() {
|
||||||
this.persona.activate()
|
this.persona.activate()
|
||||||
new RutHandler({id: '#rut_otro', alert_id: '#alert_rut_otro'})
|
new Rut({id: '#rut_otro', alert_id: '#alert_rut_otro'})
|
||||||
const comuna = new Comuna('#comuna_otro')
|
const comuna = new Comuna('#comuna_otro')
|
||||||
new Region({id: '#region_otro', comuna})
|
new Region({id: '#region_otro', comuna})
|
||||||
}
|
}
|
||||||
@ -628,8 +605,6 @@
|
|||||||
parent.find("[name='extra']").val(data.propietario.direccion.extra)
|
parent.find("[name='extra']").val(data.propietario.direccion.extra)
|
||||||
parent.find('#region').dropdown('set selected', data.propietario.direccion.comuna.provincia.region.id)
|
parent.find('#region').dropdown('set selected', data.propietario.direccion.comuna.provincia.region.id)
|
||||||
parent.find('#comuna').dropdown('set selected', data.propietario.direccion.comuna.id)
|
parent.find('#comuna').dropdown('set selected', data.propietario.direccion.comuna.id)
|
||||||
parent.find("[name='email']").val(data.propietario.email)
|
|
||||||
parent.find("[name='telefono']").val(data.propietario.telefono)
|
|
||||||
|
|
||||||
if (data.propietario.representante !== '') {
|
if (data.propietario.representante !== '') {
|
||||||
document.getElementById(this.ids.tipo).trigger('check')
|
document.getElementById(this.ids.tipo).trigger('check')
|
||||||
@ -808,9 +783,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
const cdo = structuredClone(calendar_date_options)
|
$('#fecha_venta_calendar').calendar(calendar_date_options)
|
||||||
cdo['maxDate'] = new Date()
|
|
||||||
$('#fecha_venta_calendar').calendar(cdo)
|
|
||||||
new Propietario({id: '#propietario', id_tipo: 'persona_propietario', id_cantidad: 'cantidad_propietario'})
|
new Propietario({id: '#propietario', id_tipo: 'persona_propietario', id_cantidad: 'cantidad_propietario'})
|
||||||
new Proyecto({unidades_id: '#unidades', proyecto_id: '#proyecto'})
|
new Proyecto({unidades_id: '#unidades', proyecto_id: '#proyecto'})
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
class Cierre {
|
class Cierre {
|
||||||
id
|
id
|
||||||
proyecto_id
|
proyecto_id
|
||||||
|
@ -120,7 +120,7 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
function action(action, cierre_id) {
|
function action(action, cierre_id) {
|
||||||
const url = '{{$urls->base}}/api/cierre/' + cierre_id + '/' + action
|
const url = '{{$urls->base}}/api/cierre/' + cierre_id + '/' + action
|
||||||
console.debug(url)
|
console.debug(url)
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
@include('layout.body.scripts.datatables')
|
@include('layout.body.scripts.datatables')
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
const cuotas_tables = new DataTable('#cuotas', {
|
const cuotas_tables = new DataTable('#cuotas', {
|
||||||
language: {
|
language: {
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
@include('layout.body.scripts.datatables')
|
@include('layout.body.scripts.datatables')
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
const cuotas_tables = new DataTable('#cuotas', {
|
const cuotas_tables = new DataTable('#cuotas', {
|
||||||
language: {
|
language: {
|
||||||
|
@ -54,23 +54,22 @@
|
|||||||
}
|
}
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
const url = '{{$urls->api}}/ventas/pago/{{$venta->resciliacion()->id}}'
|
const url = '{{$urls->api}}/ventas/pago/{{$venta->resciliacion()->id}}'
|
||||||
let old = new Date(Date.parse('{{$venta->resciliacion()?->fecha->format('Y-m-d') ?? $venta->currentEstado()->fecha->format('Y-m-d') ?? $venta->fecha->format('Y-m-d')}}') + 24 * 60 * 60 * 1000)
|
let old = new Date({{$venta->resciliacion()?->fecha->format('Y') ?? date('Y')}},
|
||||||
|
{{$venta->resciliacion()?->fecha->format('n') ?? date('n')}}-1, {{$venta->resciliacion()?->fecha->format('j') ?? date('j')}})
|
||||||
calendar_date_options['initialDate'] = old
|
calendar_date_options['initialDate'] = old
|
||||||
calendar_date_options['onChange'] = function(date, text, mode) {
|
calendar_date_options['onChange'] = function(date, text, mode) {
|
||||||
if (date.getTime() === old.getTime()) {
|
if (date.getTime() === old.getTime()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const body = new FormData()
|
const body = new FormData()
|
||||||
const fecha = new Date(date.getTime())
|
body.set('fecha', date.toISOString())
|
||||||
fecha.setDate(fecha.getDate() - 1)
|
|
||||||
body.set('fecha', fecha.toISOString())
|
|
||||||
$('#loading-spinner-fecha').show()
|
$('#loading-spinner-fecha').show()
|
||||||
APIClient.fetch(url, {method: 'post', body}).then(response => {
|
APIClient.fetch(url, {method: 'post', body}).then(response => {
|
||||||
$('#loading-spinner-fecha').hide()
|
$('#loading-spinner-fecha').hide()
|
||||||
if (!response) {
|
if (!response) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
old = new Date(date.getTime())
|
old = date
|
||||||
alertResponse('Fecha cambiada correctamente.')
|
alertResponse('Fecha cambiada correctamente.')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
@section('venta_content')
|
@section('venta_content')
|
||||||
<div class="ui list">
|
<div class="ui list">
|
||||||
@if (isset($venta->formaPago()->pie))
|
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="header">Valor Pagado</div>
|
<div class="header">Valor Pagado</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@ -16,16 +15,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@else
|
|
||||||
<div class="item">
|
|
||||||
<div class="ui compact warning message">
|
|
||||||
<div class="content">
|
|
||||||
<i class="exclamation triangle icon"></i>
|
|
||||||
No tiene valor pagado
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
Multa Estandar
|
Multa Estandar
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
const editVenta = {
|
const editVenta = {
|
||||||
getMonthsList() {
|
getMonthsList() {
|
||||||
const formatter = new Intl.DateTimeFormat('es-CL', {month: 'long'})
|
const formatter = new Intl.DateTimeFormat('es-CL', {month: 'long'})
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@include('layout.body.scripts.rut')
|
|
||||||
|
|
||||||
@push('page_scripts')
|
@push('page_scripts')
|
||||||
@include('ventas.facturacion.show.factura')
|
@include('ventas.facturacion.show.factura')
|
||||||
@include('ventas.facturacion.show.propietario')
|
@include('ventas.facturacion.show.propietario')
|
||||||
|
@ -194,8 +194,7 @@
|
|||||||
},
|
},
|
||||||
unidad: ({unidad, no, classes, formatters}) => {
|
unidad: ({unidad, no, classes, formatters}) => {
|
||||||
const descuento = this.props.terreno.valor * unidad.prorrateo * this.props.proporcion
|
const descuento = this.props.terreno.valor * unidad.prorrateo * this.props.proporcion
|
||||||
const precio = unidad.precio * this.props.proporcion
|
const bruto = unidad.precio - descuento
|
||||||
const bruto = precio - descuento
|
|
||||||
const neto = bruto / 1.19
|
const neto = bruto / 1.19
|
||||||
const data = [
|
const data = [
|
||||||
no,
|
no,
|
||||||
@ -257,7 +256,7 @@
|
|||||||
tooltips.neto = ` data-tooltip="No coinciden netos! Promesa: ${formatters.pesos.format(this.props.detalle.neto)} - Unidades: ${formatters.pesos.format(this.props.total.neto)}"`
|
tooltips.neto = ` data-tooltip="No coinciden netos! Promesa: ${formatters.pesos.format(this.props.detalle.neto)} - Unidades: ${formatters.pesos.format(this.props.total.neto)}"`
|
||||||
}
|
}
|
||||||
if (this.props.total.iva !== this.props.detalle.iva) {
|
if (this.props.total.iva !== this.props.detalle.iva) {
|
||||||
tooltips.iva = ` data-tooltip="No coinciden IVAs! Promesa: ${formatters.pesos.format(this.props.detalle.iva)} - Unidades: ${formatters.pesos.format(this.props.total.iva)}"`
|
tooltips.iva = ` data-tooltip="No coinciden ivas! Promesa: ${formatters.pesos.format(this.props.detalle.iva)} - Unidades: ${formatters.pesos.format(this.props.total.iva)}"`
|
||||||
}
|
}
|
||||||
if (this.props.total.total !== this.props.detalle.total) {
|
if (this.props.total.total !== this.props.detalle.total) {
|
||||||
tooltips.total = ` data-tooltip="No coinciden totales! Promesa: ${formatters.pesos.format(this.props.detalle.total)} - Unidades: ${formatters.pesos.format(this.props.total.total)}"`
|
tooltips.total = ` data-tooltip="No coinciden totales! Promesa: ${formatters.pesos.format(this.props.detalle.total)} - Unidades: ${formatters.pesos.format(this.props.total.total)}"`
|
||||||
@ -400,7 +399,7 @@
|
|||||||
},
|
},
|
||||||
total: () => {
|
total: () => {
|
||||||
this.props.total.exento = this.props.detalle.terreno
|
this.props.total.exento = this.props.detalle.terreno
|
||||||
this.props.total.neto = (this.props.unidades.reduce((sum, unidad) => sum + unidad.precio, 0) * this.props.proporcion - this.props.total.exento) / 1.19
|
this.props.total.neto = (this.props.unidades.reduce((sum, unidad) => sum + unidad.precio, 0) - this.props.total.exento) / 1.19
|
||||||
this.props.total.iva = this.props.total.neto * 0.19
|
this.props.total.iva = this.props.total.neto * 0.19
|
||||||
this.props.total.total = this.props.total.neto + this.props.total.iva + this.props.total.exento
|
this.props.total.total = this.props.total.neto + this.props.total.iva + this.props.total.exento
|
||||||
},
|
},
|
||||||
|
@ -28,11 +28,7 @@
|
|||||||
facturas.draw().facturas()
|
facturas.draw().facturas()
|
||||||
},
|
},
|
||||||
rut: rut => {
|
rut: rut => {
|
||||||
rut = rut.replaceAll(/~\d|\.|-/g, '')
|
this.props.rut = rut
|
||||||
const digito = rut.slice(-1)
|
|
||||||
rut = rut.slice(0, -1)
|
|
||||||
this.props.rut = Rut.format(rut) + '-' + digito
|
|
||||||
document.getElementById('rut'+this.props.index).value = this.props.rut
|
|
||||||
facturas.venta.update().facturas()
|
facturas.venta.update().facturas()
|
||||||
facturas.draw().facturas()
|
facturas.draw().facturas()
|
||||||
},
|
},
|
||||||
@ -76,7 +72,7 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
rut: () => {
|
rut: () => {
|
||||||
document.getElementById('rut'+this.props.index).addEventListener('change', inputEvent => {
|
document.getElementById('rut'+this.props.index).addEventListener('input', inputEvent => {
|
||||||
const rut = inputEvent.currentTarget.value
|
const rut = inputEvent.currentTarget.value
|
||||||
if (rut === this.props.rut) {
|
if (rut === this.props.rut) {
|
||||||
return
|
return
|
||||||
@ -85,7 +81,7 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
nombre: () => {
|
nombre: () => {
|
||||||
document.getElementById('propietario'+this.props.index).addEventListener('change', inputEvent => {
|
document.getElementById('propietario'+this.props.index).addEventListener('input', inputEvent => {
|
||||||
const nombre = inputEvent.currentTarget.value
|
const nombre = inputEvent.currentTarget.value
|
||||||
if (nombre === this.props.nombre) {
|
if (nombre === this.props.nombre) {
|
||||||
return
|
return
|
||||||
@ -94,7 +90,7 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
direccion: () => {
|
direccion: () => {
|
||||||
document.getElementById('direccion_propietario'+this.props.index).addEventListener('change', inputEvent => {
|
document.getElementById('direccion_propietario'+this.props.index).addEventListener('input', inputEvent => {
|
||||||
const direccion = inputEvent.currentTarget.value
|
const direccion = inputEvent.currentTarget.value
|
||||||
if (direccion === this.props.direccion) {
|
if (direccion === this.props.direccion) {
|
||||||
return
|
return
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
const url = '{{$urls->api}}/ventas/unidad/' + this.props.id + '/prorrateo'
|
const url = '{{$urls->api}}/ventas/unidad/' + this.props.id + '/prorrateo'
|
||||||
const method = 'post'
|
const method = 'post'
|
||||||
const body = new FormData()
|
const body = new FormData()
|
||||||
body.set('prorrateo', (parseFloat(newValue) / 100).toFixed(8))
|
body.set('prorrateo', newValue)
|
||||||
return fetchAPI(url, {method, body}).then(response => {
|
return fetchAPI(url, {method, body}).then(response => {
|
||||||
if (!response) {
|
if (!response) {
|
||||||
return
|
return
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user