<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Registration
 *
 * @author mzq163
 */
class Registration extends CI_Controller {

    //put your code here

    public function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->library('session');
        $this->load->model('Registration_model', 'r_model');
    }

    /**
     * 
     * 
     * 
     * 
     */
    public function userRegistrationNewForm() {
        $response_data['response'] = $this->session->flashdata('response');
        $response_data['status'] = $this->session->flashdata('status');
        $response_data['message'] = $this->session->flashdata('message');
        $this->session->set_userdata('rendering', 'registration');
        $this->load->view('welcome', $response_data);
    }

    /**
     * 
     * 
     * 
     * 
     */
    public function userRegistrationNewFormSubmit() {

        $post_data = array();

        $post_data['companyName'] = $this->input->post('company_name');

        $post_data['firstName'] = $this->input->post('admin_user_name_first');

        $post_data['lastName'] = $this->input->post('admin_user_name_last');

        $post_data['loginId'] = $this->input->post('admin_login_id');

        $post_data['password'] = base64_encode($this->input->post('password'));

        $post_data['mobileNumber'] = $this->input->post('mobile_number');

        $post_data['email'] = $this->input->post('email_admin');


        $post_data['dateOfBirth'] = date('Y-m-d', strtotime($this->input->post('date_of_birth')));
       
        $response_model = $this->r_model->userRegistrationNewFormSubmit_model($post_data);

        $this->session->set_flashdata('response', $response_model['response_data']);
        $this->session->set_flashdata('status', $response_model['status']);
        $this->session->set_flashdata('message', $response_model['message']);
        
        redirect('');
    }

    /**
     * 
     * 
     * 
     * 
     */
    public function userRegistrationUpdateForm() {
        
    }

    /**
     * 
     * 
     * 
     * 
     */
    public function userRegistrationUpdateFormSubmit() {
        
    }

}
