Exemple #1
0
 public function updateDynamics()
 {
     $latest = Record::latest($this->number)->bindPublisher();
     if ($latest === null) {
         return $this;
     }
     if ($latest->in === null) {
         $this->status = self::$statusOut;
     } else {
         $this->status = self::$statusIn;
         $this->workedInYear = $latest->in < self::$lastYear;
     }
     $this->idealReturnDate = $latest->out + self::$secondsInMonth * 4;
     $this->due = $this->idealReturnDate <= time();
     $this->record = $latest;
     return $this;
 }
Exemple #2
0
    Record::checkOut(3, $bobby);
    Record::checkOut(4, $bobby);
    $bobby->save();
    Record::checkOut(5, $robert);
    Record::checkOut(6, $robert);
    $robert->save();
    Publisher::merge('Bob', ['Bobby', 'Robert']);
    $tf->assertEquals(count((new Publisher('Bob'))->bindRecords()->records), 6);
});
$tf->test('Merging will not happen on destination publisher', function (\Testify\Testify $tf) {
    $bob = Publisher::fromName('Bob');
    $bobby = Publisher::fromName('Bobby');
    $robert = Publisher::fromName('Robert');
    (new Territory(1))->replace();
    (new Territory(2))->replace();
    (new Territory(3))->replace();
    (new Territory(4))->replace();
    (new Territory(5))->replace();
    (new Territory(6))->replace();
    Record::checkOut(1, $bob);
    Record::checkOut(2, $bob);
    $bob->save();
    Record::checkOut(3, $bobby);
    Record::checkOut(4, $bobby);
    $bobby->save();
    Record::checkOut(5, $robert);
    Record::checkOut(6, $robert);
    $robert->save();
    Publisher::merge('Bob', ['Bob', 'Bobby', 'Robert']);
    $tf->assertEquals(count((new Publisher('Bob'))->bindRecords()->records), 6);
});
Exemple #3
0
<?php

use Enpowi\App;
use Enpowi\Modules\Module;
use Enpowi\Modules\DataOut;
Module::is();
//TODO: make a listener
$data = (new DataOut())->add('territory', (new \ETM\Territory(App::param('number')))->bindGeoJson())->add('history', \ETM\Record::history(App::param('number')))->add('action', 0)->add('publisherName', '')->add('showPublisherLookup', false)->out();
?>
<div
    class="container center"
    data="<?php 
echo $data;
?>
">
  <title>Territory {{ territory.number }}</title>
  <style>
    #map {
      min-height: 400px;
    }
    table.history {
      width: 50%;
      margin-left: auto;
      margin-right: auto;
    }
    .glyph-btn {
      margin-left: 30px;
    }
    .glyph-btn img {
      width: 50px;
    }
<?php

use ETM;
use Enpowi\App;
use Enpowi\Modules\Module;
Module::is();
$number = App::param('number');
$publisher = ETM\Publisher::fromName(App::param('publisherName'));
echo ETM\Record::checkOut($number, $publisher) === null ? -1 : 1;
Exemple #5
0
<?php

use Enpowi\Modules\Module;
use Enpowi\Modules\DataOut;
use ETM\Record;
Module::is();
$data = (new DataOut())->add('history', Record::historyComplete())->out();
?>
<div
    v-module
    data="<?php 
echo $data;
?>
"
    class="container">
  <table class="table">
    <thead>
    <tr>
      <th></th>
      <th v-t>Date Out</th>
      <th v-t>Date In</th>
      <th v-t>Territory</th>
      <th v-t>Publisher</th>
    </tr>
    </thead>
    <tbody>
      <tr v-repeat="record : history">
        <td></td>
        <td>{{ dateFormatted(record.out) }}</td>
        <td>{{ dateFormatted(record.in) }}</td>
        <td>{{ record.number }}</td>