From bdf8760c484885431415ac187cddba97e14ac39b Mon Sep 17 00:00:00 2001 From: SHEREEF PT Date: Thu, 11 May 2017 15:16:55 +0530 Subject: [PATCH] [CHNG]Public User Issue Fixed --- salon_management/__init__.py | 25 +++++- salon_management/__openerp__.py | 7 +- salon_management/controllers/__init__.py | 23 +++++ salon_management/controllers/main.py | 89 +++++++++++++++++++ salon_management/models/__init__.py | 2 +- salon_management/models/salon_booking.py | 61 +------------ salon_management/models/salon_config.py | 5 +- salon_management/models/salon_management.py | 15 +--- salon_management/security/ir.model.access.csv | 46 ++++------ salon_management/security/salon_security.xml | 35 -------- .../static/description/index.html | 50 +++++++---- .../static/src/js/salon_booking.js | 84 ++++++----------- salon_management/views/salon_bookings.xml | 4 +- salon_management/views/salon_config.xml | 12 +-- 14 files changed, 234 insertions(+), 224 deletions(-) create mode 100644 salon_management/controllers/__init__.py create mode 100644 salon_management/controllers/main.py delete mode 100644 salon_management/security/salon_security.xml diff --git a/salon_management/__init__.py b/salon_management/__init__.py index 2c4eac3f8..8d489bf75 100644 --- a/salon_management/__init__.py +++ b/salon_management/__init__.py @@ -1 +1,24 @@ -import models \ No newline at end of file +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2015-TODAY Cybrosys Technologies(). +# Author: Avinash Nk() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import models +import controllers diff --git a/salon_management/__openerp__.py b/salon_management/__openerp__.py index 266b44236..b618f7d07 100644 --- a/salon_management/__openerp__.py +++ b/salon_management/__openerp__.py @@ -2,7 +2,7 @@ ############################################################################## # # Cybrosys Technologies Pvt. Ltd. -# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Copyright (C) 2015-TODAY Cybrosys Technologies(). # Author: Avinash Nk() # you can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. @@ -23,7 +23,7 @@ { 'name': 'Beauty Spa Management', 'summary': """Beauty Parlour Management with Online Booking System""", - 'version': '9.0.2.0.0', + 'version': '9.0.3.0.0', 'author': 'Cybrosys Techno Solutions', 'website': "http://www.cybrosys.com", 'company': 'Cybrosys Techno Solutions', @@ -40,14 +40,13 @@ 'views/salon_email_template.xml', 'views/salon_config.xml', 'views/working_hours.xml', - 'security/salon_security.xml', 'security/ir.model.access.csv', ], 'demo': [ 'views/booking_demo.xml', ], 'images': ['static/description/banner.jpg'], - 'license': 'AGPL-3', + 'license': 'LGPL-3', 'installable': True, 'application': True, } diff --git a/salon_management/controllers/__init__.py b/salon_management/controllers/__init__.py new file mode 100644 index 000000000..b46b74ded --- /dev/null +++ b/salon_management/controllers/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2015-TODAY Cybrosys Technologies(). +# Author: Avinash Nk() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import main \ No newline at end of file diff --git a/salon_management/controllers/main.py b/salon_management/controllers/main.py new file mode 100644 index 000000000..fd0643e88 --- /dev/null +++ b/salon_management/controllers/main.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2015-TODAY Cybrosys Technologies(). +# Author: Avinash Nk() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import json +from datetime import datetime, date +from openerp.addons.web import http +from openerp import SUPERUSER_ID +from openerp.addons.web.http import request + + +class SalonBookingWeb(http.Controller): + + @http.route('/page/salon_details', csrf=False, type="http", methods=['POST', 'GET'], auth="public", website=True) + def salon_details(self, **kwargs): + + name = kwargs['name'] + date = kwargs['date'] + time = kwargs['time'] + phone = kwargs['phone'] + email = kwargs['email'] + chair = kwargs['chair'] + j = 0 + service_list = [] + while(j < (int(kwargs['number']))): + item = "list_service["+str(j)+"][i]" + service_list.append(int(kwargs[item])) + j += 1 + salon_service_obj = request.env['salon.service'].search([('id', 'in', service_list)]) + dates_time = date+" "+time+":00" + date_and_time = datetime.strptime(dates_time, '%m/%d/%Y %H:%M:%S') + salon_booking = request.registry['salon.booking'] + booking_data = { + 'name': name, + 'phone': phone, + 'time': date_and_time, + 'email': email, + 'chair_id': chair, + 'services': [(6, 0, [x.id for x in salon_service_obj])], + } + salon_booking.create(request.cr, SUPERUSER_ID, booking_data, context=request.context) + return json.dumps({'result': True}) + + @http.route('/page/salon_check_date', type='json', auth="public", website=True) + def salon_check(self, **kwargs): + date_info = kwargs.get('check_date') + return date_info + + @http.route('/page/salon_management.salon_booking_thank_you', type='http', auth="public", website=True) + def thank_you(self, **post): + return request.website.render('salon_management.salon_booking_thank_you', {}) + + @http.route('/page/salon_management.salon_booking_form', type='http', auth="public", website=True) + def chair_info(self, **post): + + salon_service_obj = request.env['salon.service'].search([]) + salon_working_hours_obj = request.env['salon.working.hours'].search([]) + salon_holiday_obj = request.env['salon.holiday'].search([('holiday', '=', True)]) + date_check = date.today() + if 'x' in post.keys(): + date_check = post['x'] + chair_obj = request.env['salon.chair'].search([('active_booking_chairs', '=', True)]) + order_obj = request.env['salon.order'].search([('chair_id.active_booking_chairs', '=', True), + ('stage_id', 'in', [1, 2, 3])]) + date_check = str(date_check) + order_obj = order_obj.search([('start_date_only', '=', date_check)]) + return request.website.render('salon_management.salon_booking_form', + {'chair_details': chair_obj, 'order_details': order_obj, + 'salon_services': salon_service_obj, 'date_search': date_check, + 'holiday': salon_holiday_obj, + 'working_time': salon_working_hours_obj}) \ No newline at end of file diff --git a/salon_management/models/__init__.py b/salon_management/models/__init__.py index 4b79cf330..1c27fbde1 100644 --- a/salon_management/models/__init__.py +++ b/salon_management/models/__init__.py @@ -2,7 +2,7 @@ ############################################################################## # # Cybrosys Technologies Pvt. Ltd. -# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Copyright (C) 2015-TODAY Cybrosys Technologies(). # Author: Avinash Nk() # you can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. diff --git a/salon_management/models/salon_booking.py b/salon_management/models/salon_booking.py index 144534147..dc0995f9e 100644 --- a/salon_management/models/salon_booking.py +++ b/salon_management/models/salon_booking.py @@ -2,7 +2,7 @@ ############################################################################## # # Cybrosys Technologies Pvt. Ltd. -# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Copyright (C) 2015-TODAY Cybrosys Technologies(). # Author: Avinash Nk() # you can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. @@ -20,14 +20,11 @@ # If not, see . # ############################################################################## -from openerp.addons.web import http -from openerp import models, fields, _, SUPERUSER_ID, api -from openerp.addons.web.http import request -from datetime import datetime, date +from openerp import models, fields, api +from datetime import date class SalonBookingBackend(models.Model): - _name = 'salon.booking' name = fields.Char(string="Name") @@ -85,55 +82,3 @@ class SalonBookingBackend(models.Model): self.env['mail.template'].browse(template.id).send_mail(self.id) self.state = "rejected" - -class SalonBookingWeb(http.Controller): - - @http.route('/page/salon_details', type='json', auth="public", website=True) - def salon_details(self, **kwargs): - booking_info = kwargs.get('salon_data') - name = booking_info[0] - date = booking_info[1] - time = booking_info[2] - phone = booking_info[3] - email = booking_info[4] - services = booking_info[5] - chair = booking_info[6] - salon_service_obj = request.env['salon.service'].search([('id', 'in', services)]) - dates_time = date+" "+time+":00" - date_and_time = datetime.strptime(dates_time, '%m/%d/%Y %H:%M:%S') - salon_booking = request.registry['salon.booking'] - booking_data = { - 'name': name, - 'phone': phone, - 'time': date_and_time, - 'email': email, - 'chair_id': chair, - 'services': [(6, 0, [x.id for x in salon_service_obj])], - } - salon_booking.create(request.cr, SUPERUSER_ID, booking_data, context=request.context) - return - - @http.route('/page/salon_check_date', type='json', auth="public", website=True) - def salon_check(self, **kwargs): - date_info = kwargs.get('check_date') - return date_info - - @http.route('/page/salon_management.salon_booking_form', type='http', auth="public", website=True) - def chair_info(self, **post): - - salon_service_obj = request.env['salon.service'].search([]) - salon_working_hours_obj = request.env['salon.working.hours'].search([]) - salon_holiday_obj = request.env['salon.holiday'].search([('holiday', '=', True)]) - date_check = date.today() - if 'x' in post.keys(): - date_check = post['x'] - chair_obj = request.env['salon.chair'].search([('active_booking_chairs', '=', True)]) - order_obj = request.env['salon.order'].search([('chair_id.active_booking_chairs', '=', True), - ('stage_id', 'in', [1, 2, 3])]) - date_check = str(date_check) - order_obj = order_obj.search([('start_date_only', '=', date_check)]) - return request.website.render('salon_management.salon_booking_form', - {'chair_details': chair_obj, 'order_details': order_obj, - 'salon_services': salon_service_obj, 'date_search': date_check, - 'holiday': salon_holiday_obj, - 'working_time': salon_working_hours_obj}) \ No newline at end of file diff --git a/salon_management/models/salon_config.py b/salon_management/models/salon_config.py index c1fde5cb8..e6172607d 100644 --- a/salon_management/models/salon_config.py +++ b/salon_management/models/salon_config.py @@ -2,7 +2,7 @@ ############################################################################## # # Cybrosys Technologies Pvt. Ltd. -# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Copyright (C) 2015-TODAY Cybrosys Technologies(). # Author: Avinash Nk() # you can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. @@ -25,6 +25,7 @@ from openerp import models, fields, api class SalonWorkingHours(models.Model): _name = 'salon.working.hours' + name = fields.Char(string="Name") from_time = fields.Float(string="Starting Time") to_time = fields.Float(string="Closing Time") @@ -32,12 +33,12 @@ class SalonWorkingHours(models.Model): class SalonHoliday(models.Model): _name = 'salon.holiday' + name = fields.Char(string="Name") holiday = fields.Boolean(string="Holiday") class WorkshopSetting(models.Model): - _name = "salon.config.settings" @api.model diff --git a/salon_management/models/salon_management.py b/salon_management/models/salon_management.py index d297ff8ff..08455b3a7 100644 --- a/salon_management/models/salon_management.py +++ b/salon_management/models/salon_management.py @@ -2,7 +2,7 @@ ############################################################################## # # Cybrosys Technologies Pvt. Ltd. -# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Copyright (C) 2015-TODAY Cybrosys Technologies(). # Author: Avinash Nk() # you can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. @@ -20,37 +20,33 @@ # If not, see . # ############################################################################## -from openerp import models, fields, api from datetime import date, datetime, timedelta +from openerp import models, fields, api from openerp.tools.translate import _ from openerp.exceptions import UserError, ValidationError -from openerp.http import request class PartnerSalon(models.Model): - _inherit = 'res.partner' partner_salon = fields.Boolean(string="Is a Salon Partner") class SequenceUpdaterSalon(models.Model): - _name = 'salon.sequence.updater' sequence_salon = fields.Char(string="Salon Sequence") class UserSalon(models.Model): - _inherit = 'res.users' user_salon_active = fields.Boolean(string="Active Salon Users") class SalonChair(models.Model): - _name = 'salon.chair' + name = fields.Char(string="Chair", required=True, default=lambda self: self.env['salon.sequence.updater'].browse(1).sequence_salon or "Chair-1n") number_of_orders = fields.Integer(string="No.of Orders") @@ -125,7 +121,6 @@ class SalonChair(models.Model): class SalonChairUserLines(models.Model): - _name = 'salon.chair.user' read_only_checker = fields.Boolean(string="Checker", default=False) @@ -151,7 +146,6 @@ class SalonChairUserLines(models.Model): class SalonOrder(models.Model): - _name = 'salon.order' @api.depends('order_line.price_subtotal') @@ -387,7 +381,6 @@ class SalonOrder(models.Model): class SalonServices(models.Model): - _name = 'salon.service' name = fields.Char(string="Name") @@ -396,7 +389,6 @@ class SalonServices(models.Model): class SalonOrderLine(models.Model): - _name = 'salon.order.lines' service_id = fields.Many2one('salon.service', string="Service") @@ -422,7 +414,6 @@ class SalonOrderLine(models.Model): class SalonStages(models.Model): - _name = 'salon.stages' name = fields.Char(string="Name", translate=True, required=True) diff --git a/salon_management/security/ir.model.access.csv b/salon_management/security/ir.model.access.csv index 651682ad7..9535c0fd6 100644 --- a/salon_management/security/ir.model.access.csv +++ b/salon_management/security/ir.model.access.csv @@ -1,30 +1,20 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -view_salon_order1,view.salon.order1,model_salon_order,salon_management.group_salon_user,1,1,0,0 -view_salon_order_lines1,view.salon.order.lines1,model_salon_order_lines,salon_management.group_salon_user,1,1,1,0 -view_salon_stages1,view.salon.stages1,model_salon_stages,salon_management.group_salon_user,1,0,0,0 -view_salon_chair1,view.salon.chair1,model_salon_chair,salon_management.group_salon_user,1,1,0,0 -view_salon_service1,view.salon.service1,model_salon_service,salon_management.group_salon_user,1,1,1,0 -view_res_users1,view.res.users1,base.model_res_users,salon_management.group_salon_user,1,0,0,0 -view_salon_booking1,view.salon.booking1,model_salon_booking,salon_management.group_salon_user,0,0,0,0 -view_res_company1,view.res.company1,model_res_company,salon_management.group_salon_user,1,0,0,0 -view_salon_working_hours1,view.salon.working.hours1,model_salon_working_hours,salon_management.group_salon_user,0,0,0,0 -view_salon_holiday1,view.salon.holiday1,model_salon_holiday,salon_management.group_salon_user,0,0,0,0 -view_salon_config_settings1,view.salon.config.settings1,model_salon_config_settings,salon_management.group_salon_user,0,0,0,0 -view_res_partner1,view.res.partner1,model_res_partner,salon_management.group_salon_user,0,0,0,0 -view_salon_chair_user1,view.salon.chair.user1,model_salon_chair_user,salon_management.group_salon_user,0,0,0,0 -view_salon_sequence_updater1,view.salon.sequence.updater1,model_salon_sequence_updater,salon_management.group_salon_user,1,0,0,0 +view_salon_order,view.salon.order,model_salon_order,base.group_user,1,1,1,1 +view_salon_order_lines,view.salon.order.lines,model_salon_order_lines,base.group_user,1,1,1,1 +view_salon_stages,view.salon.stages,model_salon_stages,base.group_user,1,1,1,1 +view_salon_chair,view.salon.chair,model_salon_chair,base.group_user,1,1,1,1 +view_salon_service,view.salon.service,model_salon_service,base.group_user,1,1,1,1 -view_salon_order,view.salon.order,model_salon_order,salon_management.group_salon_manager,1,1,1,1 -view_salon_order_lines,view.salon.order.lines,model_salon_order_lines,salon_management.group_salon_manager,1,1,1,1 -view_salon_stages,view.salon.stages,model_salon_stages,salon_management.group_salon_manager,1,1,1,1 -view_salon_chair,view.salon.chair,model_salon_chair,salon_management.group_salon_manager,1,1,1,1 -view_salon_service,view.salon.service,model_salon_service,salon_management.group_salon_manager,1,1,1,1 -view_salon_booking,view.salon.booking,model_salon_booking,salon_management.group_salon_manager,1,1,1,1 -view_res_company,view.res.company,model_res_company,salon_management.group_salon_manager,1,1,1,1 -view_salon_working_hours,view.salon.working.hours,model_salon_working_hours,salon_management.group_salon_manager,0,0,0,0 -view_salon_holiday,view.salon.holiday,model_salon_holiday,salon_management.group_salon_manager,0,0,0,0 -view_salon_config_settings,view.salon.config.settings,model_salon_config_settings,salon_management.group_salon_manager,0,0,0,0 -view_res_partner,view.res.partner,model_res_partner,salon_management.group_salon_manager,1,1,1,1 -view_res_users,view.res.users,model_res_users,salon_management.group_salon_manager,1,1,1,1 -view_salon_chair_user,view.salon.chair.user,model_salon_chair_user,salon_management.group_salon_manager,1,1,1,1 -view_salon_sequence_updater,view.salon.sequence.updater,model_salon_sequence_updater,salon_management.group_salon_manager,1,1,1,1 \ No newline at end of file +view_salon_order3,view.salon.order3,model_salon_order,base.group_public,1,1,1,1 +view_salon_order_lines3,view.salon.order3.lines,model_salon_order_lines,base.group_public,1,1,1,1 +view_salon_stages3,view.salon.stages3,model_salon_stages,base.group_public,1,1,1,1 +view_salon_chair3,view.salon.chair3,model_salon_chair,base.group_public,1,1,1,1 +view_salon_service3,view.salon.service3,model_salon_service,base.group_public,1,1,1,1 +view_salon_booking3,view.salon.booking3,model_salon_booking,base.group_public,1,1,1,1 +view_salon_working_hours3,view.salon.working.hours3,model_salon_working_hours,base.group_public,1,1,1,1 +view_salon_holiday3,view.salon.holiday3,model_salon_holiday,base.group_public,1,1,1,1 +view_salon_config_settings3,view.salon.config.settings3,model_salon_config_settings,base.group_public,1,1,1,1 +view_res_partner3,view.res.partner3,model_res_partner,base.group_public,1,1,1,1 +view_res_users3,view.res.users3,model_res_users,base.group_public,1,1,1,1 +view_salon_chair_user3,view.salon.chair.user3,model_salon_chair_user,base.group_public,1,1,1,1 +view_salon_sequence_updater3,view.salon.sequence.updater3,model_salon_sequence_updater,base.group_public,1,1,1,1 \ No newline at end of file diff --git a/salon_management/security/salon_security.xml b/salon_management/security/salon_security.xml deleted file mode 100644 index 8d5bd0dc6..000000000 --- a/salon_management/security/salon_security.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - Salon Management - Manager and User Level Access For Beauty Spa Management - 12 - - - User - - - - - Manager - - - - - - - - Salon Orders - - - [('salon_order_created_user','=',user.id)] - - - Salon chairs - - - [('chair_created_user','=',user.id)] - - - diff --git a/salon_management/static/description/index.html b/salon_management/static/description/index.html index a5851f48a..53232a442 100644 --- a/salon_management/static/description/index.html +++ b/salon_management/static/description/index.html @@ -1,4 +1,4 @@ -
+

Beauty Spa Management

This Module is for Managing the Process's in a Spa

@@ -41,7 +41,8 @@
-
+ +

@@ -66,6 +67,7 @@

+
@@ -86,6 +88,7 @@
+
@@ -103,6 +106,7 @@
+

@@ -120,6 +124,7 @@

+
@@ -200,6 +205,7 @@
+
@@ -218,6 +224,7 @@
+
@@ -236,25 +243,36 @@
+

You Looking for a free Documentation of this Application.?

Give a Request Mail to:    odoo@cybrosys.com

-
-

Need Any Help?

- - +
+

Need Any Help?

+
diff --git a/salon_management/static/src/js/salon_booking.js b/salon_management/static/src/js/salon_booking.js index 1517fa9d0..9c4bc4911 100644 --- a/salon_management/static/src/js/salon_booking.js +++ b/salon_management/static/src/js/salon_booking.js @@ -1,6 +1,9 @@ -odoo.define('website_salon_booking_system', function (require) { +odoo.define('salon_management.website_salon_booking_system', function (require) { 'use strict'; var ajax = require('web.ajax'); +var base = require('web_editor.base'); +var core = require('web.core'); +var _t = core._t; $(document).on('click',"#submit_button",function() { var name = $( "#name" ).val(); var date = $( "#date" ).val(); @@ -9,59 +12,15 @@ $(document).on('click',"#submit_button",function() { var email = $( "#email" ).val(); var service = $( "#service" ).val(); var chair = $( "#chair" ).val(); + var list_service = []; + var number = service.length + for (var i=0; i<(service.length); i++){ + var k = {i : service[i]} + list_service.push(k) + } var time_left_char = time.substring(0, 2) var time_right_char = time.substring(3, 5) var time_separator = time.substring(2,3) - var date_day = date.substring(3,5) - var date_month = date.substring(0,2) - var date_year = date.substring(6,10) - var slash_one = date.substring(2,3) - var slash_two = date.substring(5,6) - if ((date_day < 32) && (date_day > 0) && (date_month < 13) && (date_month > 0) && - (date_year > 2016) && (slash_one == "/") && (slash_two == "/")){ - var correct_date = 0 - if([1,3,5,7,8,10,12].indexOf(date_month) == -1){ - if(date_month == 2){ - if((date_year % 4) == 0){ - if(date_day < 30){ - correct_date = 1 - } - else{ - alert("Selected February Has 29 Days Only.") - } - } - else{ - if(date_day < 29){ - correct_date = 1 - } - else{ - alert("Selected February Has 28 Days Only.") - } - } - } - else{ - if(date_day < 31){ - correct_date = 1 - } - else{ - alert("Selected Month Have 30 Days Only") - } - } - } - else{ - if(date_day < 32){ - correct_date = 1 - } - else{ - alert("Selected Month Have 31 Days Only") - } - } - } - else{ - if(date != ""){ - alert("Select a valid Date") - } - } if(date != ""){ if (isNaN(time_left_char) || isNaN(time_right_char) || time_separator != ":"){ if(time != ""){ @@ -72,20 +31,27 @@ $(document).on('click',"#submit_button",function() { var time_left = parseInt(time_left_char) var time_right = parseInt(time_right_char) if ((time_left < 24) && (time_right < 60) && (time_left >= 0) && (time_right >= 0)){ - - if (name != "" && phone != "" && email != "" && service != "" && chair != ""){ - var booking_record = [name, date, time, phone, email, service, chair]; - var salon_record = ajax.jsonRpc("/page/salon_details", 'call', {'salon_data':booking_record }) - .then(function(){ - window.location= "/page/salon_management.salon_booking_thank_you" - }) + var booking_record = {'name': name, 'date': date, 'time': time, 'phone': phone, + 'email': email, service, 'list_service':list_service,'chair': chair,'number': number } + $.ajax({ + url: "/page/salon_details", + method: "POST", + dataType: "json", + data: booking_record, + success: function( data ) { + window.location.href = "/page/salon_management.salon_booking_thank_you"; + }, + error: function (error) { + alert('error: ' + error); + } + }); } else{ alert("Fill all the required fields") } } - else{ + else { alert("Select a valid time") } } diff --git a/salon_management/views/salon_bookings.xml b/salon_management/views/salon_bookings.xml index d6f048c28..565224ab3 100644 --- a/salon_management/views/salon_bookings.xml +++ b/salon_management/views/salon_bookings.xml @@ -8,7 +8,7 @@ 80 -