CraigT543 / EasyBlue

Modifications for Easy!Appointments
21 stars 23 forks source link

Multiple Enhancements with updated Backend Settings page #10

Closed bullmoose20 closed 2 years ago

bullmoose20 commented 7 years ago

Multiple Enhancements with updated Backend Settings page Backend General Settings now has: 24hr/AM-PM, MaxDate, Intervak Settings, color theme(green, blue, red), reminders on multiple days, cell-phone-sms support, waiting list enhancements, show price when 0, show any provider Multiple code and language localization fixes French and English are complete. Added lang identifier to table so people can receive reminders and waiting list emails in the language they choose. Many other little enhancements

CraigT543 commented 7 years ago

Hello Nick, I think you have added some database table items that are not included in your modifications. I do not see them in the assets/sql files or in the /application/migrations/ files. I finally have some time to work on coding and I want to look at the great things you have done. Can you let me know of the fields or tables you have added to the database? Craig

CraigT543 commented 7 years ago

I also noticed that the cell phone table is missing from the sql file. So, it looks like your build is using Alex's original. That will not work.

bullmoose20 commented 7 years ago

Pretty sure I did... take a look at the data.sql file. and see the attached image for more details. 2017-04-24 01_43_16-

bullmoose20 commented 7 years ago

And structure.sql also has my edits so I am not sure what you mean. I moved the table of data out of the structure.sql because it should only contain "structure" which is why I moved it to data.sql. 2017-04-24 01_50_04-inbox - outlook - mail

CraigT543 commented 7 years ago

That is good for inserting data into tables that exist but if they do not exist such as the ea_cellcarrier table you need the structure in the structure file of:

CREATE TABLE IF NOT EXISTS ea_cellcarrier ( id int(11) NOT NULL, cellco varchar(30) DEFAULT NULL, cellurl varchar(30) DEFAULT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;

So what I see then is that in ea_settings you are adding the following fields:

time_format

max_date

interval_time

reminder_days_out

theme_color

week_starts_on

show_free_price_currency

show_any_provider

We need a structure for each. What I have done is just export from phoMyAdmin the table I built and then use the export to build my structure.php entry

Then we need a migrations file for those who want to just upgrade their current build. You will see the migrations files in /applications/migrations/ If you look at those files it will become apparent what it does. Also what happens is that in the EA database there is a table called migrations. You will see that it is set to 8 for my build which means that migrations files through 8 are already loaded. We should probably make an 009 file to expand your additions.

Regarding the reminders and your HTML modification. Have you looked at the effect in a text message? I did not take a close look. Did you add an alternate text for sms? If not, I think that is important. I will see what I can do there.

I really like what you have added. It is fantastic. I am noticing two modifications that I need to make for medical practices. Notifications should not have the name of the service ordered on it, I want to toggle that with just the name of the provider. Also, clients should be able to opt out of having notifications at all. All this will make it more compliant with HIPAA laws. So I want to add those two options but first I want to get yours up and running on my end.

Craig

On 4/23/2017 10:49 PM, bullmoose20 wrote:

And structure.sql also has my edits so I am not sure what you mean. I moved the table of data out of the structure.sql because it should only contain "structure" which is why I moved it to data.sql.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CraigT543/EasyBlue/pull/10#issuecomment-296530122, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyI7L5yLQyHYZB-eLh166k0p7b0yEfVks5rzDfngaJpZM4NETn5.

--

Thank you,

Craig

Craig Tucker, LCSW Logo

•LCS 20312•craigtuckerlcsw@verizon.net mailto:craigtuckerlcsw@verizon.net•www.craigtuckerlcsw.com http://www.craigtuckerlcsw.com/

•333 East Stuart Ave, Suite F, Redlands, CA 92374•Phone (909) 389-2414 • Fax (909) 353-4982•

CONFIDENTIALITY NOTICE: This email transmission, including any attachments that accompany it, may contain confidential information belonging to the sender that is protected by law and is for the exclusive use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, or distribution of information in this transmission, or the taking of any action in reliance on the contents of this transmission, is strictly prohibited. Any unauthorized interception of this transmission is illegal under the law. If you have received this transmission in error, please notify the sender by reply email right away and then destroy all copies of this transmission.

CraigT543 commented 7 years ago

Looking again, I see what you are doing. Sorry, I am trying to flip too fast between projects. Nevertheless, it looks like what is needed is the migration files and then all will be well. What I also have noticed is that my own migration files are missing. So I will work on this.

On 4/23/2017 10:49 PM, bullmoose20 wrote:

And structure.sql also has my edits so I am not sure what you mean. I moved the table of data out of the structure.sql because it should only contain "structure" which is why I moved it to data.sql.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CraigT543/EasyBlue/pull/10#issuecomment-296530122, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyI7L5yLQyHYZB-eLh166k0p7b0yEfVks5rzDfngaJpZM4NETn5.

--

Thank you,

Craig

Craig Tucker, LCSW Logo

•LCS 20312•craigtuckerlcsw@verizon.net mailto:craigtuckerlcsw@verizon.net•www.craigtuckerlcsw.com http://www.craigtuckerlcsw.com/

•333 East Stuart Ave, Suite F, Redlands, CA 92374•Phone (909) 389-2414 • Fax (909) 353-4982•

CONFIDENTIALITY NOTICE: This email transmission, including any attachments that accompany it, may contain confidential information belonging to the sender that is protected by law and is for the exclusive use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, or distribution of information in this transmission, or the taking of any action in reliance on the contents of this transmission, is strictly prohibited. Any unauthorized interception of this transmission is illegal under the law. If you have received this transmission in error, please notify the sender by reply email right away and then destroy all copies of this transmission.

CraigT543 commented 7 years ago

My missing migration files are: 009_add_ea_cellcarrier.php 010_add_id_cellcarrier.php 011_add_wp_id.php

I have added them here as txt files so they need to be renamed php

011_add_wp_id.txt 009_add_ea_cellcarrier.txt 010_add_id_cellcarrier.txt

bullmoose20 commented 7 years ago

Correct on the migration files...i missed that but also was not clear on how they worked. I will review your 3 files to better understand.

I could not test sms messages received for notifications and waiting list. My provider charges for email to sms messages. But I think that it might be best to send people a notification that says something like...check your email for the latest appointment. And check your email for a notification that was sent to you. These are short and direct them to the email that is already tied to the customer.

As for the the two other modifications for HIPAA, they should be pretty easy to implement. Receive notifications would be a yes/no field associated to the user. I presume that if you opt to get on a waiting list, then you would not need to ask the person again...so its really part of notifications only. As for "masking" the service, that one is a little trickier because in most cases non-hipaa appointments would want both service and provider.

It's so much easier to have others reviewing the code as I am not fully aware of all these specifics. I also think that I may have missed a couple places for date and time format.

bullmoose20 commented 7 years ago

Ok. I see the way those files are set up. I will take a shot at getting something working for the stuff I added.

Thinking about the cell carriers...maybe a way to add and remove entries would be useful in the backoffice. Right now the dropdown is going to be pretty long.

CraigT543 commented 7 years ago

Alright I got it going. What I noticed:

Changes to make it work on an existing database (that need to be put in migrations): ALTER TABLE ea_appointments ADD lang VARCHAR(256) NULL DEFAULT NULL AFTER id;

ALTER TABLE ea_users ADD lang VARCHAR(256) NULL DEFAULT NULL AFTER id;

INSERT INTO ea_settings (name, value) VALUES ('google_analytics_code', ''), ('customer_notifications', '1'), ('date_format', 'DMY'), ('time_format', '24HR'), ('max_date', '30'), ('interval_time', '30'), ('reminder_days_out', '1,3'), ('theme_color', 'green'), ('week_starts_on', 'sunday'), ('show_free_price_currency', 'yes'), ('show_any_provider', 'yes');

And in application/config/config.php $config['sess_cookie_name'] = 'ea_session'; $config['sess_save_path'] = DIR . '/../../storage/sessions';

for me were rolled back to the default $config['sess_cookie_name'] = 'ci_session'; $config['sess_save_path'] = NULL;

This is a server thing, so perhaps it would be best to keep these settings default and note that changes may need to be made manually based upon server?

What I also see is that with AM/PM formatting the CSS also needs to be modified for the change to accommodate the AM/PM. Or, The CSS just needs to be modified to be wider as a standard. I will mess around with that.

The captcha image is squished so the css on the frontend color files at line 260 width should be changed to 150 (from 64)

I really like what you have done. I know one thing I need to do is to change my method I used to model the database in /applications/core/MY_Model.php. This works but it does not match Alex's style at all. For coding esthetics I need to redo that. I will mess with the SMS and see how that all works out. I think, from what I recall, that there is a tag for text only when html is not available in mail. It should be pretty simple. I think that will be necessary.

Looks great. Thanks for all you are doing. Very creative solutions!

bullmoose20 commented 7 years ago

for the sessions thing, I grabbed that from Alex's build... I was not even sure if it was needed.

Not sure I follow for the CSS and the AM/PM thing. Do you have a screenshot to share?

If you change the captcha width to 150, then lots of other images will "break". For example, on the waiting list success and booking success. I think that we need to come up with slightly different CSS specific for the captcha.

Thanks for reviewing it all... like I mentioned, there are still some other scenarios that are "buggy" but overall its looking pretty good!

CraigT543 commented 7 years ago

Regarding the formatting issue on the front end for AM/PM: capture So the formatting for this is set in /assets/js/frontend_book_api.js At line 73 and 82 you will see width set to 50 and this works well for 24 hour format. 80 works best for AM/PM. So a condition needs to go here. At 80 the formatting looks like this: capture2

bullmoose20 commented 7 years ago

Done. conditional st 2017-04-24 18_54_10-microsoft edge atement added based on the settings value in the backoffice. :-)

bullmoose20 commented 7 years ago

I also fixed the width of the captcha files in the CSS files. :-)

CraigT543 commented 7 years ago

Today I tried to load your build from scratch on my other server, it stalls at the installation routine. I get this error:

A PHP Error was encountered Severity: Notice Message: Undefined property: CI_Loader::$settings_model Filename: general/installation.php Line Number: 4

Fatal error: Call to a member function get_setting() on null in /volume1/web/easy/application/views/general/installation.php on line 4 A PHP Error was encountered Severity: Error Message: Call to a member function get_setting() on null Filename: general/installation.php Line Number: 4

So it appears that the setting for the theme color is missing from the sql file or something. I am out of time. I will try to dig it up later.

bullmoose20 commented 7 years ago

Hmmm... I see the problem I think.... I never actually went through an installation from scratch so its possible that not all the right file includes are loaded and hence the error. Come to think of it, I am not even sure why the installation would need a theme color there... presumably you have not even configured the backend settings yet, so why would this be necessary here?

If this file is used during an upgrade, then I think it will be fine. If not, then the settings model correctly returns "null". A simple if statement might resolve the problem:

if ($this->settings_model->get_setting('theme_color')) { $theme_color = $this->settings_model->get_setting('theme_color'); }else{ $theme_color = "green"; }

A null value returned from the if returns a FALSE which means a brand new installation and hence the default color is set to "green". A non-null value returned means that there is a colour defined, so grab it and assign it to $theme_color.

I have not tested this, but pretty sure it would work.

Nick

CraigT543 commented 7 years ago

I think

$theme_color = "green";

is sufficient at install. No condition needed because it is only used at install.

On 5/2/2017 2:11 PM, bullmoose20 wrote:

Hmmm... I see the problem I think.... I never actually went through an installation from scratch so its possible that not all the right file includes are loaded and hence the error. Come to think of it, I am not even sure why the installation would need a theme color there... presumably you have not even configured the backend settings yet, so why would this be necessary here?

If this file is used during an upgrade, then I think it will be fine. If not, then the settings model correctly returns "null". A simple if statement might resolve the problem:

if ($this->settings_model->get_setting('theme_color')) { $theme_color = $this->settings_model->get_setting('theme_color'); }else{ $theme_color = "green"; }

A null value returned from the if returns a FALSE which means a brand new installation and hence the default color is set to "green". A non-null value returned means that there is a colour defined, so grab it and assign it to $theme_color.

I have not tested this, but pretty sure it would work.

Nick

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CraigT543/EasyBlue/pull/10#issuecomment-298762594, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyI7G5_y4W_F32s8Hx2gwo6vOSx-XY9ks5r15wMgaJpZM4NETn5.

--

Thank you,

Craig

Craig Tucker, LCSW Logo

•LCS 20312•craigtuckerlcsw@verizon.net mailto:craigtuckerlcsw@verizon.net•www.craigtuckerlcsw.com http://www.craigtuckerlcsw.com/

•333 East Stuart Ave, Suite F, Redlands, CA 92374•Phone (909) 389-2414 • Fax (909) 353-4982•

CONFIDENTIALITY NOTICE: This email transmission, including any attachments that accompany it, may contain confidential information belonging to the sender that is protected by law and is for the exclusive use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, or distribution of information in this transmission, or the taking of any action in reliance on the contents of this transmission, is strictly prohibited. Any unauthorized interception of this transmission is illegal under the law. If you have received this transmission in error, please notify the sender by reply email right away and then destroy all copies of this transmission.

CraigT543 commented 7 years ago

I noticed some small errors in the sql files that were preventing the complete load of a scratch install. I think there was a misplaced ; somewhere in the data file but I forget. Then, I also liked the fact that you were separating out all the data as the data file should be. I took out other inserts from the structure file and put them in data too. I have attached them here as txt files, rename to sql on download.
data.txt structure.txt

With this and the change in installation.php discussed above to just $theme_color = "green"; The install works fine.

NEW ISSUE I was just checking through the settings and I see that the date picker hangs if the Time Interval For Fixed Appointments setting is 60 minutes. 15 and 30 work fine. So I will try to track that down.

I have some time this weekend so I will try to get the upgrade files put together. I will also play with the text reminders alternate to html.

If I have time I would like to add a padding feature so that there is an option of adding x number of minutes always between sessions. Or rather than putting that option on the settings page I could make it according to the service, an additional field there. That may be better. That way a 50 min. session can have a 10 min. pad. And a 90 min. session could have a 30 min. pad if wanted.

bullmoose20 commented 7 years ago

Hi Craig,

Like I mentioned, I may have missed a couple things for the installation and upgrade pieces, so thanks for reviewing.

The 60 minute bug is something that I uncovered, but did not figure it out.

I also noted that the waiting list results are not always accurate. For example, I created a service that is 4 hours in length. This means that if my store closes at 4pm, then you cannot book past 12pm, but the waiting list availabilities comes back with times all the way up to 4pm.

I reported some of these issues here on GitHub if you want to take a look.

Padding at the service level sounds like a good idea. You may need to create a new field in the db(passing) to make that work.

Ciao, Nick

CraigT543 commented 7 years ago

I made a model of the problem with the 60 min interval:

`

<?php
$interval=60;
$service_duration=15;
$selected_time = '11:00';
$time1 = new DateTime($selected_time);
$start_hour=$time1;
$end_time = '20:30';
$time2 = new DateTime($end_time);
$end_hour=$time2;
$current_hour=$start_hour;
$diff = $current_hour->diff($end_hour);

while (($diff->h * 60 + $diff->i) >= intval($service_duration)) {
        $available_hours[] = $current_hour->format('H:i');
    $current_hour->add(new DateInterval('PT' . $interval . 'M'));
    $diff = $current_hour->diff($end_hour);
}

$x=count($available_hours);
$y=0;
    while ($y<=$x){
    echo  $available_hours[$y] .'<br />';
    $y++;
}
?>

`

What this illustrates is that any number other than 60 works if $service_duration is less than 30. 60 works if the $service_duration is greater than 30. I am looking at the loop and it looks good. I am not seeing the problem in the math. It must be there but I am not seeing it.

CraigT543 commented 7 years ago

I have a solution for the problem with 60 minutes. In Appointments.php around 907 I made the following change:

`

        $current_hour = $start_hour;
        $diff = $current_hour->diff($end_hour);
        while (($diff->h * 60 + $diff->i) >= intval($service_duration)) {
            //Time format-- Military 'H:i' AM/PM 'h:i a'
            if ($this->settings_model->get_setting('time_format') == '24HR') {
                $available_hours[] = $current_hour->format('H:i');
            } else {
                $available_hours[] = $current_hour->format('h:i a');
            }               
            $current_hour->add(new DateInterval('PT' . $interval . 'M'));
            $diff = $current_hour->diff($end_hour);
            if ($diff->invert == 1) {  
             break;
            }
        }

`

What was happening was that the diff always returns a positive number even when it goes into negative. So that put us into an infinite loop. That is why the memory was hogging up. This fixes that. I cannot tell you how perplexing this was for me. On to the next issue.

bullmoose20 commented 7 years ago

Hi Craig,

Cool! Have you considered using GitHub to check in and out files as it makes it really easy to see the differences between the versions of the files in question.

Plus we can all apply the fix to our builds as you fix certain items along the way.

Just an idea. 😀

Cheers, Nick

CraigT543 commented 7 years ago

No you are right. I need to learn how to use this properly.

CraigT543 commented 7 years ago

Ok, I have been working on the windows github desktop and have made a bunch of fixes to the waiting list and to the cancel button/return to book landing screen. I would like to sync with your build. How do I get permission to push?

bullmoose20 commented 7 years ago

You submit a pull request for the commits that you made. This will then send me notice that someone has made changes....i review and accept them as they go and the build is updated

bullmoose20 commented 7 years ago

You could also accept my commits to easyblue along with my pull request...then update your build with your additional updates...i can then sync it all back to me and check the differences...

CraigT543 commented 7 years ago

I am not sure if I screwed things up or if the code is missing something. What I am noticing is that the services drop down is not showing all available services and in step 4 the service is not showing up. So, I am wondering if you are seeing this? I know that you were wanting to add an option for the services to be in alternate languages. Perhaps that is still being worked out. If no I will try to use your code and work backward. If yes, I will try to find the glitch some other way.

bullmoose20 commented 7 years ago

You could always check out my test version running here: https://www.complexelepheonix.com/eb

I did not start that feature of supporting multiple languages in the dropdowns. My dropdowns are showing everything... Nick

CraigT543 commented 7 years ago

Thanks Nick,

My mistake, the drop down is fine. It is step 4 that is the issue. I am not seeing the service show up on that page. It is calling to the drop down option. It looks like it should work but I am getting a blank.

I tried your test version but am getting ajax errors.

My new test site is https://www.ctuc.website/easy/ This is a bounce back for reschedule: https://www.ctuc.website/easy/index.php/appointments/index/a2ae5d49ad8156d7a6a82ea2efa5fbee

I am adding an option for a authorization screen. I am adding an option for limited information on notices and reminders. I have updated notices and reminders to have alternative text for SMS and so that lay out looks good in SMS. I am adding an option for the client to opt out of messaging all together on the front end.

You can see where I am going there. I am slowly getting git going. My desktop git has some glitch. I have to start over there. I think it is my zip file that is the problem. I will get with the program hopefully tomorrow. --Craig

CraigT543 commented 7 years ago

I found the problem exists when the cancellation email is sent and it starts on page 0. So, I will track that down.

bullmoose20 commented 7 years ago

For git, I would keep the zip file as a separate file and all the rest of the files should be there. Having everything zipped up does not allow anyone to really use GitHub properly.

And yes, when it cam to the bounce back, I was having lots of issues which I had mentioned in a previous email thread.

As for AJAX errors, what were you doing that caused the errors exactly? I think the reason is because I did not use https in the url I gave you. I still have not been able to figure out a way to consistently redirect people to https://www.complexelepheonix.com/eb when they arrive at http://www.complexelepheonix.com/eb or http://complexelepheonix.com/eb

Nick

CraigT543 commented 7 years ago

Ok, all front end elements work. I have fixed the problems on the bounce back landing page including the reason for cancelation box. I made some CSS changes to center things up to look nice on a mobile device including some changes to the spinner. I put the spinner over the calendar and dimmed the calendar. I am now on the backend. In the appointment screen calendar apparently it is not parsing out the date format changes on post. Are you seeing this?

Error parsing the date/time string: Wrong time format date/time string = 05/15/2017 10:50 timeFormat = hh:mm tt dateFormat = mm/dd/yy

I think I recall the backend worked with time a little differently in the date picker.

bullmoose20 commented 7 years ago

Hi Craig,

Since I was so focused on the front end, I May have overlooked some backend logic. To be honest, because the business is not ready for the calendar implementation yet they put that on hold.

It's this error happening when you create an appointment in the backend on behalf of the customer or for the provider?

Nick

bullmoose20 commented 7 years ago

Oh... And when making CSS changes, don't forget it needs to be done in multiple files.

As well, be cautious with moving things around in css. I recall you had originally "hardcoded" some height, width, and screen size parameters that did not work well on my phone or tablet in landscape orientation.

Thanks again for reviewing this.

bullmoose20 commented 7 years ago

wp_ss_20170515_0002 wp_ss_20170515_0001

I think I see the problem....see images...saving that out did not give me any visible errors, but it also did not give me the intended 30 minute appointment.

CraigT543 commented 7 years ago

Yes, it appears to be confusing the AM/PM vs 24hr format for time. The time variable appears to be the issue. It looks like the setting is not getting carried over to every function in the back end. I have tried changing the setting to 24hr and I am getting other odd responses so I will try to find where else to put the global variable.

bullmoose20 commented 7 years ago

Fyi, using chrome with inspect mode, I do attempt to output variables and their values to the console so that might help to track it down. Time for me to troubleshoot this is gonna be tough over the next couple of days. What is files are you looking at for the backend appointment booking?

CraigT543 commented 7 years ago

Ok, I just uploaded my edits to Github. I am still having glitches with sync. Frustrating. Nevertheless, I think all the kinks are worked out. I am going live with it. Thanks for your work. It is fantastic.

bullmoose20 commented 7 years ago

Cool. Did you ever trace down the backoffice "time" bug? I am going to see how git desktop sees your repository later on and let you know. Thanks for all your work as well.