Skip to content

Commit

Permalink
Refactor library. (#2)
Browse files Browse the repository at this point in the history
* Create index.html

* Refactor code

* Add view and recreate class implements traits.

* Add example controller and .js

* Add list periods.

* Add selected periods array

* Calcular días a disfrutar en periodos seleccionados.

* Agregar calculo de fecha final, y periodos disponibles.

* Add composer.json
  • Loading branch information
EdwinBetanc0urt authored Dec 8, 2019
1 parent 416bc12 commit 9e9f36b
Show file tree
Hide file tree
Showing 15 changed files with 1,020 additions and 553 deletions.
167 changes: 167 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@

# IDE generated files #
#######################
*.iml
atlassian-ide-plugin.xml
yuicompressor-*
*.suo
*.ntvs*
*.njsproj
*.sln



# IDE Editors #
###############

# vim
.*.sw[a-z]
*.un~
Session.vim
.netrwhist
*.swp

# vscode editor
.vscode/
.vscode

# eclipse
*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
.externalToolBuilders/
*.launch
.buildpath

# phpstorm
.idea/

# textmate
*.tmproj
*.tmproject
tmtags

# sublimetext
/*.sublime-project
*.sublime-workspace

# netbeans
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml



# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so



# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip



# Logs and databases #
######################
*.log
#*.sql
*.sqlite
.sizecache.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*
selenium-debug.log
**/*.log
*.bak
**/*.bak



# OS generated files #
######################
# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/

# Linux
.*
!.gitignore
!.htaccess
*~

# Mac OS X
.DS_Store
.DS_Store?
.AppleDouble
.LSOverride
Icon
Icon?
._*
.Spotlight-V100
.Trashes
/_MACOSX



# Node Modules #
################
node_modules/
.publish/
dist/
.dist/
bower_components/
.sass-cache/
/nbproject/
/nbproject/private/
/dist/
/test/unit/coverage/
/test/e2e/reports/

package-lock.json
yarn.lock



# Composer downloads #
######################
composer
composer.phar
docs/
/docs/
vendor/
/vendor/
/vendors/*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# lib_Vacaciones
# vacacionesVE
Libreria para el calculo vacacional
11 changes: 11 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "edwinbetanc0urt/vacaciones-ve",
"description": "Libreria para el calculo vacacional",
"keywords": ["php", "vacaciones", "vacancy", "holydays", "ve", "venezuela"],
"type": "library",
"license": "MIT",
"minimum-stability": "stable",
"require": {
"php": ">=5.6"
}
}
97 changes: 97 additions & 0 deletions controller/example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php
// Localización español
setlocale(LC_ALL, "es_VE.UTF-8", "es_VE", "spanish");
date_default_timezone_set("America/Caracas");
ini_set("default_charset", "utf-8");

define("ERRORES", E_ALL | E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
error_reporting(ERRORES);
ini_set("display_errors", "On");
ini_set("display_startup_errors", "On");

include("../vacacionesVE.php");

if (isset($_POST["setOpcion"])) {
$opcion = $_POST["setOpcion"];
}
else {
$opcion = NULL;
}


/**
* @description: Condicional según una variable enviada por POST ejecuta su función
* @param string $opcion, POST enviado ya satinado
**/
switch ($opcion) {
case 'antiguedad':
calcularAntiguedad();
break;

case 'diasPeriodo':
calcularDiasPeriodo();
break;

case 'diasTotalesAntiguedad':
calcularDiasTotalesAntiguedad();
break;

case 'listarPeriodosTotales':
listarPeriodosTotales();
break;

case 'listarPeriodosDisponibles':
listarPeriodosDisponibles();
break;

case 'calcularFechaFin':
calcularFechaFin();
break;
} // cierre del switch


function calcularAntiguedad() {
$antiguedad = vacacionesVE::_getAntiguedad($_POST["setFechaIngreso"]);
echo $antiguedad;
}

function calcularDiasPeriodo() {
$diasPeriodo = vacacionesVE::_getDiasPeriodos($_POST["setFechaIngreso"], $_POST["setPeriodos"]);
echo $diasPeriodo;
}

function calcularDiasTotalesAntiguedad() {
$diasAntiguedad = vacacionesVE::_getDiasTotalesAntiguedad($_POST["setAntiguedad"]);
echo $diasAntiguedad;
}

function listarPeriodosTotales() {
$periodos = vacacionesVE::_getPeriodosAntiguedad($_POST["setFechaIngreso"]);

header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 2000 05:00:00 GMT');
header('Content-type: application/json');
echo json_encode($periodos);
}

function listarPeriodosDisponibles() {
$periodosUtilizados = array(
"2013-2014"
);
$todosPeriodos = vacacionesVE::_getPeriodosAntiguedad($_POST["setFechaIngreso"]);

$periodosNoUtilizados = array_diff($todosPeriodos, $periodosUtilizados);
$periodosDisponibles = array_slice($periodosNoUtilizados, 0, vacacionesVE::$maxPeriodos);

header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 2000 05:00:00 GMT');
header('Content-type: application/json');
echo json_encode($periodosDisponibles);
}


function calcularFechaFin() {
$fechaFin = vacacionesVE::getFechaFinal($_POST["setFechaInicio"], $_POST["setDiasHabiles"]);
echo vacacionesVE::getFechaFormato($fechaFin);
// echo $fechaFin;
}
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Vacaciones from './vacaciones_Vzla.js';

var vacaciones = new Vacaciones();
console.log(vacaciones); // 27
// import Vacaciones from './vacaciones_Vzla';
var date = Vacaciones.getClientDate('2019-03-01', '', 'ada');
console.log(date);
// const Vacaciones = require('./vacaciones_Vzla');


// Vacaciones.a();
// console.log(Vacaciones)
66 changes: 66 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

<!DOCTYPE html>
<html lang="es">
<head>
<title>
VacacionesVE, Calculo de vacaciones para Venezuela
</title>
<meta charset="UTF-8">
<meta name="title" content="EdwinBetanc0urt GitHub Pages">
<meta name="description" content="EdwinBetanc0urt GitHub Pages">
<link rel="stylesheet" href="public/bootstrap/css/bootstrap.min.css">
</head>
<body>
<form id="vacacionesVE" name="vacacionesVE" method="post" action="index.php">
<div class="container">
<br />
<h1>VacacionesVE, Calculo de vacaciones para Venezuela.</h1>
<br />
<div class="form-row align-items-center">
<div class="row">
<div class="form-group col-12 col-sm-6">
<label for="fechaIngreso">Fecha Ingreso</label>
<input type="date" id="fechaIngreso" class="form-control" />
</div>
<div class="form-group col-6 col-sm-6">
<label for="antiguedad">Antigüedad (años)</label>
<input type="number" id="antiguedad" class="form-control" />
</div>
<div class="form-group col-3">
<label for="fechaInicio">Fecha Inicio Vacacional</label>
<input type="date" id="fechaInicio" class="form-control" />
</div>
<div class="form-group col-3">
<label for="fechaFin">Fecha Fin Vacacional</label>
<input type="text" id="fechaFin" class="form-control" />
</div>
<div class="form-group col-4">
<label for="fechaReingreso">Fecha Reingreso Vacacional</label>
<input type="date" id="fechaReingreso" class="form-control" />
</div>
<div class="form-group col-6">
<label for="fechaReingreso">
Periodos a seleccionar para el disfrute vacacional (maximo 2)
</label>
<select id="periodos" class="form-control" multiple>
<option value="">Seleccione una opcion</option>
</select>
</div>
<div class="form-group col-6">
<label for="diasPeriodo">Dias en el periodo:</label>
<input type="number" id="diasPeriodo" class="form-control" />
</div>
</div>
<br /><br />
</div>
</div>
</form>
<!-- <script type="module" src="./index.js"></script> -->
<script src="public/jquery.min.js"></script>
<script src="public/bootstrap/js/bootstrap.min.js"></script>
<script src="public/example.js"></script>
</body>
</html>
Loading

0 comments on commit 9e9f36b

Please sign in to comment.