Ejemplo n.º 1
0
?>
                            </tr>
                          </thead>
                          <tbody>
                              <tr class="itemblank">
                                <td><div class="innerblank"></div></td>
                              </tr>
                            <?php 
foreach ($employees as $key => $value) {
    $calendar = $value->calendar;
    ?>
                                <tr>
                                  <?php 
    for ($i = 1; $i <= 31; $i++) {
        $dt = Carbon\Carbon::create($year, $month, $i);
        if (checkDateValid($i, $month, $year)) {
            if ($dt->dayOfWeek == 6 || $dt->dayOfWeek == 0) {
                ?>
                                          <td style="background-color:#ffbff7"><div class="item" idem="{{ $value->id }}" idday="<?php 
                echo $i;
                ?>
" ><?php 
                echo $calendar->{'n' . $i};
                ?>
</div></td>
                                        <?php 
            } else {
                ?>
                                          <td><div class="item" idem="{{ $value->id }}" idday="<?php 
                echo $i;
                ?>
Ejemplo n.º 2
0
    /**
     * Ajax get data Timekeeper
     * @param  [type] $month [description]
     * @param  [type] $year  [description]
     * @return [type]        [description]
     */
    public function api_getTable($month, $year)
    {
        $employees = Employee::all();
        foreach ($employees as $key => $value) {
            $calendar = Calendar::where('employee_id', '=', $value->id)->where('month', $month)->where('year', $year)->first();
            if ($calendar == null) {
                $calendar = $this->bornCalendarEmpty($value->id, $month, $year);
            }
            $this->generatePresenteWhenInitNewDate($calendar, $month, $year);
            $employees[$key]->calendar = $calendar;
        }
        ?>
       <div id="datafullname" style="display:none"></div>
                <div class="sidebar-calendar">
                  <table>
                    <thead>
                      <tr><th><div class="nameitem">Fullname</div></th></tr>
                    </thead>
                    <tbody>
                        <tr class="itemblank">
                          <td><div class="nameitem"></div></td>
                        </tr>
                      <?php 
        foreach ($employees as $key => $value) {
            ?>
                        <tr>
                          <!-- <td><div class="nameitem">{{ $value->id }}</div></td> -->
                          <td><div class="nameitem" idem="<?php 
            echo $value->id;
            ?>
"><?php 
            echo $value->lastname . " " . $value->firstname;
            ?>
</div></td>
                        </tr>
                      <?php 
        }
        ?>
                    </tbody>
                  </table>
                </div>
                <div class="content-calendar">
                  <div id="datacalendar" style="display:none"></div>
                  <table>
                    <thead>
                      <tr>
												<?php 
        for ($i = 1; $i <= 31; $i++) {
            $dt = null;
            if (checkDateValid($i, $month, $year)) {
                $dt = Carbon::create($year, $month, $i);
                echo "<th><div class='day'>" . $i . "<br/>" . toEnglishDate($dt->dayOfWeek) . "</div></th>";
            }
        }
        ?>
                      </tr>
                    </thead>
                    <tbody>
                        <tr class="itemblank">
                          <td><div class="innerblank"></div></td>
                        </tr>
                      <?php 
        foreach ($employees as $key => $value) {
            $calendar = $value->calendar;
            ?>
                          <tr>
														<?php 
            for ($i = 1; $i <= 31; $i++) {
                $dt = Carbon::create($year, $month, $i);
                if (checkDateValid($i, $month, $year)) {
                    if ($dt->dayOfWeek == 6 || $dt->dayOfWeek == 0) {
                        ?>
																		<td style="background-color:#ffbff7"><div class="item" idem="{{ $value->id }}" idday="<?php 
                        echo $i;
                        ?>
" ><?php 
                        echo $calendar->{'n' . $i};
                        ?>
</div></td>
																	<?php 
                    } else {
                        ?>
																		<td><div class="item" idem="{{ $value->id }}" idday="<?php 
                        echo $i;
                        ?>
" ><?php 
                        echo $calendar->{'n' . $i};
                        ?>
</div></td>
																	<?php 
                    }
                }
                ?>
														<?php 
            }
            ?>
                          </tr>
                      <?php 
        }
        ?>

                    </tbody>
          </table>
     </div>

		<?php 
    }