{"id":70149,"date":"2025-04-09T11:52:21","date_gmt":"2025-04-09T09:52:21","guid":{"rendered":"https:\/\/staging3.dev.gibbs.no\/?page_id=70149"},"modified":"2025-05-01T15:55:03","modified_gmt":"2025-05-01T13:55:03","slug":"tilgodelapp","status":"publish","type":"page","link":"https:\/\/staging3.dev.gibbs.no\/en\/tilgodelapp\/","title":{"rendered":"Store credit"},"content":{"rendered":"<div class=\"gift_all_bookings\">\n    <div class=\"search-box\">\n        <i class=\"fas fa-search search-icon\"><\/i>\n        <input type=\"text\" id=\"search-email\" placeholder=\"S\u00f8k med e-post eller kode\" onkeyup=\"searchGiftCard()\">\n    <\/div>\n\n    <div id=\"noDataMessage\" style=\"display: none;\">\n        Ingen tilgodelapper funnet\n    <\/div>\n\n    <table id=\"refundVouchersTable\" class=\"display gift-card-table\" style=\"display:none;\">\n        <thead>\n            <tr>\n                <th>Code<\/th>\n                <th>Customer<\/th>\n                <th>Tilgodelapp bel\u00f8p<\/th>\n                <th>Balance<\/th>\n                <th>Refundert dato<\/th>\n                <th>Utl\u00f8psdato<\/th>\n                <th>Kansellerings\u00e5rsak<\/th>\n                <th>Actions<\/th>\n            <\/tr>\n        <\/thead>\n    <\/table>\n<\/div>\n\n<style>\n    table.dataTable.dtr-inline.collapsed > tbody > tr[role=\"row\"] > td:first-child::before {\n        font-family: \"Font Awesome 5 Free\";\n        content: \"\\f067\"; \/* Plus icon *\/\n        font-weight: 900;\n        margin-right: 10px;\n        color: #008474;\n    }\n\n    table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td:first-child::before {\n        content: \"\\f068\"; \/* Minus icon *\/\n    }\n    #refundVouchersTable_paginate a {\n        font-family: Source Sans Pro;\n        font-weight: bold;\n        border-radius: 5px;\n        padding: 2px 12px;\n        margin: 0px 1px;\n        color: #008474 !important;\n        text-decoration: none;\n    }\n    #refundVouchersTable_paginate, #refundVouchersTable_info {\n        margin-top: 30px;\n    }\n    \n    #refundVouchersTable_paginate a.active, #refundVouchersTable_paginate a.current, #refundVouchersTable_paginate a:hover {\n        border: 1px solid #008474 !important;\n        background-color: #585858;\n        background: linear-gradient(to bottom, #008474 0%, #008474 100%) !important;\n        color: #fff !important;\n    }\n    #refundVouchersTable_paginate .disabled{\n        display: none;\n    }\n    \n    \/* Styles for cancelled orders without vouchers *\/\n    .no-voucher {\n        display: inline-block;\n        padding: 3px 8px;\n        background-color: #f8f8f8;\n        border-left: 3px solid #888;\n        color: #888;\n        font-style: italic;\n    }\n    \n    .zero-amount {\n        color: #888;\n        font-style: italic;\n    }\n    \n    .not-applicable {\n        color: #888;\n        font-style: italic;\n    }\n    \n    .no-actions {\n        color: #888;\n        font-style: italic;\n    }\n    \n    \/* Highlighting the row for zero-amount cancellations *\/\n    table.dataTable tbody tr.zero-amount-row {\n        background-color: #f9f9f9;\n    }\n<\/style>\n\n<script type=\"text\/javascript\">\njQuery(document).ready(function($) {\n    console.log('Initializing refund vouchers table');\n    \/\/ Initialize DataTable\n    let vouchersTable = $('#refundVouchersTable').DataTable({\n        \"processing\": true,\n        \"serverSide\": true,\n        \"responsive\": true,\n        \"order\": [[4, \"desc\"]], \/\/ Standardsortering etter refundert dato (nyeste f\u00f8rst)\n        \"searching\": false, \/\/ Deaktiver standard s\u00f8keboks\n        \"lengthMenu\": [10, 25, 50, 100], \/\/ Alternativer for \"Vis oppf\u00f8ringer\" nedtrekksmeny\n        \"pageLength\": 10, \/\/ Standard antall oppf\u00f8ringer \u00e5 vise\n        \"lengthChange\": false, \/\/ Skjul \"oppf\u00f8ringer per side\" nedtrekksmeny\n        \"ajax\": {\n            \"url\": \"https:\/\/staging3.dev.gibbs.no\/wp-admin\/admin-ajax.php\",\n            \"type\": \"POST\",\n            \"data\": function(d) {\n                d.action = \"fetch_voucher_data\"; \/\/ Custom AJAX action\n                d.searchData = $('#search-email').val(); \/\/ Include search email in AJAX data\n                console.log('Sending AJAX request with data:', d);\n                return d;\n            },\n            \"dataSrc\": function(json) {\n                console.log('Received AJAX response:', json);\n                if (json.data.length > 0) {\n                    console.log('Data found, showing table');\n                    $(\".dataTables_length\").show();\n                    $('#refundVouchersTable_wrapper').show();\n                    $('#refundVouchersTable').show();\n                    $('#noDataMessage').hide();\n                } else {\n                    console.log('No data found, showing message');\n                    $(\".dataTables_length\").hide();\n                    $('#refundVouchersTable_wrapper').hide();\n                    $('#refundVouchersTable').hide();\n                    $('#noDataMessage').show();\n                }\n                return json.data;\n            },\n            \"error\": function(xhr, error, thrown) {\n                console.error('AJAX error:', error, thrown);\n            }\n        },\n        \"columns\": [\n            { \n                \"data\": \"code\",\n                \"render\": function(data, type, row) {\n                    if (data === 'N\/A') {\n                        return '<span class=\"no-voucher\">Ingen tilgodelapp<\/span>';\n                    }\n                    return '<span class=\"gift-card-code\">' + data + '<\/span>'; \n                }\n            },\n            { \"data\": \"purchased_by\" },\n            { \n                \"data\": \"purchased_amount\",\n                \"render\": function(data, type, row) {\n                    if (data === '0') {\n                        return '<span class=\"zero-amount\">Kr 0,-<\/span>';\n                    }\n                    return data;\n                }\n            },\n            { \n                \"data\": \"remaining_saldo\",\n                \"render\": function(data, type, row) {\n                    if (data === '0') {\n                        return '<span class=\"zero-amount\">Kr 0,-<\/span>';\n                    }\n                    return data;\n                }\n            },\n            { \"data\": \"purchased_date\" },\n            { \n                \"data\": \"expire_date\",\n                \"render\": function(data, type, row) {\n                    if (data === 'N\/A') {\n                        return '<span class=\"not-applicable\">Ikke relevant<\/span>';\n                    }\n                    return data;\n                }\n            },\n            { \n                \"data\": \"cancellation_reason\",\n                \"render\": function(data) {\n                    return data ? data : 'Ikke spesifisert';\n                }\n            },\n            { \n                \"data\": \"actions\",\n                \"defaultContent\": \"<button class='btn'>Ingen handlinger<\/button>\",\n                \"render\": function(data, type, row) {\n                    if (row.code === 'N\/A') {\n                        return '<span class=\"no-actions\">Ingen handlinger tilgjengelig<\/span>';\n                    }\n                    \n                    const pdfButton = '<button class=\"btn btn-pdf\" onclick=\"downloadPDF(\\'' + row.code + '\\')\">Last ned PDF<\/button>';\n                    if (row.show_actions) {\n                        const actionButton = row.is_active\n                            ? '<button class=\"btn btn-deactivate\" onclick=\"deactivateGiftCard(\\'' + row.id + '\\')\">Deaktiver<\/button>'\n                            : '<button class=\"btn btn-activate\" onclick=\"activateGiftCard(\\'' + row.id + '\\')\">Aktiver<\/button>';\n                        return pdfButton + ' ' + actionButton;\n                    } else {\n                        return pdfButton;\n                    }\n                }\n            }\n        ],\n        \"language\": {\n            \"processing\": \"Laster inn...\",\n            \"lengthMenu\": \"Vis _MENU_ oppf\u00f8ringer per side\",\n            \"zeroRecords\": \"Ingen tilgodelapper funnet \ud83d\ude0a\",\n            \"info\": \"_TOTAL_ tilgodelapper\",\n            \"infoEmpty\": \"Ingen oppf\u00f8ringer tilgjengelig\",\n            \"infoFiltered\": \"(_MAX_ totalt)\",\n            \"search\": \"S\u00f8k:\",\n            \"paginate\": {\n                \"next\": \"Neste\",\n                \"previous\": \"Forrige\"\n            },\n            \"emptyTable\": \"Ingen data tilgjengelig\",\n            \"loadingRecords\": \"Laster...\",\n            \"thousands\": \" \",\n            \"decimal\": \",\",\n            \"aria\": {\n                \"sortAscending\": \": aktiver for \u00e5 sortere kolonnen stigende\",\n                \"sortDescending\": \": aktiver for \u00e5 sortere kolonnen synkende\"\n            }\n        }\n    });\n\n    \/\/ Reload DataTable on search input change\n    window.searchGiftCard = function() {\n        vouchersTable.ajax.reload();\n    };\n\n    \/\/ Apply custom styling to pagination buttons after the table is initialized\n    vouchersTable.on('draw', function() {\n        \/\/ Fjern inline-stiler satt av DataTables\n        $('.dataTables_paginate .paginate_button').removeAttr('style');\n\n        \/\/ Bruk egendefinerte stiler\n        $('.dataTables_paginate .paginate_button').css({\n            'display': 'inline-block',\n            'padding': '8px 16px',\n            'margin': '0 5px',\n            'font-size': '14px',\n            'color': '#008474',\n            'background-color': 'transparent',\n            'border-radius': '20px',\n            'font-weight': 'bold',\n            'cursor': 'pointer',\n            'text-align': 'center'\n        });\n\n        \/\/ Stil for aktiv knapp\n        $('.dataTables_paginate .paginate_button.current').css({\n            'background-color': '#008474',\n            'color': '#fff',\n            'pointer-events': 'none'\n        });\n\n        \/\/ Hover-effekt\n        $('.dataTables_paginate .paginate_button').hover(\n            function() {\n                $(this).css({\n                    'background-color': '#006b5c',\n                    'color': '#fff'\n                });\n            },\n            function() {\n                if (!$(this).hasClass('current')) {\n                    $(this).css({\n                        'background-color': 'transparent',\n                        'color': '#008474'\n                    });\n                }\n            }\n        );\n        \n        \/\/ Mark zero-amount cancellation rows\n        $('#refundVouchersTable tbody tr').each(function() {\n            var $row = $(this);\n            var codeCell = $row.find('td:first-child');\n            \n            if (codeCell.find('.no-voucher').length > 0) {\n                $row.addClass('zero-amount-row');\n            }\n        });\n    });\n});\n\n\/\/ Function to download PDF\nfunction downloadPDF(giftcode) {\n    const form = jQuery(\"<form>\", {\n        action: 'https:\/\/staging3.dev.gibbs.no\/wp-admin\/admin-ajax.php',\n        method: \"POST\"\n    });\n    form.append(jQuery(\"<input>\", { type: \"hidden\", name: \"action\", value: \"downloadVoucherPDF\" }));\n    form.append(jQuery(\"<input>\", { type: \"hidden\", name: \"refund_code\", value: giftcode }));\n    jQuery(\"body\").append(form);\n    form.submit();\n    form.remove(); \/\/ Clean up\n}\n\n\/\/ Function to deactivate a gift card\nfunction deactivateGiftCard(postId) {\n    jQuery.post('https:\/\/staging3.dev.gibbs.no\/wp-admin\/admin-ajax.php', {\n        action: 'deactivate_giftcard',\n        post_id: postId\n    }, function(response) {\n        jQuery('#refundVouchersTable').DataTable().ajax.reload(null, false);\n    });\n}\n\n\/\/ Function to activate a gift card\nfunction activateGiftCard(postId) {\n    jQuery.post('https:\/\/staging3.dev.gibbs.no\/wp-admin\/admin-ajax.php', {\n        action: 'activate_giftcard',\n        post_id: postId\n    }, function(response) {\n        jQuery('#refundVouchersTable').DataTable().ajax.reload(null, false);\n    });\n}\n<\/script>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"_uag_custom_page_level_css":"","footnotes":""},"class_list":["post-70149","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Tilgodelapp - Gibbs.no - Bookingsystem<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/staging3.dev.gibbs.no\/en\/tilgodelapp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tilgodelapp - Gibbs.no - Bookingsystem\" \/>\n<meta property=\"og:url\" content=\"https:\/\/staging3.dev.gibbs.no\/en\/tilgodelapp\/\" \/>\n<meta property=\"og:site_name\" content=\"Gibbs.no - Bookingsystem\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GibbsNorge\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-01T13:55:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/staging3.dev.gibbs.no\/wp-content\/uploads\/2023\/10\/Gibbs-Bookingsystem.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/staging3.dev.gibbs.no\/tilgodelapp\/\",\"url\":\"https:\/\/staging3.dev.gibbs.no\/tilgodelapp\/\",\"name\":\"Tilgodelapp - Gibbs.no - Bookingsystem\",\"isPartOf\":{\"@id\":\"https:\/\/staging3.dev.gibbs.no\/#website\"},\"datePublished\":\"2025-04-09T09:52:21+00:00\",\"dateModified\":\"2025-05-01T13:55:03+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/staging3.dev.gibbs.no\/tilgodelapp\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/staging3.dev.gibbs.no\/tilgodelapp\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/staging3.dev.gibbs.no\/tilgodelapp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/staging3.dev.gibbs.no\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tilgodelapp\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/staging3.dev.gibbs.no\/#website\",\"url\":\"https:\/\/staging3.dev.gibbs.no\/\",\"name\":\"Gibbs.no\",\"description\":\"Bookingsystem - 1.Book 2.Betal 3.\u00c5pne\",\"publisher\":{\"@id\":\"https:\/\/staging3.dev.gibbs.no\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/staging3.dev.gibbs.no\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/staging3.dev.gibbs.no\/#organization\",\"name\":\"Gibbs AS\",\"url\":\"https:\/\/staging3.dev.gibbs.no\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/staging3.dev.gibbs.no\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.gibbs.no\/wp-content\/uploads\/2023\/11\/Gibbs-bookingsystem-logo.png\",\"contentUrl\":\"https:\/\/www.gibbs.no\/wp-content\/uploads\/2023\/11\/Gibbs-bookingsystem-logo.png\",\"width\":696,\"height\":696,\"caption\":\"Gibbs AS\"},\"image\":{\"@id\":\"https:\/\/staging3.dev.gibbs.no\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/GibbsNorge\",\"https:\/\/www.linkedin.com\/company\/gibbsnorge\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tilgodelapp - Gibbs.no - Bookingsystem","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/staging3.dev.gibbs.no\/en\/tilgodelapp\/","og_locale":"en_US","og_type":"article","og_title":"Tilgodelapp - Gibbs.no - Bookingsystem","og_url":"https:\/\/staging3.dev.gibbs.no\/en\/tilgodelapp\/","og_site_name":"Gibbs.no - Bookingsystem","article_publisher":"https:\/\/www.facebook.com\/GibbsNorge","article_modified_time":"2025-05-01T13:55:03+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/staging3.dev.gibbs.no\/wp-content\/uploads\/2023\/10\/Gibbs-Bookingsystem.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/staging3.dev.gibbs.no\/tilgodelapp\/","url":"https:\/\/staging3.dev.gibbs.no\/tilgodelapp\/","name":"Tilgodelapp - Gibbs.no - Bookingsystem","isPartOf":{"@id":"https:\/\/staging3.dev.gibbs.no\/#website"},"datePublished":"2025-04-09T09:52:21+00:00","dateModified":"2025-05-01T13:55:03+00:00","breadcrumb":{"@id":"https:\/\/staging3.dev.gibbs.no\/tilgodelapp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/staging3.dev.gibbs.no\/tilgodelapp\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/staging3.dev.gibbs.no\/tilgodelapp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/staging3.dev.gibbs.no\/"},{"@type":"ListItem","position":2,"name":"Tilgodelapp"}]},{"@type":"WebSite","@id":"https:\/\/staging3.dev.gibbs.no\/#website","url":"https:\/\/staging3.dev.gibbs.no\/","name":"Gibbs.no","description":"Bookingsystem - 1.Book 2.Betal 3.\u00c5pne","publisher":{"@id":"https:\/\/staging3.dev.gibbs.no\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/staging3.dev.gibbs.no\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/staging3.dev.gibbs.no\/#organization","name":"Gibbs AS","url":"https:\/\/staging3.dev.gibbs.no\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/staging3.dev.gibbs.no\/#\/schema\/logo\/image\/","url":"https:\/\/www.gibbs.no\/wp-content\/uploads\/2023\/11\/Gibbs-bookingsystem-logo.png","contentUrl":"https:\/\/www.gibbs.no\/wp-content\/uploads\/2023\/11\/Gibbs-bookingsystem-logo.png","width":696,"height":696,"caption":"Gibbs AS"},"image":{"@id":"https:\/\/staging3.dev.gibbs.no\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GibbsNorge","https:\/\/www.linkedin.com\/company\/gibbsnorge"]}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"trp-custom-language-flag":false,"post-thumbnail":false,"listeo-avatar":false,"listeo-blog-post":false,"listeo-blog-related-post":false,"listeo-post-thumb":false,"listeo-gallery":false,"listeo-listing-grid":false,"listeo_core-avatar":false,"listeo_core-preview":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false},"uagb_author_info":{"display_name":"K Gibbs","author_link":"https:\/\/staging3.dev.gibbs.no\/en\/author\/kamil-gryga94gmail-com\/"},"uagb_comment_info":0,"uagb_excerpt":null,"_links":{"self":[{"href":"https:\/\/staging3.dev.gibbs.no\/en\/wp-json\/wp\/v2\/pages\/70149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/staging3.dev.gibbs.no\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/staging3.dev.gibbs.no\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/staging3.dev.gibbs.no\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/staging3.dev.gibbs.no\/en\/wp-json\/wp\/v2\/comments?post=70149"}],"version-history":[{"count":4,"href":"https:\/\/staging3.dev.gibbs.no\/en\/wp-json\/wp\/v2\/pages\/70149\/revisions"}],"predecessor-version":[{"id":73115,"href":"https:\/\/staging3.dev.gibbs.no\/en\/wp-json\/wp\/v2\/pages\/70149\/revisions\/73115"}],"wp:attachment":[{"href":"https:\/\/staging3.dev.gibbs.no\/en\/wp-json\/wp\/v2\/media?parent=70149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}