Path : /var/www/html/jewelry-pos/storage/framework/views/ |
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
Current File : /var/www/html/jewelry-pos/storage/framework/views/2560784954dd3ead4d69fee5bffb7d2a.php |
<?php $__env->startSection('content'); ?> <style> th{ font-weight: bold !important; } </style> <div class="col-lg-12 ab" style="width: 100%;position: relative;"> <div class="" style="position:absolute;top:0;width: 100%;margin:auto"> <main id="js-page-content" role="main" class="page-content mt-2" style="width: 100%;position: absolute;top:0;"> <div class="row"> <div class="col-sm-9 col-xl-9"> <div class="row" style="display: flex;justify-content: start;align-items: center"> <div class="col-sm-2 col-xl-2 mt-2"> <a class="btn btn-sm shadow-lg" href="<?php echo e(route('home')); ?>" style="color: whitesmoke !important;background-color: #0e2060;"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-bar-left" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="M12.5 15a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5M10 8a.5.5 0 0 1-.5.5H3.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L3.707 7.5H9.5a.5.5 0 0 1 .5.5"/> </svg> <?php echo e(__('message.back')); ?> </a> </div> <div class="col-sm-3 col-xl-3 text-primary mt-2" style="font-weight: bold;"> <?php $__currentLoopData = $currencies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $currency): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $rate[$currency->name] = $currency->exchange_out_rate; ?> <div class="row-sm-3row-xl-1"> <label class="pr-2 shadow-lg">1<?php echo e($currency->name); ?> =</label> <label class="shadow-lg"><?php echo e(number_format($currency->exchange_out_rate, 2)); ?> <?php echo e($currency_->name); ?></label> </div> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </div> <div class="col-sm-5 col-xl-5" style="display: block;justify-content: center;align-items: center;position: relative;width: 100%;"> <input type="text" placeholder="<?php echo e(__('message.search')); ?>" id="input" class="p-2 form-control shadow-2 ui-autocomplete" style="width: 100%;" onchange="changeAutoComplete()" autofocus name="q" value=""> <div class="dropdown card p-2 rounded" hidden="hidden" style="list-style-type: none;z-index: 100000000000000;position: absolute;width: 95%;"> </div> </div> </div> <?php echo $__env->make('pointToSale.discount-modal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> <div class="row"> <div class="col-sm-12 col-xl-12 card-body"> <main id="js-page-content" role="main" class="page-content"> <div class="panel-container show"> <div class="d-flex flex-column h-100"> <div class="h-auto"> <table id="example" class="table table-bordered table-hover table-striped w-100 shadow-sm" style="font-size: 14px"> <thead class="text-center" id="head_table"> <tr> <th> <input type="checkbox"> </th> <th><?php echo e(__('message.item')); ?></th> <th><?php echo e(__('message.qty')); ?></th> <th><?php echo e(__('message.weight')); ?></th> <th><?php echo e(__('message.wages')); ?> <span id="scale"></span> </th> <th><?php echo e(__('message.discount')); ?></th> <th><?php echo e(__('message.diamond size')); ?></th> <th><?php echo e(__('message.description')); ?></th> <th><?php echo e(__('message.unit price')); ?></th> <th><?php echo e(__('message.modify')); ?></th> </tr> </thead> <tbody class="text-center" id="table-product"> </tbody> </table> <!-- datatable end --> </div> </div> </div> </main> </div> </div> </div> <div class="col-sm-3 col-xl-3" style="padding-right: 50px"> <div class="row"> <div class="col-sm-12 col-xl-12"> <h1 class="btn btn-danger shadow-lg" style="width: 100%"><?php echo e(__('message.scan invoice')); ?></h1> <input type="text" placeholder="<?php echo e(__('message.scan')); ?>" id="scan" onkeyup="autoPrint()" class="p-2 form-control shadow-lg shadow-2 ui-autocomplete" style="width: 100%;" onload="" autofocus onchange="scan();" name="scan" value=""> <div class="" id="scanBars" tabindex="-1" style="list-style-type: none;width: 100%;"> <ul id="scanBar" class="ui-menu" style="text-align:center;z-index:9999;cursor: pointer;position: fixed;background-color: white !important;width:10%;box-shadow: 5px 5px 5px gray;border-radius: 8px;"></ul> </div> </div> <div class="col-md-12 col-sm-12 col-xl-12"> <div class="mt-4 text-center" style="margin: auto;width: 100%;"> <form method="POST" enctype="multipart/form-data" id="upload_image"> <label id="btnHoverClass" class="btnhover text-center " style="cursor: pointer;width: 100%;height: 100%;"> <img size="50" src="<?php echo e(!empty('') ? asset('') : asset('no_image.png')); ?>" id="framefav" class="card-img-top" alt="" style="width:100%"> <input type="file" size="50" style="display: none;width:100%;" name="image" id="formFile" onchange="previewfav()" placeholder="<?php echo e(__('message.image')); ?>" accept=".png,.jpg,.jpeg"> <input type="submit" hidden="hidden" id="btnSubmitImage"> </label> </form> </div> </div> </div> </div> </div> </main> </div> <div class="row" style="width: 98%;position: fixed;bottom: 0;margin: auto"> <div class="col-sm-12 col-xl-12"> <div class="row"> <div style="width: 80%;display: flex;justify-content: right;align-items: center" class=""> <div class="row mb-3 mt-2" style="width: 45%; font-weight: bold;font-size: 15px;"> <div class="col-sm-12 col-xl-12 text-primary rounded"> <div class="row p-2"> <div class="col-sm-6 col-xl-3 text-left"> <?php echo e(__('message.total')); ?> </div> <div class="col-sm-2 col-xl-2 text-left "> : </div> <div class="col-sm-4 col-xl-3" id="total_price"> $ 00.00 </div> </div> <div class="row p-2"> <div class="col-sm-6 col-xl-3 text-left" id='discount'> <span class=""> <?php echo e(__('message.discount($)')); ?> </span> </div> <div class="col-sm-2 col-xl-2"> : </div> <div class="col-sm-4 col-xl-3" id="discount_price"> $ 00.00 </div> <input type="hidden" id="discountPrice" value="0"> </div> <div class="row p-2"> <div class="col-sm-6 col-xl-3 text-left"> <?php echo e(__('message.grand total')); ?> </div> <div class="col-sm-2 col-xl-2"> : </div> <div class="col-sm-4 col-xl-3" data-price=""id="total_grand"> $ 00.00 </div> </div> </div> </div> </div> </div> </div> <div class="col-sm-12 col-xl-12" style="margin: auto"> <div class="row"> <div class="" style="width: 100%;"> <div class="row"> <div class="col-sm-3 col-xl-3"> <a class="shadow-lg" data-toggle="modal" data-target="#discount_modal" id="btn_discount"> <div class="p-1 rounded overflow-hidden position-relative text-white mb-g text-center" id="info_hover" style="cursor: pointer;"> <label class="pt-3" style="cursor: pointer"> <i style="font-size: 25px;padding-bottom: 10px" class="fal fa-dollar-sign"></i> <div class="text-light" style="font-size: 13px;"> <label style="cursor: pointer"> <?php echo e(__('message.discount')); ?> </label> </div> </label> </div> </a> </div> <div class="col-sm-3 col-xl-3"> <a href="#" class="" id="delete-btn" onclick="delete_data()"> <div class="p-1 rounded overflow-hidden position-relative text-white mb-g text-center" id="info_hover" style="cursor: pointer;"> <label class="pt-3" style="cursor: pointer"> <i style="font-size: 25px;padding-bottom: 10px" class="fal fa-trash"></i> <div class="text-light" style="font-size: 13px;"> <label style="cursor: pointer"> <?php echo e(__('message.deletes')); ?> </label> </div> </label> </div> </a> </div> <div class="col-sm-3 col-xl-3"> <a id="print" class=""> <div class="p-1 rounded overflow-hidden position-relative text-white mb-g text-center" id="info_hover" style="cursor: pointer;"> <label class="pt-3" style="cursor: pointer"> <i style="font-size: 25px;padding-bottom: 10px" class="fal fa-print" id="icon"></i> <div class="text-light" style="font-size: 13px;"> <label style="cursor: pointer"> <?php echo e(__('message.invoice')); ?> </label> </div> </label> </div> </a> </div> <div class="col-sm-3 col-xl-3"> <!-- Button trigger modal --> <a href="#" class="text-white fw-bold" class="btn btn-primary" data-toggle="modal" data-target=".bd-example-modal-lg" id="btn_pay"> <div class="p-1 rounded overflow-hidden position-relative text-white mb-g text-center" id="info_hover" style="cursor: pointer;"> <label class="pt-3" style="cursor: pointer"> <i style="font-size: 25px;padding-bottom: 10px" class="fal fa-sack-dollar"></i> <div class="text-light text-white fw-bold" style="font-size: 13px;"> <label style="cursor: pointer"> <?php echo e(__('message.pay')); ?> </label> </div> </label> </div> </a> </div> </div> </div> </div> </div> </div> </div> <div aria-live="polite" aria-atomic="true" style="position: absolute;width: 30%;bottom: 220px;right: 20px;"> <div class="toast 3s error" id="errorMessage" style="position: absolute; top: 0; right: 0;"> <div class="toast-header"> <img src="<?php echo e(asset('errorIcon.png')); ?>" style="width: 40px;" class="rounded mr-2" alt="..."> <strong class="mr-auto" style="color: red;font-weight: bold"><?php echo e(__('message.error')); ?></strong> <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="toast-body" style="color: whitesmoke ;background-color: rgba(255,0,0,0.83);"> <?php echo e(__('message.search not found')); ?> </div> </div> </div> <?php echo $__env->make('pointToSale.modalPay', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> <?php echo $__env->make('pointToSale.modalSetting', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> <!-- Flexbox container for aligning the toasts --> <div aria-live="polite" aria-atomic="true" style="position: absolute;width: 30%;bottom: 250px;right: 20px;"> <div id="message" class="toast 3s message" style="position: absolute; top: 0; right: 0;height: 80px"> <div class="toast-header"> <i class="fal fa-comment" style="color: red;font-weight: bold;font-size: 20px;margin-right: 10px"></i> <strong class="mr-auto" style="color: red;font-weight: bold"><?php echo e(__('message.message')); ?></strong> <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="toast-body" style="color: whitesmoke ;background-color: rgba(255,0,0,0.83);"> <?php echo e(__('message.your item is empty')); ?> </div> </div> </div> <div aria-live="polite" aria-atomic="true" style="position: absolute;width: 30%;bottom: 250px;right: 20px;"> <div id="err" class="toast 3s err" style="position: absolute; top: 0; right: 0;height: 80px"> <div class="toast-header"> <i class="fal fa-comment" style="color: red;font-weight: bold;font-size: 20px;margin-right: 10px"></i> <strong class="mr-auto" style="color: red;font-weight: bold"><?php echo e(__('message.message')); ?></strong> <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="toast-body" style="color: whitesmoke ;background-color: rgba(255,0,0,0.83);"> <?php echo e(__('message.your item is empty')); ?> </div> </div> </div> <div aria-live="polite" aria-atomic="true" style="position: absolute;width: 30%;bottom: 250px;right: 20px;"> <div id="scan" class="toast 3s scan" style="position: absolute; top: 0; right: 0;height: 80px"> <div class="toast-header"> <i class="fal fa-comment" style="color: red;font-weight: bold;font-size: 20px;margin-right: 10px"></i> <strong class="mr-auto" style="color: red;font-weight: bold"><?php echo e(__('message.message')); ?></strong> <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="toast-body" style="color: whitesmoke ;background-color: rgba(255,0,0,0.83);"> <?php echo e(__('message.barcode not found')); ?> </div> </div> </div> <div aria-live="polite" aria-atomic="true" style="position: absolute;width: 30%;bottom: 250px;right: 20px;"> <div id="already_buy_back" class="toast 3s already_buy_back" style="position: absolute; top: 0; right: 0;height: 80px"> <div class="toast-header"> <i class="fal fa-comment" style="color: red;font-weight: bold;font-size: 20px;margin-right: 10px"></i> <strong class="mr-auto" style="color: red;font-weight: bold"><?php echo e(__('message.message')); ?></strong> <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="toast-body" style="color: whitesmoke ;background-color: rgba(255,0,0,0.83);"> <?php echo e(__('message.this invoice buy back already')); ?> </div> </div> </div> <div class="modal fade bd-example-modal-lg-form" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" style="z-index: 1000 !important;backdrop-filter: brightness(0.5); "> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="row m-0 text-center" style="height: 40px"> <div class="col-xs-12 col-md-12 col-xl-12 bg-info text-center"> <header class="text-center mt-2" style="font-weight: bold;font-size: 18px;color: whitesmoke"><?php echo e(__('message.form modify')); ?></header> </div> </div> <div class="content m-4 " style="font-size: 15px;font-family: 'Khmer OS Siemreap';"> <div class="row"> <div class="mt-2 col-xs-3 col-md-3 col-xl-3"> <?php echo e(__('message.weight')); ?> : </div> <div class="col-xs-9 col-md-9 col-xl-9 mb-2"> <input type="text" pattern="^[0-9]*$" id="modify_weight" name="modify_weight" class="form-control" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');" placeholder="<?php echo e(__('message.enter weight')); ?>"> </div> </div> <div class="row"> <div class="mt-2 col-xs-3 col-md-3 col-xl-3 mb-2"> <?php echo e(__('message.cut weight')); ?> : </div> <div class="col-xs-9 col-md-9 col-xl-9 mb-2"> <input type="checkbox" id="cut_weight" name="cut_weight" onchange="getValue(this)" style="width: 20px;height: 100%"/> </div> </div> <div class="row" id="feesElement"> <div class="mt-2 col-xs-3 col-md-3 col-xl-3"> <?php echo e(__('message.wages')); ?> <span id="scale1"></span> : </div> <div class="col-xs-9 col-md-9 col-xl-9 mb-2"> <input type="text" pattern="^[0-9]*$" id="modify_wages" name="modify_wages" class="form-control" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');" placeholder="<?php echo e(__('message.enter wages')); ?>"> </div> </div> <?php $rate_in = \App\Models\Currency::selectRaw('exchange_in_rate , name,exchange_out_rate')->get(); $khr = clone $rate_in; $khrs = $khr->where('name' , 'KHR')->firstOrfail(); $thb = clone $rate_in; $thbs = $thb->where('name' , 'THB')->firstOrfail(); ?> <div class="row" id="hideDiamond" style="z-index: -1000;"> <div class="mt-3 col-xs-3 col-md-3 col-xl-3"> <?php echo e(__('message.diamond size')); ?> : </div> <div class="col-xs-9 col-md-9 col-xl-9 mt-2"> <div class="form-group" style="width: 100%;"> <textarea id="ckeditor" name="diamond_size_modify"></textarea> </div> </div> </div> </div> <div class="footer"> <div class="row mb-2"> <div class="col-xs-3 col-md-3 col-xl-3 text-left ml-2"> <button class="btn btn-sm btn-outline-primary" id="upgrade"><?php echo e(__('message.upgrade')); ?></button> <button class="btn btn-sm btn-outline-primary d-none" id="unupgrade"><?php echo e(__('message.unupgrade')); ?></button> </div> <div class="col-xs-6 col-md-6 col-xl-6 text-right"> <button class="btn btn-danger" data-dismiss="modal"><?php echo e(__('message.close')); ?></button> </div> <div class="col-xs-2 col-md-2 col-xl-2 text-left"> <button class="btn btn-info" id="saveModify"><?php echo e(__('message.save')); ?></button> </div> </div> </div> </div> </div> </div> <?php $__env->stopSection(); ?> <?php $__env->startSection('scripts'); ?> <?php echo $__env->make('app.datepicker-js-config', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> <script type="text/javascript"> // $('#not_for_sale').on('click', function() { // var val = $(this).prop('checked'); // if(val == true){ // $('#hideNote').removeAttr('hidden'); // }else{ // $('#hideNote').attr('hidden' , 'hidden'); // note_not_for_sale.setData(''); // } // }); function roundToTwo(num) { return Math.round((num + Number.EPSILON) * 100) / 100; } function getValue(checkbox){ if (checkbox.checked) { localStorage.setItem('cut_weight' , 1); } else { localStorage.setItem('cut_weight' , 0); } } function Check(){ var rUsd = document.getElementById('returnusd'); var rKhr = document.getElementById('returnkhr'); var rThb = document.getElementById('returnthb'); var txtPhone = document.getElementById('phone').value; document.getElementById('modal_pay').addEventListener("click", function (){ $('#modal_pay').prop('disabled', true); if(rUsd.value < 0 || rKhr.value < 0 || rThb.value < 0){ Swal.fire({ position: "top-end", icon: "error", title: "<?php echo e(__('message.your spending is incorrect')); ?>", showConfirmButton: false, timer: 1500, width: '250px', }); $('#modal_pay').removeAttr('data-dismiss'); $('#modal_pay').removeAttr('id'); document.getElementById('dolarPay').focus(); return; } }); } function returnCash(){ var realPay = document.getElementById('realPay'); var dolarPay = document.getElementById('dolarPay'); var thbPay = document.getElementById('bthPay'); var amountUsd = document.getElementById('dolarAmount'); var khr = realPay.value / <?php echo e($khrs->exchange_out_rate); ?>; var thb = thbPay.value / <?php echo e($thbs->exchange_out_rate); ?>; var sumUsd = (dolarPay.value - (-khr) - (-thb)); var rUsd = sumUsd - amountUsd.value; var rKhr = rUsd * <?php echo e($khrs->exchange_in_rate); ?>; var rThb = rUsd * <?php echo e($thbs->exchange_in_rate); ?>; document.getElementById('returnusd').value = rUsd.toFixed(2); document.getElementById('returnkhr').value = rKhr.toFixed(2); document.getElementById('returnthb').value = rThb.toFixed(2); displayColorReal(); displayColorDolar(); displayColorBth(); if(rUsd.value < 0 || rKhr.value < 0 || rThb.value < 0){ Swal.fire({ position: "top-end", icon: "error", title: "<?php echo e(__('message.your spending is incorrect')); ?>", showConfirmButton: false, timer: 1500, width: '250px', }); $('#modal_pay').removeAttr('data-dismiss'); $('#modal_pay').removeAttr('id'); document.getElementById('dolarPay').focus(); return; } $('#modal_pay').attr('data-dismiss' , 'modal'); $('#modal_pay').attr('id' , 'modal_pay'); } function modify_price(){ $(document).ready(function (){ var amountUsd = document.getElementById('dolarAmount'); var khr = amountUsd.value * <?php echo e($khrs->exchange_out_rate); ?>; var thb = amountUsd.value * <?php echo e($thbs->exchange_out_rate); ?>; document.getElementById('khrAmount').value = khr; document.getElementById('thbAmount').value = thb; }); } var product_id, thbAmount, usdAmount,khrAmount, name , qty , sales_price , discount , customer_name , phone , note , price_amount , selling_to_usd_exchange_rate , original_wages , image; var sale_id; var btn_print = document.getElementById('print'); btn_print.disabled = true; var btn_pay = document.getElementById('btn_pay'); btn_pay.disabled = true; var btn_discount = document.getElementById('btn_discount'); btn_discount.disabled = true; var rowCount = $("#table-product").find("tr:first td").length; btn_discount.addEventListener('click' , function (){ if(btn_discount.disabled){ $('#message').toast({animation: true, delay: 2000, autohide: true}); $('#message').toast('show'); } }) function changeAutoComplete() { let modify_weight = document.getElementById('modify_weight'); let modify_wages = document.getElementById('modify_wages'); var q = $('input[name="q"]').val(); if(q.length>3){ $.ajax({ url: "<?php echo e(route('search')); ?>?q=" + q, cache: false, success: function (response) { // $("#results").append(html); html = ''; btn = ''; dropdown = '' if (response.length > 1) { html = ''; $('#formFile').attr('disabled' , true); document.getElementById('btnHoverClass').classList.remove('btnhover'); $('#table-product').html(html); $('.dropdown').removeAttr('hidden'); var textList = ""; for(var i = 0;i<response.length;i++){ if(i < 5){ textList += "<span><li class='p-2' id='list"+ i +"' style='cursor: pointer'>"+ response[i].name + ' | ' + response[i].product_category.name +"</li></span>"; } } document.body.addEventListener('click' , function (){ $('.dropdown').attr('hidden' , 'hidden'); // $('#input').focus(); }) setTimeout(function (){ $('#list0').click(function (){ $('.dropdown').attr('hidden' , 'hidden'); $('#input').val(response[0].part_number); $('#input').focus(); changeAutoComplete(); }) $('#list1').click(function (){ $('.dropdown').attr('hidden' , 'hidden'); $('#input').val(response[1].part_number); $('#input').focus(); changeAutoComplete(); }) $('#list2').click(function (){ $('.dropdown').attr('hidden' , 'hidden'); $('#input').val(response[2].part_number); $('#input').focus(); changeAutoComplete(); }) $('#list3').click(function (){ $('.dropdown').attr('hidden' , 'hidden'); $('#input').val(response[3].part_number); $('#input').focus(); changeAutoComplete(); }) $('#list4').click(function (){ $('.dropdown').attr('hidden' , 'hidden'); $('#input').val(response[4].part_number); $('#input').focus(); changeAutoComplete(); }) $('#list5').click(function (){ $('.dropdown').attr('hidden' , 'hidden'); $('#input').val(response[5].part_number); $('#input').focus(); changeAutoComplete(); }) }, 100) // $('.dropdown').append("<li id='list'>"+ response[i].name +"</li>"); $('.dropdown').html(textList); // <a class="dropdown-item" href="#">Action</a> // let data = target.value; // console.log('target',target); // ulField.innerHTML = ``; // if (data.length) { // let autoCompleteValues = autoComplete(data, response); // autoCompleteValues.forEach(value => { // addItem(value); // }); // } btn_pay.disabled = false; } else { $('.dropdown').attr('hidden' , 'hidden'); if (response.length == 1) { window.localStorage.setItem('parseQ',q); product_id= response[0].id; sale_id = response[0].id; var wages_in_weight=0,original_wages_in_weight=0; if(response[0].product_category.fixed_price == true || response[0].fixed_price == true){ $('#scale').html(''); $('#scale1').html(''); wages_in_weight = parseFloat(response[0].wages).toFixed(2); original_wages_in_weight = parseFloat(response[0].original_wages).toFixed(2); }else{ $('#scale').html('(គិតជាលី)'); $('#scale1').html('(គិតជាលី)'); wages_in_weight = response[0].wages_in_weight; original_wages_in_weight = response[0].original_wages_in_weight; if(!wages_in_weight){ if(response[0].wages){ wages_in_weight = parseFloat(response[0].wages / (response[0].product_category.selling_rate)).toFixed(2); } } if(!original_wages_in_weight){ if(response[0].original_wages){ original_wages_in_weight = parseFloat(response[0].original_wages / (response[0].product_category.supplier_price)).toFixed(2); } } } html = '<tr> <td> <input type="checkbox" value="1"> </td> <td id="name"> ' + response[0].name + ' <br>' +response[0].product_category.name+ ' </td> <td class="credit" id="qty"> ' + 1 + ' </td><td class="credit" id="weight"> ' + parseFloat(response[0].weight).toFixed(2) +' </td> <td class="credit" id="wages"> ' + wages_in_weight + '</td> <td class="credit" id="dis"> ' + parseFloat($('#discountPrice').val()).toFixed(2) + ' </td><td id="diamond_size"> ' + response[0].diamond_size.replace(/(?:\r\n|\r|\n)/g, '<br/>') + '</td><td id="description"> ' + response[0].description + '</td><td class="credit" id="price"> ' + (parseFloat(response[0].sellingPrice).toFixed(2)) + ' </td><td class="d-flex " style="justify-content:center;align-items:center"><button class="btn btn-sm btn-danger mr-2" id="decrement"><?php echo e(__('message.minimize')); ?></button><button id="btn_min" data-toggle="modal" data-target=".bd-example-modal-lg-form" class="btn btn-sm btn-primary mr-2" style="font-size:12px"><?php echo e(__('message.modify')); ?></button><button class="btn btn-sm btn-info" id="increment"><?php echo e(__('message.plus')); ?></button></td></tr> '; $('#cut_weight').prop('checked', false); localStorage.setItem('cut_weight' , false); localStorage.setItem('rate' , response[0].product_category.supplier_price); $('#unupgrade').addClass('d-none'); $('#feesElement').removeClass('d-none'); if(!response[0].purity_upgrade_to){ $('#upgrade').addClass('d-none'); }else{ $('#upgrade').removeClass('d-none'); } localStorage.setItem('upgrade_purity' , '0'); $('#upgrade').click(function (){ $('#upgrade').addClass('d-none'); $('#unupgrade').removeClass('d-none'); $('#feesElement').addClass('d-none'); localStorage.setItem('upgrade_purity' , response[0].selling_purity); console.log(response[0].selling_purity) }); $('#unupgrade').click(function (){ $('#upgrade').removeClass('d-none'); $('#unupgrade').addClass('d-none'); $('#feesElement').removeClass('d-none'); localStorage.setItem('upgrade_purity' , '0'); }); $('#formFile').removeAttr('disabled'); document.getElementById('btnHoverClass').className = 'btnhover'; modify_weight.value = response[0].weight; modify_wages.value = wages_in_weight; localStorage.setItem('imageLocal' , response[0].image); localStorage.setItem('setOldWeight' , response[0].weight); localStorage.setItem('setOldWages' , wages_in_weight); localStorage.setItem('fixed_price' , response[0].product_category.fixed_price); localStorage.setItem('selling_rate' , response[0].product_category.selling_rate); localStorage.setItem('for_sale' , response[0].for_sale); localStorage.setItem('selling_to_usd_exchange_rate' , response[0].product_category.selling_to_usd_exchange_rate) let productCategoryName = response[0].product_category.name; localStorage.setItem('originalWagesLocal' , parseFloat(original_wages_in_weight).toFixed(2)); if(productCategoryName == 'ពេជ្រ' || productCategoryName == 'Gold' || productCategoryName == 'เพชร'){ $('#hideDiamond').removeAttr('hidden'); }else{ $('#hideDiamond').attr('hidden' , 'hidden'); } $(document).ready(function (){ let qty = parseInt($('#qty').html()); $('#qty').html(qty); let price = $('#price').html(); price = price * qty; $('#dis').val(0 + ' <?php echo e($currency_->currency_symbol); ?>') $('#price').html(price + ' $'); if(response[0].product_category.fixed_price == true || response[0].fixed_price == true){ $('#wages').html($('#wages').val() +" <?php echo e($currency_->currency_symbol); ?>"); }else{ $('#wages').html($('#wages').val()); } if(response[0].description === null){ $('#description').html(''); } $('#price').html(price+" <?php echo e($currency_->currency_symbol); ?>"); setTotal(price.toFixed(2) , 0); localStorage.setItem('DolarAmountLocal' , $('#price').html()); $('#print').attr("disabled" , false); $('#print').attr("href" , '<?php echo e(route('pointToSale.show')); ?>'); $('#print').attr("target" , "_blank"); document.getElementById('btn_min').addEventListener("click", function (){ let str = $('#diamond_size').html(); $("#ckeditor").html(str); ckeditor.setData(str); }); function upgradeSellingPrice(){ var upgradeSellingPrice = 0; if($('#upgrade').hasClass('d-none')){ wages = 0; if(response[0].product_category.fixed_price == false || response[0].fixed_price == false){ wages = wages * (response[0].product_category.selling_rate); } upgradeSellingPrice = response[0].upgradeSellingPrice; }else{ upgradeSellingPrice = response[0].sellingPrice } return parseFloat(upgradeSellingPrice).toFixed(2); } function upgradeSellingRate(){ var upgradeSellingRate = 0; if($('#upgrade').hasClass('d-none')){ upgradeSellingRate = response[0].product_category.upgrade_selling_rate; }else{ upgradeSellingRate = response[0].product_category.selling_rate } return parseFloat(upgradeSellingRate).toFixed(4); } document.getElementById('increment').addEventListener("click", function (){ let qty = $('#qty').html(); qty++; let price = parseFloat(upgradeSellingPrice()).toFixed(2); // var nowWeight = parseFloat($('#modify_weight').val()); // var w = 0; // var addWages = 0; // if(response[0].weight < nowWeight){ // w = nowWeight - response[0].weight; // addPrice = w * response[0].product_category.selling_rate; // price = Number(price) + Number(addPrice); // // localStorage.setItem('setOldWeight' , weightModify); // } // else if(response[0].weight > nowWeight){ // w = response[0].weight - nowWeight; // addPrice = w * response[0].product_category.selling_rate; // price = Number(price - addPrice); // // localStorage.setItem('setOldWeight' , weightModify); // } // // var nowWages = parseFloat($('#wages').html()); // if(wages_in_weight < nowWages){ // addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); // price = Number(price) + Number(addWages); // }else if(wages_in_weight > nowWages){ // addWages = parseFloat(wages_in_weight - nowWages).toFixed(2); // price = Number(price) - Number(addWages); // } var nowWeight = parseFloat($('#modify_weight').val()); var w = 0; var addWages = 0; var nowWages = parseFloat($('#wages').html()); if(response[0].weight < nowWeight){ w = nowWeight - response[0].weight; addPrice = w * upgradeSellingRate(); if(wages_in_weight < nowWages){ addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); // price = Number(price) + Number(addWages); }else if(wages_in_weight > nowWages){ // addWages = parseFloat(wages_in_weight - nowWages).toFixed(2); addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); // price = Number(price) - Number(addWages); } price = parseFloat(Number(upgradeSellingPrice()) + Number(addPrice) +(Number(addWages))).toFixed(2); } if(response[0].weight > nowWeight){ w = response[0].weight - nowWeight; addPrice = w * upgradeSellingRate(); if(wages_in_weight < nowWages){ addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); // price = Number(price) + Number(addWages); }else if(wages_in_weight > nowWages){ addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); // price = Number(price) - Number(addWages); } price = Number(upgradeSellingPrice() - addPrice + (Number(addWages))); } if(response[0].weight == nowWeight){ if(wages_in_weight < nowWages){ addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); }else if(wages_in_weight > nowWages){ addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); } price = parseFloat(upgradeSellingPrice() + Number(addWages)).toFixed(2); } $('#price').html(parseFloat(price * qty).toFixed(2)+" <?php echo e($currency_->currency_symbol); ?>"); var discount=parseFloat($('#discount').val()).toFixed(2); var discount_type=$('#discount_type').val(); var discount_amount=0; var wages = parseFloat($('#wages').html()).toFixed(2); var discount_percent = $('#discount_percent').val(); if(discount_type=='percent'){ if(response[0].product_category.fixed_price == false || response[0].fixed_price == false){ wages = wages * (response[0].product_category.selling_rate); } discount_amount=((parseFloat($('#price').html()).toFixed(2)-wages)*discount_percent)/100; }else { discount_amount=discount; } $('#dis').html(parseFloat(discount_amount).toFixed(2)+" <?php echo e($currency_->currency_symbol); ?>"); $('#qty').html(qty); setTotal(parseFloat($('#price').html()).toFixed(2) , discount_amount); localStorage.setItem('DolarAmountLocal' , $('#price').html()); }) document.getElementById('decrement').addEventListener("click", function (){ let qty = $('#qty').html(); if(qty == 1){ html = ''; $('#table-product').html(html); $('#framefav').attr('src', '/no_image.png') btn_pay.disabled = true; btn_discount.disabled = true; setTotal(0,0) if(rowCount == 0){ $(document).ready(function () { btn_pay.addEventListener("click", function () { $('#message').attr('hidden' , false); $('#message').toast({animation: true, delay: 2000, autohide: true}); $('#message').toast('show'); }) btn_print.addEventListener("click", function () { $('#print').attr('disabled' , true); $('#message').attr('hidden' , false); $('#print').removeAttr("href"); $('#message').toast({animation: true, delay: 2000, autohide: true}); $('#message').toast('show'); }) btn_discount.addEventListener("click", function () { $('#btn_discount').removeAttr("data-toggle"); $('#message').toast({animation: true, delay: 2000, autohide: true}); $('#message').toast('show'); }) }); } $('#formFile').attr('disabled' , true); document.getElementById('btnHoverClass').classList.remove('btnhover'); return; } qty--; $('#qty').html(qty); let price = parseFloat(upgradeSellingPrice()).toFixed(2); var nowWeight = parseFloat($('#modify_weight').val()); var w = 0; var addWages = 0; var nowWages = parseFloat($('#wages').html()); if(response[0].weight < nowWeight){ w = nowWeight - response[0].weight; addPrice = w * upgradeSellingRate(); if(wages_in_weight < nowWages){ addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); // price = Number(price) + Number(addWages); }else if(wages_in_weight > nowWages){ // addWages = parseFloat(wages_in_weight - nowWages).toFixed(2); addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); // price = Number(price) - Number(addWages); } price = parseFloat(Number(upgradeSellingPrice()) + Number(addPrice) +(Number(addWages))).toFixed(2); } if(response[0].weight > nowWeight){ w = response[0].weight - nowWeight; addPrice = w * upgradeSellingRate(); if(wages_in_weight < nowWages){ addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); // price = Number(price) + Number(addWages); }else if(wages_in_weight > nowWages){ addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); // price = Number(price) - Number(addWages); } price = parseFloat(upgradeSellingPrice() - addPrice + Number(addWages)).toFixed(2); } if(response[0].weight == nowWeight){ if(wages_in_weight < nowWages){ addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); }else if(wages_in_weight > nowWages){ addWages = parseFloat(nowWages - wages_in_weight).toFixed(2); } price = parseFloat(upgradeSellingPrice() + Number(addWages)).toFixed(2); } $('#price').html(parseFloat(price * qty).toFixed(2)+" <?php echo e($currency_->currency_symbol); ?>"); var discount=parseFloat($('#discount').val()); var discount_type=$('#discount_type').val(); var discount_amount=0; var wages = parseFloat($('#wages').html()).toFixed(2); var discount_percent = $('#discount_percent').val(); if(discount_type=='percent'){ if(response[0].product_category.fixed_price == false || response[0].fixed_price == false){ wages = wages * (upgradeSellingRate()); } discount_amount=((parseFloat($('#price').html()).toFixed(2)-wages)*discount_percent)/100; }else { discount_amount=discount; } $('#dis').html(parseFloat(discount_amount).toFixed(2)+" <?php echo e($currency_->currency_symbol); ?>"); setTotal(parseFloat($('#price').html()).toFixed(2) , discount_amount); localStorage.setItem('DolarAmountLocal' , $('#price').html()); }) }) function invoice(){ let f = parseFloat($('#weight').html()); let wages = parseFloat($('#wages').html()).toFixed(2); let qty = $('#qty').html(); let price = parseFloat($('#price').html()).toFixed(2); let discount=$('#discountPrice').val(); let VarDiamond = $('#diamond_size').html(); // var vals = $('#not_for_sale').prop('checked'); // // var not_for_sale,note_not_for_sales; // if(vals == false){ // not_for_sale = 1; // }else{ // not_for_sale = 2; // } // // note_not_for_sales = note_not_for_sale.getData(); // var path = $('#framefav').prop('src'); // console.log('Image ' + path); // $('#dis').html(discount); localStorage.setItem('setPriceLocal' , $('#price').html()) localStorage.setItem('discountLocal' , $('#discountPrice').val()); localStorage.setItem('diamondLocal' , VarDiamond); $('#print').attr("href" ,"<?php echo e(route('pointToSale.show')); ?>?q=" + btn + "&w=" + parseFloat(f) + "&wg=" + wages + "&qty=" + qty + "&price=" + price+ "&discount=" + discount); $('#print').attr("target" , "_blank"); localStorage.setItem('DolarAmountLocal' , $('#price').html()); } setTimeout(invoice, 100) $(document).ready(function (){ let btn_increment = document.getElementById('increment'); let btn_decrement = document.getElementById('decrement'); function invoiceBtn(){ let f = parseFloat($('#weight').html()).toFixed(2); let wages = parseFloat($('#wages').html()).toFixed(2); let qty = $('#qty').html(); let price = parseFloat($('#price').html()).toFixed(2); let discount = parseFloat($('#discountPrice').val()).toFixed(2); let VarDiamond = $('#diamond_size').html(); $('#dis').html(parseFloat(discount).toFixed(2)+" <?php echo e($currency_->currency_symbol); ?>"); localStorage.setItem('diamondLocal' , VarDiamond); localStorage.setItem('discountLocal' , parseFloat($('#discountPrice').val()).toFixed(2)); $('#print').attr("href" ,"<?php echo e(route('pointToSale.show')); ?>?q=" + btn + "&w=" + f + "&wg=" + wages + "&qty=" + qty + "&price=" + price + '&discount=' + discount); $('#print').attr("target" , "_blank"); } btn_increment.addEventListener("click", function (){ setTimeout(invoiceBtn, 100); }); btn_decrement.addEventListener("click", function (){ setTimeout(invoiceBtn, 100); localStorage.setItem('DolarAmountLocal' , $('#price').html()); }); }); btn_pay.disabled = false; btn_discount.disabled = false; $(document).ready(function (){ btn_pay.addEventListener("click", function (){ $('#message').attr('hidden' , true); // $('#dolarAmount').val(response[0].price * $('#qty').html()); $('#dolarAmount').val(parseFloat($('#total_grand').data('price')).toFixed(2)); $('#khrAmount').val(parseFloat(($('#total_grand').data('price')*(<?php echo e($rate['KHR']); ?>)) * $('#qty').html()).toFixed(0)); $('#thbAmount').val(parseFloat(($('#total_grand').data('price')*(<?php echo e($rate['THB']); ?>)) * $('#qty').html()).toFixed(0)); }) btn_print.addEventListener("click", function () { $('#message').attr('hidden' , true); }) }) function modifyWeightAndWages(){ var weight = Number($('#weight').val()); var wages = Number($('#wages').val()); var wagesPrice = 0,setPrice = 0; var w = 0; if(weight < weightModify){ w = weightModify - response[0].weight; addPrice = w * response[0].product_category.selling_rate; if(response[0].product_category.name == 'ផ្លាកទីន វៀតណាម'){ addPrice = (w * response[0].selling_purity) * response[0].product_category.goldRate; } if(wages < wagesModify){ wagesPrice = wagesModify - wages_in_weight; // price = parseFloat(Number(response[0].sellingPrice) + Number(addPrice) + Number(wagesPrice)).toFixed(2); }else if(wages > wagesModify){ // wagesPrice = wages_in_weight - wagesModify; wagesPrice = wagesModify - wages_in_weight; // price = parseFloat(Number(response[0].sellingPrice - addPrice - wagesPrice)).toFixed(2); } // else{ // price = parseFloat(Number(response[0].sellingPrice) + Number(addPrice)).toFixed(2); // } if(response[0].fixed_price == false || response[0].product_category.fixed_price == false){ wagesPrice = wagesPrice * response[0].product_category.selling_rate; } price = parseFloat(response[0].sellingPrice + addPrice + (wagesPrice)).toFixed(2); } if(weight > weightModify){ w = response[0].weight - weightModify; addPrice = w * response[0].product_category.selling_rate; if(response[0].product_category.name == 'ផ្លាកទីន វៀតណាម'){ addPrice = (w * response[0].selling_purity) * response[0].product_category.goldRate; } if(wages < wagesModify){ wagesPrice = wagesModify - wages_in_weight; // price = parseFloat(Number(response[0].sellingPrice) + Number(addPrice) + Number(wagesPrice)).toFixed(2); }else if(wages > wagesModify){ // wagesPrice = wages_in_weight - wagesModify; wagesPrice = wagesModify - wages_in_weight; // price = parseFloat(Number(response[0].sellingPrice - addPrice - wagesPrice)).toFixed(2); } // else { // price = parseFloat(Number(response[0].sellingPrice - addPrice)).toFixed(2); // } if(response[0].fixed_price == false || response[0].product_category.fixed_price == false){ wagesPrice = wagesPrice * response[0].product_category.selling_rate; } price = parseFloat(response[0].sellingPrice - addPrice + (wagesPrice)).toFixed(2); } } btn = ''+ response[0].part_number +''; btn_print.disabled = false; $('#table-product').html(html); // let saveModify = document.getElementById('saveModify'); $('#saveModify').unbind('click').click(function (){ weightModify = parseFloat(Number($('#modify_weight').val())).toFixed(2); wagesModify = parseFloat(Number($('#modify_wages').val())).toFixed(2); dia = ckeditor.getData(); // localStorage.setItem('note_not_for_sale' , note_not_for_sale.getData()); price = parseFloat($('#price').val()).toFixed(2); let txt = response[0].product_category.name; var fixed = localStorage.getItem('fixed_price'); if(fixed == false){ modifyWeightAndWages(); } $('#weight').html(weightModify); if(response[0].product_category.fixed_price == true || response[0].fixed_price == true){ $('#wages').html(wagesModify + ' <?php echo e($currency_->currency_symbol); ?>'); }else{ $('#wages').html(wagesModify); } $('#diamond_size').html(dia); $('#saveModify').attr('data-dismiss', 'modal'); $('#price').html((price*Number($('#qty').html()) ) + ' <?php echo e($currency_->currency_symbol); ?>'); if($('#upgrade').hasClass('d-none') && response[0].purity_upgrade_to){ // $('#modify_wages').val(parseFloat(0)); $('#price').html(parseFloat((response[0].upgradeSellingPrice)*Number($('#qty').html())).toFixed(2) + ' <?php echo e($currency_->currency_symbol); ?>'); $('#wages').html(parseFloat(0)); setTotal(parseFloat($('#price').html()).toFixed(2) , parseFloat(discount_amount).toFixed(2)) } var discount=parseFloat($('#discount').val()); var discount_type=$('#discount_type').val(); var discount_amount=0; var wages = parseFloat($('#wages').html()).toFixed(2); var discount_percent = $('#discount_percent').val(); if(discount_type=='percent'){ // if(response[0].product_category.fixed_price == false || response[0].fixed_price == false){ // wages = wages * (response[0].product_category.selling_rate); // } discount_amount=((parseFloat($('#price').html()).toFixed(2)-wages)*discount_percent)/100; }else { discount_amount=discount; } $('#dis').html(parseFloat(discount_amount).toFixed(2)+" <?php echo e($currency_->currency_symbol); ?>"); setTotal(parseFloat($('#price').html()).toFixed(2) , parseFloat(discount_amount).toFixed(2)) setTimeout(invoice, 100); var wages_check = parseFloat($('#wages').html()); if(wages_check == 0 && response[0].product_category.name != 'ផ្លាកទីន វៀតណាម'){ $('#name').html(response[0].name+'<br>'+response[0].productCategoryName); }else { $('#name').html(response[0].name+'<br>'+response[0].product_category.name); } }) if (response[0].image) { $('#framefav').attr('src', '/' + response[0].image) } else { $('#framefav').attr('src', '/no_image.png') } // setTotal(parseFloat(response[0].price) , 0); // $('input#dolarAmount').html(response[0].price * $('#qty').html()); $('input[name="q"]').val(q); $('#name').val(response[0].name); $('#price').val(parseFloat(response[0].sellingPrice).toFixed(2) + ' $'); // $('#weight').val(response[0].weight); $('#wages').val(wages_in_weight); $('#diamond_size').val(response[0].diamond_size); $('#description').val(response[0].description); } else { $('.error').toast({animation: true, delay: 2000, autohide: true}); $('.error').toast('show'); html = ''; $('#table-product').html(html); } //discount $('#save').on('click',function(){ var discount=parseFloat($('#discount').val()).toFixed(2); var discount_type=$('#discount_type').val(); var discount_percent = parseFloat($('#discount_percent').val()); var discount_amount=0; let f = parseFloat($('#weight').html()).toFixed(2); let wages = parseFloat($('#wages').html()).toFixed(2); let qty = $('#qty').html(); let price = parseFloat($('#price').html()).toFixed(2); let VarDiamond = $('#diamond_size').html(); if(discount_type=='percent'){ if(response[0].product_category.fixed_price == false || response[0].fixed_price == false){ wages = wages * (response[0].product_category.selling_rate); } discount_amount=roundToTwo(((parseFloat($('#price').html()).toFixed(2)-wages) * discount_percent)/100); }else { discount_amount=discount; } // console.log(discount_amount , discount_percent , discount , price , wages , discount_percent/100); $('#dis').html(parseFloat(discount_amount).toFixed(2)+" <?php echo e($currency_->currency_symbol); ?>"); setTotal($('#price').val(),parseFloat(discount_amount).toFixed(2)); // var vals = $('#not_for_sale').prop('checked'); // var not_for_sale,note_not_for_sale; // if(vals == false){ // not_for_sale = 1; // }else{ // not_for_sale = 2; // } // // note_not_for_sale = note_not_for_sale.getData(); localStorage.setItem('diamondLocal' , VarDiamond); localStorage.setItem('discountLocal' , parseFloat($('#discountPrice').val()).toFixed(2)); $('#print').attr("href" ,"<?php echo e(route('pointToSale.show')); ?>?q=" + btn + "&w=" + f + "&wg=" + wages + "&qty=" + qty + "&price=" + price+ "&discount=" + parseFloat(discount_amount).toFixed(2)); }); } } }); } } if(rowCount == 0){ $('#formFile').attr('disabled' , true); document.getElementById('btnHoverClass').classList.remove("btnhover"); $(document).ready(function () { btn_pay.addEventListener("click", function () { $('.message').toast({animation: true, delay: 2000, autohide: true}); $('.message').toast('show'); }) btn_print.addEventListener("click", function () { $('#message').toast({animation: true, delay: 2000, autohide: true}); $('#message').toast('show'); }) }); }else { $('#formFile').removeAttr('disabled'); document.getElementById('btnHoverClass').className = 'btnhover'; $(document).ready(function (){ btn_pay.addEventListener("click", function (){ $('#message').attr('hidden' , true); }) }) } var weightModify = 0,wagesModify = 0 , addPrice = 0; var dia = ''; var price = 0; var ulField = document.getElementById('suggestions'); var inputField = document.getElementById('input'); inputField.addEventListener('input', changeAutoComplete); $('#suggestions').click(selectItem); var html = ''; var btn = ''; var dropdown = ''; var modal_pay = $('#modal_pay'); function pay(){ let customerName = $('#customerName').val(); let PhoneNumber = $('#phone').val(); let note = $('#note').val(); returnCash(); var rUsd = document.getElementById('returnusd'); var rKhr = document.getElementById('returnkhr'); var rThb = document.getElementById('returnthb'); if (rUsd.value < 0 || rKhr.value < 0 || rThb.value < 0) { Swal.fire({ position: "top-end", icon: "error", title: "<?php echo e(__('message.your spending is incorrect')); ?>", showConfirmButton: false, timer: 1500, width: '250px', }); $('#modal_pay').removeAttr('data-dismiss'); $('#modal_pay').removeAttr('id'); document.getElementById('dolarPay').focus(); return; } else { if(PhoneNumber.length <= 8){ Swal.fire({ position: "top-end", icon: "error", title: "<?php echo e(__('message.please enter phone number')); ?>", showConfirmButton: false, timer: 1500, width: '250px', }); $('#modal_pay').removeAttr('data-dismiss'); $('#modal_pay').removeAttr('id'); document.getElementById('phone').focus(); return; }else{ $('#modal_pay').removeAttr('data-dismiss'); $('#modal_pay').removeAttr('id'); } } let SelectUsd = document.getElementById('selectUsd'); let SelectKhr = document.getElementById('selectKhr'); let SelectThb = document.getElementById('selectThb'); let usdPay = document.getElementById('dolarPay'); let khrPay = document.getElementById('realPay'); let thbPay = document.getElementById('bthPay'); if (SelectUsd.checked == false && SelectKhr.checked == false && SelectThb.checked == false) { Swal.fire({ position: "top-end", icon: "error", title: "<?php echo e(__('message.select your return')); ?>", showConfirmButton: false, timer: 1500, width: '250px', }); return; } if(SelectUsd.checked == true){ let rUsd = document.getElementById('returnusd'); let resultUsd = usdPay.value - rUsd.value; usdAmount = resultUsd; khrAmount = khrPay.value; thbAmount = thbPay.value; localStorage.setItem('returnUsd' , rUsd.value); }else if(SelectKhr.checked == true){ let rKhr = document.getElementById('returnkhr'); let resultKhr = khrPay.value - rKhr.value khrAmount = resultKhr; usdAmount = usdPay.value; thbAmount = thbPay.value; localStorage.setItem('returnKhr' , rKhr.value); }else if(SelectThb.checked == true){ let rThb = document.getElementById('returnthb'); let resultThb = thbPay.value - rThb.value; thbAmount = resultThb; khrAmount = khrPay.value; usdAmount = usdPay.value; localStorage.setItem('returnThb' , rThb.value); } localStorage.setItem('phoneNumberLocal' , PhoneNumber); localStorage.setItem('noteLocal' , note); localStorage.setItem('customerName' , customerName); localStorage.setItem('dolarPayLocal' , $('#dolarPay').val()); localStorage.setItem('khrAmountLocal' , $('#realPay').val()); localStorage.setItem('thbAmountLocal' , $('#bthPay').val()); localStorage.setItem('DolarAmountLocal' , $('#dolarAmount').val()); localStorage.setItem('discountLocal' , parseFloat($('#discountPrice').val()).toFixed(2)); localStorage.setItem('qtyLocal' , $('#qty').val()); qty = $('#qty').html(); var storePath = $('#formFile').val(); $('#weight').val($('#modify_weight').val()); $('#wages').val($('#modify_wages').val()); $('#diamond_size').html(localStorage.getItem('diamondLocal')); var form = new FormData(); // form.append("image", fileInput.files[0], "/C:/Users/programmer/Desktop/1677655912700.png"); var not_use_rate = 0; if ($('#not_use_rate').is(':checked')) { not_use_rate = 1; } // Append Form Data With Image form.append("image", $('#formFile')[0].files[0]); form.append("usd_amount", usdAmount); form.append("khr_amount", khrAmount); form.append("thb_amount", thbAmount); form.append("customer_name", customerName); form.append("phone", PhoneNumber); form.append("note", note); form.append("sales_price", $('#dolarAmount').val()); form.append("product_id", product_id); form.append("discount", $('#discountPrice').val()); form.append("qty", qty); form.append("name", $('#name').val()); form.append("price", $('#price').val()); form.append("weight", $('#weight').val()); form.append("wages", $('#wages').val()); form.append("diamond_size", $('#diamond_size').html()); form.append("description", $('#description').html()); form.append("user_id", "<?php echo e(Auth::user()->id); ?>"); form.append("selling_to_usd_exchange_rate", localStorage.getItem('selling_to_usd_exchange_rate')); form.append("upgrade_purity", localStorage.getItem('upgrade_purity')); form.append("original_wages", localStorage.getItem('originalWagesLocal')); form.append("for_sale" , localStorage.getItem('for_sale')); form.append("cut_weight" , localStorage.getItem('cut_weight')); form.append("not_use_rate" , not_use_rate); form.append("rate" , localStorage.getItem('rate')); // form.append("note_not_for_sale" , localStorage.getItem('note_not_for_sale')); $.ajax({ url: "<?php echo e(route('sell.store')); ?>", // "url": "http://127.0.0.1:8000/api/product/store", "method": "POST", "timeout": 0, "processData": false, "mimeType": "multipart/form-data", "contentType": false, data:form, success: function (response) { response = JSON.parse(response) if(response.sale_id){ html = ''; btn = ''; $('#table-product').html(html); btn_pay.disabled = true; btn_discount.disabled = true; if(rowCount == 0){ $('#formFile').attr('disabled' , true); document.getElementById('btnHoverClass').classList.remove('btnhover'); $(document).ready(function () { btn_pay.addEventListener("click", function () { $('#message').attr('hidden' , false); $('#message').toast({animation: true, delay: 2000, autohide: true}); $('#message').toast('show'); }) btn_print.addEventListener("click", function () { $('#print').attr('disabled' , true); $('#message').attr('hidden' , false); $('#print').removeAttr("href"); $('#message').toast({animation: true, delay: 2000, autohide: true}); $('#message').toast('show'); }) }); } $('#modal_pay').attr('data-dismiss' , 'modal'); $('#modal_pay').attr('id' , 'modal_pay'); $('#framefav').attr('src', '/no_image.png') let setval = 0; setTotal(setval.toFixed(2) , 0); $('input#dolarAmount').val(''); $('input#khrAmount').val(''); $('input#thbAmount').val(''); $('input#returnusd').val('0'); $('input#returnkhr').val('0'); $('input#returnthb').val('0'); $('input[name="usd_amount"],input[name="khr_amount"],input[name="thb_amount"]').val(''); $('#modal_pay').prop('disabled', false); localStorage.setItem('pay' , 1); window.open('<?php echo e(route('sales.show' , '')); ?>/' + response.sale_id , '_blank'); Swal.fire({ position: "top-end", icon: "success", title: response.message, showConfirmButton: false, timer: 1000, width: '250px', }); window.location.reload(); }else{ Swal.fire({ position: "top-end", icon: "error", title: response.message, showConfirmButton: false, timer: 1000, width: '250px', }); $('#modal_pay').attr('data-dismiss' , ''); $('#modal_pay').attr('id' , ''); return; } }, error: function(jqXHR, textStatus, errorThrown) { console.log(textStatus, errorThrown); } }); }; function setTotal(price , discount) { let parsePrice = parseFloat(price).toFixed(2); $('#price').val(price); $('#total_price').html('$ ' + parsePrice); $('#discount_price').html('$ ' + parseFloat(discount).toFixed(2)); $('#discountPrice').val(parseFloat(discount).toFixed(2)); let grand_total = price - discount; $('#total_grand').html('$ ' + grand_total.toFixed(2)); $('#total_grand').data('price',grand_total); } function autoComplete(inputValue, api) { let destination = []; return destination.filter( (value) => value.toLowerCase().includes(inputValue.toLowerCase()) ); } function addItem(value) { ulField.innerHTML = ulField.innerHTML + `<li class="hover-search"><a class="val">${value}</a></li>` + '<br>'; } function selectItem({target}) { if (target.tagName === 'LI' || target.tagName === 'A') { inputField.value = target.textContent; ulField.innerHTML = ``; } document.getElementById('input').focus(); document.getElementById('input').form.submit(); } function delete_data() { html = ''; $('#formFile').attr('disabled' , true); document.getElementById('btnHoverClass').classList.remove('btnhover'); localStorage.clear(); $('#table-product').html(html); setTotal(0 , 0); $('#framefav').attr('src', '/no_image.png'); btn_pay.disabled = true; btn_print.disabled = true; btn_discount.disabled = true; btn_print.removeAttribute('href'); $('#message').attr('hidden' , false); $('.message').attr('hidden' , false); $('#print').attr('hidden' , false); $('#input').val(''); $('#input').focus(); btn_pay.addEventListener("click", function () { $('.err').toast({animation: true, delay: 2000, autohide: true}); $('.err').toast('show'); }) btn_print.addEventListener("click", function () { $('#err').toast({animation: true, delay: 2000, autohide: true}); $('#err').toast('show'); }) btn_discount.addEventListener("click", function () { $('#err').toast({animation: true, delay: 2000, autohide: true}); $('#err').toast('show'); }) } function autoPrint(){ var scan = $('#scan').val(); $.ajax({ url: "<?php echo e(route('scan')); ?>?scan=" + scan, cache: false, success: function (response) { if(response.id !=null){ if(response.already_buy_back == false){ window.open("<?php echo e(route('sales.show' , '')); ?>/" + response.id , '_blank'); }else { $('.already_buy_back').toast({animation: true, delay: 2000, autohide: true}); $('.already_buy_back').toast('show'); } }else{ $('.scan').toast({animation: true, delay: 2000, autohide: true}); $('.scan').toast('show'); } } }); } </script> <script type="text/javascript"> // date earchform strt_date to EndDate $(document).ready(function () { $(".ranges > ul > li").click(function () { setTimeout(function () { $('#search-form').submit(); }, 100); }); }); // date var runDatePicker = function () { // enable clear button $('#datepicker-3').datepicker({ todayBtn: "linked", clearBtn: true, todayHighlight: true, templates: controls }); } // end date $(document).ready(function () { $("#js-nav-menu").removeClass('active'); $("#js-nav-menu li ul li").removeClass('active'); $("#menu_dashboard").addClass('active open'); $("#menu_dashboard").addClass('collapse in') $("#menu_dashboard").addClass('active') }) </script> <?php $__env->stopSection(); ?> <?php $__env->startSection('meta'); ?> <title><?php echo e($settings_->shop_name); ?></title> <?php $__env->stopSection(); ?> <?php echo $__env->make('layouts.admin-main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/jewelry-pos/resources/views/pointToSale/index.blade.php ENDPATH**/ ?>