Subversion Repositories SmartDukaan

Rev

Rev 19771 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<script>
        $(document).ready(function(){
                $('.sendsms').click(function(){
                        var retid = $(this).data('retid')
                        var phone = $('#'+retid).val().trim();
                        var value = true;
                        
                        if(phone != ''){
                                if(phone.match(/^\d{10}$/) == null)
                            {
                                value = false;
                                message = "Invalid contact number";    
                                alert(message);
                            }
                        }

                        if(value){
                                $.ajax({
                                        'url' : "<?php echo $base_url;?>retailers/sendsms?retid="+retid+"&contact="+phone,
                                        'type': "GET"
                                },'json')
                                .done(function(msg){
                                        val = JSON.parse(msg);
                                        if(val['result'] == "success")
                                        {
                                                alert("Sms sent successfully..");
                                                location.reload();
                                        }
                                        else{
                                                alert("Sms sending failed..");
                                        }
                                });
                        }
                        
                });
        });
</script>
<div class="container">
        <div class = "row">
                <div class="col-lg-12 table-responsive">
                        <h2><?php echo __('Verified Retailers'); ?></h2>
        
                                <table cellpadding="0" cellspacing="0" border="1" class="table table-striped" >
                                        <tr>
                                                
                                                <th style="text-align:center">Mobile No.</th>
                                                <th style="text-align:center">Tin</th>
                                                <th style="text-align:center">Address</th>
                                                <th style="text-align:center">City</th>
                                                <th style="text-align:center">State</th>
                                                <th style="text-align:center">If any other number</th>
                                                <th></th>
                                        </tr>
                                
                                        <?php foreach($verified as $pkey => $pvalue):?>
                                        <tr>
                                                <td style="text-align:center"><?php echo $pvalue['Retailer']['contact1'];?></td>
                                                <td style="text-align:center"><?php echo $pvalue['Retailer']['tinnumber'];?></td>
                                                <td style="text-align:center"><?php echo $pvalue['Retailer']['address'];?></td>
                                                <td style="text-align:center"><?php echo $pvalue['Retailer']['city'];?></td>
                                                <td style="text-align:center"><?php echo $pvalue['Retailer']['state'];?></td>
                                                <td style="text-align:center">
                                                                <input type ="text" class = "contact2" id= "<?php echo $pvalue['Retailer']['id'];?>">
                                                </td>
                                                <td style="text-align:center">
                                                        <button type="button" class="btn btn-success btn-xs sendsms" data-retid= "<?php echo $pvalue['Retailer']['id'];?>">Send Sms</button>
                                                </td>
                                        </tr>
                                                
                                        <?php endforeach;?>
                                
                                </table>
                </div>
        </div>
        
</div>