From b5da34986154d4ccddefba740e9bc324608b98e0 Mon Sep 17 00:00:00 2001 From: torun23 Date: Mon, 22 Jul 2024 18:09:47 +0530 Subject: [PATCH] commit --- application/config/routes.php | 16 ++- application/controllers/Form_controller.php | 2 +- application/controllers/Home.php | 4 +- application/controllers/New_form.php | 2 +- .../controllers/Publish_controller.php | 4 +- application/controllers/Response_submit.php | 4 +- application/controllers/Users.php | 2 +- application/views/Tables/draft.php | 8 +- application/views/Tables/list_forms.php | 2 +- application/views/edit_form_view.php | 9 +- application/views/form_preview.php | 4 +- application/views/form_preview_back.php | 2 +- application/views/publish_view.php | 5 +- application/views/response_submit.php | 2 +- application/views/templates/forms_ui.php | 5 +- application/views/templates/header.php | 8 +- assets/css/styles.css | 6 + assets/js/edit_form_views.js | 135 ++++++++++++++++++ 18 files changed, 182 insertions(+), 38 deletions(-) create mode 100644 assets/js/edit_form_views.js diff --git a/application/config/routes.php b/application/config/routes.php index c8b9593..92e526a 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -5,14 +5,20 @@ $route['forms'] = 'home/index4'; $route['responses/list/(:num)'] = 'Response_submit/list_responses/$1'; $route['responses/view/(:num)'] = 'Response_submit/viewresponse/$1'; - +$route['publish/(:num)'] = 'forms/preview/$1'; $route['default_controller'] = 'Form_controller/index_forms'; $route['404_override'] = ''; $route['translate_uri_dashes'] = FALSE; $route['start'] = 'Form_controller/index_forms'; -$route['new_form'] = 'home/create_form'; -$route['title_desc'] = 'home/title'; -$route['default_page'] = 'Form_controller/index_forms'; +// $route['new_form'] = 'home/create_form'; +$route['title_desc'] = 'homepage/title'; $route['forms/delete/(:any)'] = 'Form_controller/delete/$1'; -// $route['froms_home'] = 'Form_controller/index_forms'; +$route['home'] = 'Form_controller/index_forms'; +$route['published_forms'] = 'Publish_controller/list_user_published_forms'; +$route['drafts'] = 'Form_controller/index_forms_draft'; +$route['edit/(:num)'] = 'Form_controller/edit_form/$1'; + +$route['form_preview/(:num)'] = 'forms/preview_back/$1'; +$route['responses/(:num)'] = 'Response_submit/view_responses/$1'; +$route['designform'] = 'homepage/design_form'; diff --git a/application/controllers/Form_controller.php b/application/controllers/Form_controller.php index 2f0c987..8123384 100644 --- a/application/controllers/Form_controller.php +++ b/application/controllers/Form_controller.php @@ -39,7 +39,7 @@ class Form_controller extends CI_Controller { $this->load->model('Frontend_model'); $this->Frontend_model->deleteForm($id); $this->session->set_flashdata('status','Form data deleted successfully'); -redirect('default_page'); +redirect('home'); } public function __construct() { parent::__construct(); diff --git a/application/controllers/Home.php b/application/controllers/Home.php index 42a82c8..a06f8b4 100644 --- a/application/controllers/Home.php +++ b/application/controllers/Home.php @@ -1,11 +1,11 @@ load->view('Frontend/header'); diff --git a/application/controllers/New_form.php b/application/controllers/New_form.php index f2dab84..0d12807 100644 --- a/application/controllers/New_form.php +++ b/application/controllers/New_form.php @@ -27,7 +27,7 @@ class New_form extends CI_Controller // $this->session->set_flashdata('user_registered', 'You are now registered and can log in'); - redirect('home/design_form'); + redirect('designform'); } } diff --git a/application/controllers/Publish_controller.php b/application/controllers/Publish_controller.php index a04a305..c159a7c 100644 --- a/application/controllers/Publish_controller.php +++ b/application/controllers/Publish_controller.php @@ -19,7 +19,7 @@ class Publish_controller extends CI_Controller { ]); // Redirect to the list_user_published_forms function - redirect('Publish_controller/list_user_published_forms'); + redirect('published_forms'); } // Method to list published forms of a user @@ -49,6 +49,6 @@ class Publish_controller extends CI_Controller { $this->Publish_model->update_form($form_id, ['is_published' => 0]); // Redirect to the list_user_published_forms function - redirect('Publish_controller/list_user_published_forms'); + redirect('published_forms'); } } diff --git a/application/controllers/Response_submit.php b/application/controllers/Response_submit.php index a23d016..6032f5b 100644 --- a/application/controllers/Response_submit.php +++ b/application/controllers/Response_submit.php @@ -14,7 +14,7 @@ class Response_submit extends CI_Controller { $data['questions'] = $questions; // Redirect to the view_responses function in the Response_submit controller - redirect('Response_submit/view_responses/' . $form_id); + redirect('responses/' . $form_id); } public function view_responses($form_id) { @@ -66,7 +66,7 @@ class Response_submit extends CI_Controller { $this->Response_model->insert_response_answer($data); } - redirect('Response_submit/view_responses/' . $form_id); + redirect('responses/' . $form_id); } diff --git a/application/controllers/Users.php b/application/controllers/Users.php index 2dd567f..9d42e47 100644 --- a/application/controllers/Users.php +++ b/application/controllers/Users.php @@ -71,7 +71,7 @@ class Users extends CI_Controller // Set message $this->session->set_flashdata('user_loggedin', 'You are now logged in'); - redirect('default_page'); + redirect('home'); } else { // Set message $this->session->set_flashdata('login_failed', 'Login is invalid'); diff --git a/application/views/Tables/draft.php b/application/views/Tables/draft.php index 0d7355b..f6f9d1c 100644 --- a/application/views/Tables/draft.php +++ b/application/views/Tables/draft.php @@ -30,17 +30,17 @@ Drafts id; ?> title; ?> + href="id); ?>">title; ?> description; ?> created_at; ?> - Edit + Edit Delete + class="btn btn-danger btn-sm" style=" background-color: rgb(103, 58, 183); border-color: rgb(103, 58, 183); color: white;">Delete diff --git a/application/views/Tables/list_forms.php b/application/views/Tables/list_forms.php index 8fe06ea..d7e00e9 100644 --- a/application/views/Tables/list_forms.php +++ b/application/views/Tables/list_forms.php @@ -29,7 +29,7 @@ id; ?> title; ?> + href="id); ?>">title; ?> description; ?> created_at; ?> diff --git a/application/views/edit_form_view.php b/application/views/edit_form_view.php index 214dd82..fd53d9f 100644 --- a/application/views/edit_form_view.php +++ b/application/views/edit_form_view.php @@ -8,10 +8,6 @@ - -
@@ -59,7 +55,7 @@
- + @@ -146,7 +142,7 @@ $(document).ready(function() { success: function(response) { if (response.status === 'success') { alert('Form updated successfully!'); - window.location.href = base_url + 'Form_controller/index_forms_draft'; + window.location.href = base_url + 'drafts'; } else { alert(response.message); } @@ -204,3 +200,4 @@ $(document).ready(function() { + diff --git a/application/views/form_preview.php b/application/views/form_preview.php index 8b40637..fd32754 100644 --- a/application/views/form_preview.php +++ b/application/views/form_preview.php @@ -120,7 +120,7 @@ - Publish - + Publish + diff --git a/application/views/form_preview_back.php b/application/views/form_preview_back.php index a14f07b..045418d 100644 --- a/application/views/form_preview_back.php +++ b/application/views/form_preview_back.php @@ -58,7 +58,7 @@ - Back + Back diff --git a/application/views/publish_view.php b/application/views/publish_view.php index 3be8acb..e939504 100644 --- a/application/views/publish_view.php +++ b/application/views/publish_view.php @@ -29,21 +29,20 @@ id; ?> - title; ?> + title; ?> description; ?> response_link; ?> - Unpublish + Unpublish - diff --git a/application/views/response_submit.php b/application/views/response_submit.php index 31a7e7d..c054d8c 100644 --- a/application/views/response_submit.php +++ b/application/views/response_submit.php @@ -66,7 +66,7 @@ - + diff --git a/application/views/templates/forms_ui.php b/application/views/templates/forms_ui.php index 0fd919c..60b90b7 100644 --- a/application/views/templates/forms_ui.php +++ b/application/views/templates/forms_ui.php @@ -28,6 +28,7 @@ #submit-btn { margin-top: 20px; + background-color: rgb(103, 58, 183); border-color: rgb(103, 58, 183); color: white;" float: left; clear: both; } @@ -45,7 +46,7 @@