zz - PHP Online
Form of PHP Sandbox
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of zz.php
- <!--begin::Breadcrumb-->
- <ul class="breadcrumb breadcrumb-separatorless fw-semibold fs-base my-1" style="padding-left: 38px;padding-bottom: 11px;">
- <!--begin::Item-->
- <li class="breadcrumb-item text-gray-500">
- <a href="<?=base_url(); ?>master" class="text-gray-500 text-hover-primary"> Home </a>
- </li>
- <!--end::Item-->
- <!--begin::Item-->
- <li class="breadcrumb-item">
- <span class="text-gray-500">/</span>
- </li>
- <!--end::Item-->
- <!--begin::Item-->
- <li class="breadcrumb-item text-gray-500"> Apps </li>
- <!--end::Item-->
- <!--begin::Item-->
- <li class="breadcrumb-item">
- <span class="text-gray-500">/</span>
- </li>
- <!--end::Item-->
- <!--begin::Item-->
- <li class="breadcrumb-item text-gray-500">
- <a href="<?=base_url(); ?>master/employee" class="text-gray-500 text-hover-primary">Order</a>
- </li>
- <!--end::Item-->
- <!--begin::Item-->
- <li class="breadcrumb-item">
- <span class="text-gray-500">/</span>
- </li>
- <!--end::Item-->
- <!--begin::Item-->
- <li class="breadcrumb-item text-gray-500"> add-ons Add</li>
- <!--end::Item-->
- </ul>
- <!--end::Breadcrumb-->
- <?php
- $this->db->select('oh.id as order_id,oh.*,c.*');
- $this->db->from("order_header as oh");
- $this->db->join("customer as c","c.id=oh.customer_id");
- $this->db->where("oh.id",$id);
- $this->db->where("oh.status",1);
- $this->db->where("oh.status_id",2);
- $headedata=$this->db->get()->row();
- $this->db->select('od.*,ogd.*,odd.*');
- $this->db->from("order_detail_group_det as ogd");
- $this->db->join("order_detail_det as odd","ogd.order_detail_det_id=odd.id");
- $this->db->join("order_details as od","ogd.order_detail_id=od.id");
- $this->db->where("od.status",1);
- $this->db->where("od.order_header_id",$headedata->id);
- $detailsdata=$this->db->get();
- ?>
- <!--begin::Content-->
- <div id="kt_app_content" class="app-content flex-column-fluid " >
- <!--begin::Content container-->
- <div id="kt_app_content_container" class="app-container container-fluid ">
- <!--begin::Layout-->
- <div class="d-flex flex-column flex-lg-row">
- <!--begin::Content-->
- <div class="flex-lg-row-fluid mb-10 mb-lg-0 me-lg-7 me-xl-10">
- <!--begin::Card-->
- <div class="card">
- <!--begin::Card body-->
- <div class="card-body p-12">
- <!--begin::Form-->
- <form id="submitForm" name="addform" action="<?php echo base_url();?>welcome/addonsAction" method="post" enctype="multipart/form-data" >
- <!--begin::Wrapper-->
- <div class="d-flex flex-column align-items-start flex-xxl-row">
- <div class="row">
- <!-- <div class="col-lg-6" style="width:100%;">
- <a href="<?=base_url();?>Master" class="btn btn-primary"><i class="glyphicon glyphicon-home"></i></a>
- </div> -->
- <div class="col-lg-6" style="width:100%;">
- <span class="fs-2x fw-bold text-gray-800">Add-ons/specifications</span>
- </div>
- </div>
- </div>
- <!--end::Top-->
- <!--begin::Separator-->
- <div class="separator separator-dashed my-10"></div>
- <!--end::Separator-->
- <!--begin::Wrapper-->
- <div class="mb-0">
- <div class="row gx-10 mb-5">
- <!--begin::Col-->
- <div class="col-lg-6">
- <label class="form-label fs-6 fw-bold text-gray-700 mb-3">
- <p class="addpara">Order Number</p>
- </label>
- <!--begin::Input group-->
- <div class="mb-5" style="margin-top: -16px;">
- <input name="order_no" id="order_no" value="<?=$headedata->order_id ?>"required="" type="text" class="form-control " readonly>
- <input name="header_id" id="header_id" value="<?=$headedata->order_id ?>"required="" type="hidden" class="form-control " readonly>
- </div>
- <!--end::Input group-->
- </div>
- <div class="col-lg-6">
- <label class="form-label fs-6 fw-bold text-gray-700 mb-3">
- <p class="addpara">Group Number</p>
- </label>
- <!--begin::Input group-->
- <div class="mb-5" style="margin-top: -16px;">
- <input name="order_no" id="order_no" value="<?=$headedata->order_id ?>"required="" type="text" class="form-control " readonly>
- </div>
- <!--end::Input group-->
- </div>
- </div>
- <!--begin::Row-->
- <div class="row gx-10 mb-5">
- <!--begin::Col-->
- <div class="col-lg-6">
- <label class="form-label fs-6 fw-bold text-gray-700 mb-3">
- <p class="addpara">Compay Name</p>
- </label>
- <!--begin::Input group-->
- <div class="mb-5" style="margin-top: -16px;">
- <input name="companyname" id="companyname" value="<?=$headedata->company_name ?>" required="" type="text" class="form-control " readonly >
- </div>
- <!--end::Input group-->
- </div>
- </div>
- </div>
- <?php
- $this->db->select('*');
- $this->db->from('gender_master');
- $this->db->where('status',1);
- $genderdetails=$this->db->get();
- $this->db->select('*');
- $this->db->from('yarn_count');
- $this->db->where('status',1);
- $yarncount=$this->db->get();
- $this->db->select('*');
- $this->db->from('product');
- $this->db->where('status',1);
- $styledetails=$this->db->get();
- $this->db->select('*');
- $this->db->from('sleeve_master');
- $this->db->where('status',1);
- $sleevdetails=$this->db->get();
- $this->db->select('*');
- $this->db->from('sizegroup_master');
- $this->db->where('status',1);
- $size=$this->db->get();
- $this->db->select('*');
- $this->db->from('brand');
- $this->db->where('status',1);
- $brand=$this->db->get();
- $this->db->select('*');
- $this->db->from('color_details');
- $this->db->where('status',1);
- $color_details=$this->db->get();
- $this->db->select('*');
- $this->db->from('fabricant_master');
- $this->db->where('status',1);
- $fabricant_master=$this->db->get();
- ?>
- <div class="" style="overflow-x:scroll" >
- <table id="example1" class="table table-striped table-bordered " cellspacing="0" style="padding-top:0%;max-width:none !important;width:200% !important">
- <thead>
- <tr >
- <th width="10px"class="tdtexts">SNO</th>
- <th width="100px" class="tdtexts">GROUP NO</th>
- <th width="100px" class="tdtexts">COUNT</th>
- <th width="100px" class="tdtexts">STYLE</th>
- <th width="100px" class="tdtexts">FABRICANT</th>
- <th width="100px"class="tdtexts">SLEEVE</th>
- <th width="100px" class="tdtexts">RATIO</th>
- <th width="100px" class="tdtexts">PHOTO</th>
- <th width="100px" class="tdtexts">BRAND</th>
- <th width="100px" class="tdtexts" >SIZE</th>
- <th width="100px" class="tdtexts" >BDL</th>
- <th width="100px" class="tdtexts" >PCS</th>
- <th width="100px" class="tdtexts" >TOTAL PCS</th>
- <th width="100px" class="tdtexts" >GRMS</th>
- <th width="100px" class="tdtexts" >TOTAL KGS</th>
- <th width="100px" class="tdtexts">KD</th>
- <th width="100px" class="tdtexts">FD</th>
- <th width="100px" class="tdtexts">KGS</th>
- <th width="100px" class="tdtexts">ROLL</th>
- <th width="100px" class="tdtexts">T/W</th>
- <th width="100px" class="tdtexts">SH</th>
- </tr>
- </thead>
- <?PHP $sno=1; ?>
- <tbody class="table-bordered" id="addrow">
- <?php foreach($detailsdata->result() as $row) { ?>
- <tr id="mainrow_<?=$sno?>" class="mainrow">
- <td class="tdtexts" style="padding-top:20px;width:100px;" id="tdrow_<?=$sno?>"><?=$sno?>
- <input type="hidden" style="width:100%;" value="<?=$row->id ?>" required="true" name="items[<?=$sno?>][detailid]" id="detailid_<?=$sno ?>" class="form-control inputleft detailid" /></td>
- <input type="hidden" style="width:100%;" value="<?=$sno ?>" required="true" name="items[<?=$sno?>][sno]" id="sno_<?=$sno ?>" class="form-control inputleft sno" /></td>
- <!-- <td class="tdtexts" >
- <select id="gender_<?=$sno?>" name="items[<?=$sno?>][gender]" class="form-control chosen-select gender" readonly />
- <option value="">Select Gender</option>
- <?php foreach($genderdetails->result() as $rows){
- if($row->gender_id==$rows->id) {?>
- <option value="<?=$rows->id ?>" selected ><?=$rows->name ?></option>
- <?php } else { ?>
- <option value="<?=$rows->id ?>" ><?=$rows->name ?></option>
- <?php } } ?>
- </select>
- </td>-->
- <td class="tdtexts" style="padding-top:20px;width:100px;" id="tdrow_<?=$sno?>"><?=$row->group_no?> </td>
- <td class="tdtexts" >
- <select id="count_<?=$sno?>" name="items[<?=$sno?>][count]" class="form-control chosen-select count" readonly />
- <option value="">Select count</option>
- <?php foreach($yarncount->result() as $rows){
- if($row->yarn_count_id==$rows->id) {?>
- <option value="<?=$rows->id ?>" selected ><?=$rows->yarn_count ?></option>
- <?php } else { ?>
- <option value="<?=$rows->id ?>" ><?=$rows->yarn_count ?></option>
- <?php } } ?>
- </select>
- </td>
- <td class="tdtexts" >
- <select id="style_<?=$sno?>" name="items[<?=$sno?>][style]" class="form-control chosen-select style" readonly />
- <option value="">Select style</option>
- <?php foreach($styledetails->result() as $rows){
- if($row->style_id==$rows->id) {?>?>
- <option value="<?=$rows->id ?>" selected ><?=$rows->name ?></option>
- <?php } else { ?>
- <option value="<?=$rows->id ?>" ><?=$rows->name ?></option>
- <?php } } ?>
- </select>
- </td>
- <td class="tdtexts" >
- <select id="fabricant_<?=$sno?>" name="items[<?=$sno?>][fabricant]" class="form-control chosen-select fabricant" />
- <option value="0">Select Fabricant</option>
- <?php foreach($fabricant_master->result() as $rows){
- if($row->fabricant_id==$rows->id){
- ?>
- <option value="<?=$rows->id ?>" selected ><?=$rows->fabricant_name ?></option>
- <?php } } ?>
- </select>
- </td>
- <td class="tdtexts" >
- <select id="sleeve_<?=$sno?>" name="items[<?=$sno?>][sleeve]" class="form-control chosen-select sleeve" readonly />
- <option value="">Select sleeve</option>
- <?php foreach($sleevdetails->result() as $rows){
- if($row->sleeve_id==$rows->id) {?>?> ?>
- <option value="<?=$rows->id ?>" selected ><?=$rows->name ?></option>
- <?php } else { ?>
- <option value="<?=$rows->id ?>" ><?=$rows->name ?></option>
- <?php } } ?>
- </select>
- </td>
- <td Style="display: flex" class="tdtexts" >
- <input id="ratio_<?=$sno ?>" name="items[<?=$sno ?>][ratio]" type="text" class="form-control" value="<?=number_format($row->actual_ratio,0) ?>" required readonly />
- <label Style="text-align:center;padding-top:5px">:</label>
- <input id="totalratio_<?=$sno ?>" name="items[<?=$sno ?>][totalratio]" type="text" class="form-control" value=" <?=number_format($row->total_ratio,0) ?>" required readonly />
- </td>
- <td class="tdtexts" >
- <img id="frame_<?=$sno ?>" src="<?=base_url(); ?>uploads/orders/<?=$row->image ?>" width="100px" height="100px"/>
- </td>
- <td class="tdtexts" >
- <select id="brand_<?=$sno?>" name="items[<?=$sno?>][brand]" class="form-control chosen-select brand" />
- <option value="0">Select Brand</option>
- <?php foreach($brand->result() as $rows){
- if($row->brand_id==$rows->id){
- ?>
- <option value="<?=$rows->id ?>" selected ><?=$rows->name ?></option>
- <?php } } ?>
- </select>
- </td>
- <?php
- $this->db->select("*");
- $this->db->from("order_detail_det");
- $this->db->where("status",1);
- $this->db->where("id",$row->order_detail_det_id);
- $details=$this->db->get()->row();
- ?>
- <td align="center" >
- <table id="example2">
- <tbody id="addsubrow111">
- <?php $maxsizeid=0;
- $this->db->select("s.*");
- $this->db->from("sizegroup_mapping as sg");
- $this->db->join("size_details as s","sg.size_id=s.id");
- $this->db->where("sg.status",1);
- $this->db->where("s.status",1);
- $this->db->where("sg.group_id",$details->size_group_id);
- $sizegroup=$this->db->get();
- ?>
- <tr id="subrow" class="subrow">
- <td class="tdtexts" >
- <?php foreach($sizegroup->result() as $row2) {
- $maxsizeid=$row2->id; ?>
- <?=$row2->size_name ?>
- <?php } ?>
- </td>
- </tr>
- </tbody>
- </table>
- </td>
- </td>
- <td class="tdtexts" >
- <input id="bundle_<?=$sno ?>" name="items[<?=$sno ?>][bundle]" style="text-align:center" type="text" class="form-control bundle" value="<?=$row->bundle ?>" required readonly />
- </td>
- <td class="tdtexts" >
- <input id="bundleqty_<?=$sno ?>" name="items[<?=$sno ?>][bundleqty]" style="text-align:center" type="text" class="form-control bundle" value="<?=$row->quantity/$row->bundle ?>" required readonly />
- </td>
- <td class="tdtexts" >
- <input id="totalqty_<?=$sno ?>" name="items[<?=$sno ?>][totalqty]" style="text-align:center" type="text" class="form-control bundle" value="<?=$row->quantity ?>" required readonly />
- </td>
- <?php
- //fabricant calculation
- $totalsize=0;
- $totalweight=0;
- $actualweight=0;
- $this->db->select("aod.*");
- $this->db->from("order_add_ons_detail_det as aod");
- $this->db->where("aod.status",1);
- $this->db->where("aod.detail_id",$row->order_detail_id);
- $fmdetails=$this->db->get();
- // print_r($this->db->last_query());
- foreach($fmdetails->result() as $aod)
- {
- $this->db->select("sg.*");
- $this->db->from("sizegroup_mapping as sg");
- $this->db->where("sg.status",1);
- $this->db->where("sg.group_id",$details->size_group_id);
- $sizedetails=$this->db->get();
- foreach($sizedetails->result() as $size)
- {
- $this->db->select("fmd.*");
- $this->db->from("fabricant_mapping_master as fmd");
- $this->db->where("fmd.status",1);
- $this->db->where("fmd.sleeve_id",$aod->sleeve_id);
- $this->db->where("fmd.style_id",$row->style_id);
- $this->db->where("fmd.size_id",$size->size_id);
- $this->db->where("fmd.gender_id",$row->gender_id);
- $this->db->where("fmd.count_id",$row->yarn_count_id);
- $getfab_details=$this->db->get()->row();
- //print_r($this->db->last_query());
- if(!empty($getfab_details))
- {
- $totalweight +=$getfab_details->weight;
- }
- $totalsize++;
- }
- }
- $actualweight=$totalweight;
- $totalweight=number_format($actualweight*$row->quantity,0);
- ?>
- <td class="tdtexts" >
- <input id="fabricantweight_<?=$sno ?>" name="items[<?=$sno ?>][fabricantweight]" style="text-align:center" type="text" class="form-control bundle" value="<?=number_format($actualweight,3) ?>" required readonly />
- </td>
- <td class="tdtexts" >
- <input id="totalweight_<?=$sno ?>" name="items[<?=$sno ?>][totalweight]" style="text-align:center" type="text" class="form-control totalweight" value="<?=number_format($totalweight,0) ?>" required readonly />
- </td>
- <?php
- $totalcolor=0;
- $roundweight=0;
- $indivualcolorweight=0;
- $actualrollweight=0;
- $actualroll=0;
- $rondremaider=0;
- $this->db->select("aoc.detail_id,count('aoc.id')as no_fo_color");
- $this->db->from("order_color_detail_det as aoc");
- $this->db->where("aoc.status",1);
- $this->db->where("aoc.detail_id",$row->order_detail_id);
- $this->db->group_by('aoc.detail_id');
- $coloretails=$this->db->get()->row();
- if(!empty($coloretails))
- {
- $totalcolor=$coloretails->no_fo_color;
- }
- $rondremaider=$totalweight%$totalcolor;
- if($rondremaider !=0)
- {
- $roundweight=$totalweight+($totalcolor-$rondremaider);
- }
- else
- {
- $roundweight=$totalweight;
- }
- $indivualcolorweight=$roundweight/$totalcolor;
- $this->db->select('*');
- $this->db->from('fabricant_master');
- $this->db->where('status',1);
- $this->db->where('id',$row->fabricant_id);
- $fabricant=$this->db->get()->row();
- if(!empty($fabricant))
- {
- if($fabricant->fixed_roll_weight==0)
- {
- if($indivualcolorweight>=40)
- {
- $remaider=array();
- $minremainder=0;
- for($i=20;29>=$i;$i++)
- {
- $re=$indivualcolorweight%$i;
- array_push($remaider,$re);
- }
- $minremainder=min($remaider);
- if($minremainder !=0)
- {
- for($i=20;29>=$i;$i++)
- {
- $re=$indivualcolorweight%$i;
- if($re==$minremainder)
- {
- $actualrollweight=$i;
- }
- }
- // echo $roundweight;
- // echo '</br>';
- // echo $rondremaider;
- // echo '</br>';
- // echo $indivualcolorweight;
- // echo '</br>';
- // echo $minremainder;
- $roll=($indivualcolorweight -$minremainder)/$actualrollweight;
- $actualroll=$roll;
- //if($actualrollweight<30)
- //{
- $actualrollweight=$actualrollweight+1;
- //}
- }
- else
- {
- for($i=20;30>=$i;$i++)
- {
- $re=$indivualcolorweight%$i;
- if($re==$minremainder)
- {
- $actualrollweight=$i;
- }
- }
- $roll=($indivualcolorweight )/$actualrollweight;
- $actualroll=$roll;
- }
- }
- else if($indivualcolorweight<=39 && $indivualcolorweight>=31 )
- {
- $remaider=array();
- $minremainder=0;
- for($i=15;19>=$i;$i++)
- {
- $re=$indivualcolorweight%$i;
- array_push($remaider,$re);
- }
- $minremainder=min($remaider);
- //echo $minremainder;
- if($minremainder !=0)
- {
- for($i=15;19>=$i;$i++)
- {
- $re=$indivualcolorweight%$i;
- if($re==$minremainder)
- {
- $actualrollweight=$i+1;
- }
- }
- $actualroll=2;
- }
- else
- {
- for($i=15;19>=$i;$i++)
- {
- $re=$indivualcolorweight%$i;
- if($re==$minremainder)
- {
- $actualrollweight=$i;
- }
- }
- $actualroll=2;
- }
- }
- else if($indivualcolorweight<=30 && $indivualcolorweight>=20)
- {
- $actualrollweight=$indivualcolorweight;
- $actualroll=1;
- }
- else if($indivualcolorweight<=19 && $indivualcolorweight>=10)
- {
- $actualrollweight=$indivualcolorweight;
- $actualroll=1;
- }
- else
- {
- $actualrollweight=10;
- $actualroll=1;
- }
- }
- else
- {
- if($indivualcolorweight>$fabricant->fixed_roll_weight)
- {
- $re=$indivualcolorweight%$fabricant->fixed_roll_weight;
- if($re!=0)
- {
- $actualrollweight=$fabricant->fixed_roll_weight;
- $addre=$fabricant->fixed_roll_weight-$re;
- $actualroll=($indivualcolorweight+$addre)/$fabricant->fixed_roll_weight;
- }
- else
- {
- $actualrollweight=$fabricant->fixed_roll_weight;
- $actualroll=$indivualcolorweight/$fabricant->fixed_roll_weight;
- }
- }
- else
- {
- $actualrollweight=$fabricant->fixed_roll_weight;
- $actualroll=1;
- }
- }
- }
- ?>
- <td class="tdtexts" >
- <input id="kd_<?=$sno ?>" name="items[<?=$sno ?>][kd]" style="text-align:center" type="text" class="form-control kd" value="" required />
- </td>
- <td class="tdtexts" >
- <input id="fd_<?=$sno ?>" name="items[<?=$sno ?>][fd]" style="text-align:center" type="text" class="form-control fd" value="" required />
- </td>
- <td class="tdtexts" >
- <input id="kgs_<?=$sno ?>" name="items[<?=$sno ?>][kgs]" style="text-align:center" type="text" class="form-control kgs" value="<?=$actualrollweight ?>" required />
- </td>
- <td class="tdtexts" >
- <input id="roll_<?=$sno ?>" name="items[<?=$sno ?>][roll]" style="text-align:center" type="text" class="form-control roll" value="<?=$actualroll*$totalcolor ?>" required />
- </td>
- <td class="tdtexts" >
- <input id="totalrollwight_<?=$sno ?>" name="items[<?=$sno ?>][totalrollweight]" style="text-align:center" type="text" class="form-control totalroll" value="<?=($actualroll*$totalcolor)*$actualrollweight ?>" required />
- </td>
- <td class="tdtexts" >
- <input id="sh_<?=$sno ?>" name="items[<?=$sno ?>][sh]" style="text-align:center" type="text" class="form-control sh" value="<?=(($actualroll*$totalcolor)*$actualrollweight)-$totalweight?> " required />
- </td>
- </tr>
- <?php $sno++; } ?>
- </tbody>
- </table>
- </div>
- <div class="col-sm-12" style="text-align:right" >
- <input type="button" value="Return" class="btn btn-info" id="btnReturn" style="border: none;padding: 10px;">
- <input type="button" value="Submit" class="btn btn-primary" id="submit" style="border: none;padding: 10px;">
- </div>
- </form>
- </div>
- </div>
- <script>
- $(document).on('click','#btnReturn',function (e){
- window.location.href = "<?=base_url()?>Welcome/specification_view";
- });
- $(document).on('click','.addProduct',function(){
- //alert("bv");
- id_attr=$(this).attr('id');
- elementid=id_attr.split('_');
- id=parseInt(elementid[1]);
- AddProductRow(id);
- });
- function AddProductRow(id)
- {
- //alert("bv");
- var id_attr=elementid='';
- var max=value=0;
- $('.mainrow').each(function(){
- id_attr=$(this).attr('id');
- elementid=id_attr.split('_');
- id=parseInt(elementid[1]);
- if(id>max)
- max=id;
- });
- rowCount=max+1;
- //alert(rowCount);
- var rowCount2=1;
- // var markup=' <tr id="mainrow_'+rowCount+'" class="mainrow">';
- // markup+='<td class="tdtexts" style="padding-top:20px;width:100px;" id="tdrow_'+rowCount+'">'+rowCount+'';
- // markup+='<input type="hidden" style="width:100%;" value="'+rowCount+'" required="true" name="items['+rowCount+'][sno]" id="sno_'+rowCount+'" class="form-control inputleft sno" /></td>';
- // markup+='<td class="tdtexts" >';
- // markup+='<select id="gender_'+rowCount+'" name="items['+rowCount+'][gender]" class="form-control chosen-select gender" />';
- // markup+='<option value="">Select Gender</option>';
- // markup+='<?php foreach($genderdetails->result() as $rows){ ?>';
- // markup+='<option value="<?=$rows->id ?>" ><?=$rows->name ?></option>';
- // markup+='<?php } ?>';
- // markup+='</select>';
- // markup+='</td>';
- // markup+='<td class="tdtexts" >';
- // markup+='<select id="count_'+rowCount+'" name="items['+rowCount+'][count]" class="form-control chosen-select count" />';
- // markup+='<option value="">Select count</option>';
- // markup+='<?php foreach($yarncount->result() as $rows){ ?>';
- // markup+='<option value="<?=$rows->id ?>" ><?php echo str_replace("'","",$rows->yarn_count) ?></option>';
- // markup+='<?php } ?>';
- // markup+='</select>';
- // markup+='</td>';
- // markup+='<td class="tdtexts" >';
- // markup+='<select id="style_'+rowCount+'" name="items['+rowCount+'][style]" class="form-control chosen-select style" />';
- // markup+='<option value="">Select style</option>';
- // markup+='<?php foreach($styledetails->result() as $rows){ ?>';
- // markup+='<option value="<?=$rows->id ?>" ><?=$rows->name ?></option><?php } ?></select> </td>';
- // markup+='<td class="tdtexts" >';
- // markup+='<select id="sleeve_'+rowCount+'" name="items['+rowCount+'][sleeve]" class="form-control chosen-select sleeve" />';
- // markup+='<option value="">Select sleeve</option>';
- // markup+='<?php foreach($sleevdetails->result() as $rows){ ?>';
- // markup+='<option value="<?=$rows->id ?>" ><?php echo str_replace("'","",$rows->name) ?></option>';
- // markup+='<?php } ?>';
- // markup+='</select>';
- // markup+='</td>';
- // markup+='<td align="center" > ';
- // markup+='<table id="example2_'+rowCount+'">';
- // markup+='<tbody id="addsubrow">';
- // markup+='<tr id="subrow_'+rowCount+'_'+rowCount2+'" class="subrow_'+rowCount+'">';
- // markup+='<td class="tdtexts" >';
- // markup+='<select name="items2['+rowCount+']['+rowCount2+'][size]" id="size_'+rowCount+'_'+rowCount2+'" class="form-control inputright sizegroup calculateAllValue customvalidblur custom-select ">';
- // markup+='<option value="0">select size</option>';
- // markup+=' </select></td>';
- // markup+='<td class="tdtexts" > ';
- // markup+='<a class="addSubProduct btn-sm btn-success btn-inline " id="insert_'+rowCount+'_'+rowCount2+'"style="margin-top:0px;" ><i class="glyphicon glyphicon-plus"></i></a>';
- // markup+='<a class="removeSubProduct btn-sm btn-danger btn-inline" id="delete_'+rowCount+'_'+rowCount2+'" style="margin-top:0px;" ><i class="glyphicon glyphicon-remove"></i></a>';
- // markup+='</td></tr> </tbody></table></td></td>';
- // markup+='<td Style="display: flex" class="tdtexts" >';
- // markup+='<input id="ratio_'+rowCount+'" name="items['+rowCount+'][ratio]" type="text" class="form-control" value="" required />';
- // markup+='<label Style="text-align:center;padding-top:5px">:</label>';
- // markup+='<input id="totalratio_'+rowCount+'" name="items['+rowCount+'][totalratio]" type="text" class="form-control totalratio" value=" " required value="" /></td>';
- // markup+='<td class="tdtexts" >';
- // markup+='<input id="bundal_'+rowCount+'" name="items['+rowCount+'][bundle]" style="text-align:center" type="text" class="form-control bundal" value="" required value="" />';
- // markup+='</td>';
- // markup+='<td class="tdtexts" >';
- // markup+='<a class="addProduct btn-sm btn-success btn-inline " id="insert_'+rowCount+'"style="margin-top:0px;" ><i class="glyphicon glyphicon-plus"></i></a>';
- // markup+='<a class="removeProduct btn-sm btn-danger btn-inline " id="delete_'+rowCount+'" style="margin-top:9px;" ><i class="glyphicon glyphicon-remove"></i></a>';
- // markup+='</td>';
- // markup+='</tr>';
- // $("#addrow").append(markup);
- // loadsizegroup(rowCount,rowCount2);
- //$('#style_'+rowCount).focus();
- }
- $(document).on("click",".removeProduct",function(){
- id_arr = $(this).attr('id');
- element_id = id_arr.split("_");
- id = element_id[1];
- $(this).parent().parent().remove();
- });
- $(document).on('click','.addSubProduct',function(){
- id_attr=$(this).attr('id');
- elementid=id_attr.split('_');
- id=parseInt(elementid[1]);
- addSubProduct(id);
- });
- function addSubProduct(id)
- {
- var id_attr=elementid='';
- var max=value=0;
- $('.subrow_'+id).each(function(){
- id_attr=$(this).attr('id');
- elementid=id_attr.split('_');
- id2=parseInt(elementid[2]);
- if(id2>max)
- max=id2;
- });
- rowCount=max+1;
- markup='<tr id="subrow_'+id+'_'+rowCount+'" class="subrow_'+id+' tdtexts" >';
- markup+='<td > ';
- markup+='<select name="items2['+id+']['+rowCount+'][addons]" id="addons_'+id+'_'+rowCount+'" class="form-control inputright addons calculateAllValue customvalidblur custom-select ">';
- markup+='<option value="0">select</option>';
- markup+='<?php foreach($sleevdetails->result() as $row){ ?><option value="<?=$row->id ?>"><?= str_replace("'","",$row->name) ?></option>';
- markup+='<?php } ?>';
- markup+='</select>';
- markup+='</td>';
- markup+='<td >';
- markup+='<a class="addSubProduct btn-sm btn-success btn-inline " id="insert_'+id+'_'+rowCount+'"style="margin-top:0px;" ><i class="glyphicon glyphicon-plus"></i></a>';
- markup+='<a class="removeSubProduct btn-sm btn-danger btn-inline" id="delete_'+id+'_'+rowCount+'" style="margin-top:0px;" ><i class="glyphicon glyphicon-remove"></i></a>';
- markup+='</td>';
- markup+='</tr>';
- $(markup).insertAfter('#subrow_'+id+'_'+max);
- //loadsizegroup(id,rowCount);
- }
- $(document).on("click",".removeSubProduct",function(){
- id_arr = $(this).attr('id');
- element_id = id_arr.split("_");
- id = element_id[1];
- $(this).parent().parent().remove();
- });
- $(document).on('click','.addSubProduct1',function(){
- id_attr=$(this).attr('id');
- elementid=id_attr.split('_');
- id=parseInt(elementid[1]);
- addSubProduct1(id);
- });
- function addSubProduct1(id)
- {
- var id_attr=elementid='';
- var max=value=0;
- $('.csubrow_'+id).each(function(){
- id_attr=$(this).attr('id');
- elementid=id_attr.split('_');
- id2=parseInt(elementid[2]);
- if(id2>max)
- max=id2;
- });
- rowCount=max+1;
- markup='<tr id="csubrow_'+id+'_'+rowCount+'" class="csubrow_'+id+' tdtexts" >';
- markup+='<td > ';
- markup+='<select name="items3['+id+']['+rowCount+'][color]" id="color_'+id+'_'+rowCount+'" class="form-control inputright color calculateAllValue customvalidblur custom-select ">';
- markup+='<option value="0">select</option>';
- markup+='<?php foreach($color_details->result() as $row){ ?><option value="<?=$row->id ?>"><?= str_replace("'","",$row->color_name) ?></option>';
- markup+='<?php } ?>';
- markup+='</select>';
- markup+='</td>';
- markup+='<td >';
- markup+='<a class="addSubProduct1 btn-sm btn-success btn-inline " id="insert_'+id+'_'+rowCount+'"style="margin-top:0px;" ><i class="glyphicon glyphicon-plus"></i></a>';
- markup+='<a class="removeSubProduct btn-sm btn-danger btn-inline" id="delete_'+id+'_'+rowCount+'" style="margin-top:0px;" ><i class="glyphicon glyphicon-remove"></i></a>';
- markup+='</td>';
- markup+='</tr>';
- $(markup).insertAfter('#csubrow_'+id+'_'+max);
- //loadsizegroup(id,rowCount);
- }
- $(document).on('click','#submit',function (e){
- if(flag=commonArrayValidation())
- {
- //alert(flag);
- $('#submit').prop('disabled',true);
- var form = $('form')[0]; // You need to use standart javascript object here
- var formData = new FormData(form);
- var url=form.action;
- $.ajax({
- url:url,
- type:'POST',
- data:formData,
- contentType:false,
- cache:false,
- processData:false,
- dataType:'json',
- success:function(result)
- {
- //alert("Order Successfull Saved....");
- console.log(result);
- //showMessage(result.message);
- if(result.status==200)
- {
- alert(result.message,result.status);
- $('#sequenceNumber').val(result.sequenceNumber);
- $('#submit').prop('disabled',true);
- }
- else
- {
- alert(result.message,result.status);
- $('#submit').prop('disabled',false);
- }
- },
- error:function(result){
- alert('Server Error');
- $('#submit').prop('disabled',false);
- }
- });
- }
- });
- function commonArrayValidation()
- {
- flag=true;
- $('.mainrow').each(function(){
- var id_arr = $(this).attr('id');
- var element_id = id_arr.split("_");
- var id = element_id[1];
- brad=$('#brand_'+id).val();
- if(brad==0)
- {
- $('#brand_'+id).css('border','2px solid red');
- flag=false;
- //return false;
- }
- $('.subrow_'+id).each(function()
- {
- var id_arr = $(this).attr('id');
- var element_id = id_arr.split("_");
- var id1 = element_id[2];
- addons=parseFloat($('#addons_'+id+'_'+id1).val());
- if(addons==0)
- {
- $('#addons_'+id+'_'+id1).css('border','2px solid red');
- flag=false;
- return flag;
- }
- });
- $('.csubrow_'+id).each(function()
- {
- var id_arr = $(this).attr('id');
- var element_id = id_arr.split("_");
- var id1 = element_id[2];
- color=parseFloat($('#color_'+id+'_'+id1).val());
- if(color==0)
- {
- $('#color_'+id+'_'+id1).css('border','2px solid red');
- flag=false;
- return flag;
- }
- });
- });
- return flag;
- }
- </script>