109 lines
2.7 KiB
JavaScript
109 lines
2.7 KiB
JavaScript
import {Platform, Dimensions} from 'react-native';
|
|
import moment from 'moment';
|
|
|
|
const colors = {
|
|
primary: "#E74610",
|
|
primaryDark: "#d6410f",
|
|
accent: "#005598",
|
|
accentDark: "#013964",
|
|
primaryTransparent: "#1AE74610",
|
|
white: "#fff",
|
|
white50: "#78ffffff",
|
|
black: "#000000",
|
|
gray: "#888DA8",
|
|
searchText: "#707070",
|
|
searchGray: "#AFAFAF",
|
|
whitesmoke: "#F5F5F5",
|
|
darkerWhite: "#FFEDE6",
|
|
darkerGray: "#3b3b3b",
|
|
lightGray: "#EAEAEA",
|
|
darkGray: "#8E8E93",
|
|
black50: "#aa000000",
|
|
dim: "#4D000000",
|
|
textPrimary: "#4B4B4B",
|
|
yellow: "#FFCE00",
|
|
ratingBorder: "#8E8E93",
|
|
pink: "#FFEDE6",
|
|
inactive: "rgba(255, 255, 255, 0.4)",
|
|
placeHolder: "rgba(0,0,0,.3)",
|
|
iqair: [
|
|
{main: "#48B74A", opacity: "#8BD38C"},
|
|
{main: "#FFC303", opacity: "#FFD95F"},
|
|
{main: "#FF9945", opacity: "#FEBF8A"},
|
|
{main: "#D2334B", opacity: "#E47F8D"},
|
|
{main: "#0188BC", opacity: "#5EB4D5"},
|
|
{main: "#4D3068", opacity: "#8F7CA0"},
|
|
]
|
|
}
|
|
|
|
const screen = {
|
|
w: Dimensions.get('window').width,
|
|
h: Dimensions.get('window').height,
|
|
tabHeight: 58
|
|
}
|
|
|
|
const card = {
|
|
elevation: 0,
|
|
radius: 16,
|
|
}
|
|
|
|
const font = "Arial";
|
|
|
|
const formatter = {
|
|
NAME: function(profile){
|
|
return profile ? profile.firstname + " " + profile.middlename + " " + profile.lastname : "FIRSTNAME LASTNAME"
|
|
},
|
|
CN: function(card){
|
|
let range = 4
|
|
let indexes = [0, 4, 8, 12]
|
|
let res = ""
|
|
for(var x=0;x<indexes.length;x++){
|
|
res += card.substr(indexes[x], range) + (x < indexes.length - 1 ? " " : "")
|
|
}
|
|
return res
|
|
},
|
|
CRNCY: function(amount){
|
|
return parseFloat(amount).toFixed(2).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')
|
|
},
|
|
PMBL: function(number){
|
|
//RETURNS MOBILE NUMBER FORMAT API REQUIRED @ FROM 639062447306 TO @ 9062447306
|
|
return number.substr(0, 0) + "" + number.substr(2)
|
|
},
|
|
MBNF: function(number, replace){
|
|
var regEx = /^(63|\+63)\d{10}$/
|
|
var regExReplace = /^(63|\+63)/
|
|
let validMobileNumber = regEx.test(number);
|
|
if(!validMobileNumber) {
|
|
return number
|
|
}
|
|
return number.replace(regExReplace, replace)
|
|
},
|
|
ENCMBL: function(contact){
|
|
//RETURNS MOBILE NUMBER WITH HIDDEN PARTS @ 0921****104
|
|
let replacement = "****"
|
|
let index = 5
|
|
return "+" + contact.substr(0, index) + replacement+ contact.substr(index + replacement.length)
|
|
},
|
|
DT4API: function(dt){
|
|
return new moment(new Date(dt)).format("YYYY-MM-DD")
|
|
},
|
|
DTUI: function(dt){
|
|
return new moment(new Date(dt)).format("DD MMM YYYY")
|
|
},
|
|
CPN: function(mobile) {
|
|
let res = ""
|
|
res += mobile.substring(5, 0) + " " + mobile.substring(8, 5) + " " + mobile.substring(12, 8)
|
|
return res
|
|
}
|
|
}
|
|
|
|
const platform = Platform.OS;
|
|
|
|
export default {
|
|
colors,
|
|
screen,
|
|
font,
|
|
card,
|
|
formatter,
|
|
platform
|
|
} |