|
99
|
1 |
/*
|
|
|
2 |
* Copyright 2012 Tomas Zeman <tzeman@volny.cz>
|
|
|
3 |
*
|
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
|
6 |
* You may obtain a copy of the License at
|
|
|
7 |
*
|
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
9 |
*
|
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
13 |
* See the License for the specific language governing permissions and
|
|
|
14 |
* limitations under the License.
|
|
|
15 |
*/
|
|
|
16 |
package fis.sr.model
|
|
|
17 |
|
|
|
18 |
import fis.aaa.model._
|
|
|
19 |
import fis.base.model.Entity
|
|
|
20 |
import fis.cl.model._
|
|
|
21 |
import fis.crm.model._
|
|
|
22 |
import net.liftweb.common._
|
|
|
23 |
import net.liftweb.record.{MetaRecord, Record}
|
|
|
24 |
import net.liftweb.record.field._
|
|
|
25 |
import net.tz.lift.model._
|
|
|
26 |
import net.tz.lift.model.{FieldLabel => FL}
|
|
|
27 |
import org.squeryl.annotations.Column
|
|
|
28 |
|
|
|
29 |
class Service private() extends Record[Service] with Entity[Service] {
|
|
|
30 |
def meta = Service
|
|
|
31 |
|
|
|
32 |
val company = new LongField(this) with CompanyField with FL {
|
|
|
33 |
override def toForm = Full(<span class="uneditable-input">{asHtml}</span>)
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
@Column("state")
|
|
|
37 |
protected[sr] val stateFld = new CodeListItemField(this, 'service_state)
|
|
|
38 |
with FL
|
|
|
39 |
|
|
|
40 |
val from = new JodaDateMidnightField(this) with FL
|
|
|
41 |
val to = new OptionalJodaDateMidnightField(this) with FL
|
|
|
42 |
|
|
|
43 |
def state = stateFld.item.map(ServiceState(_))
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
object Service extends Service with MetaRecord[Service]
|
|
|
47 |
|
|
|
48 |
case class ServiceState(id: Long)
|
|
|
49 |
object ServiceState {
|
|
|
50 |
def apply(i: CodeListItem): ServiceState = ServiceState(i.id)
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
|
|
|
54 |
// vim: set ts=2 sw=2 et:
|