Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import {Platform, ToastAndroid, View, Text, ImageBackground, ScrollView, FlatList, Image,NetInfo, TouchableOpacity,AsyncStorage, Alert, BackHandler } from 'react-native';
- import { Button, Input, Icon, CheckBox } from 'react-native-elements';
- import { Dropdown } from 'react-native-material-dropdown';
- import Modal from 'react-native-modal';
- import Picker from 'react-native-wheel-picker';
- import DatePicker from 'react-native-datepicker';
- import {strings, JobData, Baseurl,LoginApiHeader, RequestTimeout} from '../components/Locals.js';
- import fetch from 'react-native-fetch-polyfill';
- import Spinner from 'react-native-loading-spinner-overlay';
- let TRADE_CATEGORY = []
- let TRADE = []
- let Skill_Level_Items = [];
- let Means_Of_Application = [];
- let Salary_Type = [];
- let salaryrange = [];
- let PostDuration = [];
- let isFromCopy = false;
- export default class CreateJob extends Component {
- constructor(props) {
- super(props);
- this.loaddata();
- this.handleBackButtonClick = this.handleBackButtonClick.bind(this);
- }
- componentDidMount() {
- NetInfo.isConnected.addEventListener(
- 'connectionChange',
- this._handleConnectivityChange
- );
- NetInfo.isConnected.fetch().done(
- (isConnected) => { this.setState({isConnected}); }
- );
- }
- _handleConnectivityChange = (isConnected) => {
- this.setState({
- isConnected,
- });
- };
- componentWillMount() {
- BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
- }
- componentWillUnmount() {
- NetInfo.isConnected.removeEventListener(
- 'connectionChange',
- this._handleConnectivityChange
- );
- BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
- }
- handleBackButtonClick() {
- this.props.navigation.navigate('homeStack',{},{
- type: "Navigate",
- routeName: "home",
- params: {name:""}
- });
- return true;
- }
- state = {
- visible: false,
- work_district: strings.selectworkdistricttitle,
- salary_type: "",
- salary_type_value: "",
- salary_range: [],
- salary_range_value:"",
- post_date: "",
- commencement_date: "",
- completion_date: "",
- checked: [],
- skillchecked:[],
- preferredmeanschecked:[],
- isLoading: true,
- isLoading1: false,
- checkedDistrict:[],
- selectedTradecategory: 0,
- selectedTrade: 0,
- tradecategory:[],
- trade:[],
- faxNo:"",
- vacancyNo:"",
- contactPerson:"",
- contactNo:"",
- whatsappNo:"",
- remarkEN:"",
- remarkCH:"",
- tradecategoryvalue:strings.tradepopuptitle1,
- tradevalue:strings.tradepopuptitle2,
- s_skills:[],
- VacancyIcon:false,
- ContactNoIcon:false,
- WhatsAppIcon:false,
- FaxNumberIcon:false,
- RemarkIcon:false,
- Remark1Icon:false,
- TradeCategoryIcon:false,
- TradeIcon:false,
- SkillLevelIcon:false,
- WorkDistrictIcon:false,
- TypeofSalaryIcon:false,
- RangeodSalaryIcon:false,
- PostDurationIcon:false,
- StartDateIcon:false,
- EndDateIcon:false,
- PreferredMeansIcon:false,
- }
- static navigationOptions = ({ navigation }) => ({
- headerTitle: strings.createjobtitle,
- drawerLabel: strings.createjoblbl,
- drawerIcon: <Image resizeMode="contain" style={{width: 25, height: 25}} source={require('../assets/edit_white.png')} />,
- headerLeft: <TouchableOpacity onPress={() => navigation.navigate('DrawerOpen')}>
- <Image source={require('../assets/menu.png')}/>
- </TouchableOpacity>,
- headerTitleStyle: { color: "#fff" },
- headerStyle: { backgroundColor: "#7fb539", paddingHorizontal: 15 },
- })
- async loaddata(){
- const Skill_Level_Items1 = await AsyncStorage.getItem('@Skill_Level_Items');
- if (Skill_Level_Items1 !== null){
- Skill_Level_Items = JSON.parse(Skill_Level_Items1);
- }
- const Means_Of_Application1 = await AsyncStorage.getItem('@Means_Of_Application');
- if (Means_Of_Application1 !== null){
- Means_Of_Application = JSON.parse(Means_Of_Application1);
- }
- const Salary_Type1 = await AsyncStorage.getItem('@Salary_Type');
- if (Salary_Type1 !== null){
- Salary_Type = JSON.parse(Salary_Type1);
- }
- const salaryrange1 = await AsyncStorage.getItem('@salaryrange');
- if (salaryrange1 !== null){
- salaryrange = JSON.parse(salaryrange1);
- }
- const TRADE_CATEGORY1 = await AsyncStorage.getItem('@TRADE_CATEGORY');
- if (TRADE_CATEGORY1 !== null){
- TRADE_CATEGORY = JSON.parse(TRADE_CATEGORY1);
- }
- const TRADE1 = await AsyncStorage.getItem('@TRADE');
- if (TRADE1 !== null){
- TRADE = JSON.parse(TRADE1);
- }
- const PostDuration1 = await AsyncStorage.getItem('@PostDuration');
- if (PostDuration1 !== null){
- PostDuration = JSON.parse(PostDuration1);
- }
- this.setState({post_date:PostDuration[0].value});
- this.setState({tradecategory:TRADE_CATEGORY});
- this.setState({trade:TRADE[0]});
- this.setState({salary_type:Salary_Type[0].value});
- this.setState({salary_type_value:Salary_Type[0].value});
- this.setState({salary_range_value:salaryrange[0][0].value});
- this.setState({salary_range:salaryrange[0]});
- this.setState({isLoading: false});
- if(JobData.Id != 0){
- //console.warn(JobData.data);
- var data = JobData.data;
- isFromCopy = true;
- this.setState({skillchecked:data.SkillLevels});
- this.setState({preferredmeanschecked:data.PreferredContactId});
- this.setState({tradecategoryvalue:data.TradeCategoryId});
- this.setState({tradevalue:data.TradeId});
- this.setState({work_district:data.DistrictId});
- this.setState({salary_type_value:data.PaymentTypeId});
- this.onchangeslarytype(data.PaymentTypeId);
- this.setState({salary_range_value:data.PaymentRangeId});
- this.setState({commencement_date:data.CommencementFrom});
- this.setState({completion_date:data.CommencementTo});
- this.setState({post_date:data.PostDuration});
- this.setState({vacancyNo:""+data.VacancyNo});
- if(strings.getLanguage() != "zh")
- this.setState({contactPerson:data.ContactNameEn});
- else
- this.setState({contactPerson:data.ContactNameCht});
- this.setState({contactNo:data.ContactPhone});
- this.setState({whatsappNo:data.ContactWtsapp});
- this.setState({faxNo:data.ContactFax});
- this.setState({remarkEN:data.RemarkEn});
- this.setState({remarkCH:data.RemarkCht});
- JobData.Id = 0;
- }
- }
- returnData(checked) {
- var districs = "";
- if(checked.length==0)
- return
- this.setState({workdistrictchecked:checked});
- for(let j=0; j<checked.length; j++){
- if(j+1==checked.length)
- districs += checked[j]
- else
- districs += checked[j] + ", ";
- }
- this.setState({work_district:districs});
- this.setState({WorkDistrictIcon:false});
- }
- onchangeslarytype(value){
- this.setState({salary_type:value});
- for(let i=0; i<Salary_Type.length; i++){
- if(Salary_Type[i].value == value){
- this.setState({ salary_range: salaryrange[i] })
- this.setState({salary_range_value:salaryrange[i][0].value})
- }
- }
- }
- closemodal(){
- this.setState({ visible: false });
- if(TRADE_CATEGORY.length>0 && TRADE_CATEGORY[this.state.selectedTradecategory] != null)
- this.setState({tradecategoryvalue:TRADE_CATEGORY[this.state.selectedTradecategory]});
- else
- this.setState({tradecategoryvalue:""});
- if(TRADE[this.state.selectedTradecategory].length>0 && TRADE[this.state.selectedTradecategory][this.state.selectedTrade] != null)
- this.setState({tradevalue:TRADE[this.state.selectedTradecategory][this.state.selectedTrade]});
- else
- this.setState({tradevalue:""});
- }
- onPickerSelect(index) {
- this.setState({
- selectedTradecategory: index,
- })
- if(TRADE[index].length > 0){
- this.setState({TradeCategoryIcon:false});
- this.setState({TradeIcon:false});
- this.setState({trade:TRADE[index]})
- }
- else
- this.setState({trade:[""]})
- }
- onPickerSelect1(index) {
- this.setState({
- selectedTrade: index,
- })
- }
- onSubmitPress(){
- var isAllvalid = true;
- if(this.state.tradecategoryvalue == strings.tradepopuptitle1){
- this.setState({TradeCategoryIcon:<Icon onPress={()=>this.showError(strings.selectcategoryerr)} style={{width: "10%",}} name="alert-circle" type="material-community" color="red" />});
- isAllvalid = false;
- }else{
- this.setState({TradeCategoryIcon:false});
- }
- if(this.state.tradevalue == strings.tradepopuptitle2){
- this.setState({TradeIcon:<Icon onPress={()=>this.showError(strings.selecttradeerr)} style={{width: "10%",}} name="alert-circle" type="material-community" color="red" />});
- isAllvalid = false;
- }else{
- this.setState({TradeIcon:false});
- }
- if(this.state.work_district == strings.selectworkdistricttitle || this.state.work_district == ""){
- this.setState({WorkDistrictIcon:<Icon onPress={()=>this.showError(strings.selectworkdistricterr)} style={{width: "10%",}} name="alert-circle" type="material-community" color="red" />});
- isAllvalid = false;
- }else{
- this.setState({WorkDistrictIcon:false});
- }
- if(this.state.salary_type.length==0){
- this.setState({TypeofSalaryIcon:<Icon onPress={()=>this.showError(strings.selectsalrytypeerr)} style={{width: "10%",}} name="alert-circle" type="material-community" color="red" />});
- isAllvalid = false;
- }else{
- this.setState({TypeofSalaryIcon:false});
- }
- if(this.state.salary_range_value.length==0){
- this.setState({RangeodSalaryIcon:<Icon onPress={()=>this.showError(strings.selectrangeerr)} style={{width: "10%",}} name="alert-circle" type="material-community" color="red" />});
- isAllvalid = false;
- }else{
- this.setState({RangeodSalaryIcon:false});
- }
- if(this.state.post_date.length==0){
- this.setState({PostDurationIcon:<Icon onPress={()=>this.showError(strings.selectstartdateerr)} style={{width: "10%",}} name="alert-circle" type="material-community" color="red" />});
- isAllvalid = false;
- }else{
- this.setState({PostDurationIcon:false});
- }
- if(this.state.commencement_date.length==0){
- this.setState({StartDateIcon:<Icon onPress={()=>this.showError(strings.selectstartdateerr)} style={{width: "10%",}} name="alert-circle" type="material-community" color="red" />});
- isAllvalid = false;
- }else{
- this.setState({StartDateIcon:false});
- }
- if(this.state.vacancyNo.length==0){
- this.setState({VacancyIcon:<Icon onPress={()=>this.showError(strings.vacancynoerr)} name="alert-circle" type="material-community" color="red" />});
- isAllvalid = false;
- }
- if(this.state.contactPerson.length==0){
- this.setState({ContactPersonIcon:<Icon onPress={()=>this.showError(strings.contactpersonerr)} name="alert-circle" type="material-community" color="red" />});
- isAllvalid = false;
- }
- if(this.state.contactNo.length==0){
- this.setState({ContactNoIcon:<Icon onPress={()=>this.showError(strings.contactnoerr)} name="alert-circle" type="material-community" color="red" />});
- isAllvalid = false;
- }
- if(!isAllvalid)
- return
- if(this.state.VacancyIcon != false || this.state.ContactNoIcon != false || this.state.WhatsAppIcon != false || this.state.FaxNumberIcon != false || this.state.RemarkIcon != false || this.state.Remark1Icon != false || this.state.TradeCategoryIcon != false || this.state.TradeIcon != false || this.state.SkillLevelIcon != false || this.state.WorkDistrictIcon != false || this.state.TypeofSalaryIcon != false || this.state.RangeodSalaryIcon != false || this.state.PostDurationIcon != false || this.state.StartDateIcon != false || this.state.EndDateIcon != false || this.state.PreferredMeansIcon != false){
- return
- }else{
- var json = [{
- TradeId: this.state.tradevalue,
- tradecategory:this.state.tradecategoryvalue,
- SkillLevelId: this.state.skillchecked,
- DistrictId: this.state.work_district,
- PaymentTypeId: this.state.salary_type,
- PaymentRangeId: this.state.salary_range_value,
- PreferredContactId: this.state.preferredmeanschecked,
- ContactPersonEn: this.state.contactPerson,
- ContactPersonCht: this.state.contactPerson,
- ContactNo: this.state.contactNo,
- Wtsapp: this.state.whatsappNo,
- FaxNo:this.state.faxNo,
- PostDuration: this.state.post_date,
- VacancyNo: this.state.vacancyNo,
- RemarkEn: this.state.remarkEN,
- RemarkCht: this.state.remarkCH,
- CommencementFrom: this.state.commencement_date,
- CommencementTo: this.state.completion_date,
- }];
- this.props.navigation.navigate('createJobPreview',{jobdata:json});
- }
- }
- showError(msg){
- ToastAndroid.showWithGravityAndOffset(
- msg,
- ToastAndroid.LONG,
- ToastAndroid.BOTTOM,
- 25,
- 50
- );
- }
- validate(text, name){
- alph = /^[a-zA-Z]+$/;
- num = /^[0-9]+$/;
- mail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
- alphnum = /^([a-zA-Z0-9 _-]+)$/
- if(name=="vacancyno"){
- if(num.test(text) && text>0 && text<99){
- this.setState({VacancyIcon:false})
- }else{
- this.setState({VacancyIcon: <Icon onPress={()=>this.showError(strings.vacancynoerr1)} name="alert-circle" type="material-community" color="red" />})
- }
- this.setState({vacancyNo:text});
- }
- else if(name=="contactPerson"){
- this.setState({ContactPersonIcon:false})
- this.setState({contactPerson:text});
- }
- else if(name=="contactNo"){
- if(num.test(text) && text.length==8){
- this.setState({ContactNoIcon:false})
- }else{
- this.setState({ContactNoIcon: <Icon onPress={()=>this.showError(strings.phoneerr)} name="alert-circle" type="material-community" color="red" />})
- }
- this.setState({contactNo:text});
- }
- else if(name=="whatsappNo"){
- if(num.test(text) && text.length==8){
- this.setState({WhatsAppIcon:false})
- }else{
- this.setState({WhatsAppIcon: <Icon onPress={()=>this.showError(strings.repwhatsapperr)} name="alert-circle" type="material-community" color="red" />})
- }
- this.setState({whatsappNo:text});
- }
- else if(name=="faxNo"){
- if(num.test(text) && text.length==8){
- this.setState({FaxNumberIcon:false})
- }else{
- this.setState({FaxNumberIcon: <Icon onPress={()=>this.showError(strings.repfaxerr)} name="alert-circle" type="material-community" color="red" />})
- }
- this.setState({faxNo:text});
- }
- else if(name=="remarkEN"){
- this.setState({RemarkIcon:false});
- this.setState({remarkEN:text});
- }
- else if(name=="remarkCH"){
- this.setState({Remark1Icon:false});
- this.setState({remarkCH:text});
- }
- }
- checkItem = item => {
- const { skillchecked } = this.state;
- if (!skillchecked.includes(item)) {
- this.setState({ skillchecked: [...skillchecked, item] });
- } else {
- this.setState({ skillchecked: skillchecked.filter(a => a !== item) });
- }
- };
- checkItem1 = item => {
- const { preferredmeanschecked } = this.state;
- if (!preferredmeanschecked.includes(item)) {
- this.setState({ preferredmeanschecked: [...preferredmeanschecked, item] });
- } else {
- this.setState({ preferredmeanschecked: preferredmeanschecked.filter(a => a !== item) });
- }
- };
- dateselected(date){
- this.setState({ commencement_date: date })
- if(date != "")
- this.setState({StartDateIcon:false});
- }
- translate1(){
- if(!this.state.isConnected){
- ToastAndroid.showWithGravityAndOffset(strings.connectionerr,ToastAndroid.LONG,ToastAndroid.BOTTOM,25,50);
- return
- }
- if(this.state.remarkEN == "")
- return
- this.setState({isLoading1:true})
- fetch(Baseurl+'System/TranslateEngToCht', {
- method: 'POST',
- timeout: RequestTimeout,
- headers: LoginApiHeader,
- body: JSON.stringify({
- Translate: this.state.remarkEN,
- })
- })
- .then((response) => {
- return response.json()
- })
- .then(async (responseJson) => {
- if(responseJson.Translate != null){
- this.setState({remarkCH:responseJson.Translate});
- }
- else if(responseJson.Message != null){
- ToastAndroid.showWithGravityAndOffset(
- responseJson.Message,
- ToastAndroid.LONG,
- ToastAndroid.BOTTOM,
- 25,
- 50
- );
- }else{
- ToastAndroid.showWithGravityAndOffset(
- "Failed to Translate",
- ToastAndroid.LONG,
- ToastAndroid.BOTTOM,
- 25,
- 50
- );
- }
- this.setState({isLoading1:false});
- })
- .catch((error) => {
- if(error=="TypeError: Network request failed"){
- ToastAndroid.showWithGravityAndOffset(strings.timeouterr,ToastAndroid.LONG,ToastAndroid.BOTTOM,25,50);
- }
- this.setState({isLoading1:false});
- });
- }
- translate2(){
- if(!this.state.isConnected){
- ToastAndroid.showWithGravityAndOffset(strings.connectionerr,ToastAndroid.LONG,ToastAndroid.BOTTOM,25,50);
- return
- }
- if(this.state.remarkCH == "")
- return
- this.setState({isLoading1:true})
- fetch(Baseurl+'System/TranslateChtToEng', {
- method: 'POST',
- timeout: RequestTimeout,
- headers: LoginApiHeader,
- body: JSON.stringify({
- Translate: this.state.remarkCH,
- })
- })
- .then((response) => {
- return response.json()
- })
- .then(async (responseJson) => {
- if(responseJson.Translate != null){
- this.setState({remarkEN:responseJson.Translate});
- }
- else if(responseJson.Message != null){
- ToastAndroid.showWithGravityAndOffset(
- responseJson.Message,
- ToastAndroid.LONG,
- ToastAndroid.BOTTOM,
- 25,
- 50
- );
- }else{
- ToastAndroid.showWithGravityAndOffset(
- "Failed to Translate",
- ToastAndroid.LONG,
- ToastAndroid.BOTTOM,
- 25,
- 50
- );
- }
- this.setState({isLoading1:false});
- })
- .catch((error) => {
- if(error=="TypeError: Network request failed"){
- ToastAndroid.showWithGravityAndOffset(strings.timeouterr,ToastAndroid.LONG,ToastAndroid.BOTTOM,25,50);
- }
- this.setState({isLoading1:false});
- });
- }
- renderPicker() {
- if (Platform.OS === "android") {
- return (
- <View>
- <Picker
- style={{ width:"95%", height: 100, alignSelf: "center" }}
- selectedValue={this.state.selectedTradecategory}
- itemStyle={{ color: "#000", fontSize: 14, }}
- itemSpace={25}
- multiline={true}
- onValueChange={(index) => this.onPickerSelect(index)}>
- {
- this.state.tradecategory.map((value, i) => (
- <Picker.Item label={value} value={i} key={value} />
- ))
- }
- </Picker>
- <View style={{ height: 1, width: '100%', backgroundColor: '#000', marginTop: 10, marginBottom: 10 }} />
- <Picker
- style={{ width:"95%", height: 100, alignSelf: "center" }}
- selectedValue={this.state.selectedTrade}
- itemStyle={{ color: "#000", fontSize: 14, multiline:true}}
- itemSpace={25}
- multiline={true}
- onValueChange={(index) => this.onPickerSelect1(index)}>
- {
- this.state.trade.map((value, i) => (
- <Picker.Item label={value} value={i} key={value} />
- ))
- }
- </Picker>
- </View>
- )
- }
- return (
- <View style={styles.row}>
- <Picker
- style={{ height: 120, width: 100 }}
- >
- </Picker>
- </View>
- )
- }
- render() {
- const { navigate } = this.props.navigation;
- if (this.state.isLoading) {
- return <View><Text></Text></View>;
- }
- return (
- <ImageBackground resizeMode="cover" source={require('../assets/gradient_bg.png')} style={{ flex: 1 }}>
- <ScrollView style={{ marginBottom: 50 }}>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.tradecategorylbl}</Text>
- <View style={styles.row1}>
- <Text style={styles.label1}
- onPress={() => this.setState({ visible: true })}
- >{this.state.tradecategoryvalue}</Text>
- {this.state.TradeCategoryIcon}
- </View>
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.tradelbl}</Text>
- <View style={styles.row1}>
- <Text style={styles.label1}
- onPress={() => this.setState({ visible: true })}
- >{this.state.tradevalue}</Text>
- {this.state.TradeIcon}
- </View>
- </View>
- <View style={[styles.row, { justifyContent: "flex-start", alignItems: "flex-start" }]}>
- <Text style={styles.label}>{strings.skilllevellbl}</Text>
- <View style={styles.row1}>
- <View style={{ marginLeft: 0, width:"97%" }}>
- <FlatList
- data={Skill_Level_Items}
- extraData={this.state}
- renderItem={({ item }) => (
- <CheckBox
- iconType="material-community"
- uncheckedIcon="checkbox-blank-outline"
- checkedIcon="checkbox-marked"
- uncheckedColor="#417505"
- checkedColor="#417505"
- containerStyle={styles.checkBoxContainer}
- textStyle={{ fontSize: 14, fontWeight: "200" }}
- title={item}
- onPress={() => this.checkItem(item)}
- checked={this.state.skillchecked.includes(item)}
- />
- )}
- />
- </View>
- {this.state.SkillLevelIcon}
- </View>
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.wprkdistrictlbl}</Text>
- <View style={styles.row1}>
- <Text style={styles.label1}
- onPress={() => navigate('select_work_district',{returnData: this.returnData.bind(this)})}
- >{this.state.work_district}</Text>
- {this.state.WorkDistrictIcon}
- </View>
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.typeosalarylbl}</Text>
- <View style={styles.row1}>
- <Dropdown
- label=""
- fontSize={14}
- value={this.state.salary_type_value}
- onChangeText={(value) => this.onchangeslarytype(value)}
- containerStyle={styles.dropdownContainer}
- inputContainerStyle={{ borderBottomWidth: 1 }}
- data={Salary_Type}
- />
- {this.state.TypeofSalaryIcon}
- </View>
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.rangofsalarylbl}</Text>
- <View style={styles.row1}>
- <Dropdown
- fontSize={14}
- label=""
- value={this.state.salary_range_value}
- onChangeText={(value) => this.setState({ salary_range_value: value })}
- containerStyle={styles.dropdownContainer}
- inputContainerStyle={{ borderBottomWidth: 1 }}
- data={this.state.salary_range}
- />
- {this.state.RangeodSalaryIcon}
- </View>
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.postofficelbl}</Text>
- <View style={styles.row1}>
- <Dropdown
- fontSize={14}
- label=""
- value={this.state.post_date}
- onChangeText={(value) => this.setState({ post_date: value })}
- containerStyle={styles.dropdownContainer}
- inputContainerStyle={{ borderBottomWidth: 1 }}
- data={PostDuration}
- />
- {this.state.PostDurationIcon}
- </View>
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.jobcommendatelbl}</Text>
- <View style={styles.row1}>
- <DatePicker
- iconComponent={<Image style={{ width: 20, height: 20 }} resizeMode="contain" source={require('../assets/calendar.png')} />}
- style={styles.datePickerContainer}
- date={this.state.commencement_date}
- mode="date"
- placeholder={strings.selectdatelbl}
- format="DD/MM/YY"
- minDate={new Date()}
- confirmBtnText={strings.confirmbtnlbl}
- cancelBtnText={strings.canclebtn}
- customStyles={{
- dateIcon: {
- position: 'absolute',
- right: 0,
- top: 4,
- marginLeft: 0
- },
- dateInput: {
- borderWidth: 0,
- alignItems: "flex-start"
- }
- }}
- onDateChange={(date) => { this.dateselected(date) }}
- />
- {this.state.StartDateIcon}
- </View>
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.jobcompdatelbl}</Text>
- <View style={styles.row1}>
- <DatePicker
- iconComponent={<Image style={{ width: 20, height: 20 }} resizeMode="contain" source={require('../assets/calendar.png')} />}
- style={styles.datePickerContainer}
- date={this.state.completion_date}
- mode="date"
- placeholder={strings.selectdatelbl}
- format="DD/MM/YY"
- minDate={this.state.commencement_date==""?new Date():this.state.commencement_date}
- confirmBtnText={strings.canclebtn}
- cancelBtnText={strings.canclebtn}
- customStyles={{
- dateIcon: {
- position: 'absolute',
- right: 0,
- top: 4,
- marginLeft: 0
- },
- dateInput: {
- borderWidth: 0,
- alignItems: "flex-start"
- }
- }}
- onDateChange={(date) => { this.setState({ completion_date: date }) }}
- />
- {this.state.EndDateIcon}
- </View>
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.noofvacancylbl}</Text>
- <Input
- keyboardType="numeric"
- containerStyle={{ width: "60%" }}
- underlineColorAndroid="transparent"
- inputContainerStyle={styles.input}
- value={this.state.vacancyNo}
- onChangeText={(text)=>this.validate(text,"vacancyno")}
- inputStyle={{ fontSize: 14, marginLeft: 0 }}
- rightIcon={this.state.VacancyIcon}
- />
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.contactpersonlbl}</Text>
- <Input
- containerStyle={{ width: "60%" }}
- underlineColorAndroid="transparent"
- inputContainerStyle={styles.input}
- value={this.state.contactPerson}
- onChangeText={(text)=>this.validate(text,"contactPerson")}
- inputStyle={{ fontSize: 14, marginLeft: 0 }}
- rightIcon={this.state.ContactPersonIcon}
- />
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.contactnolbl}</Text>
- <Input
- keyboardType="numeric"
- containerStyle={{ width: "60%" }}
- underlineColorAndroid="transparent"
- inputContainerStyle={styles.input}
- value={this.state.contactNo}
- onChangeText={(text)=>this.validate(text,"contactNo")}
- inputStyle={{ fontSize: 14, marginLeft: 0 }}
- rightIcon={this.state.ContactNoIcon}
- />
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.whatsappnumberlbl}</Text>
- <Input
- keyboardType="numeric"
- containerStyle={{ width: "60%" }}
- underlineColorAndroid="transparent"
- inputContainerStyle={styles.input}
- value={this.state.whatsappNo}
- onChangeText={(text)=>this.validate(text,"whatsappNo")}
- inputStyle={{ fontSize: 14, marginLeft: 0 }}
- rightIcon={this.state.WhatsAppIcon}
- />
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.faxnumberlbl}</Text>
- <Input
- keyboardType="numeric"
- containerStyle={{ width: "60%" }}
- underlineColorAndroid="transparent"
- inputContainerStyle={styles.input}
- value={this.state.faxNo}
- onChangeText={(text)=>this.validate(text,"faxNo")}
- inputStyle={{ fontSize: 14, marginLeft: 0 }}
- rightIcon={this.state.FaxNumberIcon}
- />
- </View>
- <View style={[styles.row, { justifyContent: "flex-start", alignItems: "flex-start" }]}>
- <Text style={styles.label}>{strings.preferredmeanslbl}</Text>
- <View style={styles.row1}>
- <View style={{ width:"97%" }}>
- <FlatList
- data={Means_Of_Application}
- extraData={this.state}
- renderItem={({ item }) => (
- <CheckBox
- iconType="material-community"
- uncheckedIcon="checkbox-blank-outline"
- checkedIcon="checkbox-marked"
- uncheckedColor="#417505"
- checkedColor="#417505"
- containerStyle={styles.checkBoxContainer}
- textStyle={{ fontSize: 14, fontWeight: "200" }}
- title={item}
- onPress={() => this.checkItem1(item)}
- checked={this.state.preferredmeanschecked.includes(item)}
- />
- )}
- />
- </View>
- {this.state.PreferredMeansIcon}
- </View>
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.remarkElbl}</Text>
- <View style={styles.row1}>
- <Input
- containerStyle={{ width: "85%", }}
- underlineColorAndroid="transparent"
- inputContainerStyle={styles.input}
- value={this.state.remarkEN}
- onChangeText={(text)=>this.validate(text,"remarkEN")}
- inputStyle={{ fontSize: 14, marginLeft: 0 }}
- rightIcon={this.state.RemarkIcon}/>
- <View style={{width:"15%", marginLeft:5}}>
- <TouchableOpacity onPress={()=>this.translate1()}>
- <Image style={{width:20,height:20}} source={require('../assets/ec.png')}/>
- </TouchableOpacity>
- </View>
- </View>
- </View>
- <View style={styles.row}>
- <Text style={styles.label}>{strings.remarkClbl}</Text>
- <View style={styles.row1}>
- <Input
- containerStyle={{ width: "85%" }}
- underlineColorAndroid="transparent"
- inputContainerStyle={styles.input}
- inputStyle={{ fontSize: 14 }}
- value={this.state.remarkCH}
- onChangeText={(text)=>this.validate(text,"remarkCH")}
- inputStyle={{ fontSize: 14, marginLeft: 0 }}
- rightIcon={this.state.Remark1Icon}/>
- <View style={{width:"15%",marginLeft:5}}>
- <TouchableOpacity onPress={()=>this.translate2()}>
- <Image style={{width:20,height:20}} source={require('../assets/ce.png')}/>
- </TouchableOpacity>
- </View>
- </View>
- </View>
- </ScrollView>
- <View style={styles.footerWrap}>
- <Button
- onPress={() => this.onSubmitPress()}
- title={strings.priviewandsubmitbtn}
- icon={<Image resizeMode="contain" style={{ width: 20, height: 20 }} source={require('../assets/check.png')} />}
- iconLeft
- containerStyle={styles.btnContainer}
- buttonStyle={styles.btn}
- />
- </View>
- <Modal
- isVisible={this.state.visible}
- onBackdropPress={() => this.setState({ visible: false })}
- onBackButtonPress={() => this.setState({ visible: false })} >
- <View style={styles.modalContentWrapper}>
- <View style={styles.modalHeader}>
- <Text style={{ color: "#fff" }}>{strings.tradepopuptitle}</Text>
- </View>
- {this.renderPicker()}
- <View style={styles.footerWrap1}>
- <Button
- onPress={() => this.closemodal()}
- icon={<Image resizeMode="contain" style={{ width: 20, height: 20 }} source={require('../assets/check.png')} />}
- iconLeft
- title={strings.okbtn}
- containerStyle={styles.btnContainer}
- buttonStyle={styles.btn}
- />
- </View>
- </View>
- </Modal>
- <Spinner visible={this.state.isLoading1} overlayColor={"rgba(0, 0, 0, 0.65)"} textContent={"Please wait..."} textStyle={{color: '#FFF'}} />
- </ImageBackground>
- )
- }
- }
- const styles = {
- row: {
- flexDirection: "row",
- alignItems: "center",
- justifyContent: "space-between",
- paddingVertical: 2,
- marginVertical: 5,
- paddingHorizontal: 15,
- },
- row1: {
- width: "60%",
- flexDirection: "row",
- },
- label: {
- width: "35%",
- fontSize: 12
- },
- label1: {
- width: "90%",
- fontSize: 16,
- marginBottom:5,
- },
- header: {
- padding: 12,
- backgroundColor: "#3a5e0a"
- },
- headerText: {
- color: "#fff",
- },
- input: {
- height: 30
- },
- footerWrap: {
- position: "absolute",
- width: "100%",
- bottom: 0,
- flexDirection: "row",
- backgroundColor: "#fff"
- },
- footerWrap1: {
- width: "100%",
- bottom: 0,
- flexDirection: "row",
- backgroundColor: "#fff",
- marginTop: 10,
- },
- btnContainer: {
- width: "100%",
- marginLeft: .5,
- marginRight: .5,
- },
- btn: {
- borderRadius: 0,
- backgroundColor: "#7fb539",
- paddingVertical: 6,
- },
- camBtnWrap: {
- borderColor: "#7fb539",
- borderWidth: 1,
- width: 130,
- height: 80,
- borderRadius: 3,
- justifyContent: "center",
- marginLeft: "15%",
- marginBottom: 10
- },
- dropdownContainer: {
- width: "90%",
- marginTop: -25,
- },
- datePickerContainer: {
- width: "90%",
- borderBottomWidth: .8,
- paddingRight: 5
- },
- checkBoxContainer: {
- backgroundColor: "transparent",
- margin: 0,
- borderWidth: 0,
- paddingVertical: 2
- },
- modalContentWrapper: {
- backgroundColor: "#fff",
- },
- modalHeader: {
- padding: 12,
- backgroundColor: "#3a5e0a"
- }
- }
Add Comment
Please, Sign In to add comment