<div class="content-wrapper" ng-if="!myAccess.projectAdd && !myAccess.projectEdit">
    <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" ng-if="myAccess.projectAdd || myAccess.projectEdit">
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="text-success">
                        <go-back/>
                        <i class="fas fa-table"></i> {{btn.name}}
                    </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="{{baseurl}}/projects/list">Projects</a></li>
                        <li class="breadcrumb-item active">{{btn.screen}}</li>
                    </ol>
                </div>
            </div>
        </div>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="card card-outline card-success">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-sm-12 col-lg-12">
                                <!-- <h3 class="card-title">Project Weekly Information</h3> -->
                                <div class="form-group">
                                    <label for="proj_name">Project Name</label>
                                    <input type="text" id="proj_name" class="form-control" ng-model="project.proj_name" placeholder="Project Name" disabled="true">
                                </div>
                                <div class="form-group mt-2">
                                    <label for="week_number">Weeks Data</label>
                                    <table class="table table-bordered table-striped table-sm">
                                        <thead>
                                            <tr>
                                                <th>Profile</th>
                                                <th>Weekly Number</th>
                                                <th>Weekly Hour</th>
                                                <th> 
                                                    <button type="button" class="btn btn-success btn-xs" ng-click="addRow()">Add Row</button>
                                                    <button type="button" ng-if="project.forecast[0].id" class="btn btn-success btn-xs" ng-click="cloneData()">Clone Data For Next Week</button>
                                                </th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr ng-repeat="pro in project.forecast track by $index">
                                                <td>
                                                    <select ng-model="pro.profile_id" class="form-control">
                                                        <option value="0">--None--</option>
                                                        <option ng-repeat="dec in forecastProfile" value="{{dec.id}}">
                                                            {{dec.name}}
                                                        </option>
                                                    </select>
                                                </td>
                                                <td>
                                                    <input type="number" class="form-control" ng-model="pro.week_number" placeholder="Week Number">
                                                </td>
                                                <td>
                                                    <input type="number" class="form-control" ng-model="pro.weekly_rate" placeholder="Week Hour">
                                                </td>
                                                <td> 
                                                    <button type="button" ng-if="project.forecast.length > 1 || pro.id" class="btn btn-danger btn-xs"  ng-click="removeRow($index)">Delete Row</button>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card-footer">
                        <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="createProject()" class="btn btn-success float-right btn-xs"><i class="fas {{btn.icon}}"></i> {{btn.name}}</button>
                        </div>
                    </div>
                </div>
            </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="goTo($event,'projectList')">Proceed</button>
                </div>
            </div>
        </div>
    </div>
</div>
