{"id":1027,"date":"2015-11-30T15:53:51","date_gmt":"2015-11-30T13:53:51","guid":{"rendered":"https:\/\/www.karaver.com\/el\/?page_id=1027"},"modified":"2016-06-23T12:13:49","modified_gmt":"2016-06-23T09:13:49","slug":"order-form","status":"publish","type":"page","link":"https:\/\/www.karaver.com\/ro\/order-form\/","title":{"rendered":"Formular de Comand\u0103 en Gros"},"content":{"rendered":"<script>\n   window.products = '[]';\n   window.companies = '[]';\n   window.data      = '[]';\n   (function($){\n\t   $.fn.mobileFix = function (options) {\n\t\tvar $parent = $(this),\n\t\t$fixedElements = $(options.fixedElements);\n\t\n\t\t$(document)\n\t\t.on('focus', options.inputElements, function(e) {\n\t\t\t$parent.addClass(options.addClass);\n\t\t})\n\t\t.on('blur', options.inputElements, function(e) {\n\t\t\t$parent.removeClass(options.addClass);\n\t\n\t\t\t\/\/ Fix for some scenarios where you need to start scrolling\n\t\t\tsetTimeout(function() {\n\t\t\t\t$(document).scrollTop($(document).scrollTop())\n\t\t\t}, 1);\n\t\t});\n\t\n\t\treturn this; \/\/ Allowing chaining\n\t};\n\t   \n\t   \n   $(document).ready(function(){\t   \t   \n\t\t$(window).scroll(function(e){\n\t\t\tif($(window).scrollTop()>210){\n\t\t\t\t$('#fixed-header').addClass('fixed');\t\n\t\t\t}else{\n\t\t\t\t$('#fixed-header').removeClass('fixed');\n\t\t\t}\n\t\t});\n   });\n   \n   })(jQuery);\n   \t\n<\/script>\n<style>\n.krv-form tfoot tr:first-child td{\n\tborder-top:1px solid #ffe1b2 !important;\t\t\t\t\t\n}\n\n.krv-form tfoot tr:last-child td{\n\tborder-bottom:1px solid #ffe1b2 !important;\t\t\t\t\t\n}\n\n.krv-form tfoot tr td:last-child{\n\tborder-right:1px solid #ffe1b2 !important;\t\t\t\t\t\t\n}\n\n.krv-form tfoot td{\n\tborder-left:1px solid #ffe1b2 !important;\t\t\t\t\n\tborder-right:1px solid #ffe1b2 !important;\t\t\t\t\t\n}\n\n<\/style>\n<script>\n\nif(typeof $ == 'undefined'){\n\t$ = jQuery;\t\n}\n\n\nvar model = {\n\tcompanies: JSON.parse(window.companies),\n\tlang:'',\n\ttotalItems:'',\n\tajaxUrl:'',\n\tsaveAction:'',\n};\n\nwindow.initData = {\n\t\t\tsaveAction:'krv_submit',\n\t\t\tajaxUrl:'https:\/\/www.karaver.com\/wp-admin\/admin-ajax.php',\n\t\t\tisLoaded:false,\n\t\t\tisLoading:false,\t\t\t\n\t\t\tnotes:'',\n\t\t\tcolspan:8,\n\t\t\tcustomer:{\n\t\t\t\tcompany:{\n\t\t\t\t\tvalue:'',\n\t\t\t\t\tisValid:true,\n\t\t\t\t},\n\t\t\t\tstore:{\n\t\t\t\t\tvalue:'',\n\t\t\t\t\tisValid:true,\n\t\t\t\t},\n\t\t\t\tname:{\n\t\t\t\t\tvalue:'',\n\t\t\t\t\tisValid:true,\t\n\t\t\t\t},\n\t\t\t\temail:{\n\t\t\t\t\tvalue:'',\n\t\t\t\t\tisValid:true,\t\n\t\t\t\t},\n\t\t\t},\n\t\t\tediting:null,\n\t\t\tsubcompanies:[],\n\t\t\tproducts:JSON.parse(window.products),\n\t\t\titems: JSON.parse(window.data),\t\n\t\t\tisAreaDropDown:true,\t\t\n\t\t\ttotalItems:0};\n\nfunction progress(percent) {\n\t\t$element = jQuery('#progressBar');\n        var progressBarWidth = percent * $element.width() \/ 100;\n        $element.find('div').animate({ width: progressBarWidth }, 500).html(percent + \"% \");\n }\n\n<\/script>\n\n\n<div ng-app=\"krvForm\" ng-controller=\"MainController\" ng-init=\"loaded=false;\" id=\"krv-app\" style=\"padding-bottom:10px;width:100%;float:left;position:relative;min-height:400px;\">\n\t<div style=\"z-index:10000;position:absolute;top:0px;left:0px;width:100%;height:100%;background:#fff;text-align:center;\" ng-show=\"dataLoaded != true\">\n    \tLoading...\n    <\/div>\n\n\t\t\n\n\t<div style=\"display:none\">    \n        <div id=\"edit-notes\">\n            <h3 ng-if=\"data.editing != null\">Notes about <i>{{ data.editing.title }}<\/i><\/h3>    \n            <div class=\"notes-form\" ng-if=\"data.editing != null\">\n                <textarea ng-model=\"data.editing.notes\" placeholder = \"Enter your notes\"><\/textarea>\n                <div class=\"actions\">\n                    <a href=\"#\" id=\"save-notes-btn\" ng-click=\"$event.preventDefault();saveNote()\">Save & Close<\/a>\n                <\/div>   \n            <\/div>\t\n\t    <\/div>\n    <\/div>\n\n\t\n    \t<div class=\"failure\" ng-show=\"show_errors\">Please validate that you have correctly filled all required fields.<\/div>\n\t<div class=\"success\" ng-show=\"show_success\">Thank you for your order, it has been added to our system.<\/div>\n    \n    \n    \t<form id=\"ajax-form\" enctype=\"multipart\/form-data\" method = \"POST\" name=\"krvform\" novalidate ng-submit=\"$event.preventDefault();\" ng-class=\"{'isLoading':isLoading}\">\n    \n    \t<input type=\"hidden\" value=\"ro\" name=\"language\" \/>\n    \n    \t<div>\n    \n        <div v-show=\"dataLoaded == true\" id=\"fixed-header\">\n        \n         <div class=\"header-wrapper\">\n \n        \n       \n        <div class=\"promotions\">\n        <div class=\"promo-text\"><ul><li class=\"widget widget_text\">\t\t\t<div class=\"textwidget\">(GR) Offers you can order now!<\/div>\n\t\t<\/li><\/ul><\/div>\n                       \n          \n                       \n   \t \n\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"200\" height=\"214\" src=\"https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-73-200x214.png\" class=\"attachment-order size-order\" alt=\"\" srcset=\"https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-73-200x214.png 200w, https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-73-215x230.png 215w, https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-73-330x353.png 330w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/>\t  \t      \n\t\t                     \n                     \n                   \n   \t \n\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"200\" height=\"214\" src=\"https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-75-200x214.png\" class=\"attachment-order size-order\" alt=\"\" srcset=\"https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-75-200x214.png 200w, https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-75-215x230.png 215w, https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-75-330x353.png 330w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/>\t  \t      \n\t\t                     \n                     \n                   \n   \t \n\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"200\" height=\"214\" src=\"https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-77-200x214.png\" class=\"attachment-order size-order\" alt=\"\" srcset=\"https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-77-200x214.png 200w, https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-77-215x230.png 215w, https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-77-330x353.png 330w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/>\t  \t      \n\t\t                     \n                     \n                   \n   \t \n\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"200\" height=\"214\" src=\"https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-79-200x214.png\" class=\"attachment-order size-order\" alt=\"\" srcset=\"https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-79-200x214.png 200w, https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-79-215x230.png 215w, https:\/\/www.karaver.com\/wp-content\/uploads\/Website-size-all-togather-79-330x353.png 330w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/>\t  \t      \n\t\t                     \n                     \n                  \n                     \n        \t\t<\/div>\n        \n            <div class=\"info-box\">\n            <div class=\"krv-form-help\">For any question contact us at +30 210 8001710.<\/div>\n            <div id=\"progress-box\">\n\t\t\tComplete Percentage<br \/>\n            <div id=\"progressBar\" class =\"jquery-ui-like\"><div><\/div><\/div>\n            <\/div>\n            <\/div>            \n             <br class=\"clearfloat\" \/>\n            <\/div>       \n        <\/div>\t  \n    \n    <h3 class=\"form-step\">CUSTOMER DETAILS<\/h3>\n    \n    <div class=\"form-customer\">\n    \t<div class=\"form-row\">\n        \t<div class=\"form-left\">\n            \t<label for=\"company_title\">Company Title *<\/label>               \n                <select name = \"customer_company\" id = \"company_title\" ng-change=\"company_changed()\" ng-model=\"data.customer.company.value\" ng-class = \"{'error' : krvform.customer_company.$error.required && krvform.customer_company.$dirty}\" required>\n                \t<option value = \"\">Please select<\/option>\n                \t\t\t\t\t\t\n                    <option value=\"other\">Other<\/option>\n                <\/select>    \n             <\/div>\n             <div class=\"form-right\">   \n               \t<label for=\"company_store\">Store (Area) *<\/label>\n\t            <input type=\"text\" id = \"customer_store\" value = \"\" name = \"customer_store\" ng-if= \"data.customer.company.value == 'other'\" ng-model=\"data.customer.store.value\" ng-class = \"{'error' : krvform.customer_store.$error.required && krvform.customer_store.$dirty}\" required \/>\n                <select id =\"company_store\" name=\"customer_store\" ng-if=\"data.customer.company.value != 'other'\" ng-disabled=\"data.customer.company.value == ''\" ng-model=\"data.customer.store.value\" ng-class = \"{'error' : krvform.customer_store.$error.required && krvform.customer_store.$dirty}\" required>\n                  \t<option value = \"\">Please select<\/option>\n                    <option ng-repeat = \"company in data.subcompanies\" value = \"{{company.id}}\">{{company.name}}<\/option>\n                \t<option value=\"other\">Other<\/option>\n                <\/select>\n             <\/div>  \n           <\/div>\n        <div class=\"form-row\">  \n             <div class=\"form-left\">\n            \t<label for=\"customer_name\">Name *<\/label>\n\t            <input type=\"text\" id = \"customer_name\" value = \"\" name = \"customer_name\" required ng-model = \"data.customer.name.value\" ng-class = \"{'error' : krvform.customer_name.$error.required && krvform.customer_name.$dirty}\" \/>\n             <\/div>\n             <div class=\"form-right\">   \n             \t<label for=\"company_email\">Email<\/label>\n\t            <input type=\"email\" id = \"customer_email\" name = \"customer_email\"  ng-model = \"data.customer.email.value \" \n                \tng-class = \"{'error':krvform.customer_email.$invalid && krvform.customer_email.$dirty}\"\n                    placeholder=\"Fill in your email to receive a copy\"\n                \/>\n             <\/div>  \n\t\t<\/div>\n    <\/div>\n    \t<h3 class=\"form-step second\">COMPLETE THE FORM<\/h3>\t  \n\t\t\t<table id=\"krv-form\" cellpadding=\"0\" cellspacing=\"0\" krv-colspan-watch>         \n            \t<tbody ng-repeat = \"(itemindex, item) in data.items\">\n                \t<tr class=\"form-category\" ng-click=\"$event.preventDefault();item.isOpen = !item.isOpen;\">\n                \t\t<td class=\"form-category-name\" colspan=\"{{colspan-1}}\">\n                    \t\t<span class=\"title\">{{item.name}}:<\/span>{{item.description}}\n\t                    <\/td>\n    \t                <td class=\"show_toggle\"><span ng-class = \"{'opened':item.isOpen,'closed':!item.isOpen}\"><\/span><\/td>\n        \t        <\/tr>  \n                    <tr class=\"thead\" ng-show = \"item.isOpen\" data-group = \"{{'group-' + itemindex}}\">               \t\n                        <td class=\"image-column\" colspan=\"1\"><strong>Product<\/strong><\/td>\n                        <td class=\"name-column\"><strong>Product Description<\/strong><\/td>                \n                        <td class=\"barcode-column\"><strong>Barcode<\/strong> <br \/> Product Code<\/td>\n                        <td class=\"package-column\">Package<\/td>\n                        <td class=\"price-column\"> Price<\/td>\n                        <td class=\"price-column\"> Sale Price<\/td>                \n                        <td class=\"stock-column\"><strong>Stock<\/strong><\/td>\n                        <td class=\"order-column\"><strong>Order<\/strong><\/td>\n                <\/tr>\n                \n                <tr    \tng-repeat-start=\"(catindex,category) in item.children\"\n                class = \"subcategory-row group-{{catindex}}\" ng-if=\"catindex  > 0\" data-group = \"{{'group-' + itemindex\"}} ng-show = \"item.isOpen\">\n                    \t<td colspan=\"{{colspan}}\"><\/td>\n                <\/tr>  \n                \n\t\t\t\t<tr ng-show = \"item.isOpen\" data-group = \"{{'group-' + itemindex}}\" ng-repeat = \"product in category.products\" class=\"form-product\" ng-class=\"{ 'first': $first,'last': $last, 'last-row-category':catindex==item.children.length-1 && $last}\">                \t\n                <td class=\"image-column\" data-rel-group=\"gallery-{{product.id}}\" krv-gallery=\"{{product.images}}\">\n                        \t<a ng-href=\"{{product.raw_image}}\" ng-show = \"product.image != ''\" class = \"krv-colorbox-image gallery-image\" rel=\"gallery-{{product.id}}\">\n\t                            <img ng-src=\"{{product.image}}\" \/>\n                                <span class=\"magnifier\"><\/span>\n                            <\/a>\n                            \n                                             <\/td>     \n                                    \n                    <td class = \"name-column\">\n                        <span class=\"title\">{{product.title}}<\/span><br \/>\n                        <span class=\"subtitle\">{{product.subtitle}}<\/span>\n                    <\/td>   \n                    \n                    \n                    <td class=\"barcode-column\">\n                            <span class=\"barcode\" ng-bind-html=\" product.barcode \"><\/span><br \/>\n                            <span class=\"sku\">{{ product.sku }}<\/span>                    \n                     <\/td>   \n                     <td class=\"package-column\" ng-bind-html=\"product.package\">\n                     <\/td>    \t\n                     \n                     <td class=\"price-column\">\n                            {{product.price | currency:'\u20ac'}}\n                      <\/td>\n                        \n                      <td class=\"price-column\">\n                            {{product.sale | currency:'\u20ac'}}\n                      <\/td>\n                      \n                       <td class = \"stock-column\">\n                            <input type=\"number\" value = \"\" min = \"0\"  name = \"stock_values_{{product.id}}\" ng-model = \"product.stock\" ng-class = \"{error: krvform['stock_values_'+product.id].$error.required && krvform['stock_values_'+product.id].$dirty}\" ng-change = \"onStockChange(product)\" required \/>                    \t\t\n                        <\/td>\n                        \n                         <td class = \"order-column\">\n                            <input type=\"number\" value = \"0\" min = \"0\" krv-clear-field ng-model = \"product.order\" ng-change = \"onOrderChange(product)\" \/>                    \n   \t                        <a href=\"#\" class=\"notes-trigger\" ng-click=\"$event.preventDefault(); show_notes($index,product)\" title=\"Add notes about product\"><\/a>                                           \n                        <\/td>     \n                     \n                    <\/tr>\t\n\t                <tr class=\"tr-space\" ng-repeat-end \n                    \t\t\t\t\t ng-show = \"item.isOpen\" \n                                         data-group = \"{{'group-' + itemindex\"}}>\n                    \t<td colspan=\"{{colspan}}\">\n                    <\/tr>                    \t                \n                <\/tbody>      \n                <tfoot>\n        \t<tr>\n                <td colspan=\"{{colspan}}\" style=\"text-align:right;\">\n                   \t<span class=\"total-label\">Subtotal:<\/span><span class=\"price\">{{ subtotal | currency:'\u20ac'}}<\/span>\n                <\/td>\n            <\/tr>       \n            <tr>\n            \t<td colspan=\"{{colspan}}\" style=\"text-align:right;\">\n                \t<span class=\"total-label\">Discount:<\/span><span class=\"price\">{{ discount | currency:'\u20ac'}}<\/span>\n                <\/td>\n            <\/tr>      \n            <tr>\n            \t<td colspan=\"{{colspan}}\" style=\"text-align:right;\">\n                \t<span class=\"total-label\">Total:<\/span><span class=\"price\">{{ total | currency:'\u20ac'}}<\/span>\n                <\/td>\n            <\/tr>                  \n        <\/tfoot>      \n    <\/table>\n    <h3 class=\"form-step third\">UPLOAD IMAGE (<small><em>UPLOAD IMAGES FROM THE SHELF<\/em><\/small>)<span class=\"right\">OPTIONAL<\/span><\/h3>    \n    \n    <div class=\"form-item-files form-item-container\">    \n        <input type=\"file\" name=\"file1\" class = \"upload-file\"  ng-class = \"{'error'  : file1_error != ''}\" \/>\n        <input type=\"file\" name=\"file2\" class = \"upload-file\"  ng-class = \"{'error'  : file2_error != ''}\" \/>        \n        <input type=\"file\" name=\"file3\" class = \"upload-file\"  ng-class = \"{'error'  : file3_error != ''}\"  \/>                    \n        <input type=\"file\" name=\"file4\" class = \"upload-file\"  ng-class = \"{'error'  : file4_error != ''}\" \/>                \n        <input type=\"file\" name=\"file5\" class = \"upload-file\"  ng-class = \"{'error'  : file5_error != ''}\" \/>                \n        \n        <p><em>* Permitted file types <strong>jpg, png, gif<\/strong> and maximum size per file: <strong>1MB<\/strong><\/em><\/p>\n    <\/div>    \n\n    <h3 class=\"form-step fourth\" style=\"margin-top:20px;\">NOTES<span class=\"right\">OPTIONAL<\/span><\/h3>        \n    <div class=\"form-item-notes form-item-container\">\n    \t<textarea name = \"notes\" ng-model=\"data.notes\"> <\/textarea>\n    <\/div>\n    \n    <\/div>\n   \t<div id=\"item-form-footer\">\n        \t\n    \t<a href=\"https:\/\/www.karaver.com?krv_order_pdf=download\" target = \"_blank\">Download the order form as PDF<\/a>\n        <button type=\"submit\" ng-click=\"$event.preventDefault();submit()\">Submit<\/button>    \n    <\/div>         \n     <\/form>       \n<\/div>\n<script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/angularjs\/1.5.3\/angular.min.js\"><\/script>\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/angular.js\/1.5.3\/angular-sanitize.js\"><\/script>\n<script>\n\nvar Store = {\n\tcompanies: JSON.parse(window.companies),\t\n};\n\n\n\nvar module = angular.module('krvForm',['ngSanitize']);\n\n\nmodule.controller('MainController',['$scope','$window','$timeout',function($scope,$window,$timeout){\n\t$scope.loaded =false;\n\t$scope.message = 'Loaded';\n\t$scope.data = $window.initData;\n\t$scope.colspan = 8;\n\t$scope.subtotal = 0;\n\t$scope.discount =0;\n\t$scope.total = 0;\n\t$scope.percentage = 0;\n\t$scope.isLoading = false;\n\t$scope.show_errors = false;\n\t$scope.show_success = false;\n\t$scope.file1_error = '';\n\t$scope.file2_error = '';\t\n\t$scope.file3_error = '';\t\n\t$scope.file4_error = '';\t\n\t$scope.file5_error = '';\t\n\t\n\n\t\n\n\t$scope.dataLoaded = true;\n\t$scope.submit = function(){\n\n\t\tif(!$scope.krvform.$valid){\n\t\t\t\n\t\t\t$scope.show_errors = true;\t\n\t\t\t$scope.show_success = false;\n\t\t\tjQuery('html,body').animate({ scrollTop: 0 }, 'slow');\t\t\n\t\t\t$scope.isLoading = false;\t\t\t\n\t\t\t Object.keys($scope.krvform.$error).forEach(function (key) {\n            \t$scope.krvform.$error[key].forEach(function (control) {\n           \t   \t  control.$setDirty(); \/\/ no $setDirty function\n            \t});\n        \t});\n\t\t\t$scope.krvform.$setDirty();\t\n\t\t\t\n\t\t\treturn;\t\n\t\t}\t\t\n\t\t\n\t\t$scope.isLoading = true;\n\t\t\n\t\tjQuery('#ajax-form').ajaxSubmit({\n\t\t\t\tsuccess:function(resp){\t\t\t\t\t\n\t\t\t\t\tjQuery('html,body').animate({ scrollTop: 0 }, 'slow');\t\t\n\t\t\t\t\t$scope.$evalAsync(function(){\n\t\t\t\t\t\t$scope.show_success = true;\t\t\n\t\t\t\t\t\t$scope.show_errors = false;\t\n\t\t\t\t\t\t$scope.file1_error = '';\n\t\t\t\t\t\t$scope.file2_error = '';\t\t\t\t\t\t\n\t\t\t\t\t\t$scope.file3_error = '';\t\t\t\t\t\t\n\t\t\t\t\t\t$scope.file4_error = '';\t\t\t\t\t\t\n\t\t\t\t\t\t$scope.file5_error = '';\t\t\t\t\t\t\n\t\t\t\t\t\t$scope.isLoading   = false;\t\t\t\t\t\t\n\t\t\t\t\t\tclearForm();\n\t\t\t\t\t\t$scope.krvform.$setPristine();\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tbeforeSubmit:function(){\n\t\t\t\t\t\n\t\t\t\t},\n\t\t\t\terror:function(error){\t\n\t\t\t\t\tjQuery('html,body').animate({ scrollTop: 0 }, 'slow');\t\t\n\n\t\t\t\t\t$scope.$evalAsync(function(){\n\t\t\t\t\t\t$scope.show_errors = true;\t\t\t\n\t\t\t\t\t\t$scope.isLoading = false;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(error.responseJSON.errors){\n\t\t\t\t\t\t\tif(error.responseJSON.errors.file1){\n\t\t\t\t\t\t\t\t$scope.file1_error = error.responseJSON.errors.file1.message;\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(error.responseJSON.errors.file2){\n\t\t\t\t\t\t\t\t$scope.file2_error = error.responseJSON.errors.file2.message;\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(error.responseJSON.errors.file3){\n\t\t\t\t\t\t\t\t$scope.file3_error = error.responseJSON.errors.file3.message;\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(error.responseJSON.errors.file4){\n\t\t\t\t\t\t\t\t$scope.file4_error = error.responseJSON.errors.file4.message;\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(error.responseJSON.errors.file5){\n\t\t\t\t\t\t\t\t$scope.file5_error = error.responseJSON.errors.file5.message;\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t$scope.krvform.$setPristine();\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t},\n\t\t\t\tdata:{\n\t\t\t\t\taction:$scope.data.saveAction,\n\t\t\t\t\titems:$scope.data.items,\n\t\t\t\t},\n\t\t\t\turl:$scope.data.ajaxUrl,\n\t\t\t\ttype:'post',\n\t\t\t\tdataType:'json',\t\t\t\t\n\t\t\t});\t\t\n\n\t}\n\t\n\t$scope.company_changed = function(){\n\t\t$scope.data.customer.store.value = '';\n\t\tif($scope.data.customer.company.value == ''){\t\t\n\t\t\t$scope.data.subcompanies = [];\t\n\t\t}else{\n\t\t\tvar comp = Store.companies[$scope.data.customer.company.value];\t\t\t\n\t\t\t$scope.data.subcompanies = comp.children.map(function(c){\n\t\t\t\treturn c;\n\t\t\t});\n\t\t}\t\n\t}\n\t\n\t$scope.onStockChange = function(product){\t\t\n\t\t$scope.percentage = computePercent();\n\t\t$scope.subtotal = computeSubtotal();\t\n\t\tprogress($scope.percentage);\n\t\tupdateDiscount();\n\t\tupdateTotal();\n\t};\n\t\n\t$scope.onOrderChange = function(product){\n\t\t$scope.subtotal = computeSubtotal();\t\t\t\n\t\tupdateDiscount();\n\t\tupdateTotal();\n\t}\n\t\n\tfunction updateTotal(){\n\t\t$scope.total  =  ($scope.subtotal - $scope.discount).toFixed(2);\t\n\t}\n\t\n\tfunction updateDiscount(){\n\t\tif($scope.percentage == 100){\t\t\t\n\t\t\t$scope.discount =  ($scope.subtotal * 0.05).toFixed(2);\t\n\t\t\treturn $scope.discount;\n\t\t}\n\t\t$scope.discount = (0).toFixed(2);\t\n\t\treturn $scope.discount;\n\t}\n\t\n\t$scope.saveNote =function(){\n\t\tjQuery.colorbox.close();\n\t};\n\t\n\t$scope.show_notes = function(index, product){\n\t\t\n\t\t  $scope.data.editing = product;\t\t  \n\t\t\t\n\t\t  \t\n\t\t   $timeout(function(){\t  \n\t\t  jQuery.colorbox({\t\t\t\t\t\t\t\n\t\t\t\t\thref:'#edit-notes',\n\t\t\t\t\tinline:true,\n\t\t\t\t\treturnFocus:true,\t\t\t\t\t\t\n\t\t\t\t\twidth: jQuery('#ajax-form').width(),\n\t\t\t\t\tmaxWidth: jQuery('#ajax-form').width(),\t\t\t\t\t\n\t\t\t\t\tmaxHeight: \"600px\",\n\t\t\t\t    opacity: 0.8,\t\t\t\t\t\n\t\t\t\t\tfixed:true,\n\t\t\t\t\ttop:'40%',\n\t\t\t\t\tclassName:'notes-cbox',\t\t\t\t\t\n\t\t\t\t\ttransition: \"fade\",\n\t\t\t\t\t colorboxPreloading: true});\n\t\t\t\t\t \n\t\t   },200);\n\t\t  \n\t}\n\t\n\t\n\t function clearForm(){\n\t\t\n\t\t\tjQuery.each($scope.data.items, function(i,elem){\t\t\t\t\n\t\t\t\tjQuery.each(this.children,function(){\n\t\t\t\t\tjQuery.each(this.products, function(){\n\t\t\t\t\t\tthis.stock = '';\n\t\t\t\t\t\tthis.isValid = true;\n\t\t\t\t\t\tthis.order = 0;\n\t\t\t\t\t\tthis.notes = '';\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\t\t\t\t\t\t\n\t\t\t$scope.data.notes = '';\n\t\t\tjQuery('.upload-file').val('');\n\t\t\t$scope.total = 0;\n\t\t\t$scope.subtotal =0;\n\t\t\t$scope.discount = 0;\n\t\t\t$scope.percentage = 0;\n\t\t\tprogress($scope.percentage);\n\t\t\t\n\t\t\t$scope.data.customer = { \n\t\t\t    company:{\n\t\t\t\t\tvalue:'',\n\t\t\t\t\tisValid:true,\n\t\t\t\t},\n\t\t\t\tstore:{\n\t\t\t\t\tvalue:'',\n\t\t\t\t\tisValid:true,\n\t\t\t\t},\n\t\t\t\ttitle:{\n\t\t\t\t\tvalue:'',\n\t\t\t\t\tisValid:true,\n\t\t\t\t},\t\t\n\t\t\t\tphone:{\n\t\t\t\t\tvalue:'',\n\t\t\t\t\tisValid:true,\n\t\t\t\t},\n\t\t\t\tname:{\n\t\t\t\t\tvalue:'',\n\t\t\t\t\tisValid:true,\t\n\t\t\t\t},\n\t\t\t\temail:{\n\t\t\t\t\tvalue:'',\n\t\t\t\t\tisValid:true,\t\n\t\t\t\t},\n\t\t\t};\t\t\t\t\t\t\t\n\t};\n\t\n\tfunction computePercent(){\n\t\t\tvar items = $scope.data.items;\n\t\t\tvar process = 0;\n\t\t\tjQuery.each(items, function(i,elem){\t\t\t\t\n\t\t\t\tjQuery.each(this.children,function(){\n\t\t\t\t\tjQuery.each(this.products, function(){\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tif(this.stock === '' || this.stock === null || angular.isUndefined(this.stock)) return true;\t\t\t\t\t\t\n\t\t\t\t\t\tprocess++;\t\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\t\t\n\t\t\tvar p = Math.round( (process\/$scope.data.totalItems) * 100);\t\n\t\t\t\/\/progress(p);\n\t\t\treturn p;\t\t\n\t}\n\t\n\tfunction computeSubtotal(){\t\t\n\t\tvar total = 0;\n\t\tvar items = $scope.data.items;\n\t\tjQuery.each(items, function(i,elem){\t\t\t\t\n\t\t\tjQuery.each(this.children,function(){\n\t\t\t\tjQuery.each(this.products, function(){\n\t\t\t\t\ttotal += this.order * this.price;\n\t\t\t\t});\n\t\t\t});\n\t\t});\t\n\t\treturn (total).toFixed(2);\t\n\t}\n\t\n\t\/\/$scope.subtotal = 15;\n\t\/*function(){\n\t\treturn 15;\n\t\tvar total = 0;\n\t\tvar items = this.items;\n\t\tjQuery.each(items, function(i,elem){\t\t\t\t\n\t\t\tjQuery.each(this.children,function(){\n\t\t\t\tjQuery.each(this.products, function(){\n\t\t\t\t\ttotal += this.order * this.price;\n\t\t\t\t});\n\t\t\t});\n\t\t});\t\n\t\treturn (total).toFixed(2);\t\n\t}*\/\n\t\n\n\t\n\t\n\t\/*subTotal: function(){\n\t\t\tvar total = 0;\n\t\t\tvar items = this.items;\n\t\t\tjQuery.each(items, function(i,elem){\t\t\t\t\n\t\t\t\tjQuery.each(this.children,function(){\n\t\t\t\t\tjQuery.each(this.products, function(){\n\t\t\t\t\t\ttotal += this.order * this.price;\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\t\n\t\t\treturn (total).toFixed(2);\t\n\t\t},\n\t\tdiscount: function(){\n\t\t\tif(this.percentage == 100){\n\t\t\t\treturn (this.subTotal * 0.05).toFixed(2);\t\n\t\t\t}\n\t\t\treturn (0).toFixed(2);\n\t\t},\n\t\ttotal: function(){\n\t\t\treturn (this.subTotal - this.discount).toFixed(2);\t\n\t\t}*\/\n\t\n}]).directive('krvLoaded',function(){\n\treturn {\n\t\tlink: function(scope, element,attrs){\n\n\t\t\tsetTimeout(function(){\t\t\t\t\t\t\t\t\n\t\t\t\tjQuery(element).css({'display':'block'});\n\t\t\t},400);\n\t\t}\t\t\n\t};\n}).directive('krvColspanWatch', function(){\n\treturn {\n\t\tlink: function(scope, element, attrs){\n\t\t\tconsole.log('CheckSize');\n\t\t\tfunction checkSize(){\n\t\t\tconsole.log(window.innerWidth);\n\t\t\tif(window.innerWidth > 680){\t\t\t\t\n\t\t\t\tscope.$evalAsync(function(){\n\t\t\t\t\tscope.colspan = 8;\n\t\t\t\t});\n\t\t\t\t\n\t\t\t}else if(window.innerWidth > 500){\n\t\t\t\tscope.$evalAsync(function(){\n\t\t\t\t\tscope.colspan = 6;\n\t\t\t\t});\n\t\t\t}else if(window.innerWidth > 435){\n\t\t\t\tscope.$evalAsync(function(){\n\t\t\t\t\tscope.colspan = 5;\n\t\t\t\t});\n\t\t\t}else{\n\t\t\t\tscope.$evalAsync(function(){\n\t\t\t\t\tscope.colspan = 4;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t\n\t\tjQuery(window).resize(function(){\t\t\t\n\t\t\tcheckSize();\n\t\t});\t\t\t\t\n\t\tcheckSize();\t\n\t\t}\n\t};\n})\n\n.directive('krvClearField',function(){\n\treturn {\n\t\tlink: function(scope, element,attrs){\n\t\t\tvar defaultVal = element.val();\n\t\t\telement.bind(\"focus\", function(e) {\t\t\t\t\n        \t    if(element.val() == defaultVal) element.val('');\n\t        });\n\t\t}\n\t}\n})\n.directive('krvGallery',function(){\n\treturn{\n\t\tlink: function(scope, element,attrs){\t\t\t\n\t\t\tvar group= null;\t\t\t\n\t\t\tif(group = attrs['relGroup']){\t\t\t\t\n\t\t\t\t if(attrs['krvGallery'].length > 0){\n\t\t\t\t\t\tvar images = JSON.parse(attrs['krvGallery']);\n\t\t\t\t\t\tif(!angular.isArray(images)) return;\n\t\t\t\t\t\tangular.forEach(images,function(src,index){\n\t\t\t\t\t\t\t$(element).append(\"<a href='\"+src+\"' class='gallery-image' rel='\"+group+\"'><\/a>\");\n\t\t\t\t\t\t});\n\t\t\t\t }\t\t\t \n\t\t\t\t jQuery('.gallery-image',element)\n\t\t\t\t\t.colorbox({\n\t\t\t\t\t\t\treturnFocus:false,\n\t\t\t\t\t\t\tscalePhotos: true, \n\t\t\t\t\t\t\tmaxWidth: \"97%\",\n\t\t\t\t\t\t\tmaxHeight: \"97%\",\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransition: \"fade\", colorboxPreloading: true,rel:group});\t\n\t\t\t\t}\n\t\t}\n\t};\n});\n<\/script>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":15,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.karaver.com\/ro\/wp-json\/wp\/v2\/pages\/1027"}],"collection":[{"href":"https:\/\/www.karaver.com\/ro\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.karaver.com\/ro\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.karaver.com\/ro\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.karaver.com\/ro\/wp-json\/wp\/v2\/comments?post=1027"}],"version-history":[{"count":0,"href":"https:\/\/www.karaver.com\/ro\/wp-json\/wp\/v2\/pages\/1027\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.karaver.com\/ro\/wp-json\/wp\/v2\/media?parent=1027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}