From 9969154e58ca06f2da1d47d07b67b4be03690e41 Mon Sep 17 00:00:00 2001 From: patrick Date: Thu, 11 Jul 2019 18:08:14 +1000 Subject: [PATCH] start rating dynamic bugfix --- js/bts_timesheet.js | 4 ++-- ts.php | 22 ++-------------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/js/bts_timesheet.js b/js/bts_timesheet.js index 15da342..f3b5d5d 100644 --- a/js/bts_timesheet.js +++ b/js/bts_timesheet.js @@ -261,6 +261,7 @@ var self = this; this.el.find("div.brating span").click(function(){ var r = $(this).attr('data-rating'); + self.data.rating = r; self.set_rating(r); }) @@ -286,7 +287,7 @@ this.set_staff(data.staff); this.set_client(data.client); this.set_ack(data.ack); - + this.set_rating(data.rating); //save to html element this.data = data; this.el.data({job:this, data:data}); @@ -378,7 +379,6 @@ set_rating(num){ if (!(1 <= num && num <=5)) return; - this.data.rating=num; this.el.find('div.brating span').each(function(i,e){ var rating = $(e).attr('data-rating'); var rating = parseInt(rating); diff --git a/ts.php b/ts.php index 0575558..da4a4a4 100644 --- a/ts.php +++ b/ts.php @@ -96,29 +96,10 @@ class AcareOffice{ staff VARCHAR(45) NULL, client VARCHAR(45) NULL, ack TINYINT(4) NULL, - rating INT NULL DEFAULT 0, + rating INT(4) NULL DEFAULT 0, PRIMARY KEY (id) ) $charset_collate;"; -// $sql = "CREATE TABLE $table_name ( -// id int(64) NOT NULL AUTO_INCREMENT, -// paid tinyint(4) DEFAULT NULL, -// referal varchar(45) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL, -// clientid int(64) NOT NULL, -// loanamount float DEFAULT NULL, -// settledate date DEFAULT NULL, -// loanterm mediumint(10) DEFAULT NULL, -// commissionrate float DEFAULT NULL, -// commission float DEFAULT NULL, -// trailrate float DEFAULT NULL, -// trail float DEFAULT NULL, -// paydate date DEFAULT NULL, -// brokerid int(64) NOT NULL, -// status tinyint(4) NOT NULL, -// notes varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL, -// PRIMARY KEY (id) -// ) $charset_collate;"; - //create database require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); @@ -450,6 +431,7 @@ class AcareOffice{ 'staff'=> $s->staff, 'client'=> $s->client, 'ack' => $s->ack, + 'rating' =>$s->rating, ); } }