
<div class="content-wrapper" ng-if="!myAccess.allocationEdit">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-6 offset-sm-1 offset-md-2 offset-lg-3 mt-5">
                <div class="alert alert-warning alert-dismissible">
                    <h5><i class="icon fas fa-ban"></i> Warning!</h5>
                    Unauthorised Access.
                </div>
            </div>
        </div>
    </div>
</div>
<div class="content-wrapper" class="modal-demo" ng-if="myAccess.allocationEdit">
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="text-purple">
                        <go-back/>
                        <i class="fas fa-table"></i> Allocation Update
                    </h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a ng-href="{{baseurl}}/dashboard">Home</a></li>
                        <li class="breadcrumb-item"><a ng-href="#" ng-click="goToSelf('projectView',{projectid:allocation.proj_id})">Projects</a></li>
                        <li class="breadcrumb-item active">View</li>
                    </ol>
                </div>
            </div>
        </div>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-md-6">
                <div class="card card-outline card-success">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-12 col-md-12 col-lg-12">
                                <div class="form-group">
                                    <label>Project:</label>
                                    <input type="text" class="form-control disabled" disabled ng-value="allocation.proj_name">
                                </div>
                                <div class="form-group">
                                    <label>Hero:</label>
                                    <input type="text" class="form-control disabled" disabled ng-value="allocation.emp_first_name+' '+allocation.emp_last_name">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="card card-outline card-success">
                    <div class="card-body">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label>Hero:</label>
                                <input type="text" class="form-control disabled" disabled ng-value="allocation.emp_first_name+' '+allocation.emp_last_name">
                            </div>
                            <div class="form-group">
                                <label for="willActAs">Will act as</label>
                                <select id="willActAs" class="form-control custom-select"
                                        ng-model="allocation.willActAs" ng-options="ps.id as ps.desg_name for ps in designationOptions">
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="line_mngr_id">Manager</label>
                                <select id="line_mngr_id" class="form-control custom-select" 
                                        ng-model="allocation.line_mngr_id" ng-options="l.employeeid as (l.emp_first_name+' '+l.emp_last_name) for l in managers">
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="proj_mngr_id">Project Manager</label>
                                <select id="proj_mngr_id" class="form-control custom-select"
                                        ng-model="allocation.proj_mngr_id" ng-options="l.employeeid as (l.emp_first_name+' '+l.emp_last_name) for l in managers">
                                </select>
                            </div>
                            <!--<div class="form-group">
                                <div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
                                    <input type="checkbox" ng-model="allocation.isBillable" class="custom-control-input" id="customSwitch1">
                                    <label class="custom-control-label" for="customSwitch1">Is Billable</label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="billingRatio">Allocation Ratio</label>
                                <select id="billingRatio" class="form-control custom-select"
                                        ng-model="allocation.billingRatio" ng-options="l.value as l.label for l in billingRatioOption">
                                </select>
                            </div>-->
                            <div class="form-group">
                                <label for="billableHours"><i class="fas fa-rupee-sign"></i> Billable Hours</label>
                                <input ng-model="allocation.billableHours" min="0" type="number" id="billableHours" class="form-control" placeholder="Billable Hours">
                            </div>
                            <div class="form-group">
                                <label for="totalHours">Total Hours ( <i class="fas fa-rupee-sign"></i> Billable Hours <i class="fas fa-plus"></i> Non-Billable Hours )</label>
                                <input ng-model="allocation.partialHours" min="{{allocation.billableHours}}" type="number" id="totalHours" class="form-control" placeholder="Total Hours">
                            </div>
                            <div class="form-group">
                                <label for="fromDate">Date of Assignment</label>
                                <input id="fromDate" type=text date-picker
                                       placeholder='DD-MM-YYYY'
                                       dateformat='dd-mm-yy'
                                       maxlength="10"
                                       ng-required='true'
                                       class='form-control'
                                       ng-model='allocation.fromDate'>
                            </div>
                            <div class="form-group">
                                <label for="emp_allocation_type">Allocation Type</label>
                                <select id="emp_allocation_type" class="form-control custom-select"
                                        ng-model="allocation.emp_allocation_type" ng-options="l.value as l.label for l in emp_allocation_type" ng-change="checkBilling(allocation.emp_allocation_type)">
                                </select>
                            </div>
                            <!-- <div class="form-group" ng-if="billingCondition"> 
                                <label for="emp_allocation_type">Billing Type</label> 
                                <select id="emp_allocation_type" class="form-control custom-select" ng-model="allocation.billing_type" ng-options="l.value as l.label for l in billing_type"> 
                                </select> 
                            </div>  -->
                            <div class="form-group" ng-if="billingCondition"> 
                                <label for="billing_rate"><i class="fas fa-rupee-sign"></i> Billing Rate</label> 
                                <input ng-model="allocation.billing_rate" min="0" type="number" id="billing_rate" class="form-control" placeholder="Hourly Rate"> 
                            </div>
                            <div class="form-group">
                                <label for="profile_id">Billing As Profile</label>
                                <select ng-model="allocation.profile_id" class="form-control">
                                    <option value="0">--None--</option>
                                    <option ng-repeat="dec in forecastProfile" value="{{dec.id}}">
                                        {{dec.name}}
                                    </option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-12">
                <button type="button" class="btn btn-danger btn-xs" data-toggle="modal" data-target="#modal-default">Cancel</button>
                <button type="submit" ng-click="addAllocation()" class="btn btn-success float-right"><i class="fas fa-pen"></i> Allocation Update</button>
            </div>
        </div>
    </section>
    <div class="modal fade" id="modal-default">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <p>Are you sure to leave this page!</p>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-default btn-xs" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary btn-xs" data-dismiss="modal" ng-click="goToSelf('projectView',{projectid:allocation.proj_id})">Proceed</button>
                </div>
            </div>
        </div>
    </div>
</div>
