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
// requiring path and fs modules | |
const path = require('path') | |
const fs = require('fs') | |
const dirTree = require('directory-tree') | |
const LOCALE_PATH = 'public/locales' | |
const SRC_PATH = 'src/' | |
const directoryLocalesPath = path.join(__dirname, LOCALE_PATH) | |
const directorySrcPath = path.join(__dirname, SRC_PATH) |
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
import { createServer, Model, Response } from "miragejs"; | |
export function paginator(items, currentPage, perPageItems) { | |
const page = currentPage || 1 | |
const perPage = perPageItems || 10 | |
const offset = (page - 1) * perPage | |
const totalPages = Math.ceil(items.length / perPage) | |
const paginatedItems = items.slice(offset, page * perPage) |
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
import { useSelector } from 'react-redux' | |
function useAccessControl(mode, page) { | |
const accessControl = useSelector((state) => state.accessControl.data) || {} | |
const user = useSelector((state) => state.user.profile) || {} | |
function can(action) { | |
console.log(`accessControl.${mode}.${page}.${action}`) | |
return Boolean(accessControl[mode][page][action]) | |
} |
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
// É necessário instalar o xlsx | |
// Foi testado com a versão "xlsx": "^0.14.2" | |
function Workbook() { | |
if (!(this instanceof Workbook)) | |
return new Workbook() | |
this.SheetNames = [] | |
this.Sheets = {} |
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
function currencyToFloat (currency = '') { | |
const regex = /([+-]?[0-9|^.|^,]+)[\.|,]([0-9]+)$/gim | |
const result = regex.exec(currency) | |
const floatResult = result | |
? result[1].replace(/[.,]/g, '') + '.' + result[2] | |
: currency.replace(/[^0-9-+]/g, '') | |
return floatResult | |
} |
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
const eng = { | |
above: 'The {{field}} should be above {{argument.0}}.', | |
accepted: 'The {{field}} should have been accepted', | |
after: 'The {{field}} should be a date after {{argument.0}}' | |
} | |
const pt = { | |
acima: 'O {{field}} deve estar acima de {{argument.0}}.', | |
aceito: 'O {{field}} deveria ter sido aceito', | |
after: 'O {{field}} deve ser uma data após {{argument.0}}' |
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
{ | |
"above": "O campo {{field}} deve estar acima de {{argument.0}}.", | |
"accepted": "O campo {{field}} deveria ter sido aceito", | |
"after": "O campo {{field}} deve ser uma data após {{argument.0}}", | |
"after_offset_of": "O campo {{field}} deve ser depois de {{argument.0}} {{argument.1}} da data de hoje", | |
"alpha": "O campo {{field}} deve conter apenas letras", | |
"alpha_numeric": "O campo {{field}} deve conter apenas letrase números", | |
"array": "O campo {{field}} deve ser um ARRAY.", | |
"before": "O campo {{field}} deve ser uma dataantes de {{argument.0}}.", | |
"before_offset_of": "O campo {{field}} deve estar antes de {{argument.0}} {{argument.1}} da data de hoje", |
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
import store from 'store' | |
import decode from 'jwt-decode' | |
import axiosClient from '@/helpers/axiosClient.js' | |
export default class AuthService { | |
// Initializing important variables | |
constructor() { | |
this.fetch = this.fetch.bind(this) | |
this.login = this.login.bind(this) |
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
const onOpen = (selectedDates, dateStr, instance) => { | |
if(!document.getElementById('selectRanges')) { | |
let _elem = document.getElementsByClassName(instance.calendarContainer.classList.value)[0] | |
let elemClone = _elem.cloneNode(true) | |
function createMarkup() { | |
return {__html: elemClone.innerHTML}; | |
} | |
const ElemFinal = (props) => ( |
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
const renderText = (component) => { | |
const __a = document.createElement('div') | |
ReactDOM.render(component, __a) | |
const _el = __a.outerHTML | |
ReactDOM.unmountComponentAtNode(__a) | |
return _el | |
} |
NewerOlder