Changeset 53765dd for src/main/resources/static/js
- Timestamp:
- 01/04/24 09:07:47 (11 months ago)
- Branches:
- master
- Children:
- e8999eb
- Parents:
- 1413ee2
- Location:
- src/main/resources/static/js
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/resources/static/js/business_admin.js
r1413ee2 r53765dd 1 1 $(document).ready(function() { 2 2 var business = {}; 3 4 getBusinessInfo().then(function (data) { 5 business = data; 6 }); 3 var serviceTypeList = {}; 4 5 getServiceTypes().then(function (serviceTypes) { 6 serviceTypeList = serviceTypes; 7 getBusinessInfo(serviceTypes).then(function (data) { 8 business = data; 9 }); 10 }); 11 12 7 13 8 14 getAppointments(); … … 71 77 72 78 updateServices(servicesObj).then(function (response) { 73 getBusinessInfo( ).then(function (data) {79 getBusinessInfo(serviceTypeList).then(function (data) { 74 80 business = data; 75 81 }); … … 78 84 if (servicesForDelete.length > 0) { 79 85 deleteServices(servicesForDelete).then(function (response) { 80 getBusinessInfo( ).then(function (data) {86 getBusinessInfo(serviceTypeList).then(function (data) { 81 87 business = data; 82 88 }); … … 101 107 102 108 updateBusinessInfo(businesses).then(function() { 103 getBusinessInfo( ).then(function (found) {109 getBusinessInfo(serviceTypeList).then(function (found) { 104 110 business = found; 105 111 }); … … 205 211 } 206 212 207 function getBusinessInfo() { 213 function getServiceTypes() { 214 return $.ajax({ 215 url: "http://localhost:8080/api/nomenclature/serviceTypes/me" 216 }).then(function (serviceTypes) { 217 return serviceTypes; 218 }); 219 } 220 221 function getBusinessInfo(serviceTypeList) { 208 222 return $.ajax({ 209 223 url: "http://localhost:8080/api/business/me" … … 231 245 var $el = $("#predefined_services_admin_panel"); 232 246 $el.empty(); 247 const existingServiceTypeIds = business['services'].map(service => service['serviceType']['id']); 248 const missingAddedServiceTypes = serviceTypeList.filter(serviceType => existingServiceTypeIds.indexOf(serviceType['id']) === -1); 249 //console.log(missingAddedServiceTypes); 233 250 234 251 $.each(business['services'], function (index, obj) { -
src/main/resources/static/js/customer_admin.js
r1413ee2 r53765dd 1 1 $(document).ready(function() { 2 3 getCustomerInfo(); 2 var customer = {}; 3 4 getCustomerInfo().then(function (customerData) { 5 customer = customerData; 6 }); 4 7 5 8 getFutureAppointments(); … … 70 73 71 74 function getCustomerInfo() { 72 $.ajax({75 return $.ajax({ 73 76 url: "http://localhost:8080/api/customer/me" 74 77 }).success(function (customer) { … … 82 85 $('#email').val(customer['email']); 83 86 $('#username').val(customer['username']); 87 return customer; 84 88 }).error(function (error) { 85 89 console.log(JSON.stringify(error)); -
src/main/resources/static/js/homepage.js
r1413ee2 r53765dd 59 59 60 60 $.ajax({ 61 url: "http://localhost:8080/api/nomenclature s/businessTypes"61 url: "http://localhost:8080/api/nomenclature/businessTypes" 62 62 }).then(function (data) { 63 63 businessTypes = data; … … 338 338 }).then(function (data) { 339 339 var $el = $("#reviewsModalBody"); 340 $('#reviews-ul').append($('< td class="form-outline mb-4"><button type="button" id="reviews-li" class="btn btn-primary btn-block" data-bs-toggle="modal" data-bs-target="#showReviewsModal">Checkout reviews</button></td>'));340 $('#reviews-ul').append($('<button type="button" id="reviews-li" class="btn btn-primary btn-block" data-bs-toggle="modal" data-bs-target="#showReviewsModal">Checkout reviews</button>')); 341 341 $el.empty(); 342 342 -
src/main/resources/static/js/register_business.js
r1413ee2 r53765dd 2 2 var enumerations = {}; 3 3 $.ajax({ 4 url: "http://localhost:8080/api/nomenclature s/businessTypes"4 url: "http://localhost:8080/api/nomenclature/businessTypes" 5 5 }).then(function (data) { 6 6 enumerations = data; 7 7 var $el = $("#companyType"); 8 //$el.empty(); // remove old options9 8 10 9 $.each(data, function (index, obj) { … … 103 102 }); 104 103 businessObj['services'] = servicesObj; 105 console.log(businessObj);106 104 $.ajax({ 107 105 url: "http://localhost:8080/api/business", … … 113 111 alert( "Well done! You have finished the registration process. " + 114 112 "Please check periodically to see if the company has been approved." ); 115 window.location.href = "/ homepage";113 window.location.href = "/login"; 116 114 }, 117 115 error: function(err) {
Note:
See TracChangeset
for help on using the changeset viewer.