diff --git a/app/Config/Routes.php b/app/Config/Routes.php index b11cebe5..d67e19b0 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -111,11 +111,11 @@ $routes->get('generate_invoice_pdf/(:num)', 'Invoice::generate_invoice_pdf/$1'); $routes->get('print_address/(:num)', 'Invoice::print_address/$1'); - # Notifications Routes $routes->get('send_whatsapp_message/', 'Notifications::send_whatsapp_message'); $routes->post('whatsapp_custom_notifications/', 'Notifications::whatsapp_custom_notifications'); $routes->match(['post', 'get'], 'mail_custom_notifications', 'Notifications::mail_custom_notifications'); +$routes->get('customer_group_notifications/', 'Notifications::customer_group_notifications'); # Api integration Routes $routes->post('api/(:any)', 'ApiIntegration::api_integration/$1'); diff --git a/app/Controllers/ApiIntegration.php b/app/Controllers/ApiIntegration.php index 9fe02c50..d6082689 100644 --- a/app/Controllers/ApiIntegration.php +++ b/app/Controllers/ApiIntegration.php @@ -361,7 +361,7 @@ class ApiIntegration extends ResourceController } $book_image_data[$i]['img_name'] =isset($img->name) && !empty($img->name) ? $img->name : NULL; $book_image_data[$i]['wp_img_url'] = isset($img->src) && !empty($img->src) ? $img->src : NULL; - $book_image_data[$i]['is_cover'] = 0; + $book_image_data[$i]['is_cover'] = empty($bookImgId) && $i == 0 ? 1 : 0 ; $book_image_data[$i]['type'] = 2; $book_image_data[$i]['book_id'] = $last_insert_book_id; $book_image_data[$i]['isactive'] = 1; @@ -796,6 +796,7 @@ class ApiIntegration extends ResourceController $invoice_data['payment_status']=$records['status']; $invoice_data['order_number']=$records['order_key']; $invoice_data['payment_method']=$records['payment_method_title']; + $invoice_data['status']='Approved'; $invoice_data['event_id']=NULL; $invoice_data['business_id']=$this->global_variable_business_id; $invoice_data['shipping_address']=$shipping_addr; @@ -1143,7 +1144,7 @@ class ApiIntegration extends ResourceController $this->logger->info("Api saveInvoiceAddressInCustomerAddress = ".json_encode($request_addr_array)); $this->logger->info("Api saveInvoiceAddressInCustomerAddress Flag = ".$flag." Customer Id = ".$customer_id); $api_model = new ApiIntegrationModel(); - $where = ['customer_id' =>$customer_id,'address_type'=>$flag, + $where = ['customer_id' =>$customer_id,'address_type'=>(int)$flag, 'first_name'=>$request_addr_array[0]->first_name,'last_name'=>$request_addr_array[0]->last_name, 'address_1'=>$request_addr_array[0]->address_1,'address_2'=>$request_addr_array[0]->address_2, 'city'=>$request_addr_array[0]->city,'postal_code'=>$request_addr_array[0]->postcode]; diff --git a/app/Controllers/Customer.php b/app/Controllers/Customer.php index 0a277396..fc900f4d 100644 --- a/app/Controllers/Customer.php +++ b/app/Controllers/Customer.php @@ -73,6 +73,8 @@ class Customer extends BaseController } $data['session_bid'] = $session_bid; + $data['country_details'] = $this->get_country_details(); + $data['state_details'] = $this->get_state_details(); $this->render_page('customer_form', $data); } @@ -80,6 +82,8 @@ class Customer extends BaseController ## For inserting/updating details of customer public function insert_customer() { + $requestData = $this->request->getPost(); + print_r($requestData);die; $this->logger->info("Customer: Inserting/Updating Details"); try { helper('session'); @@ -186,7 +190,8 @@ class Customer extends BaseController $baddress2 = $requestData[$letteringflag . 'address2']; $bcountry = $requestData[$letteringflag . 'country']; $bcity = $requestData[$letteringflag . 'city']; - $bstate = $requestData[$letteringflag . 'state']; + $binputstate = $requestData[$letteringflag . 'istate']; + $bdropdownstate = $requestData[$letteringflag . 'dstate']; $bzip = $requestData[$letteringflag . 'zip']; $count = count($CAid); $address_array = []; @@ -200,7 +205,7 @@ class Customer extends BaseController $address_array[$x]['address_1'] = $baddress1[$x]; $address_array[$x]['address_2'] = $baddress2[$x]; $address_array[$x]['city'] = $bcity[$x]; - $address_array[$x]['state'] = $bstate[$x]; + $address_array[$x]['state'] = $bcountry[$x] === 'IN' ? $bdropdownstate[$x] : $binputstate[$x] ; $address_array[$x]['country'] = $bcountry[$x]; $address_array[$x]['postal_code'] = $bzip[$x]; $address_array[$x]['customer_id'] = $id; @@ -269,4 +274,21 @@ class Customer extends BaseController $address_details = $model->where($where)->findAll(); return $address_details; } + + public function get_country_details() + { + $model = new CustomerModel(); + $model->setTable('countries'); + $country_details = $model->orderBy('country_id', 'ASC')->findAll(); + return $country_details; + } + + public function get_state_details() + { + $model = new CustomerModel(); + $model->setTable('states'); + $state_details = $model->orderBy('state_id', 'ASC')->findAll(); + return $state_details; + } + } diff --git a/app/Controllers/Notifications.php b/app/Controllers/Notifications.php index dfaf7158..0542c981 100755 --- a/app/Controllers/Notifications.php +++ b/app/Controllers/Notifications.php @@ -134,4 +134,8 @@ class Notifications extends BaseController $this->logger->info("Notification : Duedate notification Whatsapp Response = " . json_encode($whatsapp_result)); } + + public function customer_group_notifications(){ + echo "customer_group_notifications";die; + } } diff --git a/app/Views/customer_form.php b/app/Views/customer_form.php index 0382706c..b21b67c5 100644 --- a/app/Views/customer_form.php +++ b/app/Views/customer_form.php @@ -4,126 +4,102 @@
- + - +