Changeset 53765dd for src/main/resources/static/js/business_admin.js
- Timestamp:
- 01/04/24 09:07:47 (6 months ago)
- Branches:
- master
- Children:
- e8999eb
- Parents:
- 1413ee2
- File:
-
- 1 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) {
Note:
See TracChangeset
for help on using the changeset viewer.