This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Model = require('../models/model'); | |
let Restaurante = require('../models/schema_restaurante'); | |
let Admin = require('../models/schema_admin'); | |
// Moment js | |
var moment = require('moment'); | |
// Working Hours | |
var WorkingHours = require('working-hours').WorkingHours; | |
// Random String | |
var randomstring = require("randomstring"); | |
var bcrypt = require('bcryptjs'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function createMemberPost(){ | |
if( $this->session->userdata("login",TRUE) ){ | |
$submit = $this->input->post('submit',TRUE); | |
//$upload = $this->upload(); | |
//echo json_encode($upload);die(); | |
$input_date = $this->input->post('admission_date'); | |
$date = (empty($this->input->post('admission_date')) ? date('Y-m-d H:i:s') : $this->input->post('admission_date')); | |
if( $this->input->is_ajax_request() ){ | |
if( $this->form_validation->run('create_member') === FALSE ){ | |
$errors = $this->form_validation->error_array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Ejercicio 1 | |
var arr = ["Acoxpa - Auditorio", "Polanco - Santa Fe", "Acoxpa - Auditorio", "Reforma - Coacalco", "Acoxpa - Auditorio", "Polanco - Santa Fe"]; | |
function count(arr){ | |
arr.sort(); | |
var result = []; | |
var current; | |
var count = 0; | |
for (var i = 0; i <= arr.length; i++){ | |
if (arr[i] != current) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
function select2Action(id_selector,max_selection,placeholder,multiple) { | |
var arr = []; | |
$(`#${id_selector}`).select2({ | |
maximumSelectionLength: max_selection, | |
language: "es", | |
placeholder: placeholder, | |
width: '100%', | |
minimumInputLength: 3, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.editarPost = async (req, res, next) => { | |
let data = req.body; | |
req.checkBody('respuesta', 'Campo obligatorio, compuesto de minimo 15 carácteres.').optional({ checkFalsy: true }).isLength({min:16}); | |
let errors = req.validationErrors(); | |
if(errors){ | |
res.json({ | |
ok:false, | |
errors | |
}); | |
}else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Historial.findById(req.params.id) | |
.populate("incidencia") | |
.exec() | |
.then(incidencias =>{ | |
if (!incidencias) { | |
return res.status(404).json({ | |
message: "No hay incidencias..." | |
}); | |
} | |
Incidencia.populate(incidencias.incidencia.cupon, {path:"cupones"}, function(err, info) { console.log('cupones',info) }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*code*/ | |
exports.index = (req, res, next) => { | |
let empresasId = req.user.empresas; | |
Incidencia.find({}) | |
.populate('Historial') | |
.exec() | |
.then(incidencias =>{ | |
res.json({ | |
incidencias | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var runCronCorteEmpresa = new CronJob({ | |
cronTime: '00 00 00 * * 0-6', | |
onTick: function() { | |
mongoose.connect('mongodb://heroku_g0l82g29:h3t4299755taqigahev14nnp1k@ds121906.mlab.com:21906/heroku_g0l82g29', { useNewUrlParser: true }) | |
.then( async () => { | |
debugS('Conectado a la base de datos') | |
const result = await run(); | |
disconnect(result); | |
}) | |
.catch(err => { debugF('Algo salio mal', err ); disconnect(); }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UI { | |
static displayElements() { | |
//let elements = Store.getElements().then(r => {return r}); | |
let elements = Store.getElements() | |
.then((data)=> {return data}); | |
console.log(elements); | |
elements.forEach(function(element) { | |
UI.addElementsToDom(element) | |
}); | |
} |
OlderNewer