Sunday, September 2, 2018

Jquery Fullcalendar Integration with PHP and Mysql web development project classes in sri lanka ICT


If you looking for Web tutorial for How to use FullCalendar.js plugin with PHP dynamic website for scheduling our meeting or event on particular date and time. So in this post we have discuss How to Integrate Jquery FullCalendar Plugin with PHP server side script and Mysql database table. If you have working website for event management like schedule meeting or plan any task on particular date and that details we can see on web page in calendar format. For this things you can use this Fullcalender plugin is the better option than other. 

FullCalendar.js plugin is javascript event calendar and this plugin we can use any web technology and it is easy to use any server side script like PHP. In short with this plugin we can play with database like Mysql also. It is a jquery library and it is displays calendar on web page with events which we have schedule on particular date and time. This is also provide not only month calendar details but also it also display details calendar like week and particular day hours details also. This plugin is very easy to use, for example we want to initialize this plugin on particular page then we have just write fullCalendar() method and this plugin will activate on particular page.

For discuss how to integrate this plugin with PHP and Mysql database, here we have make simple CRUD(Create, Read, Update, Delete) operation has been done with PHP Script with Mysql Data. First we have load data from database and display on calendar, so for this we have use events method. This method will called PHP page and from server it will send data in JSON string format and that data will display on calendar. Same way for add new event, so we have use select method of this plugin. By this method we can click on particular date cell then we can add new event of that day. After adding new event now we want to change date or time of particular event, so for this we have use eventResize and eventDrop method. By using this method we can change date and time of event. And lastly we want to remove particular event. So for this we have use eventClick method, by using this method when we have click on any event this it will triggered ajax request for remove event data from mysql table. So this way we can do Insert, Update, Delete and Select data operation with this Plugin by using PHP script with Mysql. Below we have also provide source code also.

javascript popup window with drop down
var oModal=window.showModalDialog("filename.html","","dialogHeight:100px");
inside filename.html have an html file with a dropdown and return the data using returnValue

YouTube https://www.youtube.com/channel/UCJojbxGV0sfU1QPWhRxx4-A
LinkedIn https://www.linkedin.com/in/ict-bit-tuition-class-software-development-colombo/
WordPress https://computerclassinsrilanka.wordpress.com
quora https://www.quora.com/profile/BIT-UCSC-UoM-Final-Year-Student-Project-Guide
Newsletter https://sites.google.com/view/the-leaning-tree/newsletter
Wix https://itclasssl.wixsite.com/icttraining
Web https://itclass-bit-ucsc-uom-php-final-project.business.site/
mystrikingly https://bit-ucsc-uom-final-year-project-ideas-help-guide-php-class.mystrikingly.com/
https://elakiri.com/threads/bit-ucsc-uom-php-mysql-project-guidance-and-individual-classes-in-colombo.1627048/
ucsc bit registration 2023 bit (ucsc syllabus) bit colombo university fees bit results bit vle bit course fee bit exam time table 2023 bit moratuwa





Source Code


index.php


<?php
//index.php




?>
<!DOCTYPE html>
<html>
 <head>
  <title>Jquery Fullcalandar Integration with PHP and Mysql</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.css" />
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.css" />
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js"></script>
  <script>
   
  $(document).ready(function() {
   var calendar = $('#calendar').fullCalendar({
    editable:true,
    header:{
     left:'prev,next today',
     center:'title',
     right:'month,agendaWeek,agendaDay'
    },
    events: 'load.php',
    selectable:true,
    selectHelper:true,
    select: function(start, end, allDay)
    {
     var title = prompt("Enter Event Title");
     if(title)
     {
      var start = $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss");
      var end = $.fullCalendar.formatDate(end, "Y-MM-DD HH:mm:ss");
      $.ajax({
       url:"insert.php",
       type:"POST",
       data:{title:title, start:start, end:end},
       success:function()
       {
        calendar.fullCalendar('refetchEvents');
        alert("Added Successfully");
       }
      })
     }
    },
    editable:true,
    eventResize:function(event)
    {
     var start = $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");
     var end = $.fullCalendar.formatDate(event.end, "Y-MM-DD HH:mm:ss");
     var title = event.title;
     var id = event.id;
     $.ajax({
      url:"update.php",
      type:"POST",
      data:{title:title, start:start, end:end, id:id},
      success:function(){
       calendar.fullCalendar('refetchEvents');
       alert('Event Update');
      }
     })
    },

    eventDrop:function(event)
    {
     var start = $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");
     var end = $.fullCalendar.formatDate(event.end, "Y-MM-DD HH:mm:ss");
     var title = event.title;
     var id = event.id;
     $.ajax({
      url:"update.php",
      type:"POST",
      data:{title:title, start:start, end:end, id:id},
      success:function()
      {
       calendar.fullCalendar('refetchEvents');
       alert("Event Updated");
      }
     });
    },

    eventClick:function(event)
    {
     if(confirm("Are you sure you want to remove it?"))
     {
      var id = event.id;
      $.ajax({
       url:"delete.php",
       type:"POST",
       data:{id:id},
       success:function()
       {
        calendar.fullCalendar('refetchEvents');
        alert("Event Removed");
       }
      })
     }
    },

   });
  });
   
  </script>
 </head>
 <body>
  <br />
  <h2 align="center"><a href="#">Jquery Fullcalandar Integration with PHP and Mysql</a></h2>
  <br />
  <div class="container">
   <div id="calendar"></div>
  </div>
 </body>
</html>


load.php


<?php

//load.php

$connect = new PDO('mysql:host=localhost;dbname=testing', 'root', '');

$data = array();

$query = "SELECT * FROM events ORDER BY id";

$statement = $connect->prepare($query);

$statement->execute();

$result = $statement->fetchAll();

foreach($result as $row)
{
 $data[] = array(
  'id'   => $row["id"],
  'title'   => $row["title"],
  'start'   => $row["start_event"],
  'end'   => $row["end_event"]
 );
}

echo json_encode($data);

?>


insert.php


<?php

//insert.php

$connect = new PDO('mysql:host=localhost;dbname=testing', 'root', '');

if(isset($_POST["title"]))
{
 $query = "
 INSERT INTO events 
 (title, start_event, end_event) 
 VALUES (:title, :start_event, :end_event)
 ";
 $statement = $connect->prepare($query);
 $statement->execute(
  array(
   ':title'  => $_POST['title'],
   ':start_event' => $_POST['start'],
   ':end_event' => $_POST['end']
  )
 );
}


?>


update.php


<?php

//update.php

$connect = new PDO('mysql:host=localhost;dbname=testing', 'root', '');

if(isset($_POST["id"]))
{
 $query = "
 UPDATE events 
 SET title=:title, start_event=:start_event, end_event=:end_event 
 WHERE id=:id
 ";
 $statement = $connect->prepare($query);
 $statement->execute(
  array(
   ':title'  => $_POST['title'],
   ':start_event' => $_POST['start'],
   ':end_event' => $_POST['end'],
   ':id'   => $_POST['id']
  )
 );
}

?>


delete.php


<?php

//delete.php

if(isset($_POST["id"]))
{
 $connect = new PDO('mysql:host=localhost;dbname=testing', 'root', '');
 $query = "
 DELETE from events WHERE id=:id
 ";
 $statement = $connect->prepare($query);
 $statement->execute(
  array(
   ':id' => $_POST['id']
  )
 );
}

?>


Database


--
-- Database: `testing`
--

-- --------------------------------------------------------

--
-- Table structure for table `events`
--

CREATE TABLE IF NOT EXISTS `events` (
  `id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `start_event` datetime NOT NULL,
  `end_event` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `events`
--
ALTER TABLE `events`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `events`
--
ALTER TABLE `events`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
Ref https://www.webslesson.info/2017/12/jquery-fullcalandar-integration-with-php-and-mysql.html






Individual / Group / Online ICT classes in English / Sinhala / Tamil. Sample Projects/Assignments Exam Papers, Tutorials, Notes and Answers will be provided. 
Call +94 777 33 7279 | eMail itclasssl@gmail.com | Skype ITClassSL

Thursday, June 28, 2018

Salon management System Hair and Beauty Salon Management in Colombo Sri Lanka Wedding Online Appointment Projects UCSC

CALL +94 777 33 7279   |   EMAIL ITClassSL@GMAIL.COM

Salon & Service Appointment Management System

Target Client: Sri Lanka-based SaaS provider for the salon industry (USA, UK, Australia, Canada)

A fully automated, web-based solution for managing hair & beauty salons. The system tracks employee payroll, retail inventory, customer profiles, billing, and appointment scheduling. Designed to replace paper-based tracking, it centralizes salon operations into a secure, cloud-ready platform.

📌 PROJECT ABSTRACT

SalonBook is a web-based salon management application with advanced appointment scheduling functionality. It connects clients, salons, and stylists in an online community, allowing users to browse local salons, read reviews, and book/cancel appointments instantly. Salons can manage staff, services, schedules, and promotions. Built with PHP & MySQL, it integrates WebCalendar for robust scheduling and supports PCI-compliant payment gateways, inventory POS, and automated marketing.


🔹 STEP 2: Core System Modules

The system is divided into 10 logical modules to ensure separation of concerns and scalability:

  1. User & Authentication Module – Secure login, role assignment, session management, password recovery.
  2. Appointment & Calendar Module – Real-time scheduling, availability management, recurring bookings.
  3. Customer & Client Management Module – Client profiles, service history, notes, allergies, loyalty points.
  4. Employee & Payroll Module – Staff profiles, working hours, commission tracking, salary disbursement.
  5. Inventory & Retail Module – Stock tracking, barcode integration, automatic deduction, supplier management.
  6. Billing & Payment Module – Invoice generation, POS integration, credit card processing, refunds, IOU tracking.
  7. Marketing & Communication Module – Automated SMS/email reminders, promotional campaigns, review/rating system.
  8. Reporting & Analytics Module – Trend analysis, revenue breakdown, staff performance, export capabilities.
  9. Salon Profile & Web Builder Module – Custom salon storefront, service catalogs, staff bios, directions, social links.
  10. Super Admin & System Management Module – Platform oversight, subscription billing, data backups, security audits.

🔹 STEP 3: Key Functions & Features

ModuleCore FunctionsKey Features
AppointmentsBook/cancel/reschedule, view availability, manage recurring visitsDrag-and-drop calendar (Daily/Weekly/Monthly), real-time slot sync, proximity/zip-code search (100-mile radius)
Customer ManagementRegister clients, track history, manage preferencesAllergy/notes logging, reward points system, post-appointment review prompts
Employee & PayrollAdd/remove staff, set schedules, calculate payCommission structures, pay period tracking, performance reports, attendance logging
Inventory & POSTrack stock, record retail sales, manage suppliersBarcode/credit card reader integration, automatic stock deduction, low-stock alerts
Billing & PaymentsGenerate bills, process payments, handle refundsPCI-compliant gateway, recurring billing, tax calculation, IOU management, receipt generation
Marketing & NotificationsSend reminders, run promotions, collect feedback“Set & forget” SMS/email campaigns, push notifications, temporal salon promotions, top-rated salon filters
ReportingGenerate operational/financial reportsDaily/weekly/monthly/annual trends, service spread, customer retention, export to CSV/PDF/Excel
Security & BackupProtect data, manage access, ensure complianceRole-based permissions, automated cloud backups, Web 2.0 & SEO compliance, secure data encryption

🔹 STEP 4: Step-by-Step Operational Workflow

🟢 Phase 1: System Setup & Configuration

  1. Salon Owner Registration → Creates account, sets business details, timezone, currency, working hours.
  2. Service Catalog Setup → Defines services, duration, pricing, and assigns to specific stylists.
  3. Staff Onboarding → Adds employees, sets roles, commission rates, and working schedules.
  4. Inventory Initialization → Uploads product stock, sets reorder thresholds, links barcode/SKU data.

🟡 Phase 2: Client Acquisition & Booking

  1. Client Registration → Users sign up via web/mobile, verify email/phone.
  2. Discovery & Search → Clients filter salons/stylists by location, service, ratings, or availability.
  3. Appointment Booking → Selects service → stylist → date/time → system checks real-time availability → confirms booking.
  4. Automated Confirmation → System sends SMS/email with appointment details, cancellation policy, and directions.

🔵 Phase 3: Service Delivery & Transaction

  1. Check-In & Service Execution → Staff logs in → views daily schedule → marks client as “In-Service”.
  2. Service & Product Recording → Stylist logs services performed + retail products used → system auto-deducts inventory.
  3. Billing & Payment → System calculates total (service + retail + tax) → generates invoice → processes payment (card/cash/gateway).
  4. Post-Service Actions → Receipt emailed → prompts client for rating/review → loyalty points credited.

🟣 Phase 4: Management & Optimization

  1. Payroll Processing → System aggregates commissions, hours, deductions → generates pay reports for disbursement.
  2. Marketing Automation → System schedules follow-up emails, birthday offers, rebooking reminders, and promotion alerts.
  3. Reporting & Auditing → Owner views dashboards → exports reports → adjusts pricing, staff schedules, or inventory orders.
  4. Data Backup & Security → Nightly automated backups, access logs, PCI compliance checks, role permission audits.

🔹 STEP 5: Technical Implementation Notes

ComponentTechnology/Integration
FrontendHTML5, CSS3, JavaScript, Ajax, Responsive UI/UX, Bootstrap/Dreamweaver styling
BackendPHP, MySQL, PHPMyAdmin, WebCalendar integration
Alternative/Extended Stack.NET, LINQ, SOA/Web Services (for mobile app sync)
Mobile SupportiOS/Android apps (separate for clients & business owners)
Third-Party APIsPayment Gateway (TouchSuite/PCI-compliant), SMS/Email services, Google Maps/Proximity search, Social Media (Facebook/Twitter)
SecurityRole-Based Access, SQL injection prevention, data encryption, automated backups, PCI-DSS compliance

✅ Next Steps for Implementation

  1. Requirement Finalization → Confirm scope, user roles, and regional compliance (tax, GDPR/PCI).
  2. Database Design → Map ER diagram (Users, Appointments, Services, Inventory, Payments, Reviews).
  3. UI/UX Prototyping → Wireframe dashboards for Client, Stylist, Owner, and Super Admin.
  4. Core Development → Build modules iteratively (Auth → Calendar → Billing → Inventory → Reporting).
  5. Testing & Deployment → UAT, load testing, security audit, SaaS provisioning, go-live.

🔧 LIVE MODULE DEMO: Smart Salon Search (Ajax + PHP + MySQL)

Replaces legacy search with a modern, salon-specific autocomplete system. Searches Salons, Services, and Stylists in real-time using secure PDO queries and redirects to the booking workflow.

🟨 Frontend (HTML + Ajax + CSS)

🔍 Find a Salon or Service

<script>
function fetchSalonSuggestions() {
    const input = document.getElementById("salonSearch").value.trim();
    const box = document.getElementById("suggestionBox");

    if (input.length < 2) { box.style.display = "none"; return; }

    const xhr = new XMLHttpRequest();
    xhr.open("POST", "search_salon.php", true);
    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    
    xhr.onreadystatechange = function() {
        if (xhr.readyState === 4 && xhr.status === 200) {
            box.innerHTML = xhr.responseText;
            box.style.display = "block";
        }
    };
    xhr.send("search_term=" + encodeURIComponent(input));
}

function selectResult(name, type) {
    document.getElementById("salonSearch").value = name;
    document.getElementById("suggestionBox").style.display = "none";
    if (type === 'Salon') {
        window.location.href = `book_appointment.php?salon=${encodeURIComponent(name)}`;
    } else {
        window.location.href = `view_services.php?service=${encodeURIComponent(name)}`;
    }
}
</script>

🟧 Backend (PHP - search_salon.php)

Modern, secure PDO implementation with UNION query for salons & services.

<?php
header('Content-Type: text/html; charset=utf-8');
$host = '127.0.0.1'; $db = 'salon_management_db'; $user = 'root'; $pass = '';

try {
    $pdo = new PDO("mysql:host=$host;dbname=$db;charset=utf8mb4", $user, $pass);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    if (!empty($_POST['search_term'])) {
        $term = $_POST['search_term'];
        $sql = "
            SELECT id, name, city AS location, 'Salon' AS type 
            FROM salons WHERE name LIKE :term OR city LIKE :term OR zip_code LIKE :term
            UNION
            SELECT id, name, category AS location, 'Service' AS type 
            FROM services WHERE name LIKE :term
            ORDER BY type ASC, name ASC LIMIT 10";
        
        $stmt = $pdo->prepare($sql);
        $stmt->execute(['term' => "%$term%"]);
        $results = $stmt->fetchAll(PDO::FETCH_ASSOC);

        if (count($results) > 0) {
            foreach ($results as $row) {
                $safeName = htmlspecialchars($row['name'], ENT_QUOTES, 'UTF-8');
                $safeType = htmlspecialchars($row['type'], ENT_QUOTES, 'UTF-8');
                $safeLoc  = htmlspecialchars($row['location'] ?? '', ENT_QUOTES, 'UTF-8');
                echo "<div class='suggestion-item' onclick=\"selectResult('$safeName', '$safeType')\">
                        $safeName <span class='badge'>$safeType</span><br>
                        <small style='color:#666;'>📍 $safeLoc</small>
                      </div>";
            }
        } else {
            echo "<div class='suggestion-item' style='color:#999;'>No salons or services found</div>";
        }
    }
} catch (PDOException $e) {
    error_log("Salon Search DB Error: " . $e->getMessage());
    echo "<div class='suggestion-item' style='color:red;'>Search temporarily unavailable</div>";
}
?>