public function shipping_vendore_employee_sign_up($parentOrganizationId = '') { $userType = $this->CI->session->userdata('userType'); $return = array(); $return['imageName'] = ''; $return['firstName'] = ''; $return['middleName'] = ''; $return['lastName'] = ''; $return['email'] = ''; $return['password'] = ''; $return['businessName'] = ''; $return['businessPhone'] = ''; $return['countryId'] = 154; $return['stateId'] = ''; $return['areaId'] = ''; $return['cityId'] = ''; $return['street'] = ''; $return['countryCode'] = '+234'; $return['excelFile'] = ''; $return['dropshipCentre'] = ''; $return['parentOrganizationId'] = $parentOrganizationId; if ($_POST) { //echo "<pre>"; print_r($_POST); exit; $this->CI->custom_log->write_log('custom_log', print_r($_POST, true)); $return['excelFile'] = $this->CI->input->post('excelFile'); $return['imageName'] = $this->CI->input->post('imageName'); $return['firstName'] = $this->CI->input->post('firstName'); $return['middleName'] = $this->CI->input->post('middleName'); $return['lastName'] = $this->CI->input->post('lastName'); $return['email'] = $this->CI->input->post('email'); $return['businessName'] = $this->CI->input->post('businessName'); $return['countryCode'] = trim($this->CI->input->post('countryCode')); $return['businessPhone'] = $this->CI->input->post('businessPhone'); //$return['countryId'] = $this->CI->input->post('countryId'); $return['stateId'] = $this->CI->input->post('stateId'); $return['areaId'] = $this->CI->input->post('areaId'); $return['cityId'] = $this->CI->input->post('cityId'); $return['street'] = $this->CI->input->post('street'); $return['dropshipCentre'] = $this->CI->input->post('dropshipCentre'); $return['password'] = otp5_digit(); $return['OTP'] = otp5_digit(); $return['userName'] = $return['email']; $rules = shipping_vendor_sign_up(); $rules[] = array('field' => 'dropshipCentre[]', 'label' => 'DropshipCentre', 'rules' => 'trim|required'); $this->CI->form_validation->set_rules($rules); $this->CI->form_validation->set_error_delimiters('<div class="error">', '</div>'); if ($this->CI->form_validation->run()) { $organizationId = $this->CI->session->userdata('organizationId'); $this->CI->custom_log->write_log('custom_log', 'Organization id is ' . $organizationId); if ($organizationId) { $employeeId = $this->CI->user_m->add_shipping_vendor_employee($organizationId, $return); $this->CI->custom_log->write_log('custom_log', 'Employee id is ' . $employeeId); foreach ($return['dropshipCentre'] as $dropcenterId) { $this->CI->user_m->add_shipping_employee_dropship($employeeId, $dropcenterId); } if ($employeeId) { $addressId = $this->CI->user_m->add_shipping_vendor_address($return); $this->CI->custom_log->write_log('custom_log', 'address id is ' . $addressId); if ($addressId) { $this->CI->user_m->add_shipping_vendor_employee_address($employeeId, $addressId); $roleID = $this->CI->user_m->add_shipping_vendor_employee_employee_role($employeeId, $organizationId); $this->CI->custom_log->write_log('custom_log', 'Role id is ' . $roleID); if ($roleID) { $mailData = array('email' => $return['email'], 'cc' => '', 'slug' => 'employee_sign_up_from_backend', 'businessName' => $return['businessName'], 'username' => $return['userName'], 'password' => $return['password'], 'verifyUrl' => base_url() . 'admin', 'subject' => 'Vendor employee Sign up Successfully'); if ($this->CI->email_m->send_mail($mailData)) { $this->CI->session->set_flashdata('success', $this->CI->lang->line('success_add_retailer')); $this->CI->custom_log->write_log('custom_log', $this->CI->lang->line('success_add_retailer')); } else { $this->CI->session->set_flashdata('error', 'Retailer create successfully but ' . $this->CI->lang->line('error_mail_not_send')); $this->CI->custom_log->write_log('custom_log', $this->CI->lang->line('error_mail_not_send')); } $this->CI->session->set_flashdata('success', 'Shipping employee Created Successfully'); $this->CI->custom_log->write_log('custom_log', $this->CI->lang->line('success_reatiler_sign_up')); } redirect(base_url() . $userType . '/employee_management'); } else { $this->CI->session->set_flashdata('error', 'Shipping employee address not create'); $this->CI->custom_log->write_log('custom_log', 'Shipping Vendor address not create'); } } else { $this->CI->session->set_flashdata('error', 'Shipping employee not create'); $this->CI->custom_log->write_log('custom_log', 'Shipping Vendor not create'); } } else { $this->CI->session->set_flashdata('error', 'Shipping employee organization not crate'); $this->CI->custom_log->write_log('custom_log', 'Shipping Vendore organization not crate'); } if ($userType == 'admin' || $userType == 'superadmin') { redirect(base_url() . $userType . '/employee_management'); } } } //$return['stateList'] = $this->CI->location_m->nigeria_state_list(); $return['dropshipCentreList'] = $this->CI->retailer_m->dropship_center_list(); return $return; }
public function shipping_vendore_sign_up() { $userType = $this->CI->session->userdata('userType'); $return = array(); $return['imageName'] = ''; $return['firstName'] = ''; $return['middleName'] = ''; $return['lastName'] = ''; $return['email'] = ''; $return['password'] = ''; $return['businessName'] = ''; $return['businessPhone'] = ''; $return['countryId'] = 154; $return['stateId'] = ''; $return['areaId'] = ''; $return['cityId'] = ''; $return['street'] = ''; $return['countryCode'] = '+234'; $return['excelFile'] = ''; if ($_POST) { //echo "<pre>"; print_r($_POST); exit; $this->CI->custom_log->write_log('custom_log', 'form submit data is ' . print_r($_POST, true)); $return['excelFile'] = $this->CI->input->post('excelFile'); $return['imageName'] = $this->CI->input->post('imageName'); $return['firstName'] = $this->CI->input->post('firstName'); $return['middleName'] = $this->CI->input->post('middleName'); $return['lastName'] = $this->CI->input->post('lastName'); $return['email'] = $this->CI->input->post('email'); $return['businessName'] = $this->CI->input->post('businessName'); $return['countryCode'] = trim($this->CI->input->post('countryCode')); $return['businessPhone'] = $this->CI->input->post('businessPhone'); $return['stateId'] = $this->CI->input->post('stateId'); $return['areaId'] = $this->CI->input->post('areaId'); $return['cityId'] = $this->CI->input->post('cityId'); $return['street'] = $this->CI->input->post('street'); $return['OTP'] = otp5_digit(); $return['userName'] = $return['email']; $rules = shipping_vendor_sign_up(); $this->CI->form_validation->set_rules($rules); $this->CI->form_validation->set_error_delimiters('<div class="error">', '</div>'); if ($this->CI->form_validation->run()) { $organizationId = $this->CI->shipping_m->add_shipping_vendor_organization($return); $this->CI->custom_log->write_log('custom_log', 'Organization id is ' . $organizationId); if ($organizationId) { $employeeId = $this->CI->shipping_m->add_shipping_vendor_employee($organizationId, $return); $this->CI->custom_log->write_log('custom_log', 'Employee id is ' . $employeeId); if ($employeeId) { $addressId = $this->CI->shipping_m->add_shipping_vendor_address($return); $this->CI->custom_log->write_log('custom_log', 'address id is ' . $addressId); if ($addressId) { $this->CI->shipping_m->add_shipping_vendor_employee_address($employeeId, $addressId); $roleID = $this->CI->shipping_m->add_shipping_vendor_employee_role($employeeId, $organizationId); $this->CI->custom_log->write_log('custom_log', 'Role id is ' . $roleID); if ($roleID) { $this->CI->session->set_flashdata('success', 'Shipping Vendor Created Successfully'); $this->CI->custom_log->write_log('custom_log', 'Shipping Vendor Created Successfully'); } redirect(base_url() . $userType . '/vendor_management'); } else { $this->CI->session->set_flashdata('error', 'Shipping Vendor address not create'); $this->CI->custom_log->write_log('custom_log', 'Shipping Vendor address not create'); } } else { $this->CI->session->set_flashdata('error', 'Shipping Vendor not create'); $this->CI->custom_log->write_log('custom_log', 'Shipping Vendor not create'); } } else { $this->CI->session->set_flashdata('error', 'Shipping Vendore organization not crate'); $this->CI->custom_log->write_log('custom_log', 'Shipping Vendore organization not crate'); } if ($userType == 'admin' || $userType == 'superadmin') { redirect(base_url() . $userType . '/vendor_management'); } } } //$return['stateList'] = $this->CI->location_m->nigeria_state_list(); return $return; }