Changeset 53765dd for src/main/resources


Ignore:
Timestamp:
01/04/24 09:07:47 (6 months ago)
Author:
gjoko kostadinov <gjokokostadinov@…>
Branches:
master
Children:
e8999eb
Parents:
1413ee2
Message:

Fix bugs.

Location:
src/main/resources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/main/resources/data.sql

    r1413ee2 r53765dd  
    1313       (nextval('hibernate_sequence'), current_timestamp, current_timestamp, 'waxing', 6),
    1414       (nextval('hibernate_sequence'), current_timestamp, current_timestamp, 'nail extensions', 2),
    15        (nextval('hibernate_sequence'), current_timestamp, current_timestamp, 'dress shortening', 1),
    16        (nextval('hibernate_sequence'), current_timestamp, current_timestamp, 'holes fixing', 1);
     15       (nextval('hibernate_sequence'), current_timestamp, current_timestamp, 'dress sewing', 1),
     16       (nextval('hibernate_sequence'), current_timestamp, current_timestamp, 'pants shortening', 1);
    1717
    1818insert into stakeholder (id, created, phone_number, email, first_name, last_name, modified, password, stakeholder_type, username)
  • src/main/resources/static/js/business_admin.js

    r1413ee2 r53765dd  
    11$(document).ready(function() {
    22    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
    713
    814    getAppointments();
     
    7177
    7278        updateServices(servicesObj).then(function (response) {
    73             getBusinessInfo().then(function (data) {
     79            getBusinessInfo(serviceTypeList).then(function (data) {
    7480                business = data;
    7581            });
     
    7884        if (servicesForDelete.length > 0) {
    7985            deleteServices(servicesForDelete).then(function (response) {
    80                 getBusinessInfo().then(function (data) {
     86                getBusinessInfo(serviceTypeList).then(function (data) {
    8187                    business = data;
    8288                });
     
    101107
    102108        updateBusinessInfo(businesses).then(function() {
    103             getBusinessInfo().then(function (found) {
     109            getBusinessInfo(serviceTypeList).then(function (found) {
    104110                business = found;
    105111            });
     
    205211}
    206212
    207 function getBusinessInfo() {
     213function getServiceTypes() {
     214    return $.ajax({
     215        url: "http://localhost:8080/api/nomenclature/serviceTypes/me"
     216    }).then(function (serviceTypes) {
     217        return serviceTypes;
     218    });
     219}
     220
     221function getBusinessInfo(serviceTypeList) {
    208222    return $.ajax({
    209223        url: "http://localhost:8080/api/business/me"
     
    231245        var $el = $("#predefined_services_admin_panel");
    232246        $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);
    233250
    234251        $.each(business['services'], function (index, obj) {
  • src/main/resources/static/js/customer_admin.js

    r1413ee2 r53765dd  
    11$(document).ready(function() {
    2 
    3     getCustomerInfo();
     2    var customer = {};
     3
     4    getCustomerInfo().then(function (customerData) {
     5        customer = customerData;
     6    });
    47
    58    getFutureAppointments();
     
    7073
    7174function getCustomerInfo() {
    72     $.ajax({
     75    return $.ajax({
    7376        url: "http://localhost:8080/api/customer/me"
    7477    }).success(function (customer) {
     
    8285        $('#email').val(customer['email']);
    8386        $('#username').val(customer['username']);
     87        return customer;
    8488    }).error(function (error) {
    8589        console.log(JSON.stringify(error));
  • src/main/resources/static/js/homepage.js

    r1413ee2 r53765dd  
    5959
    6060    $.ajax({
    61         url: "http://localhost:8080/api/nomenclatures/businessTypes"
     61        url: "http://localhost:8080/api/nomenclature/businessTypes"
    6262    }).then(function (data) {
    6363        businessTypes = data;
     
    338338    }).then(function (data) {
    339339        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>'));
    341341        $el.empty();
    342342
  • src/main/resources/static/js/register_business.js

    r1413ee2 r53765dd  
    22    var enumerations = {};
    33    $.ajax({
    4         url: "http://localhost:8080/api/nomenclatures/businessTypes"
     4        url: "http://localhost:8080/api/nomenclature/businessTypes"
    55    }).then(function (data) {
    66        enumerations = data;
    77        var $el = $("#companyType");
    8         //$el.empty(); // remove old options
    98
    109        $.each(data, function (index, obj) {
     
    103102        });
    104103        businessObj['services'] = servicesObj;
    105         console.log(businessObj);
    106104        $.ajax({
    107105            url: "http://localhost:8080/api/business",
     
    113111                alert( "Well done! You have finished the registration process. " +
    114112                    "Please check periodically to see if the company has been approved." );
    115                 window.location.href = "/homepage";
     113                window.location.href = "/login";
    116114            },
    117115            error: function(err) {
Note: See TracChangeset for help on using the changeset viewer.