<?php $__env->startSection('title', __('E-Way Bill')); ?>

<?php $__env->startSection('content'); ?>

<!-- Content Header (Page header) -->
<section class="content-header">
    <h1><?php echo e(__('E-Way Bill'), false); ?></h1>
</section>

<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="row">
                <input id="is_save_and_print" name="is_save_and_print" type="hidden" value="0">
                <div class="col-sm-12 text-center">
                    <button type="button" id="generate-eway-bill" class="btn btn-primary btn-big">Generate E-Way Bill</button>
                </div>
            </div>
          
        </div>
    </div>
</section>
<!-- /.content -->

<?php $__env->stopSection(); ?>

<?php $__env->startSection('javascript'); ?>

<script>
    document.getElementById('generate-eway-bill').addEventListener('click', function() {
        const url = 'https://gstsandbox.charteredinfo.com/ewaybillapi/dec/v1.03/ewayapi?action=GENEWAYBILL';
        const headers = {
            'aspid': '1755272424',
            'password': 'HELLO@123123',
            'gstin': '34AACCC1596Q002',
            'username': 'TaxProEnvPON',
            'authtoken': 'No1gsK4NmL2jLWuIjmMlhxo4s',
            'Content': 'application/json',
            'Content-Type': 'application/json'
        };

        const data = JSON.stringify({
            "supplyType": "O",
            "subSupplyType": "1",
            "subSupplyDesc": "Transaction",
            "docType": "INV",
            "docNo": "HelloTest",
            "docDate": "02/11/2020",
            "fromGstin": "34AACCC1596Q002",
            "fromTrdName": "welton",
            "fromAddr1": "4-9-35, GROUND,1ST, 2ND FLOOR, AURANGPURA",
            "fromAddr2": "GROUND FLOOR OSBORNE ROAD",
            "fromPlace": "FRAZER TOWN",
            "fromPincode": 605001,
            "actFromStateCode": 34,
            "fromStateCode": 34,
            "toGstin": "29AACCC1596Q000",
            "toTrdName": "sthuthya",
            "toAddr1": "Shree Nilaya",
            "toAddr2": "GODOWN NO 5 GAT NO 1214/1230 ",
            "toPlace": "Beml Nagar",
            "toPincode": 562160,
            "actToStateCode": 29,
            "toStateCode": 29,
            "transactionType": 4,
            "otherValue": "-100",
            "totalValue": 0,
            "cgstValue": 0,
            "sgstValue": 0,
            "igstValue": 0,
            "cessValue": 0,
            "cessNonAdvolValue": 400,
            "totInvValue": 0,
            "transporterId": "",
            "transporterName": "",
            "transDocNo": "DOC/123",
            "transMode": "1",
            "transDistance": "0",
            "transDocDate": "06/05/2022",
            "vehicleNo": "PVC1234",
            "vehicleType": "R",
            "itemList": [{
                "productName": "BLAZER-1",
                "productDesc": "BLAZER-1",
                "hsnCode": 4421,
                "quantity": 25,
                "qtyUnit": "NOS",
                "cgstRate": 0,
                "sgstRate": 0,
                "igstRate": 3,
                "cessRate": 3,
                "cessNonadvol": 0,
                "taxableAmount": 5609889
            }]
        });

        fetch(url, {
            method: 'POST',
            headers: headers,
            body: data
        })
        .then(response => response.json())
        .then(data => {
            console.log(data);
        })
        .catch(error => {
            console.error('Error:', error);
        });
    });
</script>

</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/aror4382/eway-einvoice.netbas.in/resources/views/bills/genrate-ewaybill.blade.php ENDPATH**/ ?>