From b715bfa19d8b0951f19298441e4eb916f1a66ecf Mon Sep 17 00:00:00 2001 From: "alextselegidis@gmail.com" Date: Sun, 14 Apr 2013 19:42:40 +0000 Subject: [PATCH] =?UTF-8?q?=CE=A3=CF=87=CE=B5=CE=B4=CE=AF=CE=B1=CF=83?= =?UTF-8?q?=CE=B7=20=CE=B2=CE=AC=CF=83=CE=B7=CF=82=20=CE=B4=CE=B5=CE=B4?= =?UTF-8?q?=CE=BF=CE=BC=CE=AD=CE=BD=CF=89=CE=BD,=20=CE=A3=CF=84=CE=AE?= =?UTF-8?q?=CF=83=CE=B9=CE=BC=CE=BF=20code=20igniter=20=CE=BA=CE=B1=CE=B9?= =?UTF-8?q?=20=CE=B5=CE=BA=CE=BA=CE=AF=CE=BD=CE=B7=CF=83=CE=B7=20=CF=85?= =?UTF-8?q?=CE=BB=CE=BF=CF=80=CE=BF=CE=AF=CE=B7=CF=83=CE=B7=CF=82=20=CF=84?= =?UTF-8?q?=CE=B7=CF=82=20=CF=80=CE=B5=CF=81=CE=AF=CF=80=CF=84=CF=89=CF=83?= =?UTF-8?q?=CE=B7=CF=82=20=CF=87=CF=81=CE=AE=CF=83=CE=B7=CF=82=20'=CE=9A?= =?UTF-8?q?=CF=81=CE=AC=CF=84=CE=B7=CF=83=CE=B7=20=CE=A1=CE=B1=CE=BD=CF=84?= =?UTF-8?q?=CE=B5=CE=B2=CE=BF=CF=8D'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/easy_appointments.sql | 184 ++++++++++++++++++ src/application/config/autoload.php | 2 +- src/application/controllers/appointments.php | 21 +- src/application/language/german/index.html | 10 + src/application/language/greek/index.html | 10 + src/application/models/appointments.php | 7 + src/application/models/customers.php | 7 + src/application/models/providers.php | 7 + src/application/models/services.php | 19 ++ src/application/models/settings.php | 54 +++++ src/application/views/appointments/book.php | 91 +++++++++ .../views/appointments/register.php | 13 -- src/assets/css/style.css | 76 ++++++++ 13 files changed, 472 insertions(+), 29 deletions(-) create mode 100644 db/easy_appointments.sql create mode 100644 src/application/language/german/index.html create mode 100644 src/application/language/greek/index.html create mode 100644 src/application/models/appointments.php create mode 100644 src/application/models/customers.php create mode 100644 src/application/models/providers.php create mode 100644 src/application/models/services.php create mode 100644 src/application/models/settings.php create mode 100644 src/application/views/appointments/book.php delete mode 100644 src/application/views/appointments/register.php diff --git a/db/easy_appointments.sql b/db/easy_appointments.sql new file mode 100644 index 00000000..8f234e56 --- /dev/null +++ b/db/easy_appointments.sql @@ -0,0 +1,184 @@ +-- phpMyAdmin SQL Dump +-- version 3.5.1 +-- http://www.phpmyadmin.net +-- +-- Φιλοξενητής: localhost +-- Χρόνος δημιουργίας: 14 Απρ 2013 στις 19:41:00 +-- Έκδοση διακομιστή: 5.5.24-log +-- Έκδοση PHP: 5.4.3 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Βάση: `easy_appointments` +-- + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_appointments` +-- + +CREATE TABLE IF NOT EXISTS `ea_appointments` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `start_datetime` datetime DEFAULT NULL, + `end_datetime` datetime DEFAULT NULL, + `comments` text, + `id_users_provider` bigint(20) unsigned NOT NULL, + `id_users_customer` bigint(20) unsigned NOT NULL, + `id_services` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `id_users_customer` (`id_users_customer`), + KEY `id_services` (`id_services`), + KEY `id_users_provider` (`id_users_provider`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_roles` +-- + +CREATE TABLE IF NOT EXISTS `ea_roles` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(256) DEFAULT NULL, + `is_admin` tinyint(4) DEFAULT NULL COMMENT '0', + `services` int(4) DEFAULT NULL COMMENT '0', + `providers` int(4) DEFAULT NULL COMMENT '0', + `customers` int(4) DEFAULT NULL COMMENT '0', + `notifications` int(4) DEFAULT NULL COMMENT '0', + `appointments` int(4) DEFAULT NULL COMMENT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; + +-- +-- Άδειασμα δεδομένων του πίνακα `ea_roles` +-- + +INSERT INTO `ea_roles` (`id`, `name`, `is_admin`, `services`, `providers`, `customers`, `notifications`, `appointments`) VALUES +(1, 'Administrator', 1, 15, 15, 15, 15, 15); + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_services` +-- + +CREATE TABLE IF NOT EXISTS `ea_services` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(256) DEFAULT NULL, + `duration` int(11) DEFAULT NULL, + `price` decimal(10,2) DEFAULT NULL, + `currency` varchar(32) DEFAULT NULL, + `description` text, + `id_service_categories` bigint(20) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `id_service_categories` (`id_service_categories`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; + +-- +-- Άδειασμα δεδομένων του πίνακα `ea_services` +-- + +INSERT INTO `ea_services` (`id`, `name`, `duration`, `price`, `currency`, `description`, `id_service_categories`) VALUES +(1, 'General Examination', 20, '50.00', 'euro', 'Sample Description ...', NULL); + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_service_categories` +-- + +CREATE TABLE IF NOT EXISTS `ea_service_categories` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(256) DEFAULT NULL, + `description` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_settings` +-- + +CREATE TABLE IF NOT EXISTS `ea_settings` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(512) DEFAULT NULL, + `value` longtext, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; + +-- +-- Άδειασμα δεδομένων του πίνακα `ea_settings` +-- + +INSERT INTO `ea_settings` (`id`, `name`, `value`) VALUES +(1, 'business_name', 'Javation & Co'); + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_users` +-- + +CREATE TABLE IF NOT EXISTS `ea_users` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(256) DEFAULT NULL, + `password` varchar(512) DEFAULT NULL, + `first_name` varchar(256) DEFAULT NULL, + `last_name` varchar(512) DEFAULT NULL, + `email` varchar(512) DEFAULT NULL, + `mobile_number` varchar(128) DEFAULT NULL, + `phone_number` varchar(128) DEFAULT NULL, + `address` varchar(256) DEFAULT NULL, + `city` varchar(256) DEFAULT NULL, + `state` varchar(128) DEFAULT NULL, + `zip_code` varchar(64) DEFAULT NULL, + `notes` text, + `id_roles` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `id_roles` (`id_roles`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; + +-- +-- Άδειασμα δεδομένων του πίνακα `ea_users` +-- + +INSERT INTO `ea_users` (`id`, `username`, `password`, `first_name`, `last_name`, `email`, `mobile_number`, `phone_number`, `address`, `city`, `state`, `zip_code`, `notes`, `id_roles`) VALUES +(1, 'admin', 'admin', 'Alex', 'Tselegidis', 'alextselegidis@gmail.com', '123456789', '987654321', 'Pantazopoulou 11', 'Thessaloniki', NULL, '56121', 'This is me making Easy!Appointments', 1); + +-- +-- Περιορισμοί για άχρηστους πίνακες +-- + +-- +-- Περιορισμοί για πίνακα `ea_appointments` +-- +ALTER TABLE `ea_appointments` + ADD CONSTRAINT `ea_appointments_ibfk_2` FOREIGN KEY (`id_users_customer`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `ea_appointments_ibfk_3` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `ea_appointments_ibfk_4` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Περιορισμοί για πίνακα `ea_services` +-- +ALTER TABLE `ea_services` + ADD CONSTRAINT `ea_services_ibfk_1` FOREIGN KEY (`id_service_categories`) REFERENCES `ea_service_categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Περιορισμοί για πίνακα `ea_users` +-- +ALTER TABLE `ea_users` + ADD CONSTRAINT `ea_users_ibfk_1` FOREIGN KEY (`id_roles`) REFERENCES `ea_roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/src/application/config/autoload.php b/src/application/config/autoload.php index 53129c9c..17c50920 100644 --- a/src/application/config/autoload.php +++ b/src/application/config/autoload.php @@ -52,7 +52,7 @@ $autoload['packages'] = array(); | $autoload['libraries'] = array('database', 'session', 'xmlrpc'); */ -$autoload['libraries'] = array(); +$autoload['libraries'] = array('database'); /* diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php index e89c905f..00830ece 100644 --- a/src/application/controllers/appointments.php +++ b/src/application/controllers/appointments.php @@ -1,24 +1,15 @@ - * @see http://codeigniter.com/user_guide/general/urls.html + * This page displays the book appointment wizard + * for the customers. */ public function index() { - $this->load->view('appointments/register'); + $this->load->model('Settings'); + $viewData['businessName'] = $this->Settings->getSetting('business_name'); + + $this->load->view('appointments/book', $viewData); } } diff --git a/src/application/language/german/index.html b/src/application/language/german/index.html new file mode 100644 index 00000000..c942a79c --- /dev/null +++ b/src/application/language/german/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/src/application/language/greek/index.html b/src/application/language/greek/index.html new file mode 100644 index 00000000..c942a79c --- /dev/null +++ b/src/application/language/greek/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/src/application/models/appointments.php b/src/application/models/appointments.php new file mode 100644 index 00000000..b6eddc13 --- /dev/null +++ b/src/application/models/appointments.php @@ -0,0 +1,7 @@ + diff --git a/src/application/models/customers.php b/src/application/models/customers.php new file mode 100644 index 00000000..b6eddc13 --- /dev/null +++ b/src/application/models/customers.php @@ -0,0 +1,7 @@ + diff --git a/src/application/models/providers.php b/src/application/models/providers.php new file mode 100644 index 00000000..b6eddc13 --- /dev/null +++ b/src/application/models/providers.php @@ -0,0 +1,7 @@ + diff --git a/src/application/models/services.php b/src/application/models/services.php new file mode 100644 index 00000000..fac32b90 --- /dev/null +++ b/src/application/models/services.php @@ -0,0 +1,19 @@ +db->query('SELECT *'); + + return $this->db->get('ea_services'); + } +} +?> diff --git a/src/application/models/settings.php b/src/application/models/settings.php new file mode 100644 index 00000000..f46f368d --- /dev/null +++ b/src/application/models/settings.php @@ -0,0 +1,54 @@ +db->get_where('ea_settings', array('name' => $name)); + $setting = ($query->num_rows() > 0) ? $query->row() : ''; + return $setting->value; + } + + /** + * This method sets the value for a specific setting + * on the database. If the setting doesn't exist, it + * is going to be created, otherwise updated. + * + * @param string $name The setting name. + * @param type $value The setting value. + * + * @return bool Returns the operation success - failure + * result. + */ + function setSetting($name, $value) + { + $query = $this->db->get_where('ea_settings', array('name' => $name)); + if ($query->num_rows() > 0) { + // Update setting + $updateData = array('value' => $value); + $this->db->where('name', $name); + $result = $this->db->update('ea_settings', $updateData); + } else { + // Insert setting + $insertData = array( + 'name' => $name, + 'value' => $value + ); + $result = $this->db->insert('ea_settings', $insertData); + } + + return $result; + } +} +?> \ No newline at end of file diff --git a/src/application/views/appointments/book.php b/src/application/views/appointments/book.php new file mode 100644 index 00000000..a7e46c7e --- /dev/null +++ b/src/application/views/appointments/book.php @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ 1 +
+ +
+ 2 +
+
+ 3 +
+
+ 4 +
+
+
+ + +
+

Select Service & Provider

+ + + + + + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ + +
+
+ + diff --git a/src/application/views/appointments/register.php b/src/application/views/appointments/register.php deleted file mode 100644 index 9fe7536f..00000000 --- a/src/application/views/appointments/register.php +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/assets/css/style.css b/src/assets/css/style.css index 71ce8750..a67c748f 100644 --- a/src/assets/css/style.css +++ b/src/assets/css/style.css @@ -5,3 +5,79 @@ root { display: block; } +body { + background-color: #CAEDF3; +} + + +/* REGISTER APPOINTMENT + ------------------------------------------------------------------------------ */ +#book-appointment { + width: 660px; + margin: 150px auto; + background: #FFF; + box-shadow: 0px 1px 1px #B6B6B6; +} + +#book-appointment #top-bar { + padding: 5px; + height: 70px; + background: #3DD481; + border-bottom: 2px solid #1A865F; +} + +#book-appointment #business-name { + font-weight: bold; + color: #FFF; + font-size: 27px; + margin: 27px 10px 0 14px; + display: inline-block; + text-shadow: 0px 1px 1px #8F8888; + float: left; +} + +#book-appointment #book-steps { + width: 252px; + display: inline-block; + float: right; + margin-top: 12px; +} + +#book-appointment .book-appoinment-step { + padding: 10px 20px; +} + +#book-appointment .book-step { + display: inline-block; + height: 28px; + width: 28px; + float: left; + background: #E1FFCF; + padding: 10px; + margin-right: 15px; + border-radius: 50px; + box-shadow: inset 1px 1px 3px #2B2B2B; +} + +#book-appointment .book-step strong { + font-size: 29px; + display: block; + text-align: center; + margin-top: 4px; + color: #B6DFC6; +} + +#book-appointment .active-step { + background: #FAFA99; +} + +#book-appointment .active-step strong { + color: #696439; +} + +#book-appointment #frame-footer { + padding: 10px; + text-align: center; + border-top: 1px solid #EEE; + background: #FAFAFA; +} \ No newline at end of file