Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function columnHTML(name, last, input3, input4, input5) {
- return `<a href="" class="aRow" ><div class="row"><span class="cell name"><span class="inCell">${name}</span></span><span class="cell"><span class="inCell">${last}</span></span><span class="cell"><span class="inCell">${input3}</span></span><span class="cell"><span class="inCell">${input4}</span></span><span class="cell"><span class="inCell">${input5}</span></span></div></a>`
- }
- function teethHTML(numberTeeth) {
- return (
- `<div class="teeth">
- <div class="pointerdown pointer">
- <div class="containerPointer">
- <input type="text" class="teethPriceSingle" placeholder="Price">
- <select class="selectTreatment" name="">
- <option value="">treatment</option>
- <option value="shetel">shetel</option>
- <option value="ikor">ikor</option>
- <option value="whatever">whatever</option>
- </select>
- <button type="button" name="button" class="pointersub">submit</button>
- </div>
- <div class="arrowdown"></div>
- </div>
- <div class="teethNumber">` +
- numberTeeth +
- `</div>
- <img class="imgTeeth" src="media/teethdown.png" alt="">
- </div>`
- )
- }
- function medecineScript() {
- $('.medicine').click(function() {
- let nameDoc = $('#nameOfDoc').text()
- let medicineName = $(this).text()
- let medicine = {
- medicine: medicineName,
- nameDoc: nameDoc,
- patientName: $('#nameOfPatientDetails').text()
- }
- let medicineJSON = JSON.stringify(medicine)
- $.ajax({
- url: '/medicine',
- type: 'POST',
- dataType: 'json',
- data: medicineJSON,
- success: function(data) {
- console.log(data)
- $('#patientMedicine').append(
- '<span class=`medicineNameSelected>`' +
- medicineName +
- '</span></br>'
- )
- localStorage.setItem(
- 'medicine ' + medicine.patientName + ' of ' + nameDoc,
- JSON.stringify(data)
- )
- }
- })
- })
- }
- $(window).on('load', function() {
- let username = localStorage.getItem('nameOfDoc')
- let clinic = localStorage.getItem('nameOfClinic')
- localStorage.clear()
- localStorage.setItem('nameOfDoc', username)
- localStorage.setItem('nameOfClinic', clinic)
- })
- $('#clinicFormSignUp').hide()
- $('#docFormSignUp').hide()
- $('#docFormSignIn').hide()
- $('#clinicFormSignIn').hide()
- $('#doctorSignUp').click(function(e) {
- e.preventDefault()
- $('#docFormSignIn').hide()
- $('#clinicFormSignIn').hide()
- $('#clinicFormSignUp').hide()
- $('#docFormSignUp').show()
- })
- $('#clinicSignUp').click(function(e) {
- e.preventDefault()
- $('#docFormSignIn').hide()
- $('#clinicFormSignIn').hide()
- $('#docFormSignUp').hide()
- $('#clinicFormSignUp').show()
- })
- //
- $('#doctorSignIn').click(function(e) {
- e.preventDefault()
- $('#clinicFormSignIn').hide()
- $('#docFormSignUp').hide()
- $('#clinicFormSignUp').hide()
- $('#docFormSignIn').show()
- })
- $('#clinicSignIn').click(function(e) {
- e.preventDefault()
- $('#docFormSignUp').hide()
- $('#clinicFormSignUp').hide()
- $('#docFormSignIn').hide()
- $('#clinicFormSignIn').show()
- })
- // function getLocalStorage(kind, patientClicked, nameOfDoc) {
- // localStorage.getItem(kind + " " + patientClicked.firstName + " " + patientClicked.SubName + "of" + JSON.parse(localStorage.getItem("nameOfDoc")).nameOfDoc)
- // }
- function hideExaptButtons() {
- $('#char_cont').hide()
- $('#calendar_cont').hide()
- $('#content').hide()
- }
- function openCity(evt, cityName) {
- let i, tabcontent, tablinks
- tabcontent = document.getElementsByClassName('tabcontent')
- for (i = 0; i < tabcontent.length; i++) {
- tabcontent[i].style.display = 'none'
- }
- tablinks = document.getElementsByClassName('tablinks')
- for (i = 0; i < tablinks.length; i++) {
- tablinks[i].className = tablinks[i].className.replace(' active', '')
- }
- document.getElementById(cityName).style.display = 'block'
- evt.currentTarget.className += ' active'
- }
- // Chenge Languege
- $('.he').hide()
- $('.heInput').hide()
- $('#en').click(function(e) {
- e.preventDefault()
- $('.he').hide()
- $('.en').show()
- $('.heInput').hide()
- $('.enInput').show()
- })
- $('#he').click(function(e) {
- e.preventDefault()
- $('.en').hide()
- $('.he').show()
- $('.enInput').hide()
- $('.heInput').show()
- })
- // SEARCH ENGINE:
- $('#searchB').click(function() {
- let inputVal = $('#box').val()
- $('.name').each(function() {
- let isContains =
- $(this)
- .text()
- .indexOf(inputVal) > -1
- if (!isContains) {
- $(this)
- .parent()
- .hide()
- } else {
- $(this)
- .parent()
- .show()
- }
- })
- })
- $('#bringThemOn').click(function() {
- $('.row').show()
- })
- //Menu clicks
- $('.menu_bts').click(function() {
- $(this)
- .siblings()
- .css('transform', 'translate(0px, -500px)')
- $('.menu_bts').css('opacity', '0')
- setTimeout(function() {
- $('#homeb').css('display', 'flex')
- $('#conteiner').hide()
- $('#homeb').css('opacity', '1')
- }, 1000)
- if ($(this).hasClass('left')) {
- setTimeout(function() {
- $('#content').show()
- $('#content').addClass('animated')
- $('#content').addClass('bounceIn')
- }, 1500)
- } else if ($(this).hasClass('right')) {
- setTimeout(function() {
- $('#char_cont').show()
- $('#char_cont').addClass('animated')
- $('#char_cont').addClass('bounceIn')
- }, 1500)
- } else {
- setTimeout(function() {
- $('#calendar_cont').show()
- $('#calendar_cont').addClass('animated')
- $('#calendar_cont').addClass('bounceIn')
- }, 1500)
- }
- })
- $('#homeb').click(function() {
- $(this).hide()
- $('#conteiner').show()
- $('.menu_bts').css('transform', 'translate(0px, 0px)')
- $('.menu_bts').css('opacity', '1')
- hideExaptButtons()
- })
- $('#cancleb').click(function(e) {
- e.preventDefault()
- $('#homeb').click()
- })
- $('#createNewAccount').hide()
- $('#createNewClinic').hide()
- $('#loginFormDiv').hide()
- $('.createNewAccoutSuggestion').click(function(e) {
- e.preventDefault()
- $('#createNewAccount').show()
- $('#loginFormDiv').hide()
- $('#createNewClinic').hide()
- })
- $('.createNewClinicSuggestion').click(function(e) {
- e.preventDefault()
- $('#createNewClinic').show()
- $('#createNewAccount').hide()
- $('#loginFormDiv').hide()
- })
- $('.createNewClinicSuggestion').click(function(e) {
- e.preventDefault()
- $('#login').show()
- })
- $('#loginClinic').click(function() {})
- $('.newClinicForm').submit(function(e) {
- e.preventDefault()
- $( "#clinicSignUp" ).removeClass( "active" )
- $( "#clinicSignIn" ).addClass( "active" )
- $('#docFormSignUp').hide()
- $('#clinicFormSignUp').hide()
- $('#docFormSignIn').hide()
- $('#clinicFormSignIn').show()
- let nameOfNewClinic = $('#nameOfNewClinic').val()
- let addressOfNewClinic = $('#addressOfNewClinic').val()
- let managerOfClinic = $('#ManagerOfClinic').val()
- let passwordOfNewClinic = $('#passwordOfNewClinic').val()
- let cityOfClinic = $('#cityOfClinic').val()
- let phoneNumberOfNewClinic = $('#phoneNumberOfNewClinic').val()
- let emailAddressOfNewClinic = $('#emailAddressOfNewClinic').val()
- let data = {
- nameOfNewClinic: nameOfNewClinic,
- password: passwordOfNewClinic,
- address: addressOfNewClinic + ' ' + cityOfClinic,
- managerOfClinic: managerOfClinic,
- emailAddress: emailAddressOfNewClinic,
- phoneNumber: phoneNumberOfNewClinic,
- doctors: [],
- patients: []
- }
- let datajson = JSON.stringify(data)
- $.ajax({
- url: '/createNewClinic',
- type: 'POST',
- dataType: 'json',
- data: datajson,
- success: function(data) {
- console.log(data)
- console.log('w')
- }
- })
- alert("A mail was sent to your Emmail, confirm it in order to create your account")
- })
- $("#favMedicinesOption #prescriptionTab").click(function(e) {
- e.preventDefault()
- $(".favMedicine").click(function() {
- console.log($(this));
- })
- })
- $('.loginClinic').submit(function(e) {
- e.preventDefault()
- let emailOfClinic = $('.emailOfClinicSign').val()
- let password = $('#passwordOfClinic').val()
- let data = {
- emailOfClinic: emailOfClinic,
- password: password
- }
- let dataJson = JSON.stringify(data)
- $.ajax({
- url: '/loginClinic',
- type: 'POST',
- dataType: 'json',
- data: dataJson,
- success: function(data) {
- let datafromServer = data
- let clinicsDetails = {
- nameOfClinic: datafromServer.nameOfClinic,
- idOfClinic: datafromServer.idUser,
- doctorsOfClinic: datafromServer.doctorsOfClinic
- }
- console.log(clinicsDetails)
- let clinicsJSON = JSON.stringify(clinicsDetails)
- localStorage.setItem('nameOfClinic', clinicsJSON)
- $('#ID').html(datafromServer.idUser)
- if (datafromServer.bool) {
- window.open('http://ct-doc.tk/clinic.html', '_self')
- }
- }
- })
- })
- // handling routes
- $('#cnaform').submit(function(e) {
- e.preventDefault()
- $( "#doctorSignUp" ).removeClass( "active" )
- $( "#doctorSignIn" ).addClass( "active" )
- $('#clinicFormSignIn').hide()
- $('#docFormSignUp').hide()
- $('#clinicFormSignUp').hide()
- $('#docFormSignIn').show()
- let data = {
- username:
- $('#nameOfNewAccountFirst').val() +
- ' ' +
- $('#nameOfNewAccountLast').val(),
- password: $('#passwordOfNewAccount').val(),
- address: $('#addressOfNewDoctor').val(),
- emailAddress: $('#emailAddressOfDoc').val(),
- patients: [],
- FavMedicines: [],
- confirm: "pending"
- }
- let json = JSON.stringify(data)
- console.log(data)
- $.ajax({
- url: '/createDoc',
- type: 'POST',
- dataType: 'json',
- data: json
- })
- alert("A mail was sent to your Emmail, confirm it in order to create your account")
- })
- $('#green').click(function(e) {
- e.preventDefault()
- console.log('green')
- let backgroundName = {
- background: 'green',
- nameDoc: JSON.parse(localStorage.getItem('nameOfDoc')).nameOfDoc
- }
- let JSONbackground = JSON.stringify(backgroundName)
- $.ajax({
- url: '/green',
- type: 'POST',
- dataType: 'json',
- data: JSONbackground,
- success: function(data) {
- console.log(data)
- console.log('w')
- $('.body').css('background-image', `url('media/NEXT_green.jpg')`)
- localStorage.setItem('theme', 'green')
- }
- })
- })
- // $(".fileupload").submit(function() {
- // let data = {
- // nmeOfDoc: $("#nameOfDoc").text(),
- // nameOfPtient: $(".nameOfPatientDetails").text()
- // }
- // let jsonData = JSON.stringify(data)
- // $.ajax({
- // url: '/upload',
- // type: 'POST',
- // dataType: 'json',
- // data: jsonData,
- // success: function(data) {
- //
- // }
- // })
- // })
- //set new meeting
- $('#submitSetNewMteetingBox').click(function(e) {
- e.preventDefault()
- let startMeetingHour = $('.startHour').val()
- let startMeetingMinutes = $('.startMinutes').val()
- let endMeetingHour = $('#endHour').val()
- let endMeetingMinutes = $('.endMinutes').val()
- let dateMeetingStart = $('#dateInputStart').val()
- let dateMeetingEnd = $('#dateInputEnd').val()
- let colorMeeting = $('#colorMeeting').val()
- if (startMeetingHour.length === 1) {
- let hourAccepted = '0' + startMeetingHour
- startMeetingHour = hourAccepted
- console.log('Passed')
- }
- if (startMeetingMinutes.length === 1) {
- let minutesAccepted = '0' + startMeetingMinutes
- startMeetingMinutes = minutesAccepted
- }
- if (endMeetingHour.length === 1) {
- let hourAcceptedEnd = '0' + endMeetingHour
- endMeetingHour = hourAcceptedEnd
- console.log('Passed')
- }
- if (endMeetingMinutes.length === 1) {
- let minutesAccepted = '0' + endMeetingMinutes
- endMeetingMinutes = minutesAccepted
- console.log('Passed')
- }
- if (dateMeetingEnd.length === 0) {
- dateMeetingEnd = dateMeetingStart
- }
- console.log(dateMeetingEnd)
- let meeting = {
- newMeeting: {
- title: 'Meeting',
- start:
- dateMeetingStart + 'T' + startMeetingHour + ':' + startMeetingMinutes,
- color: colorMeeting,
- end: dateMeetingEnd + 'T' + endMeetingHour + ':' + endMeetingMinutes
- },
- patientName: $('#nameOfPatientDetails').text(),
- nameDoc: $('#nameOfDoc').text()
- }
- $('#calenderMeeting').fullCalendar('addEventSource', [meeting.newMeeting])
- let meetingJson = JSON.stringify(meeting)
- $.ajax({
- url: 'newMeeting',
- type: 'POST',
- dataType: 'json',
- data: meetingJson,
- success: function(data) {
- console.log(data)
- localStorage.setItem(
- meeting.nameDoc + ' of patient ' + meeting.patientName + ' meetings',
- JSON.stringify(data)
- )
- }
- })
- })
- $('#orange').click(function(e) {
- e.preventDefault()
- console.log('orange')
- let backgroundName = {
- background: 'orange',
- nameDoc: JSON.parse(localStorage.getItem('nameOfDoc')).nameOfDoc
- }
- let JSONbackground = JSON.stringify(backgroundName)
- $.ajax({
- url: '/orange',
- type: 'POST',
- dataType: 'json',
- data: JSONbackground,
- success: function(data) {
- console.log('SAD')
- $('.body').css('background-image', `url('media/NEXT_orange.jpg')`)
- localStorage.setItem('theme', 'orange')
- }
- })
- })
- $('#blue').click(function(e) {
- e.preventDefault()
- console.log('blue')
- let backgroundName = {
- background: 'blue',
- nameDoc: JSON.parse(localStorage.getItem('nameOfDoc')).nameOfDoc
- }
- let JSONbackground = JSON.stringify(backgroundName)
- $.ajax({
- url: '/blue',
- type: 'POST',
- dataType: 'json',
- data: JSONbackground,
- success: function(data) {
- console.log('SAD')
- $('.body').css('background-image', `url('media/NEXT_blue.jpg')`)
- localStorage.setItem('theme', 'blue')
- }
- })
- })
- if (localStorage.getItem('theme') == 'grey') {
- $('.body').css('background-image', `url('media/NEXT_grey.jpg')`)
- } else if (localStorage.getItem('theme') == 'orange') {
- $('.body').css('background-image', `url('media/NEXT_orange.jpg')`)
- } else if (localStorage.getItem('theme') == 'orange') {
- $('.body').css('background-image', `url('media/NEXT_blue.jpg')`)
- } else {
- $('.body').css('background-image', `url('media/NEXT_green.jpg')`)
- }
- $('#grey').click(function(e) {
- e.preventDefault()
- console.log('grey')
- let backgroundName = {
- background: 'grey',
- nameDoc: JSON.parse(localStorage.getItem('nameOfDoc')).nameOfDoc
- }
- let JSONbackground = JSON.stringify(backgroundName)
- $.ajax({
- url: '/grey',
- type: 'POST',
- dataType: 'json',
- data: JSONbackground,
- success: function(data) {
- localStorage.setItem('theme', 'grey')
- $('.body').css('background-image', `url('media/NEXT_grey.jpg')`)
- }
- })
- })
- //$("#logB").click()
- $('#nameOfPatient').hide()
- $('#createNewPat-Form').submit(function(e) {
- e.preventDefault()
- let firstName = $('#patientFirstName').val()
- let subname = $('#subname').val()
- let pn = $('#pn').val()
- let emc = $('#emc').val()
- let fd = $('#FD').val()
- let address = $('#address').val()
- let job = $('#job').val()
- let homenumber = $('#homeNumber').val()
- let IDinput = $('#IDinput').val()
- let insurance = $('#insurance').val()
- let fax = $('#fax').val()
- let cameFrom = $('#cameFrom').val()
- let caseNumber = $('#caseNumber').val()
- let doctor = $('#doctor').val()
- let date = $('#date').val()
- let email = $('#email').val()
- let selectedGender = $('#gender option:selected')
- let gender = selectedGender[0].innerHTML
- let selectedStatus = $('#status option:selected')
- let status = selectedStatus[0].innerHTML
- let validity = $('#validity').val()
- let dataPatient = {
- nameDoc: $('#nameOfDoc').text(),
- docID: $('#ID').text(),
- data: {
- firstName: firstName,
- SubName: subname,
- fullName: firstName + ' ' + subname,
- phoneNumber: pn,
- emergencyNumber: emc,
- familyDoctor: fd,
- address: address,
- IDinput: IDinput,
- date: date,
- email: email,
- gender: gender,
- status: status,
- meetings: [],
- teethArage: {teeth: {}, price: ''},
- cameFrom: cameFrom,
- caseNumber: caseNumber,
- insurance: insurance,
- fax: fax,
- homenumber: homenumber,
- job: job,
- doctor: doctor,
- validity: validity,
- medicines: [],
- archive: false,
- nameOfFiles: [],
- infoComments: "",
- treatmentComments: "",
- prescriptionsComment: ""
- }
- }
- let jsonDataPatient = JSON.stringify(dataPatient)
- console.log(dataPatient)
- console.log(jsonDataPatient)
- $.ajax({
- url: '/PatientDetails',
- type: 'POST',
- dataType: 'json',
- data: jsonDataPatient,
- success: function(data) {
- let lol = data
- console.log(lol)
- console.log("asdasd");
- }
- })
- })
- $('#login-form').submit(function(e) {
- e.preventDefault()
- $('#nameOfPatient').show()
- $('#incorrect').html(
- 'Password or Username is incorrect! </br> <code>TIP</code>:Make sure the caps lock isnt locked on! :)'
- )
- let object = {
- username: $('#logUser').val(),
- password: $('#logPass').val(),
- patients: []
- }
- let objectJSON = JSON.stringify(object)
- $.ajax({
- url: '/loginReq',
- type: 'POST',
- dataType: 'json',
- data: objectJSON,
- success: function(data) {
- let lol = data
- let doctorsDetails = {
- nameOfDoc: lol.username,
- idOfDoc: lol.idUser
- }
- // console.log(lol.bool);
- let doctorsJSON = JSON.stringify(doctorsDetails)
- localStorage.setItem('nameOfDoc', doctorsJSON)
- $('#ID').html(lol.idUser)
- if (lol.bool) {
- window.open('http://ct-doc.tk/singleDoc.html', '_self')
- }
- }
- })
- })
- $('#char').click(function(e) {
- e.preventDefault()
- let nameDoc = $('#nameOfDoc').text()
- let nameDocObject = {
- nameDoc: nameDoc
- }
- let nameDocObjectJson = JSON.stringify(nameDocObject)
- $.ajax({
- url: '/reqPatientsDetails',
- type: 'POST',
- dataType: 'json',
- data: nameDocObjectJson,
- success: function(data1) {
- $('#patRow').html('')
- let data = data1.patients
- for (let i = 0; i < data.length; i++) {
- console.log(data[i].archive === true);
- if (data[i].archive === true) {
- $("#namesArchiveTable").append(`<tr class="row100 body">
- <td class="cell100 column1">` + data[i].fullName + `</td>
- </tr>`)
- $('#patRowArchive').append(
- `<tr class="row100 body">
- <td class="cell100 column2">` + data[i].IDinput + `</td>
- <td class="cell100 column3">` + data[i].phoneNumber + `</td>
- <td class="cell100 column4">` + data[i].gender + `</td>
- <td class="cell100 column5">` + data[i].email + `</td>
- <td class="cell100 column6">` + data[i].date + `</td>
- <td class="cell100 column7">` + data[i].address + `</td>
- <td class="cell100 column8"><button class="searchTools bringBackFromArchive"><span class="nameOfPatientHiddenArchive">` + data[i].fullName + `</span>Bring Back</button></td>
- </tr>`
- )
- } else {
- $('#patRow').append(
- columnHTML(
- data[i].firstName + ' ' + data[i].SubName,
- data[i].phoneNumber,
- data[i].familyDoctor,
- data[i].date,
- data[i].gender
- )
- )
- }
- }
- $(".deletePatient").click(function(e) {
- e.preventDefault()
- let nameOfPatient = $(this).parent().parent().parent().find(".name").children().text()
- let nameOfDoctor = $("#nameOfDoc").text()
- let data = {
- nameOfPatient: nameOfPatient,
- nameOfDoctor: nameOfDoctor
- }
- let jsonData = JSON.stringify(data)
- console.log(jsonData);
- let confirm = prompt("ARE YOU SURE YOU WANT TO DELETE PATIENT " + nameOfPatient + "? if you do, write the full name of the patient")
- if (confirm.toLowerCase() === nameOfPatient.toLowerCase()) {
- $.ajax({
- url: '/patientDeleted',
- type: 'POST',
- dataType: 'json',
- data: jsonData,
- success: function(data1) {
- alert(data1)
- }
- })
- location.reload()
- } else {
- alert("patient not deleted")
- }
- })
- $(".bringBackFromArchive").click(function(e) {
- e.preventDefault()
- let nameOfPatient = $(this).children().text()
- let nameOfDoc = $("#nameOfDoc").text()
- let data = {
- nameOfPatient: nameOfPatient,
- nameDoc: nameOfDoc
- }
- let JSONdata = JSON.stringify(data)
- $.ajax({
- url: '/backFromArchive',
- type: 'POST',
- dataType: 'json',
- data: JSONdata,
- success: function(data) {
- console.log(data);
- }
- })
- location.reload()
- })
- $("#archiveTable").click(function(e) {
- e.preventDefault()
- $(".limiter").show()
- $("#archiveTableClose").click(function(e) {
- $(".limiter").hide()
- })
- })
- $('.aRow').click(function(e) {
- e.preventDefault()
- let nameOfPatient = {
- nameOfDoc: $('#nameOfDoc').text(),
- nameOfPatient1: $(this)
- .find('.name')
- .children()
- .text()
- }
- for (let z = 0; z < data.length; z++) {
- if (
- data[z].firstName + ' ' + data[z].SubName ===
- nameOfPatient.nameOfPatient1
- ) {
- console.log(data[z])
- let patientClicked = data[z]
- $(".nameOfDocInput").val($("#nameOfDoc").text())
- $(".nameOfPatientInput").val($("#nameOfPatientDetails").text())
- $('#patientDetails').css('display', 'flex')
- $('#darkBackground').show()
- $('#darkBackground').css('height', $(document).height() + 'px')
- $('#closePatientdetails').click(function() {
- $('#patientDetails').hide()
- $('#darkBackground').hide()
- $('#meetingsUL').html('')
- })
- $(".nameOfPatientInput").val(patientClicked.firstName + ' ' + patientClicked.SubName)
- $('#nameOfPatientDetails').html(
- patientClicked.firstName + ' ' + patientClicked.SubName
- )
- $('#firstName').html(patientClicked.firstName)
- $('#SubName').html(patientClicked.SubName)
- $('#phoneNumberPatient').html(patientClicked.phoneNumber)
- $('#fax').html(patientClicked.fax)
- $("#info_box").val("")
- $('#doctor').html(patientClicked.doctor)
- $('#homenumber').html(patientClicked.homenumber)
- $('#validity').html(patientClicked.validity)
- $('#insurance').html(patientClicked.insurance)
- $('#job').html(patientClicked.job)
- $('#caseNumber').html(patientClicked.caseNumber)
- $('#cameFrom').html(patientClicked.cameFrom)
- $('#genderPatient').html(patientClicked.gender)
- $('#addressPatient').html(patientClicked.address)
- $('#emailPatient').html(patientClicked.email)
- $('#statusPatient').html(patientClicked.status)
- $('#famDocPatient').html(patientClicked.familyDoctor)
- $('#emargancyNumberPatient').html(patientClicked.emergencyNumber)
- $('#birthDayPatient').html(patientClicked.date)
- $('#calenderMeeting').fullCalendar('removeEventSources')
- $('#allTreatments').html(''),
- $("#textareaPayment").val("")
- if (localStorage.getItem("textareaPayment " + patientClicked.fullName)) {
- $("#textareaPayment").val(localStorage.getItem("textareaPayment " + patientClicked.fullName))
- } else {
- $("#textareaPayment").val(patientClicked.commentPayment)
- }
- if (localStorage.getItem("treatmentComment " + patientClicked.fullName)) {
- $("#textareaTreatment").val(localStorage.getItem("treatmentComment " + patientClicked.fullName))
- } else {
- $("#textareaTreatment").val(patientClicked.treatmentComments)
- }
- if (localStorage.getItem("prescriptionsComment " + patientClicked.fullName)) {
- $("#prescriptions_box").val(localStorage.getItem("prescriptionsComment " + patientClicked.fullName))
- } else {
- $("#prescriptions_box").val(patientClicked.prescriptionsComment)
- }
- //prescriptionsComment
- if (localStorage.getItem("infoComments " + patientClicked.fullName)) {
- $("#info_box").val(localStorage.getItem("infoComments " + patientClicked.fullName))
- } else {
- $("#info_box").val(patientClicked.infoComments)
- }
- for (var i = 0; i < patientClicked.nameOfFiles.length; i++) {
- $(".listOfFiles").append(`<img src=media/usersMedia/` + $("#nameOfDoc").text().split(' ').join('_') + `/` + patientClicked.fullName.split(' ').join('_') + `/` + patientClicked.nameOfFiles[i] + `>`)
- }
- $("#submitPayment").click(function() {
- let comment = $("#textareaPayment").val()
- let nameOfDoc = $("#nameOfDoc").text()
- let nameOfPatient = patientClicked.fullName
- let data = {
- comment: comment,
- nameDoc: nameOfDoc,
- namePatient: nameOfPatient
- }
- let JSONData = JSON.stringify(data)
- $.ajax({
- url: '/commentPayment',
- type: 'POST',
- dataType: 'json',
- data: JSONData,
- success: function(data) {
- console.log(data);
- localStorage.setItem("textareaPayment " + patientClicked.fullName, data.message)
- }
- })
- })
- $("#submitTreatmentComments").click(function() {
- let comment = $("#textareaTreatment").val()
- let nameOfDoc = $("#nameOfDoc").text()
- let nameOfPatient = patientClicked.fullName
- let data = {
- comment: comment,
- nameDoc: nameOfDoc,
- namePatient: nameOfPatient
- }
- let JSONData = JSON.stringify(data)
- $.ajax({
- url: '/treatmentComment',
- type: 'POST',
- dataType: 'json',
- data: JSONData,
- success: function(data) {
- console.log(data);
- localStorage.setItem("textareaTreatment " + patientClicked.fullName, data.message)
- }
- })
- })
- $("#submitPrescriptions").click(function() {
- let comment = $("#prescriptions_box").val()
- let nameOfDoc = $("#nameOfDoc").text()
- let nameOfPatient = patientClicked.fullName
- let data = {
- comment: comment,
- nameDoc: nameOfDoc,
- namePatient: nameOfPatient
- }
- let JSONData = JSON.stringify(data)
- $.ajax({
- url: '/prescriptionsComment',
- type: 'POST',
- dataType: 'json',
- data: JSONData,
- success: function(data) {
- console.log(data);
- localStorage.setItem("prescriptionsComment " + patientClicked.fullName, data.message)
- }
- })
- })
- $('#totalPriceOfTeeth').html('')
- $("#moveToArchive").click(function(e) {
- e.preventDefault()
- // let prompt = prompt("are you sure you wnna delete patient " + $("#nameOfPatientDetails").text() + "? if you do, type the full name of the patient")
- // if (prompt == $("#nameOfPatientDetails").text()) {
- let data = {
- namePatient: $("#nameOfPatientDetails").text(),
- }
- console.log(data);
- let jsonData = JSON.stringify(data)
- $.ajax({
- url: '/archivePatient',
- type: 'POST',
- dataType: 'json',
- data: jsonData,
- success: function(data) {
- console.log(data);
- location.reload()
- }
- })
- // } else {
- // alert("Wrong name")
- // }
- })
- let numberPatient = data.indexOf(patientClicked)
- let totalPrice = 0
- $('#favMedicines').html('')
- $("#saveBtnTextareaInfoTab").click(function(e) {
- e.preventDefault()
- let nameOfDoc = $("#nameOfDoc").text()
- let nameOfPatient = $("#nameOfPatientDetails").text()
- let comments = $("#info_box").val()
- let data = {
- nameDoc: nameOfDoc,
- namePatient: nameOfPatient,
- infoComments: comments
- }
- console.log(data);
- let jsonData = JSON.stringify(data)
- $.ajax({
- url: '/infoComments',
- type: 'POST',
- dataType: 'json',
- data: jsonData,
- success: function(data) {
- console.log(data);
- localStorage.setItem("infoComments " + patientClicked.fullName, data.message)
- }
- })
- })
- if (localStorage.getItem('favMedicine:')) {
- let favMedicines = JSON.parse(
- localStorage.getItem('favMedicine:')
- )
- for (let i = 0; i < favMedicines.length; i++) {
- //2003
- $('#favMedicines').append(
- `<a href=""class="aMedicine">
- <div class="medicine favMedicine">` +
- favMedicines[i] +
- `<span class="removeFavMedicine">✕</span>
- </div>
- </a>`
- )
- }
- } else {
- for (let i = 0; i < data1.FavMedicines.length; i++) {
- $('#favMedicines').append(
- `<a href=""class="aMedicine">
- <div class="medicine favMedicine">` +
- data1.FavMedicines[i] +
- `<span class="removeFavMedicine">✕</span>
- </div>
- </a>`
- )
- }
- $('.favMedicinesNewMedicine').click(function(e) {
- e.preventDefault()
- let favMedicine = {
- nameDoc: $('#nameOfDoc').text(),
- medicine: $(this).text()
- }
- let favMedicineJSON = JSON.stringify(favMedicine)
- $.ajax({
- url: '/medicineFav',
- type: 'POST',
- dataType: 'json',
- data: favMedicineJSON,
- success: function(data) {
- console.log(Object.values(data))
- $('#favMedicines').append(
- `<a href=""class="aMedicine">
- <div class="medicine favMedicine medicine` + $(".favMedicine").length + `">` +
- favMedicine.medicine +
- `<span class="removeFavMedicine">✕</span>
- </div>
- </a>`
- )
- let num = $(".favMedicine").length -1
- $('.medicine' + num).click(function() {
- console.log("new thing clicked " + $(".favMedicine").length + 1);
- let nameDoc = $('#nameOfDoc').text()
- let medicineName = $(this).text()
- let medicine = {
- medicine: medicineName,
- nameDoc: nameDoc,
- patientName: $('#nameOfPatientDetails').text()
- }
- let medicineJSON = JSON.stringify(medicine)
- $.ajax({
- url: '/medicine',
- type: 'POST',
- dataType: 'json',
- data: medicineJSON,
- success: function(data) {
- console.log(data)
- $('#patientMedicine').append(
- '<span class=`medicineNameSelected>`' +
- medicineName +
- '</span></br>'
- )
- localStorage.setItem(
- 'medicine ' + medicine.patientName + ' of ' + nameDoc,
- JSON.stringify(data)
- )
- }
- })
- })
- localStorage.setItem('favMedicine:', JSON.stringify(data))
- $('.aMedicine').click(function(e) {
- e.preventDefault()
- })
- }
- })
- })
- $('.medicine').click(function() {
- console.log($(this));
- let nameDoc = $('#nameOfDoc').text()
- let medicineName = $(this).text()
- let medicine = {
- medicine: medicineName,
- nameDoc: nameDoc,
- patientName: $('#nameOfPatientDetails').text()
- }
- let medicineJSON = JSON.stringify(medicine)
- $.ajax({
- url: '/medicine',
- type: 'POST',
- dataType: 'json',
- data: medicineJSON,
- success: function(data) {
- console.log(data)
- $('#patientMedicine').append(
- '<span class=`medicineNameSelected>`' +
- medicineName +
- '</span></br>'
- )
- localStorage.setItem(
- 'medicine ' + medicine.patientName + ' of ' + nameDoc,
- JSON.stringify(data)
- )
- }
- })
- })
- }
- if (
- localStorage.getItem(
- 'doctor ' +
- $('#nameOfDoc').text() +
- ' teeth: ' +
- patientClicked.firstName +
- ' ' +
- patientClicked.SubName
- )
- ) {
- let Teeth = JSON.parse(
- localStorage.getItem(
- 'doctor ' +
- $('#nameOfDoc').text() +
- ' teeth: ' +
- patientClicked.firstName +
- ' ' +
- patientClicked.SubName
- )
- )
- if (
- Teeth.patient ==
- patientClicked.firstName + ' ' + patientClicked.SubName
- ) {
- for (let i = 0; i < Object.keys(Teeth.teeth).length; i++) {
- // $("#allTreatments").append(`<div class="teethInfo">teethNumber` + Object.keys(Teeth.teeth)[i][0] + ` , treatment` + Object.values(Teeth.teeth)[0] + `, price1`+ Object.values(patientClicked.teethArage.teeth[i])[0][0]+`</div>`)
- $('#allTreatments').append(
- '<div class=`teethInfo`>teethNumber: ' +
- Object.keys(Teeth.teeth)[i] +
- ' , treatment: ' +
- Object.values(Teeth.teeth)[i][1] +
- ' price: ' +
- Object.values(Teeth.teeth)[i][0] +
- '</br></div>'
- )
- }
- for (let i = 0; i < Object.keys(Teeth.teeth).length; i++) {
- console.log(Object.values(Object.values(Teeth.teeth)[i])[0])
- totalPrice += parseInt(Object.values(Teeth.teeth)[i][0])
- }
- }
- } else {
- for (
- var SomeThing = 0;
- SomeThing < Object.keys(patientClicked.teethArage.teeth).length;
- SomeThing++
- ) {
- console.log(
- Object.keys(patientClicked.teethArage.teeth)[SomeThing]
- )
- $('#allTreatments').append(
- '<div class=`teethInfo`>teethNumber ' +
- Object.keys(patientClicked.teethArage.teeth)[SomeThing] +
- ' , treatment ' +
- Object.values(patientClicked.teethArage.teeth)[
- SomeThing
- ][1] +
- ' price: ' +
- Object.values(patientClicked.teethArage.teeth)[
- SomeThing
- ][0] +
- '</br></div>'
- )
- }
- for (
- let i = 0;
- i < Object.keys(patientClicked.teethArage.teeth).length;
- i++
- ) {
- console.log(
- Object.values(
- Object.values(patientClicked.teethArage.teeth)[i]
- )[0]
- )
- totalPrice += parseInt(
- Object.values(patientClicked.teethArage.teeth)[i][0]
- )
- }
- }
- $('#totalPriceOfTeeth').append(
- "<div>The Price Is in totall: <span id='totaltreatmentprice'>" +
- totalPrice +
- '</span>'
- )
- if (
- localStorage.getItem(
- 'meetings ' +
- patientClicked.firstName +
- ' ' +
- patientClicked.SubName
- )
- ) {
- let meetings = localStorage.getItem(
- 'meetings ' +
- patientClicked.firstName +
- ' ' +
- patientClicked.SubName
- )
- $('#meetings').html(meetings)
- } else {
- for (let i = 0; i < patientClicked.meetings.length; i++) {
- $('#meetingsUL').append(
- '<li>' + patientClicked.meetings[i] + '</li>'
- )
- }
- }
- if (
- localStorage.getItem(
- 'medicine ' +
- patientClicked.firstName +
- ' ' +
- patientClicked.SubName +
- ' of ' +
- nameOfPatient.nameOfDoc
- )
- ) {
- let medicines = JSON.parse(
- localStorage.getItem(
- 'medicine ' +
- patientClicked.firstName +
- ' ' +
- patientClicked.SubName +
- ' of ' +
- nameOfPatient.nameOfDoc
- )
- )
- $('#patientMedicine').html('')
- for (let i = 0; i < medicines.length; i++) {
- $('#patientMedicine').append(medicines[i] + '<br>')
- }
- } else {
- let medicines = patientClicked.medicines
- $('#patientMedicine').html('')
- for (let i = 0; i < medicines.length; i++) {
- $('#patientMedicine').append(medicines[i] + '<br>')
- }
- }
- let today = new Date()
- let date =
- today.getFullYear() +
- '-' +
- (today.getMonth() + 1) +
- '-' +
- today.getDate()
- $('#paycheckDate').html(date)
- $('#nameOfPatientPaycheck').html($('#nameOfPatientDetails').text())
- $('#teethPricePaycheck').html($('#allTreatments').html())
- $('#nameOfDocPaycheck').html($('#nameOfDoc').text())
- if (
- localStorage.getItem(
- $('#nameOfDoc').text() +
- ' of patient ' +
- $('#nameOfPatientDetails').text() +
- ' meetings'
- )
- ) {
- let meetings = JSON.parse(
- localStorage.getItem(
- $('#nameOfDoc').text() +
- ' of patient ' +
- $('#nameOfPatientDetails').text() +
- ' meetings'
- )
- )
- $('#calenderMeeting').fullCalendar('addEventSource', meetings)
- } else {
- for (let i = 0; i < patientClicked.meetings.length; i++) {
- $('#calenderMeeting').fullCalendar('addEventSource', [
- patientClicked.meetings[i]
- ])
- }
- }
- $('.aMedicine').click(function(e) {
- e.preventDefault()
- })
- break
- }
- }
- })
- }
- })
- })
- $(".nameOfDocInput").val($("#nameOfDoc").text())
- $('#mettings_all').click(function() {
- $('#calendar4').fullCalendar('today');
- $("#calendar4 .fc-agendaDay-button").click()
- let toServer = {
- docName: $('#nameOfDoc').text()
- }
- let toServer_Json = JSON.stringify(toServer)
- $.ajax({
- url: '/info_meeting',
- type: 'POST',
- dataType: 'json',
- data: toServer_Json,
- success: function(data) {
- for (let j = 0; j < Object.values(data).length; j++) {
- for (let i = 0; i < Object.values(data)[j].length; i++) {
- Object.values(data)[j][i].title = Object.keys(data)[j]
- $('#calendar4').fullCalendar('addEventSource', [
- Object.values(data)[j][i]
- ])
- }
- }
- console.log(Object.values(data))
- }
- })
- })
- $('#addToFavMedicines').click(function(e) {
- e.preventDefault()
- $('#favMedicinesNew').show()
- $('#backgroundFavMedicinesNew').show()
- $('#closeFavMedicinesNew').click(function(e) {
- e.preventDefault()
- console.log('WORKING')
- $('#favMedicinesNew').hide()
- $('#backgroundFavMedicinesNew').hide()
- })
- })
- let nameDoc = $('#nameOfDoc').text()
- $('#backgroundFavMedicinesNew').click(function() {
- $(this).hide()
- })
- $('#querterJaw1').html('')
- $('#querterJaw2').html('')
- $('#querterJaw3').html('')
- $('#querterJaw4').html('')
- let T = 10
- let imageSRC
- for (var i = 1; i < 5; i++) {
- for (var t = 1; t < 9; t++) {
- if (i === 1) {
- T = 10 + t
- imageSRC = "media/teethdown.png"
- } else if (i === 2) {
- T = 40 + t
- imageSRC = "media/teeth.png"
- } else if (i === 3) {
- T = 20 + t
- imageSRC = "media/teethdown.png"
- } else if (i === 4) {
- T = 30 + t
- imageSRC = "media/teeth.png"
- }
- $('#querterJaw' + i).append(
- `<div class="teeth">
- <div class="pointerdown pointer">
- <div class="containerPointer">
- <input type="text" class="teethPriceSingle" placeholder="Price">
- <select class="selectTreatment" name="">
- <option value="">treatment</option>
- <option value="shetel">shetel</option>
- <option value="ikor">ikor</option>
- <option value="whatever">whatever</option>
- </select>
- <button type="button" name="button" class="pointersub">submit</button>
- </div>
- <div class="arrowdown"></div>
- </div>
- <div class="teethNumber">` +
- T
- +
- `</div>
- <img class="imgTeeth" src="${imageSRC}" alt="">
- </div>`
- )
- }
- }
- let jack = {}
- $('.teethNumber').click(function(e) {
- e.preventDefault()
- $(this)
- .parent()
- .toggleClass('selectedTeeth')
- $(this)
- .parents()
- .find('.pointer')
- .toggle()
- if (
- $(this)
- .parents()
- .hasClass('selectedTeeth') === false
- ) {
- $(this)
- .parents()
- .find('.pointer')
- .hide()
- } else {
- $(this)
- .parents()
- .siblings()
- .find('.pointer')
- .hide()
- $(this)
- .parents()
- .parents()
- .siblings()
- .find('.pointer')
- .hide()
- }
- })
- $('#submitSpansPriceForm').submit(function(e) {
- e.preventDefault()
- let teethSelected = []
- let count = 0
- let data = {}
- for (let i = 0; i < '.selectedTeeth'.find('.teethNumber').length; i++) {
- teethSelected.push(
- $('.selectedTeeth')
- .find('.teethNumber')
- .text()[i]
- )
- data[teethSelected[i]] = []
- }
- })
- $('.imgTeeth').click(function(e) {
- e.preventDefault()
- $(this)
- .parent()
- .toggleClass('selectedTeeth')
- $(this)
- .parents()
- .find('.pointer')
- .toggle()
- if (
- $(this)
- .parents()
- .hasClass('selectedTeeth') === false
- ) {
- $(this)
- .parents()
- .find('.pointer')
- .hide()
- } else {
- $(this)
- .parents()
- .siblings()
- .find('.pointer')
- .hide()
- $(this)
- .parents()
- .parents()
- .siblings()
- .find('.pointer')
- .hide()
- }
- })
- $('.pointersub').click(function(e) {
- e.preventDefault()
- let numberTeeth = $(this)
- .parent()
- .parent()
- .parent()
- .find('.teethNumber')
- .text()
- let valuePrice = $(this)
- .siblings('.teethPriceSingle')
- .val()
- let treatment = $(this)
- .siblings('.selectTreatment')
- .val()
- let price = $('#teethPrice').val()
- let docName = JSON.parse(localStorage.getItem('nameOfDoc')).nameOfDoc
- // teethObject.teeth[parseInt(numberTeeth)].push(valuePrice)
- // teethObject.teeth[parseInt(numberTeeth)].push(treatment)
- if (isNaN(valuePrice)) {
- alert('price in Numbers')
- } else {
- jack[parseInt(numberTeeth)] = [valuePrice, treatment]
- $('#allTreatments').append(
- 'Teeth number:<span class=`teethNumberAfter`> ' +
- numberTeeth +
- '</span> , The price is: <span class=`priceAfter`>' +
- valuePrice +
- '</span> treatment: <span class=`treatmentAfter`>' +
- treatment +
- '</span>'
- )
- $('#totaltreatmentprice').html(
- parseInt($('#totaltreatmentprice').text()) + parseInt(valuePrice)
- )
- let teethObject = {
- docName: docName,
- patientName: $('#nameOfPatientDetails').text(),
- teeth: jack,
- price: $('#teethPrice').val()
- }
- console.log(jack)
- let jsonObject = JSON.stringify(teethObject)
- $.ajax({
- url: '/patientsTeeth',
- type: 'POST',
- dataType: 'json',
- data: jsonObject,
- success: function(data) {
- let PatientAndTeeth = {
- patient: teethObject.patientName,
- teeth: data
- }
- let jsonPatientTeeth = JSON.stringify(PatientAndTeeth.teeth)
- localStorage.setItem(
- 'doctor ' +
- $('#nameOfDoc').text() +
- ' teeth: ' +
- teethObject.patientName,
- JSON.stringify(PatientAndTeeth)
- )
- }
- })
- }
- })
- // Payment print section
- function printDiv() {
- var divToPrint = document.getElementById('paymentTab')
- var newWin = window.open('', 'Print-Window')
- newWin.document.open()
- newWin.document.write(
- '<html><body onload="window.print()">' +
- divToPrint.innerHTML +
- '</body></html>'
- )
- newWin.document.close()
- setTimeout(function() {
- newWin.close()
- }, 10)
- }
- $('.form')
- .find('input, textarea')
- .on('keyup blur focus', function(e) {
- var $this = $(this),
- label = $this.prev('label')
- if (e.type === 'keyup') {
- if ($this.val() === '') {
- label.removeClass('active highlight')
- } else {
- label.addClass('active highlight')
- }
- } else if (e.type === 'blur') {
- if ($this.val() === '') {
- label.removeClass('active highlight')
- } else {
- label.removeClass('highlight')
- }
- } else if (e.type === 'focus') {
- if ($this.val() === '') {
- label.removeClass('highlight')
- } else if ($this.val() !== '') {
- label.addClass('highlight')
- }
- }
- })
- $('.tab a').on('click', function(e) {
- e.preventDefault()
- $(this)
- .parent()
- .addClass('active')
- $(this)
- .parent()
- .siblings()
- .removeClass('active')
- target = $(this).attr('href')
- $('.tab-content > div')
- .not(target)
- .hide()
- $(target).fadeIn(600)
- })
- //calendar
- // let ll = {
- // username: JSON.parse(localStorage.getItem("nameOfDoc")).nameOfDoc
- // }
- // let jsonObject = JSON.stringify(ll)
- // $.ajax({
- // url: "/meetingToday",
- // type: "POST",
- // dataType: "json",
- // data: jsonObject,
- // success: function(data) {
- // if (data.length === 0) {
- //
- // } else {
- // console.log();
- //
- // for (var i = 0; i < data.length; i++) {
- // console.log(Object.values(data[i])[0][0].slice(0,3));
- // console.log(Object.values(data[i])[0][0]);
- $('.calendar1').fullCalendar({
- header: {
- left: 'prev,next today',
- center: 'title',
- right: 'month,agendaWeek,agendaDay,listMonth'
- },
- navLinks: true, // can click day/week names to navigate views
- businessHours: true, // display business hours
- editable: true,
- eventClick: function(calEvent, jsEvent, view) {
- console.log(calEvent);
- let namePatient = calEvent.title.slice(calEvent.title.indexOf("(")+1, calEvent.title.indexOf(")"))
- $("#homeb").click()
- $("#char").click()
- setTimeout(function() {
- let nameOfPatient = {
- nameOfClinic: $("#nameOfClinic").text(),
- nameOfDoc: $('#nameOfDoc').text(),
- nameOfPatient: $(this)
- .find('.name')
- .children()
- .text()
- }
- console.log(nameOfPatient);
- $('#patientDetails').css('display', 'flex')
- $('#darkBackground').show()
- $('#darkBackground').css('height', $(document).height() + 'px')
- $('#closePatientdetails').click(function() {
- $('#patientDetails').hide()
- $('#darkBackground').hide()
- $('#meetingsUL').html('')
- })
- let jsonData = JSON.stringify(nameOfPatient)
- $.ajax({
- url: '/getPatientClickedClinic',
- dataType: 'json',
- data: jsonData,
- type: 'POST',
- success: function(data) {
- let patient = data
- let totalPrice = 0
- console.log(patient);
- $('#nameOfPatientDetails').html(
- patient.firstName + ' ' + patient.SubName
- )
- $('#firstName').html(patient.firstName)
- $('#SubName').html(patient.SubName)
- $('#phoneNumberPatient').html(patient.phoneNumber)
- $('#fax').html(patient.fax)
- $('#doctor').html(patient.doctor)
- $('#homenumber').html(patient.homenumber)
- $('#validity').html(patient.validity)
- $('#insurance').html(patient.insurance)
- $('#job').html(patient.job)
- $('#caseNumber').html(patient.caseNumber)
- $('#cameFrom').html(patient.cameFrom)
- $('#genderPatient').html(patient.gender)
- $('#addressPatient').html(patient.address)
- $('#emailPatient').html(patient.email)
- $('#statusPatient').html(patient.status)
- $('#famDocPatient').html(patient.familyDoctor)
- $('#emargancyNumberPatient').html(patient.emergencyNumber)
- $('#birthDayPatient').html(patient.date)
- $('#allTreatments').html('')
- $('#totalPriceOfTeeth').html('')
- $('.calendar1').fullCalendar('removeEventSources')
- $('.calendar1').fullCalendar('today');
- $("#moveToArchive").click(function(e) {
- e.preventDefault()
- console.log("button clicked");
- $.ajax({
- url: '/archiveClinic',
- type: 'GET',
- dataType: 'json',
- success: function(data) {
- console.log(data);
- }
- })
- // location.reload()
- })
- setMeeting()
- if (localStorage.getItem("doctor of patient ${patient.fullName} meetings")) {
- $('#calenderMeeting').fullCalendar('addEventSource', [JSON.parse(localStorage.getItem("doctor of patient ${patient.fullName} meetings"))])
- } else {
- $('#calenderMeeting').fullCalendar('addEventSource', patient.meetings)
- }
- if (
- localStorage.getItem(
- 'doctor ' +
- $('#nameOfDoc').text() +
- ' teeth: ' + patient.fullName
- )
- ) {
- let Teeth = JSON.parse(
- localStorage.getItem(
- 'doctor ' +
- $('#nameOfDoc').text() +
- ' teeth: ' +
- patient.firstName +
- ' ' +
- patient.SubName
- )
- )
- if (
- Teeth.patient ==
- patient.firstName + ' ' + patient.SubName
- ) {
- for (let i = 0; i < Object.keys(Teeth.teeth).length; i++) {
- // $("#allTreatments").append(`<div class="teethInfo">teethNumber` + Object.keys(Teeth.teeth)[i][0] + ` , treatment` + Object.values(Teeth.teeth)[0] + `, price1`+ Object.values(patientClicked.teethArage.teeth[i])[0][0]+`</div>`)
- $('#allTreatments').append(
- '<div class=`teethInfo`>teethNumber: ' +
- Object.keys(Teeth.teeth)[i] +
- ' , treatment: ' +
- Object.values(Teeth.teeth)[i][1] +
- ' price: ' +
- Object.values(Teeth.teeth)[i][0] +
- '</br></div>'
- )
- }
- for (let i = 0; i < Object.keys(Teeth.teeth).length; i++) {
- console.log(Object.values(Object.values(Teeth.teeth)[i])[0])
- totalPrice += parseInt(Object.values(Teeth.teeth)[i][0])
- }
- }
- } else {
- for (
- var SomeThing = 0;
- SomeThing < Object.keys(patient.teethArage.teeth).length;
- SomeThing++
- ) {
- console.log(
- Object.keys(patient.teethArage.teeth)[SomeThing]
- )
- $('#allTreatments').append(
- '<div class=`teethInfo`>teethNumber ' +
- Object.keys(patient.teethArage.teeth)[SomeThing] +
- ' , treatment ' +
- Object.values(patient.teethArage.teeth)[
- SomeThing
- ][1] +
- ' price: ' +
- Object.values(patient.teethArage.teeth)[
- SomeThing
- ][0] +
- '</br></div>'
- )
- }
- for (
- let i = 0;
- i < Object.keys(patient.teethArage.teeth).length;
- i++
- ) {
- console.log(
- Object.values(
- Object.values(patient.teethArage.teeth)[i]
- )[0]
- )
- totalPrice += parseInt(
- Object.values(patient.teethArage.teeth)[i][0]
- )
- }
- }
- $("#info_box").val("")
- $("#textareaPayment").val("")
- $("#textareaTreatment").val("")
- $("#textareaMedicines").val("")
- if (localStorage.getItem("infoComments " + patient.fullName)) {
- $("#info_box").val(localStorage.getItem("infoComments " + patient.fullName))
- } else {
- $("#info_box").val(patient.infoComments)
- }
- if (localStorage.getItem("prescriptionsComment " + patient.fullName)) {
- $("#textareaMedicines").val(localStorage.getItem("prescriptionsComment " + patient.fullName))
- } else {
- $("#textareaMedicines").val(patient.prescriptionsComment)
- }
- if (localStorage.getItem("treatmentComment " + patient.fullName)) {
- $("#textareaTreatment").val(localStorage.getItem("treatmentComment " + patient.fullName))
- } else {
- $("#textareaTreatment").val(patient.treatmentComments)
- }
- if (localStorage.getItem("textareaPayment " + patient.fullName)) {
- $("#textareaPayment").val(localStorage.getItem("textareaPayment " + patient.fullName))
- } else {
- $("#textareaPayment").val(patient.prescriptionsComment)
- }
- $("#submitPaymentComments").click(function() {
- let comment = $("#textareaPayment").val()
- let data = {
- comment: comment
- }
- let JSONData = JSON.stringify(data)
- $.ajax({
- url: '/commentPaymentClinic',
- type: 'POST',
- dataType: 'json',
- data: JSONData,
- success: function(data) {
- console.log(data);
- localStorage.setItem("textareaPayment " + patient.fullName, data.message)
- }
- })
- })
- $("#submitMedicinesComments").click(function() {
- let comment = $("#textareaMedicines").val()
- let data = {
- comment: comment
- }
- let JSONData = JSON.stringify(data)
- $.ajax({
- url: '/prescriptionsCommentClinic',
- type: 'POST',
- dataType: 'json',
- data: JSONData,
- success: function(data) {
- console.log(data);
- localStorage.setItem("prescriptionsComment " + patient.fullName, data.message)
- }
- })
- })
- $("#submitTreatmentComments").click(function() {
- let comment = $("#textareaTreatment").val()
- let data = {
- comment: comment
- }
- let JSONData = JSON.stringify(data)
- $.ajax({
- url: '/treatmentCommentClinic',
- type: 'POST',
- dataType: 'json',
- data: JSONData,
- success: function(data) {
- console.log(data);
- localStorage.setItem("treatmentComment " + patient.fullName, data.message)
- }
- })
- })
- $("#saveBtnTextareaInfoTab").click(function(e) {
- e.preventDefault()
- let comments = $("#info_box").val()
- let data = {
- infoComments: comments
- }
- let jsonData = JSON.stringify(data)
- $.ajax({
- url: '/infoCommentsClinic',
- type: 'POST',
- dataType: 'json',
- data: jsonData,
- success: function(data) {
- console.log(data);
- localStorage.setItem("infoComments " + patient.fullName, data.message)
- }
- })
- })
- $("#submitPayment").click(function() {
- let comment = $("#textareaPayment").val()
- let data = {
- comment: comment
- }
- let JSONData = JSON.stringify(data)
- $.ajax({
- url: '/commentPaymentClinic',
- type: 'POST',
- dataType: 'json',
- data: JSONData,
- success: function(data) {
- console.log(data);
- localStorage.setItem("textareaPayment " + patient.fullName, data.message)
- }
- })
- })
- $(".newFormMeeting").click(function(e) {
- let cloneForm = $(this).parent().clone()
- $("#meetingsForm").append(cloneForm)
- setMeeting()
- })
- }
- })
- console.log($("#patRow").find(namePatient));
- // for (var i = 0; i < $(".aRow").length; i++) {
- // if ($(".aRow").get([i]).find(".name") == namePatient) {
- // $(".aRow").get([i]).click()
- // break;
- // }
- // }
- }, 3000)
- console.log(jsEvent);
- console.log(view);
- },
- events:[
- // {
- // title: 'Business Lunch',
- // start: '2017-11-03T13:00:00',
- // constraint: 'businessHours'
- // },
- // {
- // title: 'Meeting',
- // start: '2017-11-13T11:00:00',
- // constraint: 'availableForMeeting', // defined below
- // color: '#257e4a'
- // },
- // {
- // title: 'Conference',
- // start: '2017-11-18',
- // end: '2017-11-20'
- // },
- // {
- // title: 'Party',
- // start: '2017-11-29T20:00:00'
- // },
- //
- // // areas where "Meeting" must be dropped
- // {
- // id: 'availableForMeeting',
- // start: '2017-11-11T10:00:00',
- // end: '2017-11-11T16:00:00',
- // rendering: 'background'
- // },
- // {
- // id: 'availableForMeeting',
- // start: '2017-11-13T10:00:00',
- // end: '2017-11-13T16:00:00',
- // rendering: 'background'
- // },
- // red areas where no events can be dropped
- // {
- // start: '2017-11-24',
- // end: '2017-11-28',
- // overlap: false,
- // rendering: 'background',
- // color: '#ff9f89'
- // },
- // {
- // start: '2017-11-06',
- // end: '2017-11-08',
- // overlap: false,
- // rendering: 'background',
- // color: '#ff9f89'
- // }
- ]
- });
- // }
- // }
- // }
- // })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement