Compare commits
30 Commits
genericAss
...
creatingNe
| Author | SHA1 | Date | |
|---|---|---|---|
| abd8168dbf | |||
| 79059fb91b | |||
| 1b2484fbf2 | |||
| 168a6a352e | |||
| 8185a42331 | |||
| 64a6ddafb5 | |||
| 54ef088fe0 | |||
| b829f09330 | |||
| b03d152f11 | |||
| 0ec20a4c67 | |||
| 1605b1cea3 | |||
| d4fadf08bc | |||
| de84da4482 | |||
| 697d0fe769 | |||
| cb5d30b4e0 | |||
| 6c91cad46c | |||
| ccd9e10351 | |||
| 30f755c0b2 | |||
| 231e7fe2e6 | |||
| f820a22a4f | |||
| 0cdfd21fa2 | |||
| fee3db486f | |||
| 87181696e1 | |||
| 8b22c0db9c | |||
| 7feb3a6f5d | |||
| 18ee0ad333 | |||
| e5d90bc32d | |||
| 4928481f72 | |||
|
|
2d11218076 | ||
| 59a4d6e4a5 |
@@ -1 +1,2 @@
|
|||||||
Options -Indexes
|
Options -Indexes
|
||||||
|
Deny from all
|
||||||
|
|||||||
@@ -1,10 +1,29 @@
|
|||||||
|
# Stage 1 - the build process
|
||||||
|
FROM composer:1.7.1 as build-deps
|
||||||
|
ENV COMPOSER_ALLOW_SUPERUSER 1
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN composer install
|
||||||
|
RUN composer test
|
||||||
|
|
||||||
|
# Stage 2 - the production environment
|
||||||
FROM ubuntu:16.04
|
FROM ubuntu:16.04
|
||||||
|
|
||||||
# Updating
|
|
||||||
RUN apt-get -y update && apt-get -y upgrade
|
RUN apt-get -y update && apt-get -y upgrade
|
||||||
|
|
||||||
# Installing php, apache and supplementary software
|
RUN apt-get -y install apache2 \
|
||||||
RUN apt-get -y install apache2 php7.0 libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-mbstring php7.0-gd php7.0-intl php7.0-xml php7.0-mysql php7.0-mcrypt php7.0-zip curl git unzip composer
|
php7.0 \
|
||||||
|
libapache2-mod-php7.0 \
|
||||||
|
php7.0-cli \
|
||||||
|
php7.0-common \
|
||||||
|
php7.0-mbstring \
|
||||||
|
php7.0-gd \
|
||||||
|
php7.0-intl \
|
||||||
|
php7.0-xml \
|
||||||
|
php7.0-mysql \
|
||||||
|
php7.0-mcrypt
|
||||||
|
|
||||||
# Enable apache mods
|
# Enable apache mods
|
||||||
RUN a2enmod php7.0
|
RUN a2enmod php7.0
|
||||||
@@ -20,24 +39,14 @@ ENV APACHE_RUN_GROUP www-data
|
|||||||
ENV APACHE_LOG_DIR /var/log/apache2
|
ENV APACHE_LOG_DIR /var/log/apache2
|
||||||
ENV APACHE_LOCK_DIR /var/lock/apache2
|
ENV APACHE_LOCK_DIR /var/lock/apache2
|
||||||
|
|
||||||
# Expose apache
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
# Copy this repo into place.
|
|
||||||
ADD . /var/www/site
|
|
||||||
WORKDIR /var/www/site
|
WORKDIR /var/www/site
|
||||||
|
COPY --from=build-deps /root .
|
||||||
|
|
||||||
# Testing permisions
|
RUN touch logs/app.log
|
||||||
RUN chmod 777 -R .
|
RUN chmod 777 logs/app.log
|
||||||
|
|
||||||
# Installing dependencies
|
# Update the default apache site
|
||||||
RUN composer install
|
ADD docker/apache-config.conf /etc/apache2/sites-enabled/000-default.conf
|
||||||
|
|
||||||
# Unit tests
|
# By default start up apache in the foreground
|
||||||
RUN composer test
|
|
||||||
|
|
||||||
# Update the default apache site with the config we created.
|
|
||||||
ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf
|
|
||||||
|
|
||||||
# By default start up apache in the foreground, override with /bin/bash for interative
|
|
||||||
CMD /usr/sbin/apache2ctl -D FOREGROUND
|
CMD /usr/sbin/apache2ctl -D FOREGROUND
|
||||||
|
|||||||
0
api-payroll/logs/app.log
Executable file
0
api-payroll/logs/app.log
Executable file
@@ -1,3 +1,5 @@
|
|||||||
|
allow from all
|
||||||
|
|
||||||
<IfModule mod_rewrite.c>
|
<IfModule mod_rewrite.c>
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
|
||||||
|
|||||||
7
api-payroll/public/css/bootstrap-datepicker.min.css
vendored
Normal file
7
api-payroll/public/css/bootstrap-datepicker.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
243
api-payroll/public/css/landing.css
Normal file
243
api-payroll/public/css/landing.css
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
body {
|
||||||
|
background-color: #e3e3e3;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.datepicker{
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
#newViewBody{
|
||||||
|
top:17%;
|
||||||
|
left:1%;
|
||||||
|
width:98%;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation_spot{
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#newViewBody .modal-body{
|
||||||
|
color: #000;
|
||||||
|
border:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#newViewBody .panel-default{
|
||||||
|
border: 3px solid #4A89A5;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#newViewBody .panel > .panel-heading {
|
||||||
|
background-image: none;
|
||||||
|
background-color: #4A89A5;
|
||||||
|
color: white;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#newViewBody .btn-default{
|
||||||
|
border: 2px solid #62655F;
|
||||||
|
background: #F9DFAF;
|
||||||
|
}
|
||||||
|
|
||||||
|
#newViewBody .btn-default:hover{
|
||||||
|
border: 2px solid #62655F;
|
||||||
|
background: #F9DFAF;
|
||||||
|
}
|
||||||
|
|
||||||
|
#newViewBody .alert-success{
|
||||||
|
background: #C6E97C;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modalHeaderError{
|
||||||
|
background-color: #d9534f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.modalHeaderSuccess{
|
||||||
|
background-color: #5bc0de;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.metro{
|
||||||
|
width:auto;
|
||||||
|
height:auto;
|
||||||
|
}
|
||||||
|
.metroBox{
|
||||||
|
margin: 0 auto;
|
||||||
|
width:100%;
|
||||||
|
padding: 0;
|
||||||
|
height:auto;
|
||||||
|
display:table;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.metroBox h3{
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
.metroBox a{
|
||||||
|
text-decoration: none;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.boxElement{
|
||||||
|
color: #fff;
|
||||||
|
height:210px;
|
||||||
|
width: 318px;
|
||||||
|
float:left;
|
||||||
|
margin:0 5px 5px 0;
|
||||||
|
padding:0 1% 0 1%;
|
||||||
|
}
|
||||||
|
.boxElement:hover{
|
||||||
|
color: #fff;
|
||||||
|
background: #483D8B;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.amarelo{
|
||||||
|
background:#f4c20d;
|
||||||
|
}
|
||||||
|
.vermelho{
|
||||||
|
background:#da542d;
|
||||||
|
}
|
||||||
|
.azul{
|
||||||
|
background:#009bad;
|
||||||
|
}
|
||||||
|
.azulFuerte{
|
||||||
|
background:#5636b0;
|
||||||
|
}
|
||||||
|
.verde{
|
||||||
|
background-color: #009f00;
|
||||||
|
}
|
||||||
|
.violet{
|
||||||
|
background-color: #a400ab;
|
||||||
|
}
|
||||||
|
.iconPanel{
|
||||||
|
font-size: 130px;
|
||||||
|
}
|
||||||
|
@media (max-width: 310px){
|
||||||
|
.boxElement{
|
||||||
|
width: 245px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 311px) and (max-width: 353px){
|
||||||
|
.boxElement{
|
||||||
|
width: 265px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 354px) and (max-width: 365px){
|
||||||
|
.boxElement{
|
||||||
|
width: 320px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 366px) and (max-width: 520px){
|
||||||
|
.boxElement{
|
||||||
|
width: 320px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 521px) and (max-width: 549px){
|
||||||
|
.boxElement{
|
||||||
|
width: 235px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 550px) and (max-width: 590px){
|
||||||
|
.boxElement{
|
||||||
|
width: 250px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 591px) and (max-width: 610px){
|
||||||
|
.boxElement{
|
||||||
|
width: 265px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 611px) and (max-width: 630px){
|
||||||
|
.boxElement{
|
||||||
|
width: 275px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 631px) and (max-width: 655px){
|
||||||
|
.boxElement{
|
||||||
|
width: 280px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 656px) and (max-width: 699px){
|
||||||
|
.boxElement{
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 700px) and (max-width: 739px){
|
||||||
|
.boxElement{
|
||||||
|
width: 320px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 740px) and (max-width: 769px){
|
||||||
|
.boxElement{
|
||||||
|
width: 340px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 770px) and (max-width: 1230px){
|
||||||
|
.boxElement{
|
||||||
|
width: 280px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.formato_texto_custom{
|
||||||
|
width: 97%;
|
||||||
|
float: left;
|
||||||
|
border: 1px solid #222;
|
||||||
|
padding: 1%;
|
||||||
|
margin: .5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cliente_muestra_producto{
|
||||||
|
width: 96%;
|
||||||
|
padding: 1%;
|
||||||
|
margin: 0 1% 2% 1%;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea{
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-brand {
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
#custom-bootstrap-menu.navbar-default {
|
||||||
|
font-size: 14px;
|
||||||
|
background-color: rgba(27, 35, 78, 1);
|
||||||
|
border-width: 1px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a {
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
background-color: rgba(27, 35, 78, 1);
|
||||||
|
}
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a:hover,
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a:focus {
|
||||||
|
color: rgba(106, 171, 232, 1);
|
||||||
|
background-color: rgba(27, 35, 78, 1);
|
||||||
|
}
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a,
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a:hover,
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a:focus {
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
background-color: rgba(27, 35, 78, 1);
|
||||||
|
}
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-toggle {
|
||||||
|
border-color: #1b234e;
|
||||||
|
}
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-toggle:hover,
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-toggle:focus {
|
||||||
|
background-color: #1b234e;
|
||||||
|
}
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-toggle .icon-bar {
|
||||||
|
background-color: #1b234e;
|
||||||
|
}
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-toggle:hover .icon-bar,
|
||||||
|
#custom-bootstrap-menu.navbar-default .navbar-toggle:focus .icon-bar {
|
||||||
|
background-color: #1b234e;
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ body {
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border-top: 5px solid #bdb035;
|
border-top: 5px solid #5bc0de;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
.login-block h1 {
|
.login-block h1 {
|
||||||
@@ -58,15 +58,15 @@ body {
|
|||||||
background-size: 16px 80px;
|
background-size: 16px 80px;
|
||||||
}
|
}
|
||||||
.login-block input:active, .login-block input:focus {
|
.login-block input:active, .login-block input:focus {
|
||||||
border: 1px solid #bdb035;
|
border: 1px solid #5bc0de;
|
||||||
}
|
}
|
||||||
.login-block #loginButon {
|
.login-block #loginButon {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
background: #bdb035;
|
background: #009bad;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border: 1px solid #6d661c;
|
border: 1px solid #000;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@@ -75,7 +75,7 @@ body {
|
|||||||
outline: none;
|
outline: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.login-block button:hover {
|
|
||||||
background: #c7b935;
|
#modalLoginErrorHeader{
|
||||||
border: 1px solid #6d661c;
|
background-color: #d9534f;
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
api-payroll/public/fonts/glyphicons-halflings-regular.ttf
Normal file
BIN
api-payroll/public/fonts/glyphicons-halflings-regular.ttf
Normal file
Binary file not shown.
BIN
api-payroll/public/fonts/glyphicons-halflings-regular.woff
Normal file
BIN
api-payroll/public/fonts/glyphicons-halflings-regular.woff
Normal file
Binary file not shown.
BIN
api-payroll/public/fonts/glyphicons-halflings-regular.woff2
Normal file
BIN
api-payroll/public/fonts/glyphicons-halflings-regular.woff2
Normal file
Binary file not shown.
93
api-payroll/public/html/NewEmployee.php
Normal file
93
api-payroll/public/html/NewEmployee.php
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<script src="../js/NewEmployee.js"></script>
|
||||||
|
<script src="../js/getBaseUrl.js"></script>
|
||||||
|
|
||||||
|
<form class="form-horizontal" id="newEmployeeForm">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">New employee</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-4 control-label" for="newEmployeeFirstName">First name</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input id="newEmployeeFirstName" name="newEmployeeFirstName" type="text" class="form-control input-md">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-4 control-label" for="newEmployeeMiddleName">Middle name</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input id="newEmployeeMiddleName" name="newEmployeeMiddleName" type="text" class="form-control input-md">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-4 control-label" for="newEmployeeLastName">Last name</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input id="newEmployeeLastName" name="newEmployeeLastName" type="text" class="form-control input-md">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-4 control-label" for="newEmployeeBirthDate">Birth date</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input id="newEmployeeBirthDate" name="newEmployeeBirthDate" type="text" class="form-control input-md datepicker">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-4 control-label" for="newEmployeeEmail">Email</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input id="newEmployeeEmail" name="newEmployeeEmail" type="text" class="form-control input-md">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-4 control-label" for="newEmployeePhone">Phone</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input id="newEmployeePhone" name="newEmployeePhone" type="text" class="form-control input-md">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-4 control-label" for="newEmployeeType">Rol</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<select class="form-control input-md" name="newEmployeeType" id="newEmployeeType">
|
||||||
|
<option>Employee type</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-4 control-label" for="NewEmpployyContractType">Contract type</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<select class="form-control input-md" name="NewEmpployyContractType" id="NewEmpployyContractType">
|
||||||
|
<option>Contract type</option>
|
||||||
|
<option value="INTERNO">interno</option>
|
||||||
|
<option value="EXTERNO">Externo</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row col-md-offset-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<a href="#" class="btn btn-lg btn-success " onclick="saveNewEmployee();">Create</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
231
api-payroll/public/html/landing.php
Normal file
231
api-payroll/public/html/landing.php
Normal file
@@ -0,0 +1,231 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if(!isset($_SESSION['userName'])){
|
||||||
|
header("Location: ./login.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Latest compiled and minified CSS -->
|
||||||
|
<link rel="stylesheet" href="../css/bootstrap.min.css">
|
||||||
|
|
||||||
|
<!-- jQuery library -->
|
||||||
|
<script src="../js/jquery.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Latest compiled JavaScript -->
|
||||||
|
<script src="../js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="col-md-12" id="navigation_spot">
|
||||||
|
<!-- NavBar-->
|
||||||
|
<div id="custom-bootstrap-menu" class="navbar navbar-default " role="navigation">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar-header"><a class="navbar-brand" href="#"></a>
|
||||||
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="collapse navbar-collapse navbar-menubuilder">
|
||||||
|
<ul class="nav navbar-nav navbar-left" id="nevatation-options">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-user"></span> Employees<span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="#" data-nav_accion="NewEmployee.php"> New employee</a></li>
|
||||||
|
<li><a href="#" data-nav_accion="EditEmployee.php"> Modify employee</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#" onclick="loadView();"><span class="glyphicon glyphicon-tasks"></span> Management</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#" onclick="loadView();"><span class="glyphicon glyphicon-wrench"></span> Change password</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li>
|
||||||
|
<a href="#" onclick="logout();"><span class="fa fa-fw fa-power-off"></span> logout</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-12" id="newViewBody"></div>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
=================================================================================
|
||||||
|
Modals for errors encountered by ajax
|
||||||
|
=================================================================================
|
||||||
|
-->
|
||||||
|
|
||||||
|
<div id="modalErrorInternetConnection" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header modalHeaderError">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">An error has occurred</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>Please verify your internet connection and try again.</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="modalError404" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header modalHeaderError">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">An error has occurred</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>Unable to find the requested url in the sever.</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="modalError500" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header modalHeaderError">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">An error has occurred</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>The server has encountered an internal error, please try again later.</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="modalErrorParsererror" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header modalHeaderError">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">An error has occurred</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>The response from the sever wasn't a proper JSON format</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="modalErrorTimeout" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header modalHeaderError">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">An error has occurred</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>The request timeout, please try again or verify your connection.</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="modalErrorOther" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header modalHeaderError">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">An error has occurred</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>An unknown error occurred.</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
=================================================================================
|
||||||
|
Generic response modals
|
||||||
|
=================================================================================
|
||||||
|
-->
|
||||||
|
|
||||||
|
<div id="modalServerResponseError" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header modalHeaderError">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">An error has occurred</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p id="modalResponseError"></p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="modalServerResponseSuccess" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header modalHeaderSuccess" id="modalHeaderServerResponseSuccess">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">Success</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p id="serverResponseSuccess"></p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script src="../js/getBaseUrl.js"></script>
|
||||||
|
<script src="../js/landing.js"></script>
|
||||||
|
<script src="../js/bootstrap-datepicker.min.js"></script>
|
||||||
|
|
||||||
|
<link href="../css/bootstrap-datepicker.min.css" rel="stylesheet">
|
||||||
|
<link href="../css/landing.css" rel="stylesheet">
|
||||||
@@ -1,3 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if(isset($_SESSION['userName'])){
|
||||||
|
header("Location: ./landing.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<!-- Latest compiled and minified CSS -->
|
<!-- Latest compiled and minified CSS -->
|
||||||
<link rel="stylesheet" href="../css/bootstrap.min.css">
|
<link rel="stylesheet" href="../css/bootstrap.min.css">
|
||||||
|
|
||||||
@@ -41,4 +50,5 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../js/login.js"></script>
|
<script src="../js/login.js"></script>
|
||||||
|
<script src="../js/getBaseUrl.js"></script>
|
||||||
<link href="../css/login.css" rel="stylesheet">
|
<link href="../css/login.css" rel="stylesheet">
|
||||||
94
api-payroll/public/js/NewEmployee.js
Normal file
94
api-payroll/public/js/NewEmployee.js
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
/**
|
||||||
|
* Bootstrapping the starting actions for the module
|
||||||
|
*/
|
||||||
|
$(document).ready(function(){
|
||||||
|
loadEmployeeTypes();
|
||||||
|
|
||||||
|
$('.datepicker').datepicker({
|
||||||
|
format: "yyyy/mm/dd",
|
||||||
|
autoclose: true
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the the enmployee types into their select option
|
||||||
|
*/
|
||||||
|
function loadEmployeeTypes(){
|
||||||
|
let baseUrl = getbaseUrl();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: baseUrl + '/api/employee/types',
|
||||||
|
type: 'GET',
|
||||||
|
dataType: 'json',
|
||||||
|
success:function(data){
|
||||||
|
$(data).each(function(i,v){
|
||||||
|
$('#newEmployeeType').append(
|
||||||
|
'<option value="' + v.id + '">'+ v.name + '</option>'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error:function(x,e) {
|
||||||
|
let responseText = $.parseJSON(x["responseText"]);
|
||||||
|
|
||||||
|
if (x.status==0) {
|
||||||
|
$('#modalErrorInternetConnection').modal('show');
|
||||||
|
} else if(x.status==404) {
|
||||||
|
$('#modalError404').modal('show');
|
||||||
|
} else if(x.status==500) {
|
||||||
|
$('#modalServerResponseError').modal('show');
|
||||||
|
document.getElementById('modalResponseError').innerHTML = responseText['message'];
|
||||||
|
} else if(e=='parsererror') {
|
||||||
|
$('#modalErrorParsererror').modal('show');
|
||||||
|
} else if(e=='timeout'){
|
||||||
|
$('#modalErrorTimeout').modal('show');
|
||||||
|
} else {
|
||||||
|
$('#modalErrorOther').modal('show');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveNewEmployee(){
|
||||||
|
let baseUrl = getbaseUrl();
|
||||||
|
|
||||||
|
let parameters = {
|
||||||
|
"firstName":$('#newEmployeeFirstName').val(),
|
||||||
|
"middleName":$('#newEmployeeMiddleName').val(),
|
||||||
|
"lastName":$('#newEmployeeLastName').val(),
|
||||||
|
"birthDate":$('#newEmployeeBirthDate').val(),
|
||||||
|
"email":$('#newEmployeeEmail').val(),
|
||||||
|
"phone":$('#newEmployeePhone').val(),
|
||||||
|
"idEmployeeType":$('#newEmployeeType').val(),
|
||||||
|
"contractType":$('#NewEmpployyContractType').val()
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: baseUrl + '/api/employee',
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: parameters,
|
||||||
|
success:function(data){
|
||||||
|
$('#modalServerResponseSuccess').modal('show');
|
||||||
|
document.getElementById('serverResponseSuccess').innerHTML = 'The employee ' + data['fullName'] + ' has been created with the code ' + data['employeeCode'];
|
||||||
|
},
|
||||||
|
error:function(x,e) {
|
||||||
|
let responseText = $.parseJSON(x["responseText"]);
|
||||||
|
|
||||||
|
if (x.status==0) {
|
||||||
|
$('#modalErrorInternetConnection').modal('show');
|
||||||
|
} else if(x.status==404) {
|
||||||
|
$('#modalError404').modal('show');
|
||||||
|
} else if(x.status==500) {
|
||||||
|
$('#modalServerResponseError').modal('show');
|
||||||
|
document.getElementById('modalResponseError').innerHTML = responseText['message'];
|
||||||
|
} else if(e=='parsererror') {
|
||||||
|
$('#modalErrorParsererror').modal('show');
|
||||||
|
} else if(e=='timeout'){
|
||||||
|
$('#modalErrorTimeout').modal('show');
|
||||||
|
} else {
|
||||||
|
$('#modalErrorOther').modal('show');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
8
api-payroll/public/js/bootstrap-datepicker.min.js
vendored
Normal file
8
api-payroll/public/js/bootstrap-datepicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
api-payroll/public/js/getBaseUrl.js
Normal file
10
api-payroll/public/js/getBaseUrl.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* Returns the entry point url for the system, this url will be used
|
||||||
|
* to access both the api and the static resources
|
||||||
|
*
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function getbaseUrl(){
|
||||||
|
var url = window.location.href;
|
||||||
|
return url.substring(0, url.indexOf('/html/'));
|
||||||
|
}
|
||||||
77
api-payroll/public/js/landing.js
Normal file
77
api-payroll/public/js/landing.js
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* Destorys the session for the current user and redirects
|
||||||
|
* back to the login form
|
||||||
|
*/
|
||||||
|
function logout() {
|
||||||
|
let baseUrl = getbaseUrl();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: baseUrl + '/api/session/logout',
|
||||||
|
type: 'GET',
|
||||||
|
dataType: 'json',
|
||||||
|
success:function(data){
|
||||||
|
window.location.replace(baseUrl + '/html/login.php');
|
||||||
|
},
|
||||||
|
error:function(x,e) {
|
||||||
|
if (x.status==0) {
|
||||||
|
$('#modalErrorInternetConnection').modal('show');
|
||||||
|
} else if(x.status==404) {
|
||||||
|
$('#modalError404').modal('show');
|
||||||
|
} else if(x.status==500) {
|
||||||
|
$('#modalError500').modal('show');
|
||||||
|
} else if(e=='parsererror') {
|
||||||
|
$('#modalErrorParsererror').modal('show');
|
||||||
|
} else if(e=='timeout'){
|
||||||
|
$('#modalErrorTimeout').modal('show');
|
||||||
|
} else {
|
||||||
|
$('#modal_error_otro').modal('show');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entry point for loading elements from the navatation var, this functuion
|
||||||
|
* will filter the junk clicks that have landed in a dropdown menu and pass
|
||||||
|
* only the ones containing an action to the actual view loader
|
||||||
|
*/
|
||||||
|
$('#nevatation-options li a').click(function(){
|
||||||
|
|
||||||
|
let view = $(this).data('nav_accion');
|
||||||
|
|
||||||
|
if (view != "#" && view != undefined) {
|
||||||
|
loadView(view);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will fetch the html of the desired view and load it into the landing page
|
||||||
|
*
|
||||||
|
* @param requestedView string
|
||||||
|
*/
|
||||||
|
function loadView(requestedView){
|
||||||
|
let baseUrl = getbaseUrl();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: baseUrl + '/html/' + requestedView,
|
||||||
|
type: 'get',
|
||||||
|
success:function(data){
|
||||||
|
$("#newViewBody").hide().html(data).show('slow');
|
||||||
|
},
|
||||||
|
error:function(x,e) {
|
||||||
|
if (x.status==0) {
|
||||||
|
$('#modalErrorInternetConnection').modal('show');
|
||||||
|
} else if(x.status==404) {
|
||||||
|
$('#modalError404').modal('show');
|
||||||
|
} else if(x.status==500) {
|
||||||
|
$('#modalError500').modal('show');
|
||||||
|
} else if(e=='parsererror') {
|
||||||
|
$('#modalErrorParsererror').modal('show');
|
||||||
|
} else if(e=='timeout'){
|
||||||
|
$('#modalErrorTimeout').modal('show');
|
||||||
|
} else {
|
||||||
|
$('#modal_error_otro').modal('show');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,24 +1,37 @@
|
|||||||
function getbaseUrl(uriPath){
|
/**
|
||||||
var url = window.location.href;
|
* Maps the enter key to the login action
|
||||||
return url.substring(0, url.indexOf(uriPath));
|
*/
|
||||||
}
|
$(document).keypress(function(e) {
|
||||||
|
if(e.which == 13) {
|
||||||
|
processLogin();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes the input from the username and password fields and send theem to the backend
|
||||||
|
* to be validated
|
||||||
|
*
|
||||||
|
* The response from the api will contain a status that will determine if the login was
|
||||||
|
* successful or not and a message that will contain feedback which can be used to
|
||||||
|
* display errors to the user
|
||||||
|
*/
|
||||||
function processLogin() {
|
function processLogin() {
|
||||||
console.log(getbaseUrl('html/'));
|
let baseUrl = getbaseUrl();
|
||||||
var parametros = {
|
|
||||||
|
let parameters = {
|
||||||
"userName":$('#userName').val(),
|
"userName":$('#userName').val(),
|
||||||
"password":$('#password').val()
|
"password":$('#password').val()
|
||||||
};
|
};
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: getbaseUrl('/html/') + '/index.php/api/session/login',
|
url: baseUrl + '/api/session/login',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: parametros,
|
data: parameters,
|
||||||
success:function(data){
|
success:function(data){
|
||||||
console.log(JSON.stringify(data));
|
|
||||||
if(data["status"] == "success"){
|
if(data["status"] == "success"){
|
||||||
redirect("http://stackoverflow.com");
|
window.location.replace(baseUrl + '/html/landing.php');
|
||||||
|
|
||||||
}else if(data["status"] == "success" || (data["status"] === undefined)){
|
}else if(data["status"] == "success" || (data["status"] === undefined)){
|
||||||
$('#modalLoginError').modal('show');
|
$('#modalLoginError').modal('show');
|
||||||
document.getElementById('modalLoginErrorBody').innerHTML = "The server didn't respond in time, please try again or refresh this page.";
|
document.getElementById('modalLoginErrorBody').innerHTML = "The server didn't respond in time, please try again or refresh this page.";
|
||||||
@@ -31,8 +44,4 @@ console.log(getbaseUrl('html/'));
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
function redirect(url){
|
|
||||||
window.location.replace(url);
|
|
||||||
}
|
}
|
||||||
@@ -138,6 +138,7 @@ class EmployeeApplication{
|
|||||||
$email = $requestData['email'];
|
$email = $requestData['email'];
|
||||||
$this->asserts->isNotEmpty($email, "The email can't be empty.");
|
$this->asserts->isNotEmpty($email, "The email can't be empty.");
|
||||||
$this->asserts->betweenLength($email, 1, 100, "The middle name must have a length between 1 and 100 characters.");
|
$this->asserts->betweenLength($email, 1, 100, "The middle name must have a length between 1 and 100 characters.");
|
||||||
|
$this->asserts->isEmail($email, "The email isn't in a correct format");
|
||||||
|
|
||||||
$phone = $requestData['phone'];
|
$phone = $requestData['phone'];
|
||||||
$this->asserts->isNotEmpty($phone, "The phone number can't be empty.");
|
$this->asserts->isNotEmpty($phone, "The phone number can't be empty.");
|
||||||
@@ -409,6 +410,7 @@ class EmployeeApplication{
|
|||||||
$email = $requestData['email'];
|
$email = $requestData['email'];
|
||||||
$this->asserts->isNotEmpty($email, "The email can't be empty.");
|
$this->asserts->isNotEmpty($email, "The email can't be empty.");
|
||||||
$this->asserts->betweenLength($email, 1, 100, "The middle name must have a length between 1 and 100 characters.");
|
$this->asserts->betweenLength($email, 1, 100, "The middle name must have a length between 1 and 100 characters.");
|
||||||
|
$this->asserts->isEmail($email, "The email isn't in a correct format");
|
||||||
|
|
||||||
$phone = $requestData['phone'];
|
$phone = $requestData['phone'];
|
||||||
$this->asserts->isNotEmpty($phone, "The phone number can't be empty.");
|
$this->asserts->isNotEmpty($phone, "The phone number can't be empty.");
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class SessionApplication{
|
|||||||
/**
|
/**
|
||||||
* @param $userName string
|
* @param $userName string
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
function getPassword($userName){
|
function getPassword($userName){
|
||||||
$this->asserts->isNotEmpty($userName, "The username can't be empty");
|
$this->asserts->isNotEmpty($userName, "The username can't be empty");
|
||||||
@@ -51,7 +52,7 @@ class SessionApplication{
|
|||||||
$stmt->execute(array(':userName' => $userName));
|
$stmt->execute(array(':userName' => $userName));
|
||||||
$results = $stmt->fetchAll();
|
$results = $stmt->fetchAll();
|
||||||
if(!$results){
|
if(!$results){
|
||||||
exit($this->databaseSelectQueryErrorMessage);
|
throw new Exception('The user or password didnt match, please try again.');
|
||||||
}
|
}
|
||||||
$stmt = null;
|
$stmt = null;
|
||||||
return $results[0]['password'];
|
return $results[0]['password'];
|
||||||
@@ -116,12 +117,12 @@ class SessionApplication{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return array
|
||||||
*/
|
*/
|
||||||
function destroySession(){
|
function destroySession(){
|
||||||
session_destroy();
|
session_destroy();
|
||||||
|
|
||||||
return "Sucessfully logged out.";
|
return array('status' => 'success', 'message' => 'Successfully logged out.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -56,5 +56,18 @@ class Asserts{
|
|||||||
throw new Exception($errorMessage);
|
throw new Exception($errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares a string against a regex to determine if it's an email
|
||||||
|
*
|
||||||
|
* @param $string string
|
||||||
|
* @param $errorMessage string
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
function isEmail($string, $errorMessage){
|
||||||
|
if(!filter_var($string, FILTER_VALIDATE_EMAIL)){
|
||||||
|
throw new Exception($errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS `persons` (
|
|||||||
`lastName` varbinary(500) comment 'The last name of the person',
|
`lastName` varbinary(500) comment 'The last name of the person',
|
||||||
`birthDate` DATE NOT NULL DEFAULT '1900-01-01' comment 'Date of birth of the person',
|
`birthDate` DATE NOT NULL DEFAULT '1900-01-01' comment 'Date of birth of the person',
|
||||||
`email` varbinary(500) NOT NULL comment 'The email adress of the person',
|
`email` varbinary(500) NOT NULL comment 'The email adress of the person',
|
||||||
`phone` INT(10) UNSIGNED NOT NULL comment 'The phone number of the person should be the mobile one but leaves room for home ones',
|
`phone` BIGINT(10) UNSIGNED NOT NULL comment 'The phone number of the person should be the mobile one but leaves room for home ones',
|
||||||
`status` ENUM('ACTIVE', 'INACTIVE') NOT NULL DEFAULT 'ACTIVE',
|
`status` ENUM('ACTIVE', 'INACTIVE') NOT NULL DEFAULT 'ACTIVE',
|
||||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'The date on which the registry was created',
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'The date on which the registry was created',
|
||||||
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'The date of the last time the row was modified',
|
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'The date of the last time the row was modified',
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8085:80"
|
- "8085:80"
|
||||||
volumes:
|
volumes:
|
||||||
- api-payroll:/var/www/site
|
- ./volumes/apache-logs:/var/log/apache2
|
||||||
depends_on:
|
depends_on:
|
||||||
- mysql
|
- mysql
|
||||||
mysql:
|
mysql:
|
||||||
@@ -18,11 +18,11 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "3307:3307"
|
- "3307:3307"
|
||||||
volumes:
|
volumes:
|
||||||
- my-datavolume:/var/lib/mysql
|
- ./volumes/mysql-data:/var/lib/mysql
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: '12345678'
|
MYSQL_ROOT_PASSWORD: '12345678'
|
||||||
MYSQL_USER: 'sloth'
|
MYSQL_USER: 'sloth'
|
||||||
MYSQL_PASS: '12345678'
|
MYSQL_PASS: '12345678'
|
||||||
volumes:
|
volumes:
|
||||||
api-payroll:
|
mysql-data:
|
||||||
my-datavolume:
|
apache-logs:
|
||||||
|
|||||||
2
volumes/.gitignore
vendored
Normal file
2
volumes/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
mysql-data/
|
||||||
|
apache-logs/
|
||||||
1
volumes/README.md
Normal file
1
volumes/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Do not delete this directory, it'll contain the volumes created by the containers
|
||||||
Reference in New Issue
Block a user