0
我想要把檢查對象到新的數組總價&也做總和/計數我的角/ HTML代碼是:推送經過對象角JS
<div class="panel panel-default" ng-repeat="daysheet in daysheets">
<div class="panel-heading">
<h1 class="panel-title">{{daysheet.charge_client_name}}</h1>
</div>
<div class="panel-body">
<form class="form_{{daysheet.id}}">
<table class="table">
<thead>
<tr>
<th>Qty</th>
<th>Rate</th>
<th>Total</th>
<th>Invoice</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="jobd in daysheet.job_details">
<td style="width: 70px">
<input type="text" name="qty[]" value="{{jobd.product_quantity}}" class="form-control ">
</td>
<td style="width: 80px">
<input type="text" value="{{jobd.job_product_rate}}" name="rate[]" class="form-control " disabled>
</td>
<td>
<input type="text" value="{{jobd.job_product_total_rate}}" name="total[]" ng-model="total" class="form-control total_count">
</td>
<td> //checkbox when user checked show this object amount and push value in new array
<input type="checkbox" name="send_in[]" class="invoice_s_{{daysheet.id}}" ng-model="selectedjob">
</td>
</tr>
<tr>
<td colspan="13">
<p class="pull-right "> Selected joblines Total <u>// select checkbox amount(job_product_total_rate)/sum of all selected checkbox total amount(job_product_total_rate) goes here</u>
</p>
<p class="pull-right "> Total Amount <u class="tot_amt">//total amount goes here</u>
</p>
</td>
</tr>
</tbody>
</table>
</form>
</div>
和API的迴應是:
[
{
"id":"2",
"charge_client_name":"Ridgeway Bank",
"job_details":[
{
"job_id":"4",
"product_quantity":"55",
"job_product_rate":"120",
"job_product_total_rate":"6600",
"distance":"200"
},
{
"job_id":"2",
"product_quantity":"55",
"job_product_rate":"120",
"job_product_total_rate":"6600",
"distance":"12"
}
]
},
{
"id":"1",
"charge_client_name":"Woolworths Market",
"job_details":[
{
"job_id":"1",
"product_quantity":"1200",
"job_product_rate":"1200",
"job_product_total_rate":"1440000",
"distance":"100"
}
]
}]
中,我想顯示如{} job_product_total_rate所有和所有對象的所有金額/總金額,當我們點擊/簽入新的數組複選框推對象值。 預先感謝您
感謝ü它的工作,我想....... –